3
我需要Boost和一些組件庫,包括program_options,但由於庫版本命名,CMake的FIND_PACKAGE
命令在Debian上失敗。我如何強制它以最簡潔的方式找到program_options
庫?CMake無法在Debian上找到boost_program_options
# CMakeLists.txt
SET(Boost_USE_STATIC_LIBS FALSE)
SET(Boost_USE_MULTITHREADED FALSE)
FIND_PACKAGE(Boost COMPONENTS program_options system thread REQUIRED)
這將導致以下:
Unable to find the requested Boost libraries.
Boost version: 1.54.0
Boost include path: /usr/include
The following Boost libraries could not be found:
boost_program_options
檢查我的Boost庫:
$ ls -F /usr/lib | grep boost
libboost_program_options.so.1.49.0
libboost_program_options.so.1.54.0
libboost_system.a
[email protected]
libboost_system.so.1.54.0
libboost_thread.a
[email protected]
libboost_thread.so.1.49.0
libboost_thread.so.1.54.0
注意program_options
是沒有唯一的一個無版本名(其他圖書館提供鏈接(由上面的@
表示),例如libboost_system.so -> libboost_system.so.1.54.0
)。據我所知,Debian 7.2不提供創建這種鏈接的包,因此不會找到program_options
。我能做什麼不包括手動建立鏈接(我不能指望其他人使用我的軟件包來做到這一點)。
$ cmake -DBoost_DEBUG=ON
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for PROGRAM_OPTIONS_LIBRARY_RELEASE: boost_program_options-gcc47-1_54;boost_program_options-gcc47;boost_program_options-1_54;boost_program_options;boost_program_options
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for PROGRAM_OPTIONS_LIBRARY_DEBUG: boost_program_options-gcc47-d-1_54;boost_program_options-gcc47-d;boost_program_options-d-1_54;boost_program_options-d;boost_program_options;boost_program_options
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc47-1_54;boost_system-gcc47;boost_system-1_54;boost_system;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc47-d-1_54;boost_system-gcc47-d;boost_system-d-1_54;boost_system-d;boost_system;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:961 ] Searching for THREAD_LIBRARY_RELEASE: boost_thread-gcc47-1_54;boost_thread-gcc47;boost_thread-1_54;boost_thread;boost_thread
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:993 ] Searching for THREAD_LIBRARY_DEBUG: boost_thread-gcc47-d-1_54;boost_thread-gcc47-d;boost_thread-d-1_54;boost_thread-d;boost_thread;boost_thread
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1107 ] Boost_FOUND = FALSE