From 00f4bd6cfa88a7e59c482e62ad843873cd48ddcb Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sat, 5 Mar 2016 02:16:31 -0600 Subject: [PATCH] CMake: Refactor feature setup - DEAL_II_FEATURES is now used to hold the short name of all configurable features --- cmake/checks/check_01_cxx_features.cmake | 4 +++- cmake/macros/macro_configure_feature.cmake | 11 +++++++---- cmake/setup_cached_variables.cmake | 3 ++- cmake/setup_finalize.cmake | 8 +++++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index 6d94ea7580..f43871d40c 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2012 - 2015 by the deal.II authors +## Copyright (C) 2012 - 2016 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -366,11 +366,13 @@ OPTION(DEAL_II_WITH_CXX11 "Compile deal.II using C++11 language standard." ${DEAL_II_HAVE_CXX11} ) +LIST(APPEND DEAL_II_FEATURES CXX11) OPTION(DEAL_II_WITH_CXX14 "Compile deal.II using C++14 language standard." ${DEAL_II_HAVE_CXX14} ) +LIST(APPEND DEAL_II_FEATURES CXX14) # # Bail out if user requested C++11 support (DEAL_II_WITH_CXX11) but support diff --git a/cmake/macros/macro_configure_feature.cmake b/cmake/macros/macro_configure_feature.cmake index c5cbf15f65..2e3f076a43 100644 --- a/cmake/macros/macro_configure_feature.cmake +++ b/cmake/macros/macro_configure_feature.cmake @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2012 - 2015 by the deal.II authors +## Copyright (C) 2012 - 2016 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -146,6 +146,12 @@ ENDMACRO() ######################################################################## MACRO(CONFIGURE_FEATURE _feature) + + # + # Register the feature in the DEAL_II_FEATURES list + # + LIST(APPEND DEAL_II_FEATURES ${_feature}) + # # This script is arcane black magic. But at least for the better good: We # don't have to copy the configuration logic to every single @@ -222,7 +228,6 @@ MACRO(CONFIGURE_FEATURE _feature) IF(FEATURE_${_feature}_HAVE_BUNDLED) RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED()") MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.") - LIST(APPEND DEAL_II_FEATURES ${_feature}) SET(FEATURE_${_feature}_BUNDLED_CONFIGURED TRUE) SET_CACHED_OPTION(${_feature} ON) ELSE() @@ -248,7 +253,6 @@ MACRO(CONFIGURE_FEATURE _feature) ENDIF() MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with external dependencies.") - LIST(APPEND DEAL_II_FEATURES ${_feature}) SET(FEATURE_${_feature}_EXTERNAL_CONFIGURED TRUE) SET_CACHED_OPTION(${_feature} ON) @@ -262,7 +266,6 @@ MACRO(CONFIGURE_FEATURE _feature) RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED()") MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.") - LIST(APPEND DEAL_II_FEATURES ${_feature}) SET(FEATURE_${_feature}_BUNDLED_CONFIGURED TRUE) SET_CACHED_OPTION(${_feature} ON) diff --git a/cmake/setup_cached_variables.cmake b/cmake/setup_cached_variables.cmake index 8dff4ca139..95b336a002 100644 --- a/cmake/setup_cached_variables.cmake +++ b/cmake/setup_cached_variables.cmake @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2012 - 2015 by the deal.II authors +## Copyright (C) 2012 - 2016 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -315,6 +315,7 @@ OPTION(DEAL_II_WITH_64BIT_INDICES "If set to ON, then use 64-bit data types to represent global degree of freedom indices. The default is to OFF. You only want to set this to ON if you will solve problems with more than 2^31 (approximately 2 billion) unknowns. If set to ON, you also need to ensure that both Trilinos and/or PETSc support 64-bit indices." OFF ) +LIST(APPEND DEAL_II_FEATURES 64BIT_INDICES) OPTION(DEAL_II_DOXYGEN_USE_MATHJAX "If set to ON, doxygen documentation is generated using mathjax" diff --git a/cmake/setup_finalize.cmake b/cmake/setup_finalize.cmake index 6dd72d4658..30fb87ca19 100644 --- a/cmake/setup_finalize.cmake +++ b/cmake/setup_finalize.cmake @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2012 - 2015 by the deal.II authors +## Copyright (C) 2012 - 2016 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -62,8 +62,10 @@ ENDFOREACH() # Register features: # FOREACH(_feature ${DEAL_II_FEATURES}) - FILTER_SYSTEM_LIBRARIES(${_feature}) # TODO, remove here - REGISTER_FEATURE(${_feature}) + IF(DEAL_II_WITH_${_feature}) + FILTER_SYSTEM_LIBRARIES(${_feature}) + REGISTER_FEATURE(${_feature}) + ENDIF() ENDFOREACH() # -- 2.39.5