简体   繁体   English

find_package(Boost)返回空的Boost_LIBRARIES

[英]find_package(Boost) returns empty Boost_LIBRARIES

cmake version 3.8.2 cmake版本3.8.2

I have a strange problem. 我有一个奇怪的问题。 When I do find_package(Boost) , then the Boost_LIBRARIES is empty. 当我执行find_package(Boost) ,Boost_LIBRARIES为空。 But when I do find_package(Boost REQUIRED filesystem) , the Boost_LIBRARIES variable shows the corresponding libraries. 但是当我执行find_package(Boost REQUIRED filesystem) ,Boost_LIBRARIES变量显示相应的库。

In both the cases, Boost is found, because it shows that the Boost version is 1.64. 在这两种情况下,都找到了Boost,因为它表明Boost版本是1.64。

with REQUIRED 需要

-- Boost version: 1.64.0
-- Found the following Boost libraries:
--   filesystem
--   system
       Boost_INCLUDE_DIRS: /usr/local/include
       OpenCV_INCLUDE_DIRS: /usr/local/include;/usr/local/include/opencv
       Boost_LIBRARIES: /usr/local/lib/libboost_filesystem.so;/usr/local/lib/libboost_system.so
       OpenCV_LIBRARIES: opencv_calib3d;opencv_core;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_shape;opencv_stitching;opencv_superres;opencv_video;opencv_videoio;opencv_videostab

Without REQUIRED 没有要求

-- Boost version: 1.64.0
       Boost_INCLUDE_DIRS: /usr/local/include
       OpenCV_INCLUDE_DIRS: /usr/local/include;/usr/local/include/opencv
       Boost_LIBRARIES: 
       OpenCV_LIBRARIES: opencv_calib3d;opencv_core;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_shape;opencv_stitching;opencv_superres;opencv_video;opencv_videoio;opencv_videostab

Shouldnt the boost libraries, also show just the libraries and not the whole path, like the opencv? 不应该是boost库,也只显示库而不是整个路径,比如opencv?

Although I have the program_options in the same folder, the Boost cannot find it and cmake throws an error. 虽然我在同一个文件夹中有program_options,但Boost无法找到它并且cmake会抛出错误。

  Could not find the following Boost libraries:

          boost_program_options

Please see the ll. 请看ll。

truncated ll output.....
-rw-r--r-- 1 root root 1558464 Aug 12 06:23 /usr/local/lib/libboost_program_options.a
lrwxrwxrwx 1 root root      34 Aug 12 06:23 /usr/local/lib/libboost_program_options.so -> libboost_program_options.so.1.64.0*
-rwxr-xr-x 1 root root  658920 Aug 12 06:23 /usr/local/lib/libboost_program_options.so.1.64.0*

No matter REQUIRED is present or not, it's always empty. 无论是否存在,它总是空的。

Mac High Sierra/CMake 3.10.1. Mac High Sierra / CMake 3.10.1。

It seems a bug of FindBoost.cmake 这似乎是FindBoost.cmake的一个错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM