Unable to specify BOOST_ROOT for cmake

I have several versions of Boost installed (Windows 7 / MinGW). I need to use specific (1.53.0).

I defined BOOST_ROOT in the file CMakeFiles.txt: SET(BOOST_ROOT C:/boost_1_53_0/) , but I keep getting this error:

 > cmake . BOOST_ROOT=C:/boost_1_53_0/ CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1191 (message): Unable to find the requested Boost libraries. Boost version: 1.48.0 Boost include path: C:/Boost/include/boost-1_48 Detected version of Boost is too old. Requested version was 1.53 (or newer). The following Boost libraries could not be found: boost_filesystem 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. 

I also defined BOOST_ROOT as an environment variable, but with the same result.

Why is cmake still looking for an old version?

+6
source share
3 answers

If you use the precompiled version of the Boost libraries for Visual Studio, they have a special flavor for the MSVC version and bitness. I needed to point CMake to this specific place - in my case, setting BOOST_ROOT to C: / local / boost_1_59_0 and BOOST_LIBRARYDIR to C: /local/boost_1_59_0/lib64-msvc-11.0.

+6
source

Try the following:

 cmake -DBOOST_ROOT=path 
+15
source

I also struggled with this problem for a while. If this is the same problem as mine, then the problem is that you are not using the CMake configuration completely fresh without a cache. Once it starts once and finds the default installation (C: \ Boost or / usr / include), it will continue to find it regardless of the value of BOOST_ROOT. Therefore, be sure to delete all generated assembly files. Then set BOOST_ROOT to the desired separate installation, and it should work fine.

This is also mentioned by jaor on a previously related question: How can I get cmake to find my alternative boost setup?

+8
source

Source: https://habr.com/ru/post/947297/


All Articles