【发布时间】:2013-05-23 10:06:58
【问题描述】:
我的 CMakeLists.txt 文件使 cmake 指向错误的 Boost 版本:
find_package(Boost COMPONENTS program_options)
在我的例子中,它指向 /otherDir/boost 中的 Boost 1.39,而不是 /usr/local/include/boost 中的 Boost 1.50。
由于Boost的版本会改变,我想避免指定它:
find_package(Boost 1.50 COMPONENTS program_options)
或者必须设置环境变量 $ENV{BOOST_ROOT}。
问题是由于目录层次结构具有以下结构:
/usr/local/include/boost
/otherDir/boost
/otherDir/otherNeededFiles
我的 CMakeLists.txt 文件包含:
include_directories(${Boost_INCLUDE_DIRS})
include_directories(/usr/local/include)
include_directories(/otherDir)
Boost_INCLUDE_DIRS 的值是正确的 (/usr/local/include),与 Boost_LIBRARIES (/usr/local/lib/libboost_program_options.a) 的值一样。
如果我将/otherDir/boost 重命名为/otherDir/boost_old,链接器很高兴并指向最新的boost 版本。但是我不允许重命名该目录。
是否有可能做相当于:
find_package(Boost latest COMPONENTS program_options)
谢谢。
【问题讨论】: