2

My configuration is:

  • OS: Windows 10 x64
  • Boost: 1.66.0
  • CMake: 3.10
  • Visual Studio: 2017

I am compiling boost this way:

bootstrap 
.\b2 --build-dir=build toolset=msvc address-model=64 --build-type=complete stage

When running CMake I get this error:

could not find boost libraries: 
boost_system
boost_filesystem
boost_thread
boost_locale
boost_date_time

I search for these libraries and they are in the stage folder. I tried BOOST_USE_STATIC_LIBS=ON but nothing happens.

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
Ammoun
  • 73
  • 2
  • 14
  • 1
    Possible duplicate of [CMake not finding Boost](https://stackoverflow.com/questions/13280823/cmake-not-finding-boost) – jww Jan 10 '18 at 15:51
  • Possible duplicate of [CMake finds Boost but the imported targets not available for Boost version](https://stackoverflow.com/questions/42123509/cmake-finds-boost-but-the-imported-targets-not-available-for-boost-version) Even CMake's Git master does not support Boobst 1.66. – usr1234567 Jan 10 '18 at 18:07

2 Answers2

6

The naming scheme of the Boost libraries changed with version 1.66.0. An additional architecture infix has been added which is not known to FindBoost.cmake of the CMake version 3.10 you are using. Try to use version 1.65.1 and set BOOST_ROOT to the path of your Boost installation.

vre
  • 6,041
  • 1
  • 25
  • 39
  • I tried to use version 1.65.1 but I cannot compile boost libraries : unknown compiler version – Ammoun Jan 10 '18 at 16:20
  • 1
    @Ammoun Try first to use prebuilt binaries from https://sourceforge.net/projects/boost/files/boost-binaries/1.65.1/ – vre Jan 10 '18 at 16:27
  • The compiler version of Visual Studio 2017 is 14.1 so you need to get the file `boost_1_65_1-msvc-14.1-64.exe` – vre Jan 10 '18 at 16:35
  • but with prebuilt binaries I must enter this command : .\b2 --build-dir=build toolset=msvc address-model=64 --build-type=complete lib64-msvc-14.1 – Ammoun Jan 10 '18 at 16:38
  • @Ammoun No, thats the build step of Boost. You only need to call find_package in your CMakeLists.txt and set BOOST_ROOT before or on the command line. – vre Jan 10 '18 at 16:50
  • sorry this is the first time I use Cmake and boost, I don't understand how to call package in CMakeLists.txt – Ammoun Jan 11 '18 at 07:58
  • Use `set(BOOST_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) find_package(Boost COMPONENTS system filesystem thread locale date_time REQUIRED)` and call `cmake {YOUR_PATH_TO_CMAKELISTS_TXT} -DBOOST_ROOT={YOUR_PATH_TO_BOOST} -G "Visual Studio 15 2017"` from your build directory. – vre Jan 11 '18 at 08:37
  • Thank you very much for all your answers. I have used boost_1_65_1-msvc-14.1-64.exe and it works :) I have put BOOST_INCLUDEDIR and BOOST_ROOT in the cmake command as well. – Ammoun Jan 11 '18 at 09:18
  • Glad to hear :) – vre Jan 11 '18 at 09:25
-1

try set BOOST_INCLUDEDIR and BOOST_LIBRARYDIR manually before run cmake,e.g.

set BOOST_INCLUDEDIR=C:\boost\src\boost_1_59_0
set BOOST_LIBRARYDIR=C:\boost\boost_1_59_0-bin-msvc-all-32-64\boost_1_59_0\lib32-msvc-14.0

see FindBoost

chenjun
  • 301
  • 3
  • 10