From: Matthias Maier ELSE()
, ENDIF()
,
- ENDFOREACH()
, etc. statements shall not repeat the
- corresponding condition in IF()
,
- FOREACH()
, etc.
+ The else()
, endif()
,
+ endforeach()
, etc. statements shall not repeat the
+ corresponding condition in if()
,
+ foreach()
, etc.
-FOREACH(_build ${DEAL_II_BUILD_TYPES})
+foreach(_build ${DEAL_II_BUILD_TYPES})
#
# Set an appropriate keyword depending on target and build type:
#
- IF(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease")
- SET(_keyword "general")
- ELSE()
- IF(_build MATCHES DEBUG)
- SET(_keyword "debug")
- ELSE()
- SET(_keyword "optimized")
- ENDIF()
- ENDIF()
-ENDFOREACH()
+ if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease")
+ set(_keyword "general")
+ else()
+ if(_build MATCHES DEBUG)
+ set(_keyword "debug")
+ else()
+ set(_keyword "optimized")
+ endif()
+ endif()
+endforeach()
@@ -91,12 +91,12 @@ ENDFOREACH()
single line:
-LIST(APPEND CONFIG_LIBRARIES
+list(APPEND CONFIG_LIBRARIES
${_keyword}
${CONFIG_LIBRARIES_${_build}}
)
-SET_TARGET_PROPERTIES(${DEAL_II_NAMESPACE}_${build_lowercase}
+set_target_properties(${DEAL_II_NAMESPACE}_${build_lowercase}
PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
@@ -141,13 +141,13 @@ SET_TARGET_PROPERTIES(${DEAL_II_NAMESPACE}_${build_lowercase}
setup_cached_variables.cmake
:
This sets up all cached variables prior to the call to
- PROJECT(deal.II)
. For details see the comment at the
+ project(deal.II)
. For details see the comment at the
top. Furthermore, some bookkeeping for compiler and linker flags
takes place, see the section
about compile flags.
setup_deal_ii.cmake
:
This file is included immediately after the call to
- PROJECT(deal.II)
and will set up all magic
+ project(deal.II)
and will set up all magic
numbers such as names, definitions, relative and absolute
paths used in the build system. Most of the definitions are
guarded with the help of the SET_IF_EMPTY
macro so
@@ -179,15 +179,15 @@ SET_TARGET_PROPERTIES(${DEAL_II_NAMESPACE}_${build_lowercase}
# All modifications shall be guarded with the ENABLE_IF_SUPPORTED
# or ENABLE_IF_LINKS macro, e.g.
#
-# ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-fpic")
-# ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed")
+# enable_if_supported(DEAL_II_CXX_FLAGS "-fpic")
+# enable_if_links(DEAL_II_LINKER_FLAGS "-Wl,--as-needed")
#
# Compiler flags for platform dependent optimization (such as
# -march=native) must always be guarded with
# DEAL_II_ALLOW_PLATFORM_INTROSPECTION:
#
# IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
-# ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-march=native")
+# enable_if_supported(DEAL_II_CXX_FLAGS "-march=native")
# ENDIF()
#
# Checks for compiler features (such as C++14 support) and compiler
@@ -256,37 +256,37 @@ SET_TARGET_PROPERTIES(${DEAL_II_NAMESPACE}_${build_lowercase}
There are a number of readily available platform check macros:
-CHECK_CXX_SOURCE_COMPILES(source variable)
+check_cxx_source_compiles(source variable)
- Checks whether it is possible to compile _and_ link the code snippet
<source>. If successful, variable is set to 1.
-CHECK_CXX_SOURCE_RUNS(source variable)
+check_cxx_source_runs(source variable)
- variable is set to 1 if <source> could be successfully compiled and
linked and the resulting program ran and exited without error.
Avoid this macro outside of a DEAL_II_ALLOW_PLATFORM_INTROSPECTION
guard. A sensible fallback should be provided if the check cannot
be run (e.g. when cross compiling).
-CHECK_CXX_COMPILER_BUG(source variable)
+check_cxx_compiler_bug(source variable)
- Inverts the logic of CHECK_CXX_SOURCE_COMPILES(), i.e. variable is
set to 1 if it was not possible to compile and link <source>.
-CHECK_INCLUDE_FILE_CXX(header variable)
+check_include_file_cxx(header variable)
- Check whether it is possible to compile and link a dummy program
including <header>.
-CHECK_FUNCTION_EXISTS(function variable)
+check_function_exists(function variable)
- Check for the existence of a function prototype with name
<function>. (Don't forget to specify the link libraries, see
below.) Use CHECK_CXX_SYMBOL_EXISTS to search for C++ function
definitions instead, if possible.
-CHECK_CXX_SYMBOL_EXISTS(symbol header_file variable)
+check_cxx_symbol_exists(symbol header_file variable)
- Check for the existence of a symbol definition in the header_file
as well as for the presence in the current link interface
(Don't forget to specify the link libraries, see below.)
-CHECK_CXX_COMPILER_FLAG(flag variable)
+check_cxx_compiler_flag(flag variable)
- Sets the variable to 1 if the compiler understands the flag.
@@ -295,9 +295,9 @@ CHECK_CXX_COMPILER_FLAG(flag variable)
job nicely:
-ADD_FLAGS(CMAKE_REQUIRED_FLAGS "-Werror")
-CHECK_CXX_SOURCE_COMPILES(...)
-RESET_CMAKE_REQUIRED()
+add_flags(CMAKE_REQUIRED_FLAGS "-Werror")
+check_cxx_source_compiles(...)
+reset_cmake_required()
CMAKE_REQUIRED_FLAGS
) to their default values:
-LIST(APPEND CMAKE_REQUIRED_INCLUDES <a list of includes>)
-LIST(APPEND CMAKE_REQUIRED_LIBRARIES <a list of libraries>)
-CHECK_CXX_SOURCE_COMPILES(...)
-RESET_CMAKE_REQUIRED()
+list(APPEND CMAKE_REQUIRED_INCLUDES <a list of includes>)
+list(APPEND CMAKE_REQUIRED_LIBRARIES <a list of libraries>)
+check_cxx_source_compiles(...)
+reset_cmake_required()
DEAL_II_FIND_LIBRARY
,
- DEAL_II_FIND_PATH
and DEAL_II_FIND_FILE
+ It should do so by appropriate deal_ii_find_library
,
+ deal_ii_find_path
and deal_ii_find_file
calls (same syntax as the native CMake functions; just a small
wrapper to provide some useful output). The results of this calls
should be the only cached variables.
@@ -353,11 +353,11 @@ FEATURE_DEFINITIONS(|_DEBUG|_RELEASE)
FEATURE_VERSION
FEATURE_VERSION(_MAJOR|_MINOR|_SUBMINOR)
- The DEAL_II_PACKAGE_HANDLE
macro should be exclusively
+ The process_feature
macro should be exclusively
used for setting up these variables (except the version variants). An
example invocation is
-DEAL_II_PACKAGE_HANDLE(UMFPACK +process_feature(UMFPACK LIBRARIES REQUIRED UMFPACK_LIBRARY OPTIONAL CHOLMOD_LIBRARY CCOLAMD_LIBRARY COLAMD_LIBRARY CAMD_LIBRARY ${_suitesparse_config} @@ -391,8 +391,8 @@ DEAL_II_PACKAGE_HANDLE(UMFPACK A hint withdiff --git a/doc/developers/testsuite.html b/doc/developers/testsuite.html index 1442d73162..d18f254489 100644 --- a/doc/developers/testsuite.html +++ b/doc/developers/testsuite.html @@ -350,15 +350,15 @@ xx: =============================== OUTPUT END ============================ To run the testsuite in this mode, essentially, you have to do three things:FEATURE_DIR
can be set up for convenience. It is best to start theFind
module by-SET(FEATURE_DIR "" CACHE PATH "short description") -SET_IF_EMPTY(FEATURE_DIR "$ENV{FEATURE_DIR}") +set(FEATURE_DIR "" CACHE PATH "short description") +set_if_empty(FEATURE_DIR "$ENV{FEATURE_DIR}")and useFEATURE_DIR
as a hint. @@ -410,7 +410,7 @@ SET_IF_EMPTY(FEATURE_DIR "$ENV{FEATURE_DIR}")At bare minimum
configure_<feature>.cmake
file for a feature just consists of a call to the -CONFIGURE_FEATURE(<FEATURE>)
macro which is +configure_feature(<FEATURE>)
macro which is implemented in./cmake/macros/macro_configure_feature.cmake
. In this case the correspondingFind<FEATURE>.cmake
@@ -660,7 +660,7 @@ done by hand. Please note: # A list of source files that, if DEAL_II_UNITY_BUILD=ON, will be concatenated # into a few unity files: # -SET(_unity_include_src +set(_unity_include_src block_info.cc dof_faces.cc ... @@ -669,7 +669,7 @@ SET(_unity_include_src # # A list of source files that are always compiled individually: # -SET(_separate_src +set(_separate_src dof_accessor.cc dof_accessor_get.cc ... @@ -682,13 +682,13 @@ SET(_separate_src # files that each contain no more than _n_includes_per_unity_file files. If # DEAL_II_UNITY_BUILD=OFF then this variable is never read. # -SET(_n_includes_per_unity_file 15) +set(_n_includes_per_unity_file 15) # # A macro that handles setting up the list of source files to compile in the # _src variable and handles the unity build logic: # -SETUP_SOURCE_LIST("${_unity_include_src}" +setup_source_list("${_unity_include_src}" "${_separate_src}" ${_n_includes_per_unity_file} _src @@ -697,7 +697,7 @@ SETUP_SOURCE_LIST("${_unity_include_src}" # # A list of instantiations that must be expanded: # -SET(_inst +set(_inst block_info.inst.in ... ) @@ -710,18 +710,18 @@ SET(_inst # Header files and instantiation files (${_header}, ${_inst}) are added # for cosmetic reasons, so that they show up in IDEs. # -FILE(GLOB _header +file(GLOB _header ${CMAKE_SOURCE_DIR}/include/deal.II/dofs/*.h ) -DEAL_II_ADD_LIBRARY(obj_dofs OBJECT ${_src} ${_header} ${_inst}) +deal_ii_add_library(obj_dofs OBJECT ${_src} ${_header} ${_inst}) # # This macro will set up a target for each of the files listed in # ${_inst}. Appropriate target dependencies will be added to obj_dofs_debug and # obj_dofs_release. # -EXPAND_INSTANTIATIONS(obj_dofs "${_inst}") +expand_instantiations(obj_dofs "${_inst}")
@@ -780,11 +780,11 @@ $ ctest -V -R "category/my_new_test" aCMakeLists.txt
file into it containing-CMAKE_MINIMUM_REQUIRED(VERSION 3.3.0) -INCLUDE(../setup_testsubproject.cmake) -PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +cmake_minimum_required(VERSION 3.13.4) +include(../setup_testsubproject.cmake) +project(testsuite CXX) +include(${DEAL_II_TARGET_CONFIG}) +deal_ii_pickup_tests()