From fb863b90db2cd8fe30f604372a106faf7d467ed5 Mon Sep 17 00:00:00 2001 From: maier Date: Wed, 26 Sep 2012 14:49:04 +0000 Subject: [PATCH] Implement the client side cmake configuration as well git-svn-id: https://svn.dealii.org/branches/branch_cmake@26750 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 5 +- deal.II/README_CMAKE | 312 ++++++++++++++++-- .../check_for_compiler_bugs.cmake | 0 .../check_for_compiler_features.cmake | 0 .../check_for_cxx_features.cmake | 0 .../tests/darwin-dynamic-cast/BaseClass.cpp | 0 .../tests/darwin-dynamic-cast/BaseClass.h | 0 .../tests/darwin-dynamic-cast/main.cc | 0 ..._deal_ii_initialize_cached_variables.cmake | 25 ++ .../macros/macro_deal_ii_setup_target.cmake | 43 +++ deal.II/cmake/setup_deal_ii.cmake | 3 + deal.II/config/CMakeLists.txt | 30 ++ deal.II/config/Config.cmake.in | 8 +- 13 files changed, 385 insertions(+), 41 deletions(-) rename deal.II/cmake/{check => checks}/check_for_compiler_bugs.cmake (100%) rename deal.II/cmake/{check => checks}/check_for_compiler_features.cmake (100%) rename deal.II/cmake/{check => checks}/check_for_cxx_features.cmake (100%) rename deal.II/cmake/{check => checks}/tests/darwin-dynamic-cast/BaseClass.cpp (100%) rename deal.II/cmake/{check => checks}/tests/darwin-dynamic-cast/BaseClass.h (100%) rename deal.II/cmake/{check => checks}/tests/darwin-dynamic-cast/main.cc (100%) create mode 100644 deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake create mode 100644 deal.II/cmake/macros/macro_deal_ii_setup_target.cmake diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 35b0c53045..67f6f1ec7c 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -167,8 +167,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) SET(CMAKE_INCLUDE_CURRENT_DIR true) -SET(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} +LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/ ${CMAKE_SOURCE_DIR}/cmake/modules/ ) @@ -204,7 +203,7 @@ INCLUDE(setup_compiler_flags) # # Run all system checks: # -FILE(GLOB check_files "cmake/check/*.cmake") +FILE(GLOB check_files "cmake/checks/*.cmake") FOREACH(file ${check_files}) MESSAGE(STATUS "Include ${file}") INCLUDE(${file}) diff --git a/deal.II/README_CMAKE b/deal.II/README_CMAKE index 9352ceed5b..94dc31ee50 100644 --- a/deal.II/README_CMAKE +++ b/deal.II/README_CMAKE @@ -36,6 +36,12 @@ TABLE OF CONTENTS Installation + How to use deal.II in your cmake project + + Finding the deal.II library + + Setting up necessary configuration variables + Development Fat note regarding platform checks and feature configuration @@ -52,17 +58,12 @@ INTRODUCTION ============ - TODO - - The philosophy ============== »I need a new keyboard, my CAPS-KEY is stuck because of writing all this cmake script...« - TODO - Quick start =========== @@ -75,6 +76,10 @@ INTRODUCTION $ cmake -DCMAKE_INSTALL_PREFIX=/path/install/dir ../ $ make install + * Check out the examples, shipped with deal.II: + + $ cd /path/to/install/dir/examples + Useful bits =========== @@ -197,8 +202,7 @@ CONFIGURATION There are some options to determine the behaviour of the dependency resolution: - The option DEAL_II_ALLOW_CONTRIB determines the behaviour of the - dependency resolution: + The option DEAL_II_ALLOW_CONTRIB: - If set to ON external libraries still have precedence. But if there is no external library the bundled contrib library will be used. @@ -212,7 +216,9 @@ CONFIGURATION forces the use of the bundled contrib library regardless whether DEAL_II_ALLOW_CONTRIB is set to OFF or an external library is found. + Autoconfiguration: + If the option DEAL_II_FEATURE_AUTODETECTION is enabled the DEAL_II_WITH_ toggles will be automatically set (overwriting any previous configuration) depending on whether they can be supported or @@ -260,16 +266,18 @@ CONFIGURATION TRILINOS_DIR, UMFPACK_DIR (and AMD_DIR) + 3.) The system default locations for libraries and includes. + Alternatively, cached variables set by the Find mechanism may be set, hinted or overwritten directly! - These variables are usually called _INCLUDE_DIR(S) and + These variables are usually called _INCLUDE_DIR(|S) and _(LIBRARY|LIBRARIES) (highly dependend of the actual library...). You can get a list via - $ ccmake ../deal.II + $ ccmake ../deal.II (or $ make edit_cache) and entering advanced configuration mode by pressing [t]. Variables that could not be determined are suffixed with -NOTFOUND and @@ -280,27 +288,27 @@ CONFIGURATION =================== - The following options control which components of the deal.II will be + The following options control which components of deal.II will be configured, build and installed: - - DEAL_II_COMPONENT_EXAMPLES: - Enable configuration and installation of the example steps. - This adds a COMPONENT "examples" to the build system. + DEAL_II_COMPONENT_EXAMPLES: + Enable configuration and installation of the example steps. + This adds a COMPONENT "examples" to the build system. - - DEAL_II_COMPONENT_DOCUMENTATION: - Enable configuration, build and installation of the documentation. - This adds a COMPONENT "documentation" to the build system. + DEAL_II_COMPONENT_DOCUMENTATION: + Enable configuration, build and installation of the documentation. + This adds a COMPONENT "documentation" to the build system. - - DEAL_II_COMPONENT_COMPAT_FILES: - Enable installation of legacy files and tools for compatibility with - the old build system - This adds a COMPONENT "compat_files" to the build system. + DEAL_II_COMPONENT_COMPAT_FILES: + Enable installation of legacy files and tools for compatibility with + the old build system + This adds a COMPONENT "compat_files" to the build system. - - DEAL_II_COMPONENT_PROJECT_CONFIG: - Enable configuration and installation of a cmake project config. Useful - for finding ( FIND_PACKAGE(DEAL_II) ) the deal.II library out of cmake - build systems. This adds a COMPONENT "project_config" to the build - system. + DEAL_II_COMPONENT_PROJECT_CONFIG: + Enable configuration and installation of a cmake project config. + Useful for finding ( FIND_PACKAGE(DEAL_II) ) the deal.II library out + of cmake build systems. This adds a COMPONENT "project_config" to the + build system. @@ -309,7 +317,7 @@ CONFIGURATION =================== - CMAKE_BUILD_TYPES: We support the "Debug", "Release" and "DebugRelease" + CMAKE_BUILD_TYPE: We support the "Debug", "Release" and "DebugRelease" build targets. Default is the "DebugRelease" target. - Debug will compile a debug library libdeal_II.g.so with a lot of debug @@ -318,7 +326,8 @@ CONFIGURATION - Release will build an optimized libdeal_II.so. - - DebugRelease will build both. + - DebugRelease will build both libraries. + deal.II will configure sensible default CFLAGS and CXXFLAGS depending on platform, compiler and build target. There are two options, if this is @@ -335,7 +344,6 @@ CONFIGURATION CMAKE_CXX_FLAGS - used during all builds DEAL_II_CXX_FLAGS_DEBUG - additional flags for the debug library DEAL_II_CXX_FLAGS_RELEASE - additional flags for the release library - (same for *_C_FLAGS_* ...) The content of the cached variables will be preserved and added *_TO THE END_* of the default compiler flags, hence giving a possibility @@ -350,8 +358,8 @@ CONFIGURATION - BUILD_SHARED_LIBS: If set, deal.II will be linked as a shared library - CMAKE_INSTALL_RPATH_USE_LINK_PATH: If set, the deal.II library will be - installed with its rpath value set to point to all libraries outside of - the system search pathes. + installed with rpaths set for all libraries outside of the system + search paths @@ -359,6 +367,7 @@ CONFIGURATION Installation ============ + CMAKE_INSTALL_PREFIX determines the location, where the deal.II library will be installed. @@ -375,6 +384,7 @@ CONFIGURATION include lib + With DEAL_II_COMPONENT_COMPAT_FILES=OFF: ${CMAKE_INSTALL_PREFIX}/ @@ -383,8 +393,9 @@ CONFIGURATION /share/doc/deal.II/examples /share/doc/deal.II/html - If DEAL_II_COMPONENT_COMPAT_FILES is set to OFF, the individual target - directories can be overwritten by + + The individual target directories can be overwritten by + DEAL_II_CMAKE_MACROS_RELDIR DEAL_II_DOCUMENTATION_RELDIR DEAL_II_EXAMPLES_RELDIR DEAL_II_INCLUDE_RELDIR @@ -394,7 +405,156 @@ CONFIGURATION -========== +======================================== +How to use deal.II in your cmake project +======================================== + + + Finding the deal.II library + =========================== + + + If DEAL_II_COMPONENT_PROJECT_CONFIG was set, finding the deal.II library + should be no more than + + FIND_PACKAGE(deal.II CONFIG REQUIRED) + + in your CMakeLists.txt file. + + You may have to hint for the location of the deal.IIConfig.cmake file. + Either by directly specifying deal.II_DIR to point to the path were the + deal.IIConfig.cmake files are located: + + $ cmake -Ddeal.II_DIR=/path/to/the/config/file <...> + + Or by specifying a search path via CMAKE_PREFIX_PATH, e.g. + + $ cmake -DCMAKE_PREFIX_PATH=~/workspace/local + + In this case deal.IIConfig.cmake will be searched in + ~/workspace/local/ + ~/workspace/local/lib/cmake/deal.II/ + + + Setting up necessary configuration variables + ============================================ + + Importing the deal.IICONFIG.cmake file via FIND_PACKAGE will set a bunch + of variables. All of the form DEAL_II_*. + + Usually for actually using deal.II the following configuration steps are + necessary. This can be either done by hand (a), or set up via macros (b). + + + a) Configuration by hand: + + - Set up all include directories for headers: + + INCLUDE_DIRECTORIES( + # The deal.II include directories: + ${DEAL_II_INCLUDE_DIRS} + # External include directories necessary for user programs: + ${DEAL_II_EXTERNAL_INCLUDE_DIRS} + ) + + - deal.II usually ships with an optimized Release and a Debug version + of the library. So it is a good idea to set up CMAKE_BUILD_TYPE + accordingly: + + SET(CMAKE_BUILD_TYPE "Debug" CACHE + "Choose the type of build, options are: Debug, Release" + ) + + A cached variable ensures that we can later switch the build type + by editing the cache: + + $ ccmake <...> or $ make edit_cache + + - Often, it is a good idea to use the same compiler and linker + flags as the deal.II library. + + SET(CMAKE_CXX_FLAGS ${DEAL_II_CXX_FLAGS}) + SET(CMAKE_CXX_FLAGS_RELEASE ${DEAL_II_CXX_FLAGS_RELEASE}) + SET(CMAKE_CXX_FLAGS_DEBUG ${DEAL_II_CXX_FLAGS_DEBUG}) + + (Optionally you can set them up with 'CACHE "..."' to be able + to edit them via ccmake or make edit_cache) + + - _After_ this, specify your project name: + + PROJECT(myProject) + + This ensures that the compiler detection and platform setup that + is issued by calling PROJECT(...) will run after we have set up + our cached variables. This way it is our choice of variables that + will be set and not the one determined in PROJECT(...)will be set + and not the one determined in PROJECT(...) + + - After defining your targets, e.g. + + ADD_EXECUTABLE(step-1 step-1.cc) + + we have to specify to link against deal.II and all external + libraries: + + TARGET_LINK_LIBRARIES(step-1 + debug + ${DEAL_II_LIBRARIES_DEBUG} + ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG} + optimized + ${DEAL_II_LIBRARIES_RELEASE} + ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE} + general + ${DEAL_II_EXTERNAL_LIBRARIES} + ) + + - As well as using some preprocessor definitions: + + SET_TARGET_PROPERTIES(step-1 PROPERTIES + COMPILE_DEFINITIONS + "${DEAL_II_USER_DEFINITIONS}" + COMPILE_DEFINITIONS_DEBUG + "${DEAL_II_USER_DEFINITIONS_DEBUG}" + COMPILE_DEFINITIONS_RELEASE + "${DEAL_II_USER_DEFINITIONS_RELEASE}" + ) + + - Optionally, you can set the link flags to the one used by the + deal.II library: + + SET_TARGET_PROPERTIES(step-1 PROPERTIES + LINK_FLAGS + "${DEAL_II_LINKER_FLAGS}" + LINK_FLAGS_DEBUG + "${DEAL_II_LINKER_FLAGS_DEBUG}" + LINK_FLAGS_RELEASE + "${DEAL_II_LINKER_FLAGS_RELEASE}" + ) + + And this it is. + + + b) Configuration with the help of two convencience macros: + + All the steps explained in (a) can be automatically set with the help + of two convenience macros. This boils down to the following example + code: + + FIND_PACKAGE(deal.II CONFIG REQUIRED) + + INCLUDE(${DEAL_II_MACROS}) + + DEAL_II_INITIALIZE_CACHED_VARIABLES() + + PROJECT(step-1) + + ADD_EXECUTABLE(step-1 step-1.cc) + DEAL_II_SETUP_TARGET(step-1) + + + + +=========== DEVELOPMENT =========== @@ -452,6 +612,7 @@ DEVELOPMENT DEAL_II_EXTERNAL_LIBRARIES DEAL_II_EXTERNAL_LIBRARIES_DEBUG DEAL_II_EXTERNAL_LIBRARIES_RELEASE + Used to keep track of external libraries, the deal.II library and user programs have to be linked against. @@ -461,11 +622,13 @@ DEVELOPMENT DEAL_II_USER_DEFINITIONS DEAL_II_USER_DEFINITIONS_DEBUG DEAL_II_USER_DEFINITIONS_RELEASE + Used to keep track of external preprocessor definitions, necessary for the compilation of user programs. DEAL_II_USER_INCLUDE_DIRS + Used to keep track of external include dirs, necessary for the compilation of user programs. @@ -476,13 +639,92 @@ DEVELOPMENT ======================= - TODO + Platform checks reside under cmake/check. + We currently have + + cmake/check/check_for_compiler_bugs.cmake + + cmake/check/check_for_compiler_features.cmake + + cmake/check/check_for_cxx_features.cmake + + + General notes: + - A platform check should have a prominent comment explaining what + it does and why it is there, as well as a stating the author and the + year. + - Definition toggles in include/deal.II/base/config.h.in should have + a prominent comment explaining it and should be grouped by file + exporting the definition Writing features ================ - TODO + For a feature the following the following toggles, variables and + macros should be defined: + + (Note: means all caps, means all lowercase) + + + In the top level ./CMakeLists.txt: + + DEAL_II_WITH_ (bool, mandatory) + An option for enabling or disabling the configuration of + + DEAL_II_FORCE_CONTRIB_ (bool, optional) + If can be set up by contrib dependencies, this + configuration option must be present to force the use of the contrib + dependencies + + + A file cmake/configure/configure_.cmake defining how to + configure : + + DEAL_II_WITH_ (bool, mandatory) + If DEAL_II_FEATURE_AUTODETECTION is OFF, this boolean determines + whether the feature will be configured. + If DEAL_II_FEATURE_AUTODETECTION is ON, this boolean will + automatically be set if configuring the feature was successful. + + FEATURE__DEPENDS (variable, optional) + a variable which contains an optional list of other features + this feature depends on (and which have to be enbled for this feature + to work.) The features must be given with the full option toggle: + DEAL_II_WITH_[...] + + FEATURE__HAVE_CONTRIB (variable, optional) + which should either be set to TRUE if all necessary libraries of the + features comes bundled with deal.II and hence can be supported + without external dependencies, or unset. + + FEATURE__CONFIGURE_CONTRIB(var) (macro, optional) + which should setup all necessary configuration for the feature with + contrib source dependencies. var set to TRUE indicates success, + otherwise this script gives an error. + + FEATURE__FIND_EXTERNAL(var) (macro, mandatory) + which should set var to TRUE if all dependencies for the feature are + fullfilled. In this case all necessary variables for + FEATURE__CONFIGURE_EXTERNAL must be set. Otherwise + var should remain unset. + This macro should give an error (SEND_ERROR or FATAL_ERROR). + + FEATURE__CONFIGURE_EXTERNAL(var) (macro, mandatory) + which should setup all necessary configuration for the feature with + external dependencies. var set to TRUE indicates success, + otherwise this script gives an error. + + FEATURE__CUSTOM_ERROR_MESSAGE() (variable, optional) + which should either be set to TRUE if FEATURE__ERROR_MESSAGE + is set up, or be undefined. + + FEATURE__ERROR_MESSAGE() (macro, optional) + which should print a meaningfull error message (with SEND_ERROR) for + the case that no external library was found (and contrib is not + allowed to be used.) If not defined, a suitable default error message + will be printed. + diff --git a/deal.II/cmake/check/check_for_compiler_bugs.cmake b/deal.II/cmake/checks/check_for_compiler_bugs.cmake similarity index 100% rename from deal.II/cmake/check/check_for_compiler_bugs.cmake rename to deal.II/cmake/checks/check_for_compiler_bugs.cmake diff --git a/deal.II/cmake/check/check_for_compiler_features.cmake b/deal.II/cmake/checks/check_for_compiler_features.cmake similarity index 100% rename from deal.II/cmake/check/check_for_compiler_features.cmake rename to deal.II/cmake/checks/check_for_compiler_features.cmake diff --git a/deal.II/cmake/check/check_for_cxx_features.cmake b/deal.II/cmake/checks/check_for_cxx_features.cmake similarity index 100% rename from deal.II/cmake/check/check_for_cxx_features.cmake rename to deal.II/cmake/checks/check_for_cxx_features.cmake diff --git a/deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.cpp b/deal.II/cmake/checks/tests/darwin-dynamic-cast/BaseClass.cpp similarity index 100% rename from deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.cpp rename to deal.II/cmake/checks/tests/darwin-dynamic-cast/BaseClass.cpp diff --git a/deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.h b/deal.II/cmake/checks/tests/darwin-dynamic-cast/BaseClass.h similarity index 100% rename from deal.II/cmake/check/tests/darwin-dynamic-cast/BaseClass.h rename to deal.II/cmake/checks/tests/darwin-dynamic-cast/BaseClass.h diff --git a/deal.II/cmake/check/tests/darwin-dynamic-cast/main.cc b/deal.II/cmake/checks/tests/darwin-dynamic-cast/main.cc similarity index 100% rename from deal.II/cmake/check/tests/darwin-dynamic-cast/main.cc rename to deal.II/cmake/checks/tests/darwin-dynamic-cast/main.cc diff --git a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake new file mode 100644 index 0000000000..2a5d2c3a8f --- /dev/null +++ b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake @@ -0,0 +1,25 @@ +# +# This file implements the DEAL_II_INITIALIZE_VARIABLES macro, which is +# part of the deal.II library. +# +# Usage: +# DEAL_II_INITIALIZE_CACHED_VARIABLES() +# +# This macro sets some cached variables to the values used for compiling +# the deal.II library. +# +# This macro has to be called before PROJECT()! +# + +MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES) + + SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING + "Choose the type of build, options are: Debug, Release" + ) + + SET(CMAKE_CXX_FLAGS ${DEAL_II_CXX_FLAGS}) + SET(CMAKE_CXX_FLAGS_RELEASE ${DEAL_II_CXX_FLAGS_RELEASE}) + SET(CMAKE_CXX_FLAGS_DEBUG ${DEAL_II_CXX_FLAGS_DEBUG}) + +ENDMACRO() + diff --git a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake new file mode 100644 index 0000000000..ecab7c8980 --- /dev/null +++ b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake @@ -0,0 +1,43 @@ +# +# This file implements the DEAL_II_SETUP_TARGET macro, which is +# part of the deal.II library. +# +# Usage: +# DEAL_II_SETUP_TARGET(target) +# +# This macro sets the necessary include directories, linker flags, compile +# definitions and the external libraries the target will be linked against. +# + +MACRO(DEAL_II_SETUP_TARGET target) + + SET_TARGET_PROPERTIES(${target} PROPERTIES + INCLUDE_DIRECTORIES + "${DEAL_II_INCLUDE_DIRS};${DEAL_II_EXTERNAL_INCLUDE_DIRS}" + LINK_FLAGS + "${DEAL_II_LINKER_FLAGS}" + LINK_FLAGS_DEBUG + "${DEAL_II_LINKER_FLAGS_DEBUG}" + LINK_FLAGS_RELEASE + "${DEAL_II_LINKER_FLAGS_RELEASE}" + COMPILE_DEFINITIONS + "${DEAL_II_USER_DEFINITIONS}" + COMPILE_DEFINITIONS_DEBUG + "${DEAL_II_USER_DEFINITIONS_DEBUG}" + COMPILE_DEFINITIONS_RELEASE + "${DEAL_II_USER_DEFINITIONS_RELEASE}" + ) + + TARGET_LINK_LIBRARIES(${target} + debug + ${DEAL_II_LIBRARIES_DEBUG} + ${DEAL_II_EXTERNAL_LIBRARIES_DEBUG} + optimized + ${DEAL_II_LIBRARIES_RELEASE} + ${DEAL_II_EXTERNAL_LIBRARIES_RELEASE} + general + ${DEAL_II_EXTERNAL_LIBRARIES} + ) + +ENDMACRO() + diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index 7918930759..536758efa8 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -25,6 +25,7 @@ # DEAL_II_LIBRARY_NAME_RELEASE # # DEAL_II_PATH *) +# DEAL_II_CMAKE_MACROS_RELDIR *) # DEAL_II_DOCUMENTATION_RELDIR *) # DEAL_II_EXAMPLES_RELDIR *) # DEAL_II_INCLUDE_RELDIR *) @@ -70,6 +71,7 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # # The good, old directory structure: # + SET_IF_EMPTY(DEAL_II_CMAKE_MACROS_RELDIR "cmake/macros") SET_IF_EMPTY(DEAL_II_DOCUMENTATION_RELDIR "doc") SET_IF_EMPTY(DEAL_II_EXAMPLES_RELDIR "examples") SET_IF_EMPTY(DEAL_II_INCLUDE_RELDIR "include") @@ -81,6 +83,7 @@ ELSE() # IF DEAL_II_COMPONENT_COMPAT_FILES is not set, we assume that we have to # obey the FSHS... # + SET_IF_EMPTY(DEAL_II_CMAKE_MACROS_RELDIR "share/${DEAL_II_PACKAGE_NAME}/cmake/Macros") SET_IF_EMPTY(DEAL_II_DOCUMENTATION_RELDIR "share/doc/${DEAL_II_PACKAGE_NAME}/html") SET_IF_EMPTY(DEAL_II_EXAMPLES_RELDIR "share/doc/${DEAL_II_PACKAGE_NAME}/examples") SET_IF_EMPTY(DEAL_II_INCLUDE_RELDIR "include") diff --git a/deal.II/config/CMakeLists.txt b/deal.II/config/CMakeLists.txt index 5188c823d3..b2e7c7b4ec 100644 --- a/deal.II/config/CMakeLists.txt +++ b/deal.II/config/CMakeLists.txt @@ -5,6 +5,23 @@ CONFIGURE_FILE( IF(DEAL_II_COMPONENT_PROJECT_CONFIG) + + # + # Setup and install the convenience macros: + # + + LIST(APPEND DEAL_II_MACROS + ${CMAKE_INSTALL_PREFIX}/${DEAL_II_CMAKE_MACROS_RELDIR}/macro_deal_ii_initialize_cached_variables.cmake + ${CMAKE_INSTALL_PREFIX}/${DEAL_II_CMAKE_MACROS_RELDIR}/macro_deal_ii_setup_target.cmake + ) + + INSTALL(FILES + ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake + ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake + DESTINATION ${DEAL_II_CMAKE_MACROS_RELDIR} + COMPONENT project_config + ) + # # Configure and install the cmake project configuration: # @@ -23,6 +40,18 @@ IF(DEAL_II_COMPONENT_PROJECT_CONFIG) ENDIF() ENDFOREACH() + # + # Include the convenience macros directly at the end of our project + # config: + # + FOREACH(var ${DEAL_II_MARCROS}) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + "\nINCLUDE(${var})" + ) + ENDFOREACH() + + + CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake @@ -35,6 +64,7 @@ IF(DEAL_II_COMPONENT_PROJECT_CONFIG) DESTINATION ${DEAL_II_PROJECT_CONFIG_RELDIR} COMPONENT project_config ) + ENDIF() diff --git a/deal.II/config/Config.cmake.in b/deal.II/config/Config.cmake.in index 95cb4dcf67..a8a4298ff9 100644 --- a/deal.II/config/Config.cmake.in +++ b/deal.II/config/Config.cmake.in @@ -20,6 +20,7 @@ SET(DEAL_II_PACKAGE_TARNAME "${DEAL_II_PACKAGE_TARNAME}") SET(DEAL_II_PACKAGE_URL "${DEAL_II_PACKAGE_URL}") SET(DEAL_II_PROJECT_CONFIG_NAME "${DEAL_II_PROJECT_CONFIG_NAME}") +SET(DEAL_II_MACROS "${DEAL_II_MACROS}") # @@ -27,6 +28,7 @@ SET(DEAL_II_PROJECT_CONFIG_NAME "${DEAL_II_PROJECT_CONFIG_NAME}") # SET(DEAL_II_PATH "${DEAL_II_PATH}") +SET(DEAL_II_CMAKE_MACROS_RELDIR "${DEAL_II_CMAKE_MACROS_RELDIR}") SET(DEAL_II_DOCUMENTATION_RELDIR "${DEAL_II_DOCUMENTATION_RELDIR}") SET(DEAL_II_EXAMPLES_RELDIR "${DEAL_II_EXAMPLES_RELDIR}") SET(DEAL_II_INCLUDE_RELDIR "${DEAL_II_INCLUDE_RELDIR}") @@ -75,9 +77,9 @@ SET(DEAL_II_EXTERNAL_LIBRARIES "${DEAL_II_EXTERNAL_LIBRARIES}") SET(DEAL_II_EXTERNAL_LIBRARIES_DEBUG "${DEAL_II_EXTERNAL_LIBRARIES_DEBUG}") SET(DEAL_II_EXTERNAL_LIBRARIES_RELEASE "${DEAL_II_EXTERNAL_LIBRARIES_RELEASE}") -SET(DEAL_II_EXTERNAL_DEFINITIONS "${DEAL_II_USER_DEFINITIONS}") -SET(DEAL_II_EXTERNAL_DEFINITIONS_DEBUG "${DEAL_II_USER_DEFINITIONS_DEBUG}") -SET(DEAL_II_EXTERNAL_DEFINITIONS_RELEASE "${DEAL_II_USER_DEFINITIONS_RELEASE}") +SET(DEAL_II_USER_DEFINITIONS "${DEAL_II_USER_DEFINITIONS}") +SET(DEAL_II_USER_DEFINITIONS_DEBUG "${DEAL_II_USER_DEFINITIONS_DEBUG}") +SET(DEAL_II_USER_DEFINITIONS_RELEASE "${DEAL_II_USER_DEFINITIONS_RELEASE}") # -- 2.39.5