Once Conan finishes downloading, building, and configuring our dependencies, we need to tell CMake to use them.Â
If you're using Conan with the CMakeDeps generator, be sure to specify a CMAKE_BUILD_TYPEÂ value. In other cases, CMake will be unable to use the packages configured by Conan. An example invocation (from the same directory you ran Conan) could be as follows:
cmake path/to/directory/containing/CMakeLists.txt -DCMAKE_BUILD_TYPE=Release
This way, we would build our project in release mode; we must use one of the types we installed using Conan. To find our dependencies, we can just use CMake's find_package:
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")
find_package(cpprestsdk CONFIG REQUIRED)
First, we add the root build directory to the path CMake will try to find package config files in. Then, we find the package config files generated by Conan.
To pass Conan-defined targets as our targets' dependencies, it...