简体   繁体   中英

cmake linking with cpprestsdk on windows

I have started new cmake project for c++ in vs2017. And followed the cpprestsdk instructions to build on windows.

PM> vcpkg install cpprestsdk cpprestsdk:x64-windows

cmake_minimum_required (VERSION 3.8)
find_package(cpprestsdk REQUIRED)

the error

Severity Code Description Project File Line Suppression State Error CMake Error at CMakeProject1/CMakeLists.txt:5 (find_package):
By not providing "Findcpprestsdk.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "cpprestsdk", but CMake did not find one.

Could not find a package configuration file provided by "cpprestsdk" with any of the following names:

 cpprestsdkConfig.cmake cpprestsdk-config.cmake 

Add the installation prefix of "cpprestsdk" to CMAKE_PREFIX_PATH or set "cpprestsdk_DIR" to a directory containing one of the above files. If "cpprestsdk" provides a separate development package or SDK, be sure it has been installed.

C:\\PROGRAM FILES (X86)\\MICROSOFT VISUAL STUDIO\\2017\\COMMUNITY\\COMMON7\\IDE\\COMMONEXTENSIONS\\MICROSOFT\\CMAKE\\CMake\\bin\\cmake.exe -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\\Users\\berkin1\\CMakeBuilds\\c5a5aa79-502a-4e33-9202-078595e40dda\\install\\x64-Debug (default)" -DCMAKE_CXX_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\\PROGRAM FILES (X86)\\MICROSOFT VISUAL STUDIO\\2017\\COMMUNITY\\COMMON7\\IDE\\COMMONEXTENSIONS\\MICROSOFT\\CMAKE\\Ninja\\ninja.exe" "c:\\users\\berkin1\\source\\repos\\CMakeProject1" returned with exit code: 1 CMake Error at CMakeProject1/CMakeLists.txt:5 (find_package): By not providing "Findcpprestsdk.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by
"cpprestsdk", but CMake did not find one. Could not find a package configuration file provided by "cpprestsdk" with any of the following names: cpprestsdkConfig.cmake cpprestsdk-config.cmake Add the installation prefix of "cpprestsdk" to CMAKE_PREFIX_PATH or set "cpprestsdk_DIR" to a directory containing one of the above files. If "cpprestsdk" provides a separate development package or SDK, be sure it has been installed. c:\\users\\berkin1\\source\\repos\\CMakeProject1\\CMakeProject1/CMakeLists.txt 5

对我来说,它向cmake添加了以下命令行选项:

-DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=<vcpkg path>\\scripts\\buildsystems\\vcpkg.cmake

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM