-
Notifications
You must be signed in to change notification settings - Fork 442
/
CMakeLists.txt
53 lines (45 loc) · 2.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
if(${ENABLE_dkh})
find_package(dkh 1.2 CONFIG QUIET)
if(${dkh_FOUND})
get_property(_loc TARGET dkh::dkh PROPERTY LOCATION)
message(STATUS "${Cyan}Found dkh${ColourReset}: ${_loc} (found version ${dkh_VERSION})")
add_library(dkh_external INTERFACE) # dummy
if(${CMAKE_INSIST_FIND_PACKAGE_dkh})
message(VERBOSE "Suitable dkh located externally as user insists")
endif()
else()
if(${CMAKE_INSIST_FIND_PACKAGE_dkh})
message(FATAL_ERROR "Suitable dkh could not be externally located as user insists")
endif()
include(ExternalProject)
message(STATUS "Suitable dkh could not be located, ${Magenta}Building dkh${ColourReset} instead.")
set(_dkh_dir "share/cmake/dkh")
ExternalProject_Add(dkh_external
DEPENDS lapack_external
URL https://github.com/psi4/dkh/archive/3ba0128.tar.gz # v1.2 + cmake
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
-Ddkh_INSTALL_CMAKEDIR=${_dkh_dir}
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DENABLE_OPENMP=${ENABLE_OPENMP} # relevant for thread safety
-DENABLE_XHOST=${ENABLE_XHOST}
-DBUILD_FPIC=${BUILD_FPIC}
-DENABLE_GENERIC=${ENABLE_GENERIC}
-DLIBC_INTERJECT=${LIBC_INTERJECT}
-DTargetLAPACK_DIR=${TargetLAPACK_DIR}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
CMAKE_CACHE_ARGS -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
-DCMAKE_Fortran_COMPILER_ARG1:STRING=${CMAKE_Fortran_COMPILER_ARG1}
-DCMAKE_C_COMPILER_ARG1:STRING=${CMAKE_C_COMPILER_ARG1})
set(dkh_DIR ${STAGED_INSTALL_PREFIX}/${_dkh_dir} CACHE PATH "path to internally built dkhConfig.cmake" FORCE)
endif()
else()
add_library(dkh_external INTERFACE) # dummy
endif()