-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
55 lines (45 loc) · 1.14 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
# SPDX-Identifier: MIT
cmake_minimum_required(VERSION 3.14)
project(
"stdlib-example"
LANGUAGES "Fortran"
VERSION "0.1"
)
# Follow GNU conventions for installing directories
include(GNUInstallDirs)
# General configuration information
add_subdirectory("config")
if(NOT TARGET "fortran_stdlib::fortran_stdlib")
find_package("fortran_stdlib" REQUIRED)
endif()
# Collect source of the project
add_subdirectory("src")
# Collect source of the application
add_subdirectory("app")
# Export targets for other projects
add_library("${PROJECT_NAME}" INTERFACE)
target_link_libraries("${PROJECT_NAME}" INTERFACE "${PROJECT_NAME}-lib")
install(
TARGETS
"${PROJECT_NAME}"
EXPORT
"${PROJECT_NAME}-targets"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
# Install exported targets
install(
EXPORT "${PROJECT_NAME}-targets"
NAMESPACE
"${PROJECT_NAME}::"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
# Package license files
install(
FILES
"LICENSE"
DESTINATION "${CMAKE_INSTALL_DATADIR}/licenses/${PROJECT_NAME}"
)
# Include test suite
enable_testing()
add_subdirectory("test")