]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Progress
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Sep 2012 20:53:01 +0000 (20:53 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Sep 2012 20:53:01 +0000 (20:53 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26483 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/compiler.m4
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/macros/macro_add_flags.cmake
deal.II/contrib/cmake/macros/macro_strip_flag.cmake [new file with mode: 0644]
deal.II/contrib/cmake/setup_compiler_flags.cmake
deal.II/contrib/cmake/setup_compiler_flags_gnu.cmake

index 453ee5bdebd497977f30b172494a5bb69933c892..7043ed49635182465807b1050b135c3ca824d9fb 100644 (file)
@@ -1,363 +1,3 @@
-dnl -------------------------------------------------------------
-dnl Determine the C++ compiler in use. Return the name and possibly
-dnl version of this compiler in GXX_VERSION.
-dnl
-dnl Usage: DEAL_II_DETERMINE_CXX_BRAND
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_DETERMINE_CXX_BRAND, dnl
-[
-  dnl It used to be the case that AC_PROG_CXX could properly detect
-  dnl whether we are working with gcc or not, but then Intel came across
-  dnl the brilliant idea to disguise it's compiler as gcc by setting
-  dnl GCC preprocessor variables for versions etc. So we have to figure
-  dnl out again whether this is really gcc
-  if test "$GXX" = "yes" ; then
-    GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "gcc version"`
-    if test "x$GXX_VERSION_STRING" = "x" ; then
-      GXX=no
-    fi
-  fi
-
-  dnl And because it is so convenient, the PathScale compiler also identifies
-  dnl itself as GCC...
-  if test "$GXX" = "yes" ; then
-    GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "PathScale"`
-    if test "x$GXX_VERSION_STRING" != "x" ; then
-      GXX=no
-    fi
-  fi
-
-  dnl Then icc came along and started to identify itself as
-  dnl    icpc version 12.1.0 (gcc version 4.2.1 compatibility)
-  dnl which also doesn't help...
-  if test "$GXX" = "yes" ; then
-    GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "icpc"`
-    if test "x$GXX_VERSION_STRING" != "x" ; then
-      GXX=no
-    fi
-  fi
-
-  if test "$GXX" = yes ; then
-    dnl find out the right version
-    GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "gcc version"`
-
-    full_version=`echo "$GXX_VERSION_STRING" | perl -pi -e 's/.*version (\d\.\d\.\d).*/\1/g;'`
-    GXX_BRAND=GNU
-    GXX_VERSION=gcc`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'`
-    GXX_VERSION_DETAILED=gcc$full_version
-
-    AC_MSG_RESULT([C++ compiler is $GXX_VERSION (subversion $GXX_VERSION_DETAILED)])
-
-
-  else
-    dnl Check other (non-gcc) compilers
-
-    dnl Check for IBM xlC. For some reasons, depending on some environment
-    dnl variables, moon position, and other reasons unknown to me, the
-    dnl compiler displays different names in the first line of output, so
-    dnl check various possibilities
-    is_ibm_xlc="`($CXX -qversion 2>&1) | grep IBM`"
-    if test "x$is_ibm_xlc" != "x"  ; then
-      dnl Ah, this is IBM's C++ compiler. Unfortunately, we don't presently
-      dnl know how to check the version number, so assume that is sufficiently
-      dnl high...
-      AC_MSG_RESULT(C++ compiler is IBM xlC)
-      GXX_BRAND=IBM
-      GXX_VERSION=ibm_xlc
-      GXX_VERSION_DETAILED="$GXX_VERSION"
-    else
-
-      dnl Check whether we are dealing with the MIPSpro C++ compiler
-      mips_pro="`($CXX -version 2>&1) | grep MIPSpro`"
-      if test "x$mips_pro" != "x" ; then
-        GXX_BRAND=MIPSpro
-        case "$mips_pro" in
-          *7.0* | *7.1* | *7.2* | *7.3*)
-            dnl MIPSpro 7.3 does not support standard C++, therefore it is not
-            dnl able to compile deal.II. Previous compiler versions neither.
-            AC_MSG_RESULT(C++ compiler is $mips_pro)
-            AC_MSG_ERROR(This compiler is not supported)
-            GXX_VERSION=MIPSpro7.3
-            GXX_VERSION_DETAILED="$GXX_VERSION"
-            ;;
-          *7.4)
-            AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.4)
-            AC_MSG_ERROR(This compiler is not supported. Use MIPSPro compiler 7.4x)
-            GXX_VERSION=MIPSpro7.4
-            GXX_VERSION_DETAILED="$GXX_VERSION"
-            ;;
-          *7.41* | *7.42* | *7.43* | *7.44*)
-            AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.4x)
-            GXX_VERSION=MIPSpro7.4x
-            GXX_VERSION_DETAILED="$GXX_VERSION"
-            ;;
-          *"7.5"*)
-            AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.5)
-            GXX_VERSION=MIPSpro7.5
-            GXX_VERSION_DETAILED="$GXX_VERSION"
-            ;;
-          *)
-            AC_MSG_RESULT(C++ compiler is unknown version but accepted MIPSpro compiler version)
-            GXX_VERSION=MIPSpro-other
-            GXX_VERSION_DETAILED="$GXX_VERSION"
-            ;;
-        esac
-      else
-
-        dnl Intel's ICC C++ compiler? On Linux, it uses -V, on Windows
-        dnl it is -help
-        is_intel_icc1="`($CXX -V 2>&1) | grep 'Intel'`"
-        is_intel_icc2="`($CXX -help 2>&1) | grep 'Intel'`"
-        is_intel_icc="$is_intel_icc1$is_intel_icc2"
-
-        dnl When calling the Portland Group compiler, it also
-        dnl outputs the string 'Intel' in its help text, so make
-        dnl sure we're not confused
-        is_pgi="`($CXX -V 2>&1) | grep 'Portland'`"
-
-        if test "x$is_intel_icc" != "x" -a "x$is_pgi" = "x" ; then
-          GXX_BRAND=Intel
-          version_string="`($CXX -V 2>&1) | grep 'Version'` `($CXX -help 2>&1) | grep 'Version'`"
-          version5="`echo $version_string | grep 'Version 5'`"
-          version6="`echo $version_string | grep 'Version 6'`"
-          version7="`echo $version_string | grep 'Version 7'`"
-          version8="`echo $version_string | grep 'Version 8'`"
-          version9="`echo $version_string | grep 'Version 9'`"
-          version10="`echo $version_string | grep 'Version 10'`"
-          version11="`echo $version_string | grep 'Version 11'`"
-          if test "x$version5" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-5)
-            GXX_VERSION=intel_icc5
-          else if test "x$version6" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-6)
-            GXX_VERSION=intel_icc6
-          else if test "x$version7" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-7)
-            GXX_VERSION=intel_icc7
-          else if test "x$version8" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-8)
-            GXX_VERSION=intel_icc8
-          else if test "x$version9" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-9)
-            GXX_VERSION=intel_icc9
-          else if test "x$version10" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-10)
-            GXX_VERSION=intel_icc10
-          else if test "x$version11" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-11)
-            GXX_VERSION=intel_icc11
-          else if test "x$version12" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is icc-12)
-            GXX_VERSION=intel_icc12
-          else
-            AC_MSG_RESULT(C++ compiler is icc)
-            GXX_VERSION=intel_icc
-          fi fi fi fi fi fi fi fi
-          GXX_VERSION_DETAILED="$GXX_VERSION"
-        else
-
-          dnl Or DEC's cxx compiler?
-          is_dec_cxx="`($CXX -V 2>&1) | grep 'Compaq C++'`"
-          if test "x$is_dec_cxx" != "x" ; then
-            AC_MSG_RESULT(C++ compiler is Compaq-cxx)
-            GXX_BRAND=Compaq
-            GXX_VERSION=compaq_cxx
-            GXX_VERSION_DETAILED="$GXX_VERSION"
-          else
-
-            dnl Sun Workshop/Studio?
-            is_sun_cc_1="`($CXX -V 2>&1) | grep 'Sun WorkShop'`"
-            is_sun_cc_2="`($CXX -V 2>&1) | grep 'Sun C++'`"
-            if test "x$is_sun_cc_1$is_sun_cc_2" != "x" ; then
-              AC_MSG_RESULT(C++ compiler is Sun Workshop compiler)
-              GXX_BRAND=SunWorkshop
-              GXX_VERSION=sun_workshop
-              GXX_VERSION_DETAILED="$GXX_VERSION"
-            else
-
-              dnl Sun Forte?
-              is_sun_forte_cc="`($CXX -V 2>&1) | grep 'Forte'`"
-              if test "x$is_sun_forte_cc" != "x" ; then
-                AC_MSG_RESULT(C++ compiler is Sun Forte compiler)
-                GXX_BRAND=SunForte
-                GXX_VERSION=sun_forte
-                GXX_VERSION_DETAILED="$GXX_VERSION"
-              else
-
-                dnl Portland Group C++?
-                is_pgcc="`($CXX -V 2>&1) | grep 'Portland Group'`"
-                if test "x$is_pgcc" != "x" ; then
-                  GXX_VERSION_STRING=`($CXX -V 2>&1) | grep "^pgCC"`
-                  full_version=`echo "$GXX_VERSION_STRING" | perl -pi -e 's/.*pgCC\s+(\S+).*/\1/g;'`
-                  GXX_BRAND=PortlandGroup
-                  GXX_VERSION=pgCC`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'`
-                  GXX_VERSION_DETAILED=pgCC"$full_version"
-                  AC_MSG_RESULT(C++ compiler is Portland Group C++ $full_version)
-                else
-
-                  dnl HP aCC?
-                  is_aCC="`($CXX -V 2>&1) | grep 'aCC'`"
-                  if test "x$is_aCC" != "x" ; then
-                    AC_MSG_RESULT(C++ compiler is HP aCC)
-                    GXX_BRAND=HP
-                    GXX_VERSION=hp_aCC
-                    GXX_VERSION_DETAILED="$GXX_VERSION"
-                  else
-
-                    dnl Borland C++
-                    is_bcc="`($CXX -h 2>&1) | grep 'Borland'`"
-                    if test "x$is_bcc" != "x" ; then
-                      AC_MSG_RESULT(C++ compiler is Borland C++)
-                      GXX_BRAND=Borland
-                      GXX_VERSION=borland_bcc
-                      GXX_VERSION_DETAILED="$GXX_VERSION"
-                    else
-
-                      dnl KAI C++? It seems as if the documented options
-                      dnl -V and --version are not always supported, so give
-                      dnl the whole thing a second try by looking for /KCC/
-                      dnl somewhere in the paths that are output by -v. This
-                      dnl is risky business, since this combination of
-                      dnl characters might appear on other installations
-                      dnl of other compilers as well, so put this test to
-                      dnl the very end of the detection chain for the
-                      dnl various compilers
-                      is_kai_cc="`($CXX --version 2>&1) | grep 'KAI C++'`"
-                      is_kai_cc="$is_kai_cc`($CXX -v 2>&1) | grep /KCC/`"
-                      if test "x$is_kai_cc" != "x" ; then
-                        AC_MSG_RESULT(C++ compiler is KAI C++)
-                        GXX_BRAND=KAI
-                        GXX_VERSION=kai_cc
-                        GXX_VERSION_DETAILED="$GXX_VERSION"
-                      else
-
-                        dnl Maybe PathScale's compiler?
-                        is_pathscale="`($CXX -v 2>&1) | grep PathScale`"
-                        if test "x$is_pathscale" != "x" ; then
-                          AC_MSG_RESULT(C++ compiler is PathScale C++)
-                          GXX_BRAND=PathScale
-                          GXX_VERSION=pathscale_cc
-                          GXX_VERSION_DETAILED="$GXX_VERSION"
-                        else
-
-                          dnl Maybe CLang?
-                          is_clang="`($CXX --version 2>&1) | grep clang`"
-                          if test "x$is_clang" != x ; then
-                            AC_MSG_RESULT(C++ compiler is clang)
-                            GXX_BRAND=clang
-                            GXX_VERSION=clang
-                            GXX_VERSION_DETAILED="$GXX_VERSION"
-                          else
-
-                            dnl Maybe Cray C++?
-                            is_cray="`($CXX -V 2>&1) | grep Cray`"
-                            if test "x$is_cray" != x ; then
-                              AC_MSG_RESULT(C++ compiler is Cray C++)
-                              GXX_BRAND=cray
-                              GXX_VERSION=cray
-                              GXX_VERSION_DETAILED="$GXX_VERSION"
-                            else
-
-                              dnl  Aw, nothing suitable found...
-                              AC_MSG_RESULT(Unrecognized C++ compiler -- Try to go ahead and get help from dealii@dealii.org)
-                              GXX_BRAND=Unknown
-                              GXX_VERSION=unknown_cc
-                              GXX_VERSION_DETAILED="$GXX_VERSION"
-                            fi
-                          fi
-                        fi
-                      fi
-                    fi
-                  fi
-                fi
-              fi
-            fi
-          fi
-        fi
-      fi
-    fi
-  fi
-])
-
-
-
-dnl -------------------------------------------------------------
-dnl Set C++ compiler flags to their default values. They will be
-dnl modified according to other options in later steps of
-dnl configuration
-dnl
-dnl CXXFLAGSO  : flags for optimized mode
-dnl CXXFLAGSG  : flags for debug mode
-dnl CXXFLAGSPIC: flags for generation of object files that are suitable
-dnl              for shared libs
-dnl LDFLAGSPIC : flags needed for linking of object files to shared
-dnl              libraries
-dnl
-dnl Usage: DEAL_II_SET_CXX_FLAGS
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl
-[
-  dnl If CXXFLAGSG or CXXFLAGSO are not set, then initialize them with
-  dnl CXXFLAGS
-  if test "x$CXXFLAGSG" = "x" ; then
-    CXXFLAGSG="$CXXFLAGS" ;
-  fi
-
-  if test "x$CXXFLAGSO" = "x" ; then
-    CXXFLAGSO="$CXXFLAGS" ;
-  fi
-
-  dnl In no case do we want to induce BOOST to use deprecated header files
-  CXXFLAGSG="$CXXFLAGSG -DBOOST_NO_HASH -DBOOST_NO_SLIST"
-  CXXFLAGSO="$CXXFLAGSO -DBOOST_NO_HASH -DBOOST_NO_SLIST"
-
-  dnl First the flags for gcc compilers
-  if test "$GXX" = yes ; then
-    CXXFLAGSO="$CXXFLAGSO -O2 -funroll-loops -funroll-all-loops -fstrict-aliasing -Wuninitialized -felide-constructors"
-    CXXFLAGSG="$CXXFLAGSG -DDEBUG -Wall -W -Wpointer-arith -Wwrite-strings -Wsynth -Wsign-compare -Wswitch"
-
-    dnl gcc 4.4 has an interesting problem in that it doesn't
-    dnl care for one of BOOST signals2's header files and produces
-    dnl dozens of pages of error messages of the form
-    dnl   warning: invoking macro BOOST_PP_CAT argument 1: empty macro arguments are undefined in ISO C90 and ISO C++98
-    dnl This can be avoided by not using -pedantic for this compiler.
-    dnl For all other versions, we use this flag, however.
-    if test $GXX_VERSION != gcc4.4 ; then
-      CXXFLAGS="$CXXFLAGS -pedantic"
-    fi
-
-    dnl BOOST uses long long, so don't warn about this
-    CXXFLAGSG="$CXXFLAGSG -Wno-long-long"
-
-    dnl Newer versions have a flag -Wunused-local-typedefs that, though in principle
-    dnl a good idea, triggers a lot in BOOST in various places. Unfortunately,
-    dnl this warning is included in -W/-Wall, so disable it if the compiler
-    dnl supports it.
-    CXXFLAGS="-Wunused-local-typedefs"
-    AC_MSG_CHECKING(whether the compiler supports the -Wunused-local-typedefs flag)
-    AC_TRY_COMPILE(
-          [
-          ],
-          [;],
-          [
-            AC_MSG_RESULT(yes)
-            CXXFLAGSG="$CXXFLAGSG -Wno-unused-local-typedefs"
-          ],
-          [
-            AC_MSG_RESULT(no)
-            dnl Nothing to do here then. We can't disable it if the
-           dnl flag doesn't exist
-          ])
-
-
-    dnl See whether the gcc we use already has a flag for C++2011 features
-    dnl and whether we can mark functions as deprecated with an attributed
-    DEAL_II_CHECK_CXX1X
-    DEAL_II_CHECK_DEPRECATED
-
-
     dnl On some gcc 4.3 snapshots, a 'const' qualifier on a return type triggers a
     dnl warning. This is unfortunate, since we happen to stumble on this
     dnl in some of our template trickery with iterator classes. If necessary,
@@ -377,60 +17,7 @@ AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl
             CXXFLAGSG="$CXXFLAGSG -Wno-return-type"
           ])
 
