]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a rudimentary C/CXX-Flags configuration
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Sep 2012 15:36:42 +0000 (15:36 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Sep 2012 15:36:42 +0000 (15:36 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26475 0785d39b-7218-0410-832d-ea1e28bc413d

16 files changed:
deal.II/CMakeLists.txt
deal.II/contrib/cmake/check/check_for_compiler_bugs.cmake
deal.II/contrib/cmake/check/check_for_compiler_features.cmake
deal.II/contrib/cmake/check/check_for_cxx_features.cmake
deal.II/contrib/cmake/configure/configure_1_mpi.cmake
deal.II/contrib/cmake/configure/configure_1_tbb.cmake
deal.II/contrib/cmake/configure/configure_blas.cmake
deal.II/contrib/cmake/configure/configure_boost.cmake
deal.II/contrib/cmake/configure/configure_lapack.cmake
deal.II/contrib/cmake/configure/configure_trilinos.cmake
deal.II/contrib/cmake/macros/macro_add_flags.cmake [new file with mode: 0644]
deal.II/contrib/cmake/macros/macro_enable_if_available.cmake [new file with mode: 0644]
deal.II/contrib/cmake/setup_cached_compiler_flags.cmake [new file with mode: 0644]
deal.II/contrib/cmake/setup_cached_variables.cmake [deleted file]
deal.II/contrib/cmake/setup_compiler_flags.cmake [new file with mode: 0644]
deal.II/contrib/cmake/setup_finalize.cmake [new file with mode: 0644]

index 238ef5bc965393a82a99a865daa800d34a0318f2..1a77fbf04afe76a141063cb9e4d68956455e07b8 100644 (file)
@@ -93,7 +93,7 @@ OPTION(DEAL_II_ALLOW_CONTRIB
   packages, so to ensure that only external libraries are used
   DEAL_II_ALLOW_CONTRIB as well as all DEAL_II_FORCE_CONTRIB_* have to be
   OFF"
-  OFF)
+  ON)
 
 OPTION(DEAL_II_WITH_ARPACK
   "Build deal.II with support for ARPACK."
@@ -101,18 +101,18 @@ OPTION(DEAL_II_WITH_ARPACK
 
 OPTION(DEAL_II_WITH_BLAS
   "Build deal.II with support for BLAS."
-  OFF)
+  ON)
 
 OPTION(DEAL_II_WITH_FUNCTIONPARSER
   "Build deal.II with support for functionparser."
-  OFF)
+  ON)
 OPTION(DEAL_II_FORCE_CONTRIB_FUNCTIONPARSER
   "Always use the bundled functionparser library instead of an external one."
-  OFF)
+  ON)
 
 OPTION(DEAL_II_WITH_LAPACK
   "Build deal.II with support for LAPACK."
-  OFF)
+  ON)
 
 OPTION(DEAL_II_WITH_METIS
   "Build deal.II with support for Metis."
@@ -132,10 +132,10 @@ OPTION(DEAL_II_WITH_P4EST
 
 OPTION(DEAL_II_WITH_TBB
   "Build deal.II with support for tbb. This will enable thread support in deal.II."
-  OFF)
+  ON)
 OPTION(DEAL_II_FORCE_CONTRIB_TBB
   "Always use the bundled tbb library instead of an external one."
-  OFF)
+  ON)
 
 OPTION(DEAL_II_WITH_TRILINOS
   "Build deal.II with support for trilinos."
@@ -154,7 +154,7 @@ OPTION(DEAL_II_WITH_ZLIB
 
 OPTION(DEAL_II_FORCE_CONTRIB_BOOST
   "Always use the bundled boost library instead of an external one."
-  OFF)
+  ON)
 
 
 
@@ -197,14 +197,17 @@ INCLUDE(setup_external_macros)
 # configure the cached, user editable CMAKE_BUILD_TYPES, CMAKE_CXX_FLAGS,
 # etc. variables at this point:
 #
-INCLUDE(setup_cached_variables)
+INCLUDE(setup_cached_compiler_flags)
 
 #
-# Now, set the project and configure some deal_II specific variables:
+# Now, set the project and setup the rest:
 #
 PROJECT(deal.II)
+
 INCLUDE(setup_deal_ii)
 
+INCLUDE(setup_compiler_flags)
+
 
 #
 #   ####################
@@ -219,11 +222,9 @@ INCLUDE(setup_deal_ii)
 #
 #   for setting necessary linker flags for the deal.II library.
 #
-# CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (uncached)
+# CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (<...>_RELEASE, <...>_DEBUG)
 #
 #   for setting necessary compiler flags, e.g. -std=c++11 (if available).
-#   Note: Uncached variables are not visible to the user, and cannot be
-#   altered.
 #
 ADD_CUSTOM_TARGET(deal_ii_target_dependencies)
 #
@@ -262,6 +263,12 @@ FOREACH(file ${configure_files})
 ENDFOREACH()
 
 
+#
+# Finalize the configuration:
+#
+INCLUDE(setup_finalize)
+
+
 
 
 ###########################################################################
@@ -297,10 +304,3 @@ ADD_SUBDIRECTORY(include)
 
 ADD_SUBDIRECTORY(source)
 
-MESSAGE(STATUS "Configured features:")
-GET_CMAKE_PROPERTY(res VARIABLES)
-FOREACH(var ${res})
-  IF(var MATCHES "DEAL_II_WITH")
-    MESSAGE(STATUS "${var} : ${${var}}")
-  ENDIF()
-ENDFOREACH()
index ca7fae17c19d18572c2b61277733efa950b97d07..a5ebe270d2c5c3482372243df59a79dffee7349a 100644 (file)
@@ -77,3 +77,30 @@ CHECK_CXX_COMPILER_BUG(
   int main() { return 0; }
   "
   DEAL_II_EXPLICIT_DESTRUCTOR_BUG)
+
+
+#
+# TODO:
+# On Cygwin, when using shared libraries, there might occur
+# difficulties when linking libraries for several dimensions,
+# as some symbols are defined in all of them. This leads to a
+# linker error. We force the linker to ignore multiple symbols,
+# but of course this might lead to strange program behaviour if
+# you accidentally defined one symbol multiple times...
+# (added 2005/07/13, Ralf B. Schulz)
+# (modified 2005/12/20, Ralf B. Schulz)
+#
+
+#        CXXFLAGSPIC=
+#        LDFLAGS="$LDFLAGS -Xlinker --allow-multiple-definition"
+#        SHLIBFLAGS="$SHLIBFLAGS -Xlinker --allow-multiple-definition"
+#        ;;
+#
+#      *)
+#        CXXFLAGSPIC="-fPIC"
+#        LDFLAGSPIC="-fPIC"
+#        ;;
+#    esac
+
+
+
index 28d4fc0b907752075bf1588924db2c63552650e4..7145acdd1940ac6fd302fbb7530771c0c644cb93 100644 (file)
@@ -328,22 +328,6 @@ ENDIF()
 
 
 
-#
-# Check whether the -as-needed flag is available. If so set it to compile
-# the deal.II library
-#
-CHECK_CXX_COMPILER_FLAG(
-  "-Wl,-as-needed"
-  DEAL_II_COMPILER_HAS_AS_NEEDED)
-
-IF(DEAL_II_COMPILER_HAS_AS_NEEDED)
-  SET(CMAKE_SHARED_LINKER_FLAGS
-    "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-as-needed"
-    )
-ENDIF()
-
-
-
 #
 # Check for minimal vector capacity
 #
index 7056da90efd835e9f63659316da1eeb43b1f7276..2d365e29df63910362bd5192f98c21b325fdfd3a 100644 (file)
@@ -144,7 +144,7 @@ IF(DEAL_II_HAVE_CXX11_FLAG)
     SET(DEAL_II_CAN_USE_CXX1X TRUE) # TODO
     SET(DEAL_II_CAN_USE_CXX11 TRUE)
 
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") # TODO
+    ADD_FLAGS(CMAKE_CXX_FLAGS "-std=c++0x")
 
   ELSE()
 
index 7007f90fd600be6a7633cb20e80b91ee710b96cd..81f39f5bdf13ee31f2ad5904e0341401b94ef404 100644 (file)
@@ -16,8 +16,8 @@ ENDMACRO()
 MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL var)
 
   INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH})
