- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试编译 FreeLing,它使用 CMake 来检测 Boost。这是负责它的代码:
find_package(Boost COMPONENTS regex filesystem thread program_options REQUIRED)
找到这些组件(根据 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
尽管如此,Boost_LIBRARIES
似乎从未设置过。我试过这个:
find_package(Boost COMPONENTS regex filesystem thread program_options REQUIRED)
message(STATUS "Boost_LIBRARIES=" ${Boost_LIBRARIES})
它总是输出一个空字符串。
作为引用,我有 CMake 版本 3.14.3 和 Boost 版本 1.70.0。
最佳答案
线路
Found Boost 1.70.0 at /home/ambs/usr/lib/cmake/Boost-1.70.0
表示CMake模块FindBoost.cmake不使用自己的方法检测 Boost 库和 header ,而是使用位于日志中显示的目录中的 BoostConfig.cmake
脚本。
FindBoost.cmake
模块的文档注释如下:
This module finds headers and requested component libraries OR a CMake package configuration file provided by a “Boost CMake” build. For the latter case skip to the “Boost CMake” section below. For the former case results are reported in variables:
简而言之,使用 BoostConfig.cmake
脚本意味着它设置自己的变量或目标,而 FindBoost.cmake
文档中描述的变量或目标无效。
最有可能的是,“Config”文件以相同的方式设置导入的目标,如FindBoost.cmake
文档中所述,即Boost::regex
、Boost::filesystem
等等。
如果您想禁用 BoostConfig.cmake
并强制 FindBoost.cmake
按照其文档中的描述运行,请设置 Boost_NO_BOOST_CMAKE
变量。例如,当调用cmake
时:
cmake -DBoost_NO_BOOST_CMAKE=ON <other-options>
关于Boost_LIBRARIES 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56036266/
我正在尝试编译 FreeLing,它使用 CMake 来检测 Boost。这是负责它的代码: find_package(Boost COMPONENTS regex filesystem thre
构建我的项目时,Boost_LIBRARIES 不包含 program_options,即使它是必需的并且已找到。如果我手动添加它,它工作正常。我的 CMake 包含以下内容: find_packag
cmake版本3.8.2 我有一个奇怪的问题。当我执行 find_package(Boost) 时,Boost_LIBRARIES 为空。但是当我执行 find_package(Boost REQUI
我想为 python 安装 dlib 模块我已经安装了 CMake 和 boost-python 但是当我安装 dlib 时它给了我错误: We couldn't find the right ver
我是一名优秀的程序员,十分优秀!