-    dnl Newer versions of gcc can pass a flag to the assembler to
-    dnl compress debug sections. At the time of writing this test,
-    dnl this can save around 230 MB of disk space on the object
-    dnl files we produce (810MB down to 570MB for the debug versions
-    dnl of object files). Unfortunately, the sections have to be
-    dnl unpacked again when they are put into the shared libs, so
-    dnl no savings there.
-    dnl
-    dnl The flag also doesn't appear to be working on Cygwin, as
-    dnl per email by John Fowkes on the mailing list in Feb 2012,
-    dnl so don't run the test on cygwin.
-    case "$target" in
-      *cygwin* )
-         ;;
 
-      * )
-         CXXFLAGS="-Wa,--compress-debug-sections"
-         AC_MSG_CHECKING([whether the assembler understands -Wa,--compress-debug-sections])
-         AC_TRY_LINK(
-          [
-          ],
-          [;],
-          [
-            AC_MSG_RESULT(yes)
-            CXXFLAGSG="$CXXFLAGSG -Wa,--compress-debug-sections"
-          ],
-          [
-            AC_MSG_RESULT(no)
-          ])
-         ;;
-    esac
-
-    dnl Set PIC flags. On some systems, -fpic/PIC is implied, so don't set
-    dnl anything to avoid a warning. on AIX make sure we always pass -lpthread
-    dnl because this seems to be somehow required to make things work. Likewise
-    dnl DEC OSF and linux on x86_64.
-    case "$target" in
-      *aix* )
-        CXXFLAGSPIC=
-        LDFLAGSPIC=
-        LDFLAGS="$LDFLAGS -lpthread"
-        ;;
-
-      *dec-osf* )
-        CXXFLAGSPIC="-fPIC"
-        LDFLAGSPIC="-fPIC"
-        LDFLAGS="$LDFLAGS -lpthread"
-        ;;
-
-      *x86_64*)
-        CXXFLAGSPIC="-fPIC"
-        LDFLAGSPIC="-fPIC"
-        LDFLAGS="$LDFLAGS -lpthread"
-        ;;
 
       *cygwin* )
         dnl On Cygwin, when using shared libraries, there might occur
