CMake with boost (on windows): Could not find libraries?

I am trying to create my project using CMake. Iam also uses boost. The find find statement in my CMakeLists.txt file:

find_package (Boost 1.42 REQUIRED COMPONENTS

python

System

file system

Serialization

flow

program_options

regex

test_exec_monitor)

Build failed and error message: The following Boost libraries could not be found:

boost_system boost_filesystem boost_serialization boost_thread boost_program_options 

When I check my lib directories, I find that libraries are named: libboost <library_name> -vc100-mt.lib, not boost_ <FileName>

Infact, when I rename one library in my lib files so that it matches the value of the boost_ <LibraryName> Prefix, it does not complain about this library.

I see 2 solutions for the same:

1. Make changes to the CMakeLists.txt file so that it looks for libraries with the correct prefix (and suffix).

2.Others

What could be the best.

+4
source share
1 answer

From FindBoost.cmake

These last three variables are also available as environment variables: Also note that they are completely UPPERCASE, except for Boost_DIR.

Boost_DIR or the preferred installation prefix to search for BOOST_ROOT or BOOSTROOT Boost. Install this if the module has problems finding the correct Boost installation.

Use these variables to indicate in the folder where your boost files are installed. for instance

cmake .. -DBOOST_ROOT = C: / Boost

+5
source

All Articles