I'm trying to configure a project using CMake, but it fails to find Boost libraries even though they are in the specified folder. I have specified Boost_INCLUDE_DIR, Boost_LIBRARYDIR and BOOST_ROOT , but I still get an error saying that CMake is not able to find Boost. What could be the reason of such error?
相关问题
- Avoid cmake to add the flags -search_paths_first a
- boost::process system leaking file descriptors
- CMakeList file to generate LLVM bitcode file from
- How to fix NDK build error for HelloCardboard samp
- Derived class offset calculation in boost::seriali
相关文章
- boost split with a single character or just one st
- Target requires the language dialect “CXX17” (with
- How do I tell cmake not to create a console window
- boost serialization and register_type
- Forwarding a shared_ptr without class declaration
- init boost::optional of non-copyable object
- What is the equivalent of boost::make_transform_it
- Do something for all targets
I struggled with this problem for a while myself. It turned out that
cmake
was looking for Boost library files using Boost's naming convention, in which the library name is a function of the compiler version used to build it. Our Boost libraries were built usingGCC 4.9.1
, and that compiler version was in fact present on our system; however,GCC 4.4.7
also happened to be installed. As it happens, cmake'sFindBoost.cmake
script was auto-detecting theGCC 4.4.7
installation instead of theGCC 4.9.1
one, and thus was looking for Boost library files with "gcc44
" in the file names, rather than "gcc49
".The simple fix was to force cmake to assume that GCC 4.9 was present, by setting
Boost_COMPILER
to "-gcc49
" inCMakeLists.txt
. With this change,FindBoost.cmake
looked for, and found, my Boost library files.If you are building your own boost do not forget to use the --layout=versioned otherwise the search for a particular version of library will fail
I had the same problem while trying to run
make
for a project after installing Boost version 1.66.0 on Ubuntu Trusty64. The error message was similar to (not exactly like) this one:Boost was definitely installed, but CMake couldn't detect it. After spending plenty of time tinkering with paths and environmental variables, I eventually ended up checking
cmake
itself for options and found the following:So I ran the following in the directory at issue:
sudo cmake --check-system-vars
which returned:
and resolved the issue.