index a5ebe270d2c5c3482372243df59a79dffee7349a..0f2c29bac6c705cedd0c709484f0761f2fb0e404 100644 (file)
@@ -1,15 +1,21 @@
+#
+# I'm sure we will have to split this file in various sensible pieces...
+#
+
+
 #
 # Check for various compiler bugs:
 #
 
 
+
 #
+# TODO: Obsolete. Remove and clean source.
 # Versions of GCC before 3.0 had a problem with the explicit
 # instantiation of member templates when the member was in fact
 # an operator. In that case, they needed the "template" keyword,
 # which is actually not allowed at this place. Test case is
 #
-# /* ----------------------------------------------- */
 # struct X
 # {
 #     template <typename T2>
@@ -17,7 +23,6 @@
 # };
 #
 # template X X::operator=<float> (float &);
-# /* ---------------------------------------------------------- */
 #
 # The compiler only groks this if the "operator=" is prepended
 # by "template". We detect this, and either set the
@@ -79,28 +84,21 @@ CHECK_CXX_COMPILER_BUG(
   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
+# gcc 4.4 has an interesting problem in that it doesn't
+# care for one of BOOST signals2's header files and produces
+# dozens of pages of error messages of the form
+#   warning: invoking macro BOOST_PP_CAT argument 1: \
+#   empty macro arguments are undefined in ISO C90 and ISO C++98
+# This can be avoided by not using -pedantic for this compiler.
+# For all other versions, we use this flag, however.
+#
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND
+   CMAKE_CXX_COMPILER_VERSION MATCHES "4.4.")
+  STRIP_FLAG(CMAKE_C_FLAGS "-pedantic")
+  STRIP_FLAG(CMAKE_CXX_FLAGS "-pedantic")
+ENDIF()
 
 
 
