无法将(外部)Boost库加载到项目中

时间:2019-06-30 13:49:17

标签: c++ boost cmake

我正在使用CMAKE尝试将Boost库加载到我的项目中。 (我使用CLion作为IDE)。这是我的CMAKE文件:

cmake_minimum_required(VERSION 3.14)
project(untitled2)

set(Boost_USE_STATIC_LIBS        ON) # only find static libs
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)
set(Boost_INCLUDE_DIR C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs)
find_package(Boost 1.68.0 COMPONENTS system filesystem REQUIRED)

if(Boost_FOUND)
    include_directories(${Boost_INCLUDE_DIRS})
    target_link_libraries(untitled2 ${Boost_LIBRARIES})
endif()

add_executable(untitled2 main.cpp)

set(CMAKE_CXX_STANDARD 14)

这是我的目录(C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/):

enter image description here

重新加载CMAKE文件时出现此错误:

CMake Error at C:/Program Files/JetBrains/CLion 2019.1.4/bin/cmake/win/share/cmake-3.14/Modules/FindBoost.cmake:1388 (file):
  file STRINGS file
  "C:/Users/User/CLionProjects/untitled2/C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs/boost/version.hpp"
  cannot be read.
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)


CMake Error at C:/Program Files/JetBrains/CLion 2019.1.4/bin/cmake/win/share/cmake-3.14/Modules/FindBoost.cmake:2147 (message):
  Unable to find the requested Boost libraries.

  Boost version: 0.0.0

  Boost include path: C/Users/User/Downloads/boost_1_68_0/boost_1_68_0/libs

  Detected version of Boost is too old.  Requested version was 1.68 (or
  newer).
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/User/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeOutput.log".

[Failed to reload]

任何建议为何失败?

0 个答案:

没有答案