2017-08-12 69 views
0

的cmake - 3.8升压program_options没有找到

我编译和安装Boost库在/ usr/local/lib目录/,但无法做出的cmake通过命令find_package(Boost REQUIRED program_options)检测升压program_options。找到所有其他库find_package(Boost REQUIRED thread system),并且只有添加program_options会引发错误。我已经尝试了很多东西和一些无知的东西 - program_options的特殊之处。

-- Boost version: 1.63.0 
-- Found the following Boost libraries: 
-- filesystem 
-- regex 
-- serialization 
-- unit_test_framework 
-- iostreams 
-- thread 
-- system 
-- chrono 
-- date_time 
-- atomic 

升压化妆是成功的,它内置了program_options库(我可以看到它位于/ usr/local/lib目录/文件夹与其他Boost库一起)。我只是不明白,为什么会nt cmake找到它?

Error : 
    Unable to find the requested Boost libraries. 

    Boost version: 1.63.0 

    Boost include path: /usr/local/include 

    Could not find the following Boost libraries: 

      boost_program_options 

    Some (but not all) of the required Boost libraries were found. You may 
    need to install these additional Boost libraries. Alternatively, set 
    BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT 
    to the location of Boost. 

目录结构

-rw-r--r-- 1 root root 1558464 Aug 12 15:46 /usr/local/lib/libboost_program_options.a 
lrwxrwxrwx 1 root root  34 Aug 12 15:46 /usr/local/lib/libboost_program_options.so -> libboost_program_options.so.1.63.0* 
-rwxr-xr-x 1 root root 658920 Aug 12 15:46 /usr/local/lib/libboost_program_options.so.1.63.0* 
+0

发布错误? – utopia

+0

你的CMake最近够了吗? https://stackoverflow.com/a/42124857/2799037 – usr1234567

+0

@utopia更新了帖子..也张贴了/ usr/local/lib的目录结构。我对整个错误非常困惑。 – infoclogged

回答

-1

小时后和调试的时间,我放弃了,发现周围的工作。也许它会帮助别人。如果cmake正在做一些令人讨厌的事情,但您确定,您的库存在于boost库文件夹中 - 只需明确链接库。

target_link_libraries(TARGET lib1 lib2 ${Boost_LIBRARIES} libboost_program_options.so) 

您可能需要添加link_directories(/usr/local/lib/)提前,以防将rpath不包含在/ usr/local/lib目录。

+0

downvote并运行。我认为这不应该像打击和跑步一样犯罪。 – infoclogged