-  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}")
-  # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MPI_CXX_COMPILE_FLAGS}")
+  ADD_FLAGS(CMAKE_CXX_FLAGS "${MPI_CXX_COMPILE_FLAGS}")
+  ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MPI_CXX_LINK_FLAGS}")
   LIST(APPEND deal_ii_external_libraries ${MPI_CXX_LIBRARIES})
 
   SET(DEAL_II_COMPILER_SUPPORTS_MPI TRUE)
index 64206014f74b730a917ce1a223c60da5c690c437..54c10d8a3425c05d8e8a3c2efd07e61ce6c6af67 100644 (file)
@@ -17,7 +17,7 @@ MACRO(SETUP_THREADING var)
     # We support threading. Go on and configure the rest:
     #
 
-    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
+    ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
 
     SET(DEAL_II_USE_MT TRUE)
 
@@ -130,6 +130,9 @@ MACRO(FEATURE_TBB_CONFIGURE_CONTRIB var)
   # and if successfull return TRUE:
   SETUP_THREADING(${var})
 
+  # We have to disable a bunch of warnings:
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wno-long-long")
+
   INCLUDE_DIRECTORIES(
     ${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/include
     )
@@ -139,6 +142,8 @@ MACRO(FEATURE_TBB_CONFIGURE_CONTRIB var)
   LIST(APPEND deal_ii_additional_object_files
     $<TARGET_OBJECTS:obj_tbb>
     )
+
+
 ENDMACRO()
 
 
index ae48d4cebb87c0e2c3bcf9b42b2a2e73e03b7445..023f19f12cb3803bc7a172d1546944cc708f3897 100644 (file)
@@ -15,9 +15,7 @@ ENDMACRO()
 
 MACRO(FEATURE_BLAS_CONFIGURE_EXTERNAL var)
 
-  SET(CMAKE_SHARED_LINKER_FLAGS
-    "${CMAKE_SHARED_LINKER_FLAGS} ${BLAS_LINKER_FLAGS}"
-    )
+  ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
 
   LIST(APPEND deal_ii_external_libraries
     ${BLAS_LIBRARIES}
index bf119601cd34eb2e98bcca5627082f6ddbdeff72..2f0b29c80c0d29434623a7ae247480c05815d9e9 100644 (file)
@@ -65,6 +65,14 @@ MACRO(FEATURE_BOOST_CONFIGURE_CONTRIB var)
   # library:
   ADD_DEFINITIONS("-DBOOST_NO_HASH" "-DBOOST_NO_SLIST")
 
+  #
+  # Newer versions have a flag -Wunused-local-typedefs that, though in principle
+  # a good idea, triggers a lot in BOOST in various places. Unfortunately,
+  # this warning is included in -W/-Wall, so disable it if the compiler
+  # supports it.
+  #
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wno-unused-local-typedefs")
+
   INCLUDE_DIRECTORIES(
     ${CMAKE_SOURCE_DIR}/contrib/boost-1.49.0/include
     )
index bfe389a6f5d3e43169f5d62eb78900481e09519f..1c7d8830b27399ef76140e193f8224f1a8f0542c 100644 (file)
@@ -15,9 +15,7 @@ ENDMACRO()
 
 MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL var)
 
-  SET(CMAKE_SHARED_LINKER_FLAGS
-    "${CMAKE_SHARED_LINKER_FLAGS} ${LAPACK_LINKER_FLAGS}"
-    )
+  ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
 
   LIST(APPEND deal_ii_external_libraries
     ${LAPACK_LIBRARIES}
index 55f3766c0a70d88e3b1b53078b1249876dd00338..999f7d59b6c3d338262fe8fe4f789f35bc02f01c 100644 (file)
@@ -158,30 +158,10 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL var)
   #  else and we better disable some of the warnings to enable us
   #  to see through the clutter.
   #
-  CHECK_CXX_COMPILER_FLAG(
-    "-Wno-unused"
-    DEAL_II_HAVE_WNO_UNUSED_FLAG
-    )
-  IF(DEAL_II_HAVE_WNO_UNUSED_FLAG)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused")
-  ENDIF()
-
-  CHECK_CXX_COMPILER_FLAG(
-    "-Wno-overloaded-virtual"
-    DEAL_II_HAVE_WNO_OVERLOADED_VIRTUAL_FLAG
-    )
-  IF(DEAL_II_HAVE_WNO_OVERLOADED_VIRTUAL_FLAG)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")
-  ENDIF()
-
-  CHECK_CXX_COMPILER_FLAG(
-    "-Wno-extra"
-    DEAL_II_HAVE_WNO_EXTRA_FLAG
-    )
-  IF(DEAL_II_HAVE_WNO_EXTRA_FLAG)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extra")
-  ENDIF()
 
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wno-unused")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wno-extra")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wno-overloaded-virtual")
 
   SET(${var} TRUE)
 
