NuGet-find findpackage for cmake

I am creating a cross-platform library with cmake that has several (fairly common) dependencies, for example. PCRE. Deposits are available through regular package managers (APT on Ubuntu / Debian, Homebrew on OSX), as well as through NuGet on Windows. In my CMakeLists.txt I use the version of the find_pacakge module to search for these depots and set the correct include / library flags.

This question provides one way to integrate cmake + nuget, but also suggests that cmake and NuGet are unlikely to play well together, and I can't seem to find a way to get find_package to search for installed depots. Is there a way to get cmake to read nuget configuration files (how pkg_check_modules works on systems with pkg-config ) and populate the appropriate cmake variables? Or do I need to manually run my own solution in FindPCRE.cmake ?

+8
windows cmake nuget
source share
1 answer

As a (somewhat dirty) workaround, I rely on the nuget cli tool present and using

 find_program(NUGET nuget) if(NOT NUGET) message(FATAL "Cannot find nuget command line tool.\nInstall it with eg choco install nuget.commandline") else() execute_process(COMMAND ${NUGET} install foolib) endif() 
+5
source share

All Articles