我曾经使用.deb软件包(由我的团队创建)安装了一个boost版本(1.62)。现在我们要测试新版本,我已经使用
卸载了这个boost安装dpkg -r
我已经下载了boost 1.64并进行了编译。我已将编译后的代码放在
中/usr/local/boost_1_64_0
我面临的问题是当我搬到我的一个项目并执行
时cmake.
我收到以下错误
-- CMAKE_INSTALL_PREFIX is /usr
-- CMAKE_INSTALL_SYSCONFDIR is /etc
-- CMAKE_SYSTEM_NAME is Linux
-- Entering Linux/CMAKE_COMPILER_IS_GNUCXX branch.
-- CMAKE_CXX_FLAGS are: -std=c++11 -g3 -fPIC
-- CMAKE_INSTALL_SYSCONFDIR is /etc
CMake Error at /usr/local/share/cmake-3.9/Modules/FindBoost.cmake:1229 (file):
file STRINGS file "/usr/local/boost_1.62/boost/version.hpp" cannot be read.
Call Stack (most recent call first):
CMakeLists.txt:103 (find_package)
为什么还在寻找旧版本?我是不是想改变一个环境变量呢?
我的BOOST_ROOT env var如下。
/usr/local/boost_1_64_0
非常感谢
编辑: 添加了CMakeLists.txt
# Boost stuff
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Use statically-linked boost libraries")
# '- Note: By default set Boost_USE_STATIC_LIBS to ON (to link them statically
# to avoid possible problems during execution of the application (not finding
# the .so files)), but let the user change it (useful for example to use
# Fedora native boost libraries, or for OSX when using Boost's "locale" to
# avoid weird "_iconv*" missing symbols when linking")
set(Boost_USE_MULTITHREADED ON)
# add_definitions(-DBOOST_LOG_DYN_LINK)
#find_package(Boost) # <-- Use this simple line for using only headers
find_package(Boost
COMPONENTS
# # lexicographically sorted
# locale
log
# date_time
filesystem
program_options
system
thread
)
if (Boost_FOUND)
message(STATUS "Boost found:")
include_directories(${Boost_INCLUDE_DIRS})
message(STATUS " Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
message(STATUS " Boost_LIBRARIES: ${Boost_LIBRARIES}
Note: Boost_LIBRARIES can be empty if no COMPONENTS are used.") # Used below
问题是Boost_INCLUDE_DIRS变量,具有提升的旧路径,我无法找到定义该值的位置