-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
69 lines (52 loc) · 1.92 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
cmake_minimum_required(VERSION 3.20)
project(XFDTD_MODEL VERSION 0.0.0 LANGUAGES CXX)
set(XFDTD_MODEL_MAIN_PROJECT OFF)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(XFDTD_MODEL_MAIN_PROJECT ON)
endif()
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
find_package(xfdtd_core REQUIRED)
set(ASE_READER_PUBLIC_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/external/ase_reader/include)
set(XFDTD_MODEL_PUBLIC_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include ${ASE_READER_PUBLIC_INCLUDE_DIRS})
add_library(xfdtd_model INTERFACE)
target_link_libraries(xfdtd_model INTERFACE xfdtd::xfdtd_core)
target_include_directories(xfdtd_model INTERFACE
$<BUILD_INTERFACE:${XFDTD_MODEL_PUBLIC_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:include>)
add_subdirectory(test)
set(XFDTD_MODEL_CMAKE_DIR ${CMAKE_CURRENT_BINARY_DIR}/cmake)
set(XFDTD_MODEL_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
install(
EXPORT xfdtd_model-targets
FILE xfdtd_model-targets.cmake
NAMESPACE xfdtd::
DESTINATION ${XFDTD_MODEL_INSTALL_PREFIX}/lib/cmake/xfdtd_model
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/xfdtd_model-config.cmake.in
${XFDTD_MODEL_CMAKE_DIR}/xfdtd_model-config.cmake
INSTALL_DESTINATION ${XFDTD_MODEL_CMAKE_DIR}
)
export(EXPORT xfdtd_model-targets
FILE ${XFDTD_MODEL_CMAKE_DIR}/xfdtd_model-targets.cmake
NAMESPACE xfdtd::
)
install(
FILES ${XFDTD_MODEL_CMAKE_DIR}/xfdtd_model-config.cmake
DESTINATION ${XFDTD_MODEL_INSTALL_PREFIX}/lib/cmake/xfdtd_model
)
install(TARGETS xfdtd_model
EXPORT xfdtd_model-targets
INCLUDES DESTINATION include
)
install(DIRECTORY ${XFDTD_MODEL_PUBLIC_INCLUDE_DIRS}
DESTINATION ${XFDTD_MODEL_INSTALL_PREFIX}
)