From 9219eb3d54ad283c0690b794b5ae16e995df089b Mon Sep 17 00:00:00 2001 From: maier Date: Sun, 15 Dec 2013 16:37:29 +0000 Subject: [PATCH] CMake: Big compilation variables cleanup - Be consistent in naming: All compiler / linker flag variables and compile definition variables now start with DEAL_II_* - For compatibility: Rename the corresponding CMAKE_* variables to DEAL_II_* and log the fact in the configure output. git-svn-id: https://svn.dealii.org/trunk@32019 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/bundled/functionparser/CMakeLists.txt | 6 +- .../tbb41_20130401oss/src/CMakeLists.txt | 6 +- .../umfpack/UMFPACK/Source/CMakeLists.txt | 8 +- .../cmake/checks/check_01_cxx_features.cmake | 2 +- .../checks/check_02_system_features.cmake | 2 +- .../cmake/checks/check_03_compiler_bugs.cmake | 10 +- deal.II/cmake/config/CMakeLists.txt | 8 +- deal.II/cmake/config/Config.cmake.in | 2 +- deal.II/cmake/config/Make.global_options.in | 4 +- .../cmake/configure/configure_1_threads.cmake | 4 +- .../configure/configure_2_trilinos.cmake | 6 +- .../cmake/configure/configure_3_petsc.cmake | 2 +- .../macros/macro_deal_ii_add_library.cmake | 4 +- .../macro_deal_ii_insource_setup_target.cmake | 2 +- .../cmake/macros/macro_register_feature.cmake | 4 +- .../macros/macro_reset_cmake_required.cmake | 2 +- deal.II/cmake/setup_cached_variables.cmake | 137 ++++++++++-------- deal.II/cmake/setup_compiler_flags.cmake | 14 +- deal.II/cmake/setup_compiler_flags_gnu.cmake | 40 ++--- .../cmake/setup_compiler_flags_intel.cmake | 30 ++-- deal.II/cmake/setup_compiler_flags_msvc.cmake | 6 +- deal.II/cmake/setup_finalize.cmake | 27 +++- deal.II/doc/developers/cmake-internals.html | 8 +- deal.II/doc/developers/porting.html | 2 +- deal.II/doc/users/Config.sample | 14 +- deal.II/doc/users/cmake.html | 4 +- deal.II/doc/users/cmakelists.html | 4 +- 27 files changed, 209 insertions(+), 149 deletions(-) diff --git a/deal.II/bundled/functionparser/CMakeLists.txt b/deal.II/bundled/functionparser/CMakeLists.txt index eaf39a348c..0b217e8c4e 100644 --- a/deal.II/bundled/functionparser/CMakeLists.txt +++ b/deal.II/bundled/functionparser/CMakeLists.txt @@ -15,11 +15,11 @@ ## --------------------------------------------------------------------- # -# Remove -Wall and -pedantic from CMAKE_CXX_FLAGS (in directory scope) to +# Remove -Wall and -pedantic from DEAL_II_CXX_FLAGS (in directory scope) to # avoid some annoying warnings... # -STRIP_FLAG(CMAKE_CXX_FLAGS "-Wall") -STRIP_FLAG(CMAKE_CXX_FLAGS "-pedantic") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-Wall") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-pedantic") DEAL_II_ADD_LIBRARY(obj_functionparser OBJECT fparser.cc diff --git a/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt b/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt index 9604dad1b6..8e764b44f3 100644 --- a/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt +++ b/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt @@ -15,11 +15,11 @@ ## --------------------------------------------------------------------- # -# Remove -Wall and -pedantic from CMAKE_CXX_FLAGS (in directory scope) to +# Remove -Wall and -pedantic from DEAL_II_CXX_FLAGS (in directory scope) to # avoid some annoying warnings... # -STRIP_FLAG(CMAKE_CXX_FLAGS "-Wall") -STRIP_FLAG(CMAKE_CXX_FLAGS "-pedantic") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-Wall") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-pedantic") SET(CMAKE_INCLUDE_CURRENT_DIR TRUE) INCLUDE_DIRECTORIES( diff --git a/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt b/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt index 4761b3c041..16f03377d4 100644 --- a/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt +++ b/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt @@ -22,10 +22,10 @@ # # *Shush!* # -STRIP_FLAG(CMAKE_CXX_FLAGS "-pedantic") -STRIP_FLAG(CMAKE_CXX_FLAGS "-Wall") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-sign-compare") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-write-strings") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-pedantic") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-Wall") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-sign-compare") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-write-strings") SET(src_umfpack_UMF umf_2by2.cc diff --git a/deal.II/cmake/checks/check_01_cxx_features.cmake b/deal.II/cmake/checks/check_01_cxx_features.cmake index 84a9d178a2..0f5b0865f2 100644 --- a/deal.II/cmake/checks/check_01_cxx_features.cmake +++ b/deal.II/cmake/checks/check_01_cxx_features.cmake @@ -170,7 +170,7 @@ IF(DEAL_II_HAVE_CXX11_FLAG) SET(DEAL_II_USE_CXX11 TRUE) - ADD_FLAGS(CMAKE_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") + ADD_FLAGS(DEAL_II_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") ELSE() MESSAGE(STATUS "Insufficient C++11 support. Disabling ${DEAL_II_CXX11_FLAG}.") diff --git a/deal.II/cmake/checks/check_02_system_features.cmake b/deal.II/cmake/checks/check_02_system_features.cmake index cc0c675a6a..20c158c636 100644 --- a/deal.II/cmake/checks/check_02_system_features.cmake +++ b/deal.II/cmake/checks/check_02_system_features.cmake @@ -89,7 +89,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") # warnings. However, newer gccs on that platform do not have # this flag any more, so check whether we can indeed do this # - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-double") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-long-double") # # On Mac OS X, -rdynamic is accepted by the compiler (i.e. diff --git a/deal.II/cmake/checks/check_03_compiler_bugs.cmake b/deal.II/cmake/checks/check_03_compiler_bugs.cmake index f650c69ec9..ea8d16f293 100644 --- a/deal.II/cmake/checks/check_03_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_03_compiler_bugs.cmake @@ -42,7 +42,7 @@ POP_TEST_FLAG() POP_TEST_FLAG() IF(DEAL_II_WRETURN_TYPE_CONST_QUALIFIER_BUG) - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS -Wno-return-type) + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-return-type) ENDIF() @@ -59,7 +59,7 @@ ENDIF() # IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION MATCHES "4.4.") - STRIP_FLAG(CMAKE_CXX_FLAGS "-pedantic") + STRIP_FLAG(DEAL_II_CXX_FLAGS "-pedantic") ENDIF() @@ -253,7 +253,7 @@ CHECK_CXX_COMPILER_BUG( DEAL_II_TYPE_QUALIFIER_BUG) IF(DEAL_II_TYPE_QUALIFIER_BUG) - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS -Wno-ignored-qualifiers) + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-ignored-qualifiers) ENDIF() @@ -344,7 +344,7 @@ IF( DEAL_II_ICC_NUMERICLIMITS_BUG OR MESSAGE(STATUS "Intel C++11 bug found, disabling C++11 support" ) - STRIP_FLAG(CMAKE_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") + STRIP_FLAG(DEAL_II_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") SET(DEAL_II_CAN_USE_CXX1X FALSE) SET(DEAL_II_USE_CXX11 FALSE) ENDIF() @@ -402,7 +402,7 @@ IF(DEAL_II_MAC_OSX_C99_BUG) MESSAGE(STATUS "Mac OS-X C99 bug found, disabling C++11 support" ) - STRIP_FLAG(CMAKE_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") + STRIP_FLAG(DEAL_II_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") SET(DEAL_II_CAN_USE_CXX1X FALSE) SET(DEAL_II_USE_CXX11 FALSE) ENDIF() diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index e499bafbee..987df97bf9 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -74,11 +74,11 @@ INSTALL(FILES # for installation: ######################################################################## # -# Strip -Wno-deprecated from CMAKE_CXX_FLAGS so that deprecation warnings +# Strip -Wno-deprecated from DEAL_II_CXX_FLAGS so that deprecation warnings # are actually shown for user code: # -STRIP_FLAG(CMAKE_CXX_FLAGS "-Wno-deprecated") -STRIP_FLAG(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-Wno-deprecated") +STRIP_FLAG(DEAL_II_CXX_FLAGS "-Wno-deprecated-declarations") # # Populate a bunch of CONFIG_* variables with useful information: @@ -317,7 +317,7 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # Set up our linker flags: # SET(MAKEFILE_LDFLAGS_${build} - "${CMAKE_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}} ${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}" + "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}} ${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}" ) ENDFOREACH() diff --git a/deal.II/cmake/config/Config.cmake.in b/deal.II/cmake/config/Config.cmake.in index 153fb13f9e..a3e6fbcdcb 100644 --- a/deal.II/cmake/config/Config.cmake.in +++ b/deal.II/cmake/config/Config.cmake.in @@ -109,7 +109,7 @@ ENDFOREACH() SET(DEAL_II_CXX_COMPILER "@CMAKE_CXX_COMPILER@") # used for all targets: -SET(DEAL_II_CXX_FLAGS "@CMAKE_CXX_FLAGS@") +SET(DEAL_II_CXX_FLAGS "@DEAL_II_CXX_FLAGS@") # _additionally_ used for debug targets: SET(DEAL_II_CXX_FLAGS_DEBUG "@DEAL_II_CXX_FLAGS_DEBUG@") diff --git a/deal.II/cmake/config/Make.global_options.in b/deal.II/cmake/config/Make.global_options.in index 832a9237b1..a5f35b00d7 100644 --- a/deal.II/cmake/config/Make.global_options.in +++ b/deal.II/cmake/config/Make.global_options.in @@ -87,8 +87,8 @@ INCLUDE = @MAKEFILE_INCLUDE_DIRS@ # compiler flags for debug and optimized mode -CXXFLAGS.g = @CMAKE_CXX_FLAGS@ @DEAL_II_CXX_FLAGS_DEBUG@ @MAKEFILE_DEFINITIONS@ @MAKEFILE_DEFINITIONS_DEBUG@ $(INCLUDE) -CXXFLAGS.o = @CMAKE_CXX_FLAGS@ @DEAL_II_CXX_FLAGS_RELEASE@ @MAKEFILE_DEFINITIONS@ @MAKEFILE_DEFINITIONS_RELEASE@ $(INCLUDE) +CXXFLAGS.g = @DEAL_II_CXX_FLAGS@ @DEAL_II_CXX_FLAGS_DEBUG@ @MAKEFILE_DEFINITIONS@ @MAKEFILE_DEFINITIONS_DEBUG@ $(INCLUDE) +CXXFLAGS.o = @DEAL_II_CXX_FLAGS@ @DEAL_II_CXX_FLAGS_RELEASE@ @MAKEFILE_DEFINITIONS@ @MAKEFILE_DEFINITIONS_RELEASE@ $(INCLUDE) ifeq ($(enable-threads),yes) MT = MT diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index fb4cce0676..182f7d3bc8 100644 --- a/deal.II/cmake/configure/configure_1_threads.cmake +++ b/deal.II/cmake/configure/configure_1_threads.cmake @@ -185,8 +185,8 @@ MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED) # # We have to disable a bunch of warnings: # - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-parentheses") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-parentheses") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-long-long") # # Add some definitions to use the header files in debug mode: diff --git a/deal.II/cmake/configure/configure_2_trilinos.cmake b/deal.II/cmake/configure/configure_2_trilinos.cmake index 0060efb50b..d76b3cbf20 100644 --- a/deal.II/cmake/configure/configure_2_trilinos.cmake +++ b/deal.II/cmake/configure/configure_2_trilinos.cmake @@ -208,9 +208,9 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL) # # Disable a bunch of warnings caused by Trilinos headers: # - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-extra") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-overloaded-virtual") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-unused") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-extra") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-overloaded-virtual") ENDMACRO() diff --git a/deal.II/cmake/configure/configure_3_petsc.cmake b/deal.II/cmake/configure/configure_3_petsc.cmake index 3627e7c49c..6ed8f62c24 100644 --- a/deal.II/cmake/configure/configure_3_petsc.cmake +++ b/deal.II/cmake/configure/configure_3_petsc.cmake @@ -120,7 +120,7 @@ MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL) # # Disable a bunch of warnings when compiling with petsc: # - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-long-long") SET(DEAL_II_EXPAND_PETSC_VECTOR "PETScWrappers::Vector") SET(DEAL_II_EXPAND_PETSC_BLOCKVECTOR "PETScWrappers::BlockVector") diff --git a/deal.II/cmake/macros/macro_deal_ii_add_library.cmake b/deal.II/cmake/macros/macro_deal_ii_add_library.cmake index 26c7ee3b81..8efacf6dfe 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_library.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_add_library.cmake @@ -25,7 +25,7 @@ # # as well as the global (for all build types) # DEAL_II_LINKER_FLAGS -# CMAKE_CXX_FLAGS +# DEAL_II_CXX_FLAGS # DEAL_II_DEFINITIONS # @@ -41,7 +41,7 @@ MACRO(DEAL_II_ADD_LIBRARY _library) SET_TARGET_PROPERTIES(${_library}.${_build_lowercase} PROPERTIES LINK_FLAGS "${DEAL_II_LINKER_FLAGS};${DEAL_II_LINKER_FLAGS_${_build}}" COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" - COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" + COMPILE_FLAGS "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}" LINKER_LANGUAGE "CXX" ) diff --git a/deal.II/cmake/macros/macro_deal_ii_insource_setup_target.cmake b/deal.II/cmake/macros/macro_deal_ii_insource_setup_target.cmake index daa070b2ae..1d04685c1a 100644 --- a/deal.II/cmake/macros/macro_deal_ii_insource_setup_target.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_insource_setup_target.cmake @@ -30,7 +30,7 @@ MACRO(DEAL_II_INSOURCE_SETUP_TARGET _target _build) SET_TARGET_PROPERTIES(${_target} PROPERTIES LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}" COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" - COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" + COMPILE_FLAGS "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}" LINKER_LANGUAGE "CXX" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_test_short}" ) diff --git a/deal.II/cmake/macros/macro_register_feature.cmake b/deal.II/cmake/macros/macro_register_feature.cmake index 4184a22c27..22dffc44de 100644 --- a/deal.II/cmake/macros/macro_register_feature.cmake +++ b/deal.II/cmake/macros/macro_register_feature.cmake @@ -31,7 +31,7 @@ # DEAL_II_LINKER_FLAGS # # - add ${feature}_CXX_FLAGS and ${feature}_COMPILE_FLAGS to -# CMAKE_CXX_FLAGS +# DEAL_II_CXX_FLAGS # # - add ${feature}_LIBRARIES to the list of deal.II libraries depending # on general, optimized or debug keyword @@ -59,7 +59,7 @@ MACRO(REGISTER_FEATURE _feature) # variables for compiler flags: FOREACH(_var ${_feature}_CXX_FLAGS ${_feature}_COMPILE_FLAGS) IF(DEFINED ${_var}) - ADD_FLAGS(CMAKE_CXX_FLAGS "${${_var}}") + ADD_FLAGS(DEAL_II_CXX_FLAGS "${${_var}}") ENDIF() ENDFOREACH() diff --git a/deal.II/cmake/macros/macro_reset_cmake_required.cmake b/deal.II/cmake/macros/macro_reset_cmake_required.cmake index 0f2865a3d7..53a4818786 100644 --- a/deal.II/cmake/macros/macro_reset_cmake_required.cmake +++ b/deal.II/cmake/macros/macro_reset_cmake_required.cmake @@ -23,7 +23,7 @@ # MACRO(RESET_CMAKE_REQUIRED) - SET(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS_SAVED}) + SET(CMAKE_REQUIRED_FLAGS ${DEAL_II_CXX_FLAGS_SAVED}) SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_LIBRARIES) ENDMACRO() diff --git a/deal.II/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake index 6302955d10..1d01960866 100644 --- a/deal.II/cmake/setup_cached_variables.cmake +++ b/deal.II/cmake/setup_cached_variables.cmake @@ -40,12 +40,13 @@ # DEAL_II_PREFER_STATIC_LIBS # DEAL_II_STATIC_EXECUTABLE # CMAKE_INSTALL_RPATH_USE_LINK_PATH -# CMAKE_CXX_FLAGS *) -# DEAL_II_LINKER_FLAGS *) +# DEAL_II_CXX_FLAGS *) # DEAL_II_CXX_FLAGS_DEBUG -# DEAL_II_LINKER_FLAGS_DEBUG # DEAL_II_CXX_FLAGS_RELEASE +# DEAL_II_LINKER_FLAGS *) +# DEAL_II_LINKER_FLAGS_DEBUG # DEAL_II_LINKER_FLAGS_RELEASE +# # DEAL_II_WITH_64BIT_INDICES # # *) May also be set via environment variable (CXXFLAGS, LDFLAGS) @@ -53,6 +54,9 @@ # overwritten by environment) # +MESSAGE(STATUS "") +MESSAGE(STATUS "Set up cached variables.") + ######################################################################## # # @@ -105,6 +109,7 @@ OPTION(DEAL_II_FORCE_AUTODETECTION ) + ######################################################################## # # # Compilation and linking: # @@ -114,16 +119,15 @@ OPTION(DEAL_II_FORCE_AUTODETECTION # # Setup CMAKE_BUILD_TYPE: # + SET(CMAKE_BUILD_TYPE "DebugRelease" CACHE STRING "Choose the type of build, options are: Debug, Release and DebugRelease." ) -# # This is cruel, I know. But it is better to only have a known number of # options for CMAKE_BUILD_TYPE... -# IF( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease" ) @@ -132,6 +136,9 @@ IF( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND ) ENDIF() +# +# Configuration behaviour: +# OPTION(DEAL_II_ALLOW_PLATFORM_INTROSPECTION "Allow platform introspection for CPU command sets, SSE and AVX" @@ -178,11 +185,6 @@ IF(DEAL_II_STATIC_EXECUTABLE) ) ENDIF() - -# -# Set CMAKE_INSTALL_RPATH_USE_LINK_PATH to default to ON and promote to -# cache so that the user can see the value. -# SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH "ON" CACHE BOOL "Set the rpath of the library to the external link pathes on installation" ) @@ -190,47 +192,43 @@ MARK_AS_ADVANCED(CMAKE_INSTALL_RPATH_USE_LINK_PATH) # -# Define the variable that defines whether we should use 32- or 64-bit -# global DoF indices. +# Translate CMake specific variables to deal.II naming: # -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 - ) - -# -# Tell the user very prominently, that we're doing things differently w.r.t -# CMAKE_(C|CXX)_FLAGS_(DEBUG|RELEASE) -# -FOREACH(_flag - CXX_FLAGS_RELEASE - CXX_FLAGS_DEBUG - SHARED_LINKER_FLAGS_RELEASE - SHARED_LINKER_FLAGS_DEBUG - ) +FOREACH(_flag CXX_FLAGS CXX_FLAGS_RELEASE CXX_FLAGS_DEBUG) IF(NOT "${CMAKE_${_flag}}" STREQUAL "") - UNSET(${CMAKE_${_flag}} CACHE) - MESSAGE(FATAL_ERROR - "\nThe deal.II cmake build system does not use CMAKE_${_flag}.\n" - "Use DEAL_II_${_flag}, instead!\n\n" + MESSAGE(STATUS + "Prepending \${CMAKE_${_flag}} to \${DEAL_II_${_flag}}" ) + SET(DEAL_II_${_flag} "${CMAKE_${_flag}} ${DEAL_II_${_flag}}") ENDIF() ENDFOREACH() +FOREACH(_flag LINKER_FLAGS LINKER_FLAGS_DEBUG LINKER_FLAGS_RELEASE) + IF(NOT "${CMAKE_SHARED_${_flag}}" STREQUAL "") + MESSAGE(STATUS + "Prepending \${CMAKE_SHARED_${_flag}} to \${DEAL_II_${_flag}}" + ) + SET(DEAL_II_${_flag} "${CMAKE_${_flag}} ${DEAL_II_${_flag}}") + ENDIF() +ENDFOREACH() # -# Hide all unused compiler flag variables: +# Hide all unused CMake variables: # -FOREACH(_flag + +SET(DEAL_II_REMOVED_FLAGS + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_RELEASE CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_MINSIZEREL @@ -241,44 +239,60 @@ FOREACH(_flag CMAKE_SHARED_LINKER_FLAGS_RELEASE CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ) +FOREACH(_flag ${DEAL_II_REMOVED_FLAGS}) # Go away... - SET(${_flag} "" CACHE INTERNAL "" FORCE) + SET(${_flag} ${${_flag}} CACHE INTERNAL "" FORCE) + # Also set it to an empty string for the configuration run so that it + # does not confuse the build system (to unset is not an option - it is + # cached...) + SET(${_flag} "") ENDFOREACH() - # -# Set cached compiler flags to an empty string: +# Promote our configuration variables to cache: # + SET(DEAL_II_USED_FLAGS - CMAKE_CXX_FLAGS + DEAL_II_CXX_FLAGS DEAL_II_CXX_FLAGS_DEBUG DEAL_II_CXX_FLAGS_RELEASE DEAL_II_LINKER_FLAGS DEAL_II_LINKER_FLAGS_DEBUG DEAL_II_LINKER_FLAGS_RELEASE ) - FOREACH(_flag ${DEAL_II_USED_FLAGS}) # # Promote to cache: # SET(${_flag} "${${_flag}}" CACHE STRING - "The user supplied cache variable will be appended _at the end_ of the auto generated ${_flag} variable" - ) + "The user supplied cache variable will be appended _at the end_ of the configuration step to the auto generated ${_flag} variable" + ) + MARK_AS_ADVANCED(${_flag}) # - # Save the initial (cached) variable at this point and clear it. - # ${flags}_SAVED will be appended to ${flags} in - # setup_finalize.cmake (called at the end of the - # main CMakeLists.txt file). + # The order of compiler and linker flags is important. In order to + # provide an override mechanism we have to save the initial (cached) + # variable at this point and clear it. + # ${flags}_SAVED will be appended to ${flags} again in + # setup_finalize.cmake (called at the end of the main CMakeLists.txt + # file). # - SET(${_flag}_SAVED "${${_flag}}") - SET(${_flag} "") + SET(${_flag}_SAVED ${${_flag}}) + SET(${_flag}) +ENDFOREACH() +FOREACH(_variable + DEAL_II_DEFINITIONS + DEAL_II_DEFINITIONS_DEBUG + DEAL_II_DEFINITIONS_RELEASE + ) # - # Mark these flags as advanced. + # Promote to cache: # - MARK_AS_ADVANCED(${_flag}) + SET(${_variable} ${${_variable}} CACHE STRING + "Additional, user supplied compile definitions" + ) + MARK_AS_ADVANCED(${_variable}) ENDFOREACH() @@ -286,22 +300,28 @@ ENDFOREACH() # Finally, read in CXXFLAGS and LDFLAGS from environment and prepend them # to the saved variables: # + SET(CMAKE_CXX_FLAGS_SAVED "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_SAVED}") SET(DEAL_II_LINKER_FLAGS_SAVED "$ENV{LDFLAGS} ${DEAL_II_LINKER_FLAGS_SAVED}") UNSET(ENV{CXXFLAGS}) UNSET(ENV{LDFLAGS}) + + +######################################################################## +# # +# Components: # +# # +######################################################################## + # -# Also respect DEAL_II_CXX_FLAGS - it just too easy to accientally write -# DEAL_II_CXX_FLAGS instead of CMAKE_CXX_FLAGS... (this was a poor design -# choice, I know...) +# Configuration option for the 64 bit indices component: # -IF(NOT "${DEAL_II_CXX_FLAGS}" STREQUAL "") - MESSAGE(STATUS - "Appending \${DEAL_II_CXX_FLAGS} to saved \${CMAKE_CXX_FLAGS}" - ) - SET(CMAKE_CXX_FLAGS_SAVED "${CMAKE_CXX_FLAGS_SAVED} ${DEAL_II_CXX_FLAGS}") -ENDIF() + +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 + ) @@ -328,6 +348,9 @@ if this is what you tried to do.) ) ENDIF() +# +# Miscellaneous renaming: +# GET_CMAKE_PROPERTY(_res VARIABLES) FOREACH(_var ${_res}) diff --git a/deal.II/cmake/setup_compiler_flags.cmake b/deal.II/cmake/setup_compiler_flags.cmake index 879926d1b2..1caeff34e9 100644 --- a/deal.II/cmake/setup_compiler_flags.cmake +++ b/deal.II/cmake/setup_compiler_flags.cmake @@ -27,7 +27,7 @@ # All configuration in setup_compiler_flags.cmake and # setup_compiler_flags_.cmake shall ONLY modify: # -# CMAKE_CXX_FLAGS +# DEAL_II_CXX_FLAGS # DEAL_II_CXX_FLAGS_DEBUG # DEAL_II_CXX_FLAGS_RELEASE # DEAL_II_LINKER_FLAGS @@ -37,7 +37,7 @@ # All modifications shall be guarded with the ENABLE_IF_SUPPORTED # or ENABLE_IF_LINKS macro, e.g. # -# ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") +# ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-fpic") # ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed") # # Checks for compiler features (such as C++11 support) and compiler @@ -66,12 +66,12 @@ # Check the user provided CXX flags: # -MESSAGE(STATUS "") -IF(NOT "${CMAKE_CXX_FLAGS_SAVED}" STREQUAL "${CACHED_CMAKE_CXX_FLAGS_SAVED}") +IF(NOT "${DEAL_II_CXX_FLAGS_SAVED}" STREQUAL "${CACHED_DEAL_II_CXX_FLAGS_SAVED}") + MESSAGE(STATUS "") # Rerun this test if cxx flags changed: UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE) ENDIF() -SET(CACHED_CMAKE_CXX_FLAGS_SAVED "${CMAKE_CXX_FLAGS_SAVED}" CACHE INTERNAL "" FORCE) +SET(CACHED_DEAL_II_CXX_FLAGS_SAVED "${DEAL_II_CXX_FLAGS_SAVED}" CACHE INTERNAL "" FORCE) # Initialize all CMAKE_REQUIRED_* variables a this point: RESET_CMAKE_REQUIRED() @@ -84,8 +84,8 @@ IF(NOT DEAL_II_HAVE_USABLE_CXX_FLAGS) UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE) MESSAGE(FATAL_ERROR "\n" "Configuration error: Cannot compile with the user supplied CXX flags:\n" - "${CMAKE_CXX_FLAGS_SAVED}\n" - "Please check the CMake variable CMAKE_CXX_FLAGS and the\n" + "${DEAL_II_CXX_FLAGS_SAVED}\n" + "Please check the CMake variable DEAL_II_CXX_FLAGS and the\n" "environment variable CXXFLAGS\n\n" ) ENDIF() diff --git a/deal.II/cmake/setup_compiler_flags_gnu.cmake b/deal.II/cmake/setup_compiler_flags_gnu.cmake index 177473121c..e0607ae195 100644 --- a/deal.II/cmake/setup_compiler_flags_gnu.cmake +++ b/deal.II/cmake/setup_compiler_flags_gnu.cmake @@ -41,13 +41,13 @@ ENDIF() # IF(NOT (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.4")) - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-pedantic") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-pedantic") ENDIF() # # Set the pic flag. # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-fpic") # # Check whether the -as-needed flag is available. If so set it to link @@ -58,12 +58,12 @@ ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed") # # Setup various warnings: # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wall") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wpointer-arith") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wwrite-strings") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wsynth") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wsign-compare") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wswitch") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wall") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wpointer-arith") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wwrite-strings") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wsynth") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wsign-compare") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wswitch") # # Newer versions of gcc have a flag -Wunused-local-typedefs that, though in @@ -71,26 +71,26 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wswitch") # Unfortunately, this warning is included in -W/-Wall, so disable it if the # compiler supports it. # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused-local-typedefs") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-unused-local-typedefs") # # Disable Wlong-long that will trigger a lot of warnings when compiling # with disabled C++11 support: # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-long-long") # # Disable deprecation warnings # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-deprecated") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-deprecated") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-deprecated-declarations") IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # # Silence Clang warnings about unused parameters: # - SET(CMAKE_CXX_FLAGS "-Qunused-arguments ${CMAKE_CXX_FLAGS}") + SET(DEAL_II_CXX_FLAGS "-Qunused-arguments ${DEAL_II_CXX_FLAGS}") # # *Boy*, clang seems to be the very definition of "pedantic" in @@ -98,13 +98,13 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # (that are mainly triggered in third party headers so that we cannot # easily fix them...) # - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-dangling-else") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-delete-non-virtual-dtor") # not harmless but needed for boost <1.50.0 - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-newline-eof") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused-function") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused-private-field") - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused-variable") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-dangling-else") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-delete-non-virtual-dtor") # not harmless but needed for boost <1.50.0 + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-long-long") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-newline-eof") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-unused-function") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-unused-private-field") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-unused-variable") ENDIF() diff --git a/deal.II/cmake/setup_compiler_flags_intel.cmake b/deal.II/cmake/setup_compiler_flags_intel.cmake index d29abc6537..d3357cb8c5 100644 --- a/deal.II/cmake/setup_compiler_flags_intel.cmake +++ b/deal.II/cmake/setup_compiler_flags_intel.cmake @@ -38,7 +38,7 @@ ENDIF() # # Set the pic flag. # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-fpic") # # Check whether the -as-needed flag is available. If so set it to link @@ -49,12 +49,12 @@ ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed") # # Set ansi mode: # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-ansi") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-ansi") # # Enable verbose warnings: # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-w2") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-w2") # # Disable some warnings that lead to a lot of false positives: @@ -85,18 +85,18 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-w2") # -w1572 floating-point equality and inequality comparisons are unreliable # -w2536 type qualifiers are meaningless here # -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd68") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd135") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd175") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd177") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd279") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd327") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd383") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd981") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd1418") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd1478") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd1572") -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd2536") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd68") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd135") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd175") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd177") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd279") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd327") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd383") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd981") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd1418") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd1478") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd1572") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd2536") IF(DEAL_II_STATIC_EXECUTABLE) diff --git a/deal.II/cmake/setup_compiler_flags_msvc.cmake b/deal.II/cmake/setup_compiler_flags_msvc.cmake index 6aeaceb16d..7529844b4b 100644 --- a/deal.II/cmake/setup_compiler_flags_msvc.cmake +++ b/deal.II/cmake/setup_compiler_flags_msvc.cmake @@ -37,13 +37,13 @@ ######################## # enable exception handling: -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "/EHsc") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/EHsc") #enable warnings: -ADD_FLAGS(CMAKE_CXX_FLAGS "/W3") +ADD_FLAGS(DEAL_II_CXX_FLAGS "/W3") # Globally disable some legacy min and max macros that cause problems: -ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "/NOMINMAX") +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "/NOMINMAX") ############################# # # diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index 45ed9f36a5..3221dca03d 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -36,6 +36,21 @@ FOREACH(_flags ${DEAL_II_USED_FLAGS}) STRING(STRIP "${${_flags}} ${${_flags}_SAVED}" ${_flags}) ENDFOREACH() +# +# Sanity check: The variables defined in DEAL_II_REMOVED_FLAGS must not be +# used during the comfiguration stage: +# +FOREACH(_flag ${DEAL_II_REMOVED_FLAGS}) + IF(NOT "${_flag}" STREQUAL "") + MESSAGE(FATAL_ERROR + "\nInternal configuration error: The variable ${_flag} was set to a " + "non empty value during the configuration! (The corresponding " + "DEAL_II_* variable should have been used.)\n" + "${_flag}=\"${${_flag}}\"\n" + ) + ENDIF() +ENDFOREACH() + # # Deduplicate entries in DEAL_II_USER_INCLUDE_DIRS # @@ -149,7 +164,7 @@ _both("#\n") _detailed( "# Compiler flags used for this build: -# CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS} +# DEAL_II_CXX_FLAGS: ${DEAL_II_CXX_FLAGS} " ) IF(CMAKE_BUILD_TYPE MATCHES "Release") @@ -158,6 +173,7 @@ ENDIF() IF(CMAKE_BUILD_TYPE MATCHES "Debug") _detailed("# DEAL_II_CXX_FLAGS_DEBUG: ${DEAL_II_CXX_FLAGS_DEBUG}\n") ENDIF() + _detailed("# DEAL_II_LINKER_FLAGS: ${DEAL_II_LINKER_FLAGS}\n") IF(CMAKE_BUILD_TYPE MATCHES "Release") _detailed("# DEAL_II_LINKER_FLAGS_RELEASE: ${DEAL_II_LINKER_FLAGS_RELEASE}\n") @@ -165,6 +181,15 @@ ENDIF() IF(CMAKE_BUILD_TYPE MATCHES "Debug") _detailed("# DEAL_II_LINKER_FLAGS_DEBUG: ${DEAL_II_LINKER_FLAGS_DEBUG}\n") ENDIF() + +_detailed("# DEAL_II_DEFINITIONS: ${DEAL_II_DEFINITIONS}\n") +IF(CMAKE_BUILD_TYPE MATCHES "Release") + _detailed("# DEAL_II_DEFINITIONS_RELEASE: ${DEAL_II_DEFINITIONS_RELEASE}\n") +ENDIF() +IF(CMAKE_BUILD_TYPE MATCHES "Debug") + _detailed("# DEAL_II_DEFINITIONS_DEBUG: ${DEAL_II_DEFINITIONS_DEBUG}\n") +ENDIF() + _detailed("#\n") IF(NOT DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) diff --git a/deal.II/doc/developers/cmake-internals.html b/deal.II/doc/developers/cmake-internals.html index e500d2c9ac..aea4a22765 100644 --- a/deal.II/doc/developers/cmake-internals.html +++ b/deal.II/doc/developers/cmake-internals.html @@ -170,7 +170,7 @@ SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} # All configuration in setup_compiler_flags.cmake and # setup_compiler_flags_.cmake shall ONLY modify: # -# CMAKE_CXX_FLAGS +# DEAL_II_CXX_FLAGS # DEAL_II_CXX_FLAGS_DEBUG # DEAL_II_CXX_FLAGS_RELEASE # DEAL_II_LINKER_FLAGS @@ -180,7 +180,7 @@ SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} # All modifications shall be guarded with the ENABLE_IF_SUPPORTED # or ENABLE_IF_LINKS macro, e.g. # -# ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") +# 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 @@ -188,7 +188,7 @@ SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} # DEAL_II_ALLOW_PLATFORM_INTROSPECTION: # # IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) -# ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-march=native") +# ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-march=native") # ENDIF() # # Checks for compiler features (such as C++11 support) and compiler @@ -514,7 +514,7 @@ DEAL_II_FORCE_BUNDLED_<FEATURE> (an option) For internal use, for setting necessary compiler flags, e.g. -std=c++11 (if available):
    -
  • CMAKE_CXX_FLAGS +
  • DEAL_II_CXX_FLAGS
  • DEAL_II_CXX_FLAGS_DEBUG
  • DEAL_II_CXX_FLAGS_RELEASE
diff --git a/deal.II/doc/developers/porting.html b/deal.II/doc/developers/porting.html index 27fbdd8bb9..1c51a8872b 100644 --- a/deal.II/doc/developers/porting.html +++ b/deal.II/doc/developers/porting.html @@ -41,7 +41,7 @@ -DDEAL_II_SETUP_DEFAULT_COMPILER_FLAGS=OFF and set all necessary compiler flags by hand via
-CMAKE_CXX_FLAGS           - used during all builds
+DEAL_II_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
 
diff --git a/deal.II/doc/users/Config.sample b/deal.II/doc/users/Config.sample index 26faa6c15b..075bfe22eb 100644 --- a/deal.II/doc/users/Config.sample +++ b/deal.II/doc/users/Config.sample @@ -91,7 +91,7 @@ # "Fortran Compiler." # ) # -# SET(CMAKE_CXX_FLAGS "" CACHE STRING +# SET(DEAL_II_CXX_FLAGS "" CACHE STRING # "The user supplied cache variable will be appended _at the end_ of the auto generated CMAKE_CXX_FLAGS variable" # ) # @@ -115,6 +115,18 @@ # "The user supplied cache variable will be appended _at the end_ of the auto generated DEAL_II_LINKER_FLAGS_RELEASE variable" # ) # +# SET(DEAL_II_DEFINITIONS "" CACHE STRING +# "Additional, user supplied compile definitions" +# ) +# +# SET(DEAL_II_DEFINITIONS_DEBUG "" CACHE STRING +# "Additional, user supplied compile definitions" +# ) +# +# SET(DEAL_II_DEFINITIONS_RELEASE "" CACHE STRING +# "Additional, user supplied compile definitions" +# ) +# # SET(BUILD_SHARED_LIBS "ON" CACHE BOOL # "Build a shared library" # ) diff --git a/deal.II/doc/users/cmake.html b/deal.II/doc/users/cmake.html index 1f2d695a10..f702d45242 100644 --- a/deal.II/doc/users/cmake.html +++ b/deal.II/doc/users/cmake.html @@ -861,7 +861,7 @@ cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" -DCMAKE_Fortran_C Override the default configuration by setting the following cached variables:
-CMAKE_CXX_FLAGS           - used during all builds
+DEAL_II_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
 
@@ -872,7 +872,7 @@ DEAL_II_CXX_FLAGS_RELEASE - additional flags for the release library -Wsign-compare, set by the build system, can be overwritten by specifying:
-cmake -DCMAKE_CXX_FLAGS="-Wno-sign-compare" <...>
+cmake -DDEAL_II_CXX_FLAGS="-Wno-sign-compare" <...>
 
  • diff --git a/deal.II/doc/users/cmakelists.html b/deal.II/doc/users/cmakelists.html index b1f13d8d7a..19e8aa3201 100644 --- a/deal.II/doc/users/cmakelists.html +++ b/deal.II/doc/users/cmakelists.html @@ -483,9 +483,9 @@ installation.

    Furthermore, this macro sets the C++ compiler and the compile flags to default values (the same values that were used to compile deal.II itself). -These are CMAKE_CXX_COMPILER and CMAKE_CXX_FLAGS, +These are CMAKE_CXX_COMPILER and DEAL_II_CXX_FLAGS, as well as - depending on the configuration - -DEAL_II_FLAGS_DEBUG, or DEAL_II_FLAGS_RELEASE, or +DEAL_II_CXX_FLAGS_DEBUG, or DEAL_II_CXX_FLAGS_RELEASE, or both.

    -- 2.39.5