在CLOS中包含cpp-netlib,在macOS上包含Make

时间:2017-04-14 11:33:18

标签: c++ boost cmake clion

我对CLion,CMake和macOS都很陌生,所以在尝试将cppnetlib包含到我的CLion项目中时需要一些帮助。

我开始创建一个新的CLion项目,它给了我一个新的CMakeLists.txt,我编辑了它以便它也包括boost:

CMAKE_MINIMUM_REQUIRED(VERSION 3.7)
PROJECT(myapp)

SET(CMAKE_CXX_STANDARD 11)

SET(SOURCE_FILES main.cpp)
ADD_EXECUTABLE(myapp ${SOURCE_FILES})

FIND_PACKAGE(Boost 1.63.0 REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(dxcheck ${Boost_LIBRARIES})

我已经通过自制程序安装了boost,但我没有找到带有自制程序的cppnetlib包,所以我下载了cppnetlib并将其放在/ usr / local / Cellar / cpp-netlib中。现在,当我在他们的页面上按照教程并放入

set (CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local/Cellar/cpp-netlib)
find_package (cppnetlib 0.12.0 REQUIRED)
include_directories (${CPPNETLIB_INCLUDE_DIRS})
target_link_libraries (myapp ${CPPNETLIB_LIBRARIES})

进入CMakeLists.txt,我得到以下输出:

-- Boost version: 1.63.0
CMake Error at CMakeLists.txt:14 (find_package):
  By not providing "Findcppnetlib.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "cppnetlib", but CMake did not find one.

  Could not find a package configuration file provided by "cppnetlib"
  (requested version 0.11.0) with any of the following names:

    cppnetlibConfig.cmake
    cppnetlib-config.cmake

  Add the installation prefix of "cppnetlib" to CMAKE_PREFIX_PATH or set
  "cppnetlib_DIR" to a directory containing one of the above files.  If
  "cppnetlib" provides a separate development package or SDK, be sure it has
  been installed.

我已经做过一些关于查找软件包的研究,但我能够实现的是我能够通过手动将包含路径添加到CMakeLists.txt来包含cppnetlib但是我得到一个错误,说编译器无法找到位于cpp-netlib中“deps”文件夹内的标头。

我知道想知道如何使用CMake将cppnetlib等软件包正确地包含到我的CLion项目中。我正在使用CLion 2017.1,macOS Sierra,我认为CLion正在使用CMake 3.7。

0 个答案:

没有答案