[CMake] Can't find Boost with Visual Studio 2017

Volker Enderlein volker.enderlein at ifm-chemnitz.de
Sat Mar 17 18:15:11 EDT 2018


Hi David,

Boost changed its naming scheme starting from version 1.66. So its not 
your fault but the FindBoost.cmake does not know how to handle the new 
scheme. Try to use one of the 3.11.0-rc[1-3] versions that has the 
proper naming scheme handling of 1.66 or use the 1.65.1 that is the last 
version with the old naming scheme.

Cheers Volker

Am 17.03.2018 um 21:29 schrieb David Demelier:
> Hello all,
> 
> I've built Booost 1.66 on Windows with Visual Studio 2017 using the 
> following invocation:
> 
>      .\b2
>          link=shared
>          runtime-link=shared
>          threading=multi
>          toolset=msvc
>          variant=debug
>          address-model=64
>          install --prefix=C:/env/vs/amd64d
> 
> Then, the C:/env/vs/amd64d tree is filled like this:
> 
>    - lib/boost_timer-vc141-mt-gd-x64-1_66.lib (and so on)
>    - include/boost-1_66/boost/{asio/assign,...}
> 
> I create a sample CMake project:
> 
>      cmake_minimum_required(VERSION 3.5)
>      project(foo)
>      find_package(Boost REQUIRED COMPONENTS timer)
> 
> I set CMAKE_PREFIX_PATH and run CMake
> 
>      set CMAKE_PREFIX_PATH=C:/env/vs/amd64d/
>      cmake . -G "Visual Studio 15 2017 Win64"
> 
>      [...]
> -- Detecting CXX compile features - done
> CMake Warning at C:/Program 
> Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
>    Imported targets and dependency information not available for Boost 
> version
>    (all versions older than 1.33)
> Call Stack (most recent call first):
>    C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:907 
> (_Boost_COMPONENT_DEPENDENCIES)
>    C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1542 
> (_Boost_MISSING_DEPENDENCIES)
>    CMakeLists.txt:3 (find_package)
> 
> 
> CMake Error at C:/Program 
> Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1928 (message):
>    Unable to find the requested Boost libraries.
> 
>    Unable to find the Boost header files.  Please set BOOST_ROOT to the 
> root
>    directory containing Boost or BOOST_INCLUDEDIR to the directory 
> containing
>    Boost's headers.
> Call Stack (most recent call first):
>    CMakeLists.txt:3 (find_package)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also "C:/Users/markand/Documents/test/CMakeFiles/CMakeOutput.log".
> 
> I can't understand what I am missing because it's not the first time I 
> use boost on Windows though. I've tried set BOOST_ROOT to the same value 
> as CMAKE_PREFIX_PATH with no results.
> 



More information about the CMake mailing list