index 7145acdd1940ac6fd302fbb7530771c0c644cb93..2d1a2d5daf5f8623ec30b002b103639acdeef5ba 100644 (file)
@@ -3,7 +3,6 @@
 #
 
 
-
 #
 # Check whether the std::vector::iterator is just a plain pointer
 #
@@ -384,3 +383,22 @@ ELSE()
   SET(DEAL_II_MIN_BOOL_VECTOR_CAPACITY
     ${DEAL_II_MIN_BOOL_VECTOR_CAPACITY_RETURN_VALUE})
 ENDIF()
+
+
+
+#
+# Newer versions of gcc can pass a flag to the assembler to
+# compress debug sections. At the time of writing this test,
+# this can save around 230 MB of disk space on the object
+# files we produce (810MB down to 570MB for the debug versions
+# of object files). Unfortunately, the sections have to be
+# unpacked again when they are put into the shared libs, so
+# no savings there.
+#
+# TODO:
+# The flag also doesn't appear to be working on Cygwin, as
+# per email by John Fowkes on the mailing list in Feb 2012,
+# so don't run the test on cygwin.
+#
+ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wa,--compress-debug-sections")
+ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wa,--compress-debug-sections")
index 2d365e29df63910362bd5192f98c21b325fdfd3a..f73e05d0d53886e7e20d44278fbbde0549f99255 100644 (file)
@@ -86,12 +86,14 @@ IF(DEAL_II_HAVE_CXX11_FLAG)
     "
     DEAL_II_HAVE_CXX11_THREAD)
 
