[英]Boost_LIBRARIES doesn't contain program_options
When building my project, Boost_LIBRARIES doesn't contain program_options even though it is required and found. 在构建我的项目时,Boost_LIBRARIES不包含program_options,即使它是必需的。 If I add it manually, it works fine.
如果我手动添加,它可以正常工作。 My CMake contains the following:
我的CMake包含以下内容:
find_package(Boost 1.60.0 REQUIRED COMPONENTS program_options thread system regex)
message("${Boost_LIBRARIES}")
include_directories(include ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
target_link_libraries (proj ${Boost_LIBRARIES} boost_program_options)
CMake claims that the library was found, but it is not listed in the call to message("${Boost_LIBRARIES}")
CMake声称已找到该库,但未在对
message("${Boost_LIBRARIES}")
的调用中列出该库message("${Boost_LIBRARIES}")
Rewrite your code for modern CMake: 重写现代CMake的代码:
find_package(Boost 1.60.0 REQUIRED COMPONENTS program_options thread system regex)
add_executable(proj ...)
target_link_libraries(proj Boost::program_options ...)
And forget about resulting Boost_BLAH_LBAH
variables and include_directories
+ link_directories
. 忘记生成的
Boost_BLAH_LBAH
变量和include_directories
+ link_directories
。
If smth goes wrong w/ Boost finder, add -DBoost_DEBUG=ON
to cmake
command line. 如果使用Boost finder出现错误,请在
cmake
命令行中添加-DBoost_DEBUG=ON
。 If smth goes wrong w/ (any/generic) find_package
add -DCMAKE_FIND_DEBUG_MODE=ON
. 如果带(任何/通用)smth错误,
find_package
添加-DCMAKE_FIND_DEBUG_MODE=ON
。
See also for inspiration: https://steveire.wordpress.com/2017/11/05/embracing-modern-cmake/ 另请参阅灵感: https : //steveire.wordpress.com/2017/11/05/embracing-modern-cmake/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.