In my C ++ project, I use boost.program_options. In the manual customized project from MSVS 2013 and 2017 perfectly compiled.

At the moment, I BOOST_ROOT setting up a project for compiling on Windows 10. In the BOOST_ROOT environment variable, BOOST_ROOT specified the value of k:\projects\cpp-workspace\boost-libraries\ .

Here is how I compiled Boost, a single platform and debug configuration example:

 .\b2.exe --without-wave ^ --without-python ^ --without-graph_parallel ^ --without-graph ^ stage --stagedir=stage32 ^ toolset=msvc ^ variant=debug ^ link=static ^ threading=multi ^ runtime-link=static 

Folders appeared:

  • k: \ projects \ cpp-workspace \ boost-libraries \ stage32 \ lib \
  • k: \ projects \ cpp-workspace \ boost-libraries \ stage64 \ lib \

In the CMake-script wrote:

 find_package(Boost REQUIRED program_options) message(status "** Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}") message(status "** ENV BOOST_LIBRARYDIR: $ENV{BOOST_LIBRARYDIR}") message(status "** Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}") message(status "** Boost_LIBRARIES: ${Boost_LIBRARIES}") 

I receive:

 CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1902 (message): Unable to find the requested Boost libraries. Boost version: 1.60.0 Boost include path: K:/projects/cpp-workspace/boost-libraries Could not find the following Boost libraries: boost_program_options No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): readpe/CMakeLists.txt:31 (find_package) status** Boost_INCLUDE_DIR: K:/projects/cpp-workspace/boost-libraries status** ENV BOOST_LIBRARYDIR: status** Boost_LIBRARY_DIRS: status** Boost_LIBRARIES: -- Configuring incomplete, errors occurred! See also "K:/projects/cpp-workspace/readpe/build/CMakeFiles/CMakeOutput.log". 

This Boost component is compiled, not the Header-Only option. This is indicated by the presence of the file k:\projects\cpp-workspace\boost-libraries\stage32\lib\libboost_program_options-vc120-mt-s-1_60.lib .

What do I need to do to get the libraries? Is it possible to explicitly assign ${Boost_LIBRARIES} to a variable?

  • FIND_PACKAGE (Boost 1.60 COMPONENTS program_options REQUIRED) gives something? - Croessmah
  • I tried already and saw this and 3 like this. The result is the same! - sys_dev
  • one
    Stage32 is a rather strange way, how many did not collect the boost, it was always just a stage. I didn’t see CMake look for boost, but you can try renaming stage32 to stage. - ixSci
  • one
    When figuring out why find_package(Boost) does not find something, it is useful to enable the Boost_DEBUG option, for example, passing the -DBoost_DEBUG=ON option to cmake . With this option, specific files that are searched for and in which directories they are searched for will be displayed. - Tsyvarev

0