forked from dealii/dealii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
175 lines (141 loc) · 5.39 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
## ------------------------------------------------------------------------
##
## SPDX-License-Identifier: LGPL-2.1-or-later
## Copyright (C) 2012 - 2023 by the deal.II authors
##
## This file is part of the deal.II library.
##
## Part of the source code is dual licensed under Apache-2.0 WITH
## LLVM-exception OR LGPL-2.1-or-later. Detailed license information
## governing the source code and code contributions can be found in
## LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
##
## ------------------------------------------------------------------------
## ##
# The cmake build system for the deal.II project #
# #
# See doc/readme.html and doc/developers/cmake-internals.html for #
# further details on how to use the cmake build system of deal.II. #
## ##
########################################################################
# #
# Configuration: #
# #
########################################################################
#
# General configuration for cmake:
#
message(STATUS "This is CMake ${CMAKE_VERSION}")
message(STATUS "")
cmake_minimum_required(VERSION 3.13.4)
#
# We support all policy changes up to version 3.11.
#
cmake_policy(VERSION 3.13.4)
if(POLICY CMP0074)
# Introduced in CMake 3.12: find_package(<PackageName>) also searches
# <PackageName>_ROOT CMake and environment variables when set to NEW.
cmake_policy(SET CMP0074 NEW)
endif()
if(POLICY CMP0075)
# Introduced in CMake 3.12: Use CMAKE_REQUIRED_LIBRARIES also in include
# file checks. We set the policy to NEW explicitly in order to avoid
# spurious configure warnings.
cmake_policy(SET CMP0075 NEW)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
#
# Load all macros:
#
file(GLOB _macro_files "cmake/macros/*.cmake")
message(STATUS "Include ${CMAKE_SOURCE_DIR}/cmake/setup_external_macros.cmake")
include(${CMAKE_SOURCE_DIR}/cmake/setup_external_macros.cmake)
foreach(_file ${_macro_files})
message(STATUS "Include ${_file}")
include(${_file})
endforeach()
#
# Avoid verbose "Up-to-date" status information during installation:
#
set_if_empty(CMAKE_INSTALL_MESSAGE "LAZY")
#
# Check for the existence of various optional folders:
#
if(EXISTS ${CMAKE_SOURCE_DIR}/bundled/CMakeLists.txt)
set(DEAL_II_HAVE_BUNDLED_DIRECTORY TRUE)
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/doc/CMakeLists.txt)
set(DEAL_II_HAVE_DOC_DIRECTORY TRUE)
endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/tests/CMakeLists.txt)
set(DEAL_II_HAVE_TESTS_DIRECTORY TRUE)
endif()
#
# We have to initialize some cached variables before PROJECT is called, so
# do it at this point:
#
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_cached_variables.cmake)
#
# Now, set the project and set up the rest:
#
project(deal.II CXX C)
enable_language_optional(Fortran)
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_deal_ii.cmake)
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_compiler_flags.cmake)
#
# Include information about bundled libraries:
#
if(DEAL_II_HAVE_BUNDLED_DIRECTORY)
verbose_include(${CMAKE_SOURCE_DIR}/bundled/setup_bundled.cmake)
endif()
#
# Run all system checks:
#
file(GLOB _check_files "cmake/checks/*.cmake")
list(SORT _check_files)
foreach(_file ${_check_files})
verbose_include(${_file})
endforeach()
# include setup_finalize.cmake before any target definitions
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_finalize.cmake)
#
# Feature configuration:
#
file(GLOB _configure_files "cmake/configure/configure_*.cmake")
list(SORT _configure_files) # make sure to include in alphabetical order
foreach(_file ${_configure_files})
verbose_include(${_file})
endforeach()
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_sanity_checks.cmake)
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_cpack.cmake)
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_custom_targets.cmake)
########################################################################
# #
# Compilation and installation: #
# #
########################################################################
message(STATUS "")
message(STATUS "Configuring done. Proceed to target definitions now.")
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
add_subdirectory(cmake/scripts)
add_subdirectory(include)
if(DEAL_II_HAVE_DOC_DIRECTORY)
add_subdirectory(doc) # has to be included after include
endif()
if(DEAL_II_HAVE_BUNDLED_DIRECTORY)
add_subdirectory(bundled)
endif()
add_subdirectory(source) # has to be included after bundled
add_subdirectory(cmake/config) # has to be included after source
add_subdirectory(examples)
add_subdirectory(contrib/utilities)
if(DEAL_II_HAVE_TESTS_DIRECTORY)
add_subdirectory(tests)
endif()
add_subdirectory(contrib/python-bindings) # has to be included after tests
verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_write_config.cmake)
#
# And finally, print the configuration:
#
file(READ ${CMAKE_BINARY_DIR}/summary.log DEAL_II_LOG_SUMMARY)
message("${DEAL_II_LOG_SUMMARY}")