+  #
   #On some systems with gcc 4.5.0, we can compile the code
   #above but it will throw an exception when run. So test
   #that as well. The test will only be successful if we have
   #libpthread available, so link it in for this test. If
   #multithreading is requested, it will be added to CXXFLAGS
   #later on so there is no need to do this here.
+  #
   CHECK_CXX_SOURCE_RUNS(
     "
     #include <thread>
index 9fdb657330d71dae6df38ad88f36d4c152d163cd..38acfad7ab998cf834f3372411316ee48e12e0b6 100644 (file)
@@ -1,3 +1,5 @@
+
 MACRO(ADD_FLAGS variable flag)
   SET(${variable} "${${variable}} ${flag}")
 ENDMACRO()
+
diff --git a/deal.II/contrib/cmake/macros/macro_strip_flag.cmake b/deal.II/contrib/cmake/macros/macro_strip_flag.cmake
new file mode 100644 (file)
index 0000000..bf17490
--- /dev/null
@@ -0,0 +1,5 @@
+
+MACRO(STRIP_FLAG variable flag)
+  STRING(REGEX REPLACE " ${flag}" "" ${variable} ${${variable}})
+ENDMACRO()
+
index f9fa254c027a64883d6ebead83ed7272e4692ace..357a95d4bef6df443f984c1fe24a379372a1d928 100644 (file)
 #   #     FAT NOTE:    #
 #   ####################
 #
-# As a rule of thumb: All configuration in setup_compiler_flags.cmake and
+# All configuration in setup_compiler_flags.cmake and
 # setup_compiler_flags_<compiler>.cmake shall ONLY consist of CFLAGS,
 # CXXFLAGS and LINKER_FLAGS being set.
 #
 # Checks for compiler features (such as C++11 support) and compiler
-# specific bugs that set up further configuration (such as definitions)
+# specific bugs that
+#   - usually set up further configuration (such as definitions)
+#   - disable a specific flag for a specific compiler version.
+#
 # belong to
 #
 # ./check/check_for_compiler_features.cmake
+#
 # ./check/check_for_compiler_bugs.cmake
+#
+# and enable language features:
+#
 # ./check/check_for_cxx_features.cmake
 #
 # TODO: There is a bit of ambiguity. Clarify with Wolfgang.
index d426a75cd05767a319088840acb00622748010fe..52ac0ec61253a123f029d20c27375a411afaed11 100644 (file)
@@ -14,8 +14,8 @@
 
 #
 # Set the pic flag.
-# On some systems, -fpic/PIC is implied, so don't set anything to avoid
-# a warning. (TODO)
+# TODO: On some systems, -fpic/PIC is implied, so don't set anything to
+# avoid a warning.
 #
 ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-fpic")
 ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-fpic")
@@ -26,15 +26,16 @@ ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-fpic")
 #
 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 "-pedantic")
+ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-pedantic")
 
+#
+# Setup various warnings:
+#
 ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wall")
 ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wall")
 ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wpointer-arith")
@@ -48,6 +49,17 @@ ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wsign-compare")
 ENABLE_IF_AVAILABLE(CMAKE_C_FLAGS "-Wswitch")
 ENABLE_IF_AVAILABLE(CMAKE_CXX_FLAGS "-Wswitch")
 
+#
+# 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")
+
+
+
+
 #################################
 #                               #
 #    For the Release target:    #
@@ -67,6 +79,7 @@ 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:    #
@@ -83,9 +96,12 @@ 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 -ggdb is not available, fall back to -g:
+#
 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()
+

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.