[CMake] Can't find Boost with Visual Studio 2017
David Demelier
markand at malikania.fr
Sat Mar 17 16:29:32 EDT 2018
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.
--
David Demelier
More information about the CMake
mailing list