[英]Boost_LIBRARIES not defined
I am trying to compile FreeLing, that uses CMake to detect Boost. 我正在尝试编译FreeLing,它使用CMake来检测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): 找到以下组件(根据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. 但是,似乎从未设置
Boost_LIBRARIES
。 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. 作为参考,我有CMake版本3.14.3和Boost版本1.70.0。
The line 线
Found Boost 1.70.0 at /home/ambs/usr/lib/cmake/Boost-1.70.0
在/home/ambs/usr/lib/cmake/Boost-1.70.0处找到Boost 1.70.0
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. 意味着CMake模块FindBoost.cmake不会使用其自己的方法检测Boost库和标头,而是诉诸于位于日志显示的目录中的
BoostConfig.cmake
脚本。
Documentation for FindBoost.cmake
module notes such way: FindBoost.cmake
模块的文档以这种方式进行注释:
This module finds headers and requested component libraries OR a CMake package configuration file provided by a “Boost CMake” build.
该模块查找标头和请求的组件库,或“ Boost CMake”版本提供的CMake软件包配置文件。 For the latter case skip to the “Boost CMake” section below.
对于后一种情况,请跳到下面的“ Boost CMake”部分。 For the former case results are reported in variables:
对于前一种情况,结果报告为变量:
In short, using BoostConfig.cmake
script means that it sets its own variables or targets, and ones described in the documentation for FindBoost.cmake
are not valid. 简而言之,使用
BoostConfig.cmake
脚本意味着它设置了自己的变量或目标,而FindBoost.cmake
文档中描述的变量或目标无效。
Most likely, the "Config" file sets IMPORTED targets in the same manner, as described in FindBoost.cmake
documentation, that is Boost::regex
, Boost::filesystem
and so on. 最有可能的是,“ Config”文件以与
FindBoost.cmake
文档中所述相同的方式设置IMPORTED目标 ,即Boost::regex
, Boost::filesystem
等。
If you want to disable using BoostConfig.cmake
and force FindBoost.cmake
to behave as described in its documentation, set Boost_NO_BOOST_CMAKE
variable. 如果要禁用使用
BoostConfig.cmake
并强制FindBoost.cmake
其文档中所述的行为,请设置Boost_NO_BOOST_CMAKE
变量。 Eg, when call cmake
: 例如,当调用
cmake
:
cmake -DBoost_NO_BOOST_CMAKE=ON <other-options>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.