diff --git a/deal.II/contrib/cmake/macros/macro_add_flags.cmake b/deal.II/contrib/cmake/macros/macro_add_flags.cmake
new file mode 100644 (file)
index 0000000..9fdb657
--- /dev/null
@@ -0,0 +1,3 @@
+MACRO(ADD_FLAGS variable flag)
+  SET(${variable} "${${variable}} ${flag}")
+ENDMACRO()
diff --git a/deal.II/contrib/cmake/macros/macro_enable_if_available.cmake b/deal.II/contrib/cmake/macros/macro_enable_if_available.cmake
new file mode 100644 (file)
index 0000000..b4e444a
--- /dev/null
@@ -0,0 +1,8 @@
+MACRO(ENABLE_IF_AVAILABLE variable flag)
+  CHECK_CXX_COMPILER_FLAG(
+    "${flag}"
+    DEAL_II_HAVE_FLAG_${flag})
+  IF(DEAL_II_HAVE_FLAG_${flag})
+    SET(${variable} "${${variable}} ${flag}")
+  ENDIF()
+ENDMACRO()
diff --git a/deal.II/contrib/cmake/setup_cached_compiler_flags.cmake b/deal.II/contrib/cmake/setup_cached_compiler_flags.cmake
new file mode 100644 (file)
index 0000000..d9df7c9
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# FAT NOTE:
+#
+# We have a problem: We would like to setup our choice of C_FLAGS and
+# CXX_FLAGS but let the user overwrite it (if desired).
+#
+# Unfortunately this is not as easy as it sounds:
+#
+# We have to call PROJECT(deal.II) in order to set up the project and run
+# the C- and CXX-compiler detection and configuration. (Otherwise we cannot
+# compile anything and have no idea which compiler is selected.) In this
+# process CMAKE_{C|CXX}_FLAGS are already set to stupid default values.
+# (And _cannot_ be sanely set from this script afterwards...)
+#
+# To mitigate this problem, we do the following: We set cached
+# CMAKE_{C|CXX}_FLAGS variables with empty strings prior to initializing
+# the compiler, so that no default values are set.
+#
+# The compiler-flag setup in setup_compiler_flags.cmake later adds our
+# (target and platform dependend) default choice of flags.
+#
+# We add the cached variables _to the end_ of this default choice to allow
+# the user to overwrite our choice of compiler flags.
+#
+
+
+#
+# Setup CMAKE_BUILD_TYPE:
+#
+
+SET(CMAKE_BUILD_TYPE
+  "Release"
+  CACHE STRING
+  "Choose the type of build, options are: Debug Release.")
+
+IF( NOT CMAKE_BUILD_TYPE MATCHES "Release" AND
+    NOT CMAKE_BUILD_TYPE MATCHES "Debug" )
+
+  MESSAGE(FATAL_ERROR "CMAKE_BUILD_TYPE does neither match Release, nor Debug.")
+
+ENDIF()
+
+
+#
+# Set cached compiler flags to an empty string:
+#
+
+SET(deal_ii_used_flags
+  CMAKE_C_FLAGS
+  CMAKE_CXX_FLAGS
+  CMAKE_C_FLAGS_RELEASE
+  CMAKE_CXX_FLAGS_RELEASE
+  CMAKE_C_FLAGS_DEBUG
+  CMAKE_CXX_FLAGS_DEBUG
+  )
+
+FOREACH(flags ${deal_ii_used_flags})
+  SET(${flags} "" CACHE STRING
+   "The user supplied cache variable will be appended _at the end_ of the auto generated ${flags} variable"
+   )
+
+ #
+ # Save the cached variable at this point and clear it.
+ # ${flags}_SAVED will be appended to ${flags} in
+ # setup_cached_compiler_flags_finalize.cmake (called at the end of the
+ # main CMakeLists.txt file).
+ #
+ SET(${flags}_SAVED "${${flags}}")
+ SET(${flags} "")
+ENDFOREACH()
diff --git a/deal.II/contrib/cmake/setup_cached_variables.cmake b/deal.II/contrib/cmake/setup_cached_variables.cmake
deleted file mode 100644 (file)
index 67f1047..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# FAT NOTE:
-#
-# We set up the default compiler configuration, i.e. CMAKE_BUILD_TYPE,
-# CMAKE_C_FLAGS, CMAKE_CXX_FLAGS as CACHED variables, so that the user can
-# actually see and change them.
-#
-# Beware of the fact that compiler flags set later in the configuration via
-# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} <...>" are UNCACHED variables.
-#
-# cmake later concatenates cached and uncached variables together. So for a
-# release build we will end up with (more or less) something like the
-# following:
-#
-# $ <compiler>  <cached CMAKE_CXX_FLAGS> <uncached CMAKE_CXX_FLAGS> \
-#      <cached CMAKE_CXX_FLAGS_RELEASE> <uncached CMAKE_CXX_FLAGS_RELEASE>\
-#      <Definitions> <...>     <...>.c     -o <...>.o
-#
-
-
-#
-# Setup CMAKE_BUILD_TYPE:
-#
-
-SET(CMAKE_BUILD_TYPE
-  "Release"
-  CACHE STRING
-  "Choose the type of build, options are: Debug Release.")
-
-IF( NOT CMAKE_BUILD_TYPE MATCHES "Release" AND
-    NOT CMAKE_BUILD_TYPE MATCHES "Debug" )
-
-  MESSAGE(FATAL_ERROR "CMAKE_BUILD_TYPE does neither match Release, nor Debug.")
-
-ENDIF()
-
-
-#
-# Setup default compiler flags:
-#
-
-# TODO: Copy the CFLAGS and CXXFLAGS logic from the former build system
-
-SET(CMAKE_C_FLAGS
-  "-Wfatal-errors -D_REENTRANT -fPIC -O2 -march=native"
-  CACHE STRING
-  "Flags used by the compiler during all build types.")
-
-SET(CMAKE_CXX_FLAGS
-  "-Wfatal-errors -D_REENTRANT -fPIC -O2 -march=native"
-  CACHE STRING
-  "Flags used by the compiler during all build types.")
-
-
-SET(CMAKE_C_FLAGS_RELEASE
-  "-O2"
-  CACHE STRING
-  "Flags used by the compiler during all release builds.")
-SET(CMAKE_CXX_FLAGS_RELEASE
-  "-O2"
-  CACHE STRING
-  "Flags used by the compiler during all release builds.")
-
-
-SET(CMAKE_C_FLAGS_DEBUG
-  "-O0 -ggdb -DDEBUG"
-  CACHE STRING
-  "Flags used by the compiler during all debug builds.")
-SET(CMAKE_CXX_FLAGS_DEBUG
-  "-O0 -ggdb -DDEBUG"
-  CACHE STRING
-  "Flags used by the compiler during all debug builds.")
diff --git a/deal.II/contrib/cmake/setup_compiler_flags.cmake b/deal.II/contrib/cmake/setup_compiler_flags.cmake
new file mode 100644 (file)
index 0000000..c21a02e
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Setup default compiler flags:
+#
+# FAT NOTE:
+#
+# TODO
+#
+
+#
+# TODO: For the moment assume that CC and CXX are the same compilers...
+#
+
+
+
+
+#######################################################
+#                                                     #
+#    General setup for GCC and GCC like compilers:    #
+#                                                     #
+#######################################################
+
+IF( CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
+    CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+
+  ########################
+  #                      #
+  #    General setup:    #
+  #                      #
+  ########################
+
+  #
+  # Set the pic flag.
+  # On some systems, -fpic/PIC is implied, so don't set anything to avoid
+  # a warning. (TODO)
+  #
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-fpic")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-fpic")
+
+  #
+  # Check whether the -as-needed flag is available. If so set it to link
+  # the deal.II library with it.
+  #
+  ENABLE_IF_AVAILABLE(CMAKE_SHARED_LINKER_FLAGS "-Wl,-as-needed")
+
+  #
+  # Set -pedantic if the compiler supports it.
+  # Do not enable -pedantic for gcc-4.4, though...
+  #
+  IF(NOT ( CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION MATCHES "4.4." ))
+    ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-pedantic")
+    ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-pedantic")
+  ENDIF()
+
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wall")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wall")
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wpointer-arith")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wpointer-arith")
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wwrite-strings")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wwrite-strings")
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wsynth")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wsynth")
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wsign-compare")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wsign-compare")
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wswitch")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wswitch")
+
+  #################################
+  #                               #
+  #    For the Release target:    #
+  #                               #
+  #################################
+
+  #
+  # General optimization flags:
+  #
+  ADD_FLAGS(CMAKE_C_FLAGS_RELEASE "-O2")
+  ADD_FLAGS(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS_RELEASE "-funroll-loops")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS_RELEASE "-funroll-loops")
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS_RELEASE "-fstrict-aliasing")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS_RELEASE "-fstrict-aliasing")
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS_RELEASE "-felide-constructors")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS_RELEASE "-felide-constructors")
+
+  ###############################
+  #                             #
+  #    For the Debug target:    #
+  #                             #
+  ###############################
+
+  IF (CMAKE_BUILD_TYPE MATCHES "Debug")
+    ADD_DEFINITIONS("-DDEBUG")
+  ENDIF()
+
+  ADD_FLAGS(CMAKE_C_FLAGS_DEBUG "-O0")
+  ADD_FLAGS(CMAKE_CXX_FLAGS_DEBUG "-O0")
+
+  ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS_DEBUG "-ggdb")
+  ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS_DEBUG "-ggdb")
+  ENABLE_IF_AVAILABLE(CMAKE_SHARED_LINKER_FLAGS "-ggdb")
+  IF(NOT DEAL_II_HAVE_FLAG_-ggdb)
+    # If -ggdb is not available, fall back to -g:
+    ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS_DEBUG "-g")
+    ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS_DEBUG "-g")
+    ENABLE_IF_AVAILABLE(CMAKE_SHARED_LINKER_FLAGS "-g")
+  ENDIF()
+
+ELSE()
+
+  MESSAGE(WARNING "Unrecognized compiler. Please set the relevant compiler options by hand.")
+ENDIF()
+
diff --git a/deal.II/contrib/cmake/setup_finalize.cmake b/deal.II/contrib/cmake/setup_finalize.cmake
new file mode 100644 (file)
index 0000000..3301366
--- /dev/null
@@ -0,0 +1,48 @@
+FOREACH(flags ${deal_ii_used_flags})
+  #
+  # Append the saved cache variable ${flags}_SAVED at the end of ${flags}
+  #
+  SET(${flags} "${${flags}} ${${flags}_SAVED}")
+ENDFOREACH()
+
+MESSAGE("
+
+
+deal.II successfully configured!
+
+
+Compiler Flags:
+
+Flags used by the compiler during all build types:
+
+    CMAKE_C_FLAGS:   ${CMAKE_C_FLAGS}
+    CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}
+
+Additional flags used by the compiler during all release builds:
+
+    CMAKE_C_FLAGS_RELEASE:   ${CMAKE_C_FLAGS_RELEASE}
+    CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}
+
+Additional flags used by the compiler during all debug builds:
+
+    CMAKE_C_FLAGS_DEBUG:   ${CMAKE_C_FLAGS_DEBUG}
+    CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}
+
+(Note: Flags set with ccmake or the command line will be appended at the end
+of the default configuration)
+
+
+Configured Features:
+")
+
+GET_CMAKE_PROPERTY(res VARIABLES)
+FOREACH(var ${res})
+  IF(var MATCHES "DEAL_II_WITH")
+    MESSAGE("    ${var} = ${${var}}")
+  ENDIF()
+ENDFOREACH()
+
+MESSAGE("
+TODO: Tell something about contrib/external
+
+")

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.