Based on this question CMake cpprestsdk I tried to create a specific target from cpprestsdk source code. First, I cloned the github project into /home/user/git/cpprestsdk
Then, I created the CmakeLists.txt file
project(ProjectName) find_package(cpprestsdk CONFIG REQUIRED) target_link_libraries(ProjectName PRIVATE cpprestsdk::cpprestsdk_boost_internal) and the cmake command:
cmake -DCMAKE_PREFIX_PATH=/home/user/git/cpprestsdk/Release/src . and got the following error:
CMake Error at cpprestsdk/Release/src/cpprestsdk-config.cmake:25 (include): include could not find load file: /home/ebalbar/git/cpprestsdk/Release/src/cpprestsdk-targets.cmake Call Stack (most recent call first): CMakeLists.txt:2 (find_package) CMake Error at CMakeLists.txt:3 (target_link_libraries): Cannot specify link libraries for target "ProjectName" which is not built by this project. The target file can be found under /home/user/git/cpprestsdk/Release/src/CMakeFiles/Export/lib/cmake/cpprestsdk/cpprestsdk-targets.cmake
So the question is how to build cpprestsdk::cpprestsdk_boost_internal target?
Thanks in advance!
/home/user/git/cpprestsdk" - Then you should built the project and install it. AndCMAKE_PREFIX_PATHshould contain the installation prefix which you have passed when installing the project. Only after thatfind_package(cpprestsdk)will work.