I am trying to compile FreeLing, that uses CMake to detect Boost. This is the code responsible for it:
find_package(Boost COMPONENTS regex filesystem thread program_options REQUIRED)
These components are found (accordingly to the output generated by CMake):
-- Found Boost 1.70.0 at /home/ambs/usr/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS regex;filesystem;thread;program_options
-- Found boost_headers 1.70.0 at /home/ambs/usr/lib/cmake/boost_headers-1.70.0
-- Found boost_regex 1.70.0 at /home/ambs/usr/lib/cmake/boost_regex-1.70.0
-- libboost_regex.so.1.70.0
-- Adding boost_regex dependencies: headers
-- Found boost_filesystem 1.70.0 at /home/ambs/usr/lib/cmake/boost_filesystem-1.70.0
-- libboost_filesystem.so.1.70.0
-- Adding boost_filesystem dependencies: headers
-- Found boost_thread 1.70.0 at /home/ambs/usr/lib/cmake/boost_thread-1.70.0
-- libboost_thread.so.1.70.0
-- Adding boost_thread dependencies: headers
-- Found boost_program_options 1.70.0 at /home/ambs/usr/lib/cmake/boost_program_options-1.70.0
-- libboost_program_options.so.1.70.0
-- Adding boost_program_options dependencies: headers
-- Boost found.
-- Found Boost components:
regex;filesystem;thread;program_options
Nevertheless, it looks like Boost_LIBRARIES
is never set. I tried this:
find_package(Boost COMPONENTS regex filesystem thread program_options REQUIRED)
message(STATUS "Boost_LIBRARIES=" ${Boost_LIBRARIES})
and it output always a empty string.
For reference, I have CMake version 3.14.3, and Boost version 1.70.0.
The line
means that CMake module FindBoost.cmake doesn't detects Boost libraries and headers using its own methods but resorts to
BoostConfig.cmake
script, located in the directory shown in the log.Documentation for
FindBoost.cmake
module notes such way:In short, using
BoostConfig.cmake
script means that it sets its own variables or targets, and ones described in the documentation forFindBoost.cmake
are not valid.Most likely, the "Config" file sets IMPORTED targets in the same manner, as described in
FindBoost.cmake
documentation, that isBoost::regex
,Boost::filesystem
and so on.If you want to disable using
BoostConfig.cmake
and forceFindBoost.cmake
to behave as described in its documentation, setBoost_NO_BOOST_CMAKE
variable. E.g., when callcmake
: