Boost_LIBRARYDIR不是正确的拼写

时间:2015-10-16 14:41:26

标签: c++ boost cmake

我正在尝试为我的CMakeLists.txt文件添加提升功能。但是,我收到了这个错误:

CMake Error at /export/home/yhe/local/share/cmake-3.3/Modules/FindBoost.cmake:393 (message):
  ERROR: Boost_LIBRARYDIR is not the correct spelling.  The proper spelling
  is BOOST_LIBRARYDIR.

我正在使用cmake3.3.2和命令:

find_package(Boost 1.55.0 COMPONENTS atomic REQUIRED)

这是文件:

  1 cmake_minimum_required(VERSION 2.8.9)                                                                                                                                                                         
  2 SET(CMAKE_INCLUDE_DIR ${CMAKE_LINCLUDE_DIR} "/export/home/thirdparty/boost/1.55.0/")                                                                                                                          
  3 SET(CMAKE_LIBRARYDIR ${CMAKE_LIBRARYDIR} "/export/home/thirdparty/boost/1.55.0/lib/AS5")                                                                                                                      
  4 message(${Boost_LIBRARYDIR})                                                                                                                                                                                  
  5 find_package(Boost COMPONENTS atomic REQUIRED)                                                                                                                                                               

事实证明,当我调用cmake时定义了Boost_LIBRARYDIR。删除CMakeCache.txt文件后,问题就消失了。我想我可能已经设置了Boost_LIBRARYDIR,当我试图让它工作并且它被缓存。 FindBoost.cmake将在定义Boost_LIBRARYDIR时退出。但是,此错误消息确实具有误导性。

1 个答案:

答案 0 :(得分:0)

BOOST_ROOT, BOOST_LIBRARYDIR, BOOST_INCLUDEDIR变量区分大小写。

我正在使用cmake和Boost。

在我正在使用的cmake下面。请注意,我正在使用MSVC 12进行编译

set(BOOST_ROOT C:/boost/boost_1_55_0/)
set(BOOST_INCLUDEDIR C:/boost/boost_1_55_0/boost)
set(BOOST_LIBRARYDIR C:/boost/boost_1_55_0/lib64-msvc-12.0)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_COMPILER -vc120)
find_package(Boost 1.55.0 COMPONENTS atomic REQUIRED)