CMake-如何使用FetchContent下载LAPACK?

时间:2019-02-21 08:40:46

标签: cmake lapack

我想使用FetchContent功能下载LAPACK。

我的代码如下:

set(LAPACK_LOCAL_PATH ${ROOT_DIR}/external_dependencies/lapack-release)

include(FetchContent)

FetchContent_Declare(
    Lapack
    SOURCE_DIR ${LAPACK_LOCAL_PATH}
    GIT_REPOSITORY https://github.com/Reference-LAPACK/lapack-release.git
    GIT_TAG lapack-3.8.0
)

set(FETCHCONTENT_QUIET FALSE)

if(NOT Lapack_POPULATED)
    FetchContent_Populate(Lapack)
    add_subdirectory(${LAPACK_LOCAL_PATH} ${LAPACK_LOCAL_PATH}/build)
endif()

问题是,当我运行代码时,出现以下错误:

######################################################
# lapack should not be configured & built in the lapack source directory
# You must run cmake in a build directory.
# For example:
# mkdir lapack-Sandbox ; cd lapack-sandbox
# git clone https://github.com/Reference-LAPACK/lapack.git # or download & unpack the source tarball
# mkdir lapack-build
# this will create the following directory structure
#
# lapack-Sandbox
#  +--lapack
#  +--lapack-build
#
# Then you can proceed to configure and build
# by using the following commands
#
# cd lapack-build
# cmake ../lapack # or ccmake, or cmake-gui 
# make
#
# NOTE: Given that you already tried to make an in-source build
#       CMake have already created several files & directories
#       in your source tree. run 'git status' to find them and
#       remove them by doing:
#
#       cd lapack-Sandbox/lapack
#       git clean -n -d
#       git clean -f -d
#       git checkout --
#
######################################################
CMake Error at external_dependencies/lapack-release/CMAKE/PreventInSourceBuilds.cmake:41 (message):
  Quitting configuration
Call Stack (most recent call first):
  external_dependencies/lapack-release/CMAKE/PreventInSourceBuilds.cmake:45 (AssureOutOfSourceBuilds)
  external_dependencies/lapack-release/CMakeLists.txt:57 (include)

当我尝试手动构建LAPACK时,没有问题。你能告诉我我在做什么错吗?

0 个答案:

没有答案