forked from ChASE-library/ChASE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
98 lines (77 loc) · 2.44 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# -*- Mode: cmake -*-
cmake_minimum_required( VERSION 3.8 )
project( ChASE LANGUAGES C CXX VERSION 0.91 )
# ## algorithm ##
add_library(chase_algorithm INTERFACE)
include(GNUInstallDirs)
target_include_directories( chase_algorithm INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> # <prefix>/include/mylib
)
target_compile_features(chase_algorithm INTERFACE cxx_auto_type)
option( CHASE_OUTPUT "ChASE will provide output at each iteration")
if( CHASE_OUTPUT )
target_compile_definitions( chase_algorithm INTERFACE "-DCHASE_OUTPUT" )
endif()
install( TARGETS chase_algorithm
EXPORT chase-headers
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(DIRECTORY algorithm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.inc"
)
install(EXPORT chase-headers
NAMESPACE ChASE::
FILE chase-header.cmake
EXPORT_LINK_INTERFACE_LIBRARIES
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
## Tests
add_executable( "chase_driver" tests/noinput.cpp )
target_link_libraries(chase_driver chase_mpi)
## ChASE-MPI ##
add_subdirectory( "ChASE-MPI/")
add_subdirectory( "ChASE-Elemental/")
# Examples
option(BUILD_WITH_EXAMPLES "Build the examples" OFF)
if(BUILD_WITH_EXAMPLES)
message(STATUS "Building the examples of ChASE")
add_subdirectory("./examples")
endif()
# Unit tests
option(UNITTEST "Build unit tests" OFF)
if(UNITTEST)
message(STATUS "Building unittests")
add_subdirectory("./unittests")
endif()
enable_testing()
add_test( BASIC "chase_driver" )
# Documentation
option(BUILD_WITH_DOCS "Build the examples" OFF)
if(BUILD_WITH_DOCS)
message(STATUS "Building Documentation of ChASE")
add_subdirectory("./docs")
endif()
# Install ChASE as a CMake package
include(CMakePackageConfigHelpers)
if(TARGET chase_cuda )
configure_package_config_file(
"cmake/Config_CUDA.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/chase-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
else()
configure_package_config_file(
"cmake/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/chase-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
endif()
install( FILES
"${CMAKE_CURRENT_BINARY_DIR}/chase-config.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)