Can't build C++ Rest SDK(cpprestsdk) in Windows because Cmake doesn't find Boost libs

276 Views Asked by At

I try to build C++ REST SDK from source. I follow the instructions from https://github.com/microsoft/cpprestsdk/wiki/How-to-build-for-Windows. Have installed the dependencies via vcpkg. cmake complains that he can't find Boost. It looks like that cmake found the header files, but not the libs.

This is my setup:
Windows 10 Pro 64 Bit
CPP REST SDK: C:\Users\a\cpprestsdk
The build directory is C:\Users\a\cpprestsdk\build
The boots headers are in C:\Users\a\vcpkg\installed\x64-windows\include\boost
The boost libs are in C:\Users\a\vcpkg\installed\x64-windows\lib
cmake version: 3.28.0-rc1
Installed Visual Studios: Visual Studio 2022 Community, Visual Studio Express 2013 for Desktop

I have set the path to the Boost libs in the variable Boost_LIBRARY_DIR. But it doesn't work.

cpprest_find_boost.cmake

...
else()
    set(Boost_LIBRARY_DIR, "C:\\Users\\a\\vcpkg\\installed\\x64-windows\\lib")
    find_package(Boost REQUIRED COMPONENTS system date_time regex)
endif()
...

This is the build command for cmake:

C:\Users\a\cpprestsdk\build>cmake ../Release -A x64 -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 12 2013"

ErrorMessage:

CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: system date_time regex) (found version
  "1.83.0")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.28/Modules/FindBoost.cmake:2392 (find_package_handle_standard_args)
  C:/Users/a/vcpkg/installed/x64-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
  C:/Users/a/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
  cmake/cpprest_find_boost.cmake:51 (find_package)
  cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
  src/CMakeLists.txt:68 (cpprest_find_websocketpp)

Can anybody give me an hint how to find the Boost libs?

1

There are 1 best solutions below

0
On

Found the solution. Deleted vcpkg and cloned it again. Modified x-windows.cmake in the vcpkg. Added set(VCPKG_PLATFORM_TOOLSET "v120"). Then I installed the packages. vcpkg created Boost libs with v120 in the names like boost_chrono-vc120-mt.lib. CMake doesn't complain anymore:)