From 8a18a1f689b70c9def9565c6141bdd963177d375 Mon Sep 17 00:00:00 2001 From: maier Date: Fri, 24 Jan 2014 11:25:42 +0000 Subject: [PATCH] CMake: Cleanup: Remove obsolete macro, unify naming of internal macros git-svn-id: https://svn.dealii.org/trunk@32294 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/checks/check_01_cxx_features.cmake | 16 +++++---- .../cmake/checks/check_03_compiler_bugs.cmake | 7 ++-- .../cmake/macros/macro_pop_test_flag.cmake | 35 ------------------- ....cmake => macro_push_cmake_required.cmake} | 4 +-- .../macros/macro_reset_cmake_required.cmake | 2 +- deal.II/cmake/modules/FindTRILINOS.cmake | 4 +-- deal.II/cmake/setup_cached_variables.cmake | 2 +- deal.II/doc/developers/cmake-internals.html | 8 ++--- 8 files changed, 22 insertions(+), 56 deletions(-) delete mode 100644 deal.II/cmake/macros/macro_pop_test_flag.cmake rename deal.II/cmake/macros/{macro_push_test_flag.cmake => macro_push_cmake_required.cmake} (93%) diff --git a/deal.II/cmake/checks/check_01_cxx_features.cmake b/deal.II/cmake/checks/check_01_cxx_features.cmake index fa1540fae4..8c8759fd76 100644 --- a/deal.II/cmake/checks/check_01_cxx_features.cmake +++ b/deal.II/cmake/checks/check_01_cxx_features.cmake @@ -51,7 +51,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11) # Set CMAKE_REQUIRED_FLAGS for the unit tests MESSAGE(STATUS "Using C++11 flag \"${DEAL_II_CXX11_FLAG}\"") - PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}") + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}") CHECK_CXX_SOURCE_COMPILES( " @@ -103,7 +103,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11) # that as well. # IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) - PUSH_TEST_FLAG("-pthread") + PUSH_CMAKE_REQUIRED("-pthread") CHECK_CXX_SOURCE_RUNS( " #include @@ -111,7 +111,8 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11) int main(){ std::thread t(f,1); t.join(); return 0; } " DEAL_II_HAVE_CXX11_THREAD) - POP_TEST_FLAG() + RESET_CMAKE_REQUIRED() + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}") ELSE() # Just export it ;-) SET(DEAL_II_HAVE_CXX11_THREAD TRUE CACHE BOOL "") @@ -146,7 +147,7 @@ IF(NOT DEFINED DEAL_II_WITH_CXX11 OR DEAL_II_WITH_CXX11) # # On Mac OS-X 10.9 with recent gcc compilers in C++11 mode linking to # some standard C library functions, notably toupper and tolower, fail - # due to unresolved references to this functions. + # due to unresolved references to these functions. # # Thanks to Denis Davydov for the testcase. # @@ -252,7 +253,8 @@ IF(DEAL_II_WITH_CXX11 AND NOT DEAL_II_HAVE_CXX11) " -DDEAL_II_WITH_CXX11=FALSE,\n" "or use a different compiler, instead. (If the compiler flag for C++11 " "support differs from \"-std=c++0x\" or \"-std=c++11\", a suitable " - "compiler flag has to be specified manually.\n\n" + "compiler flag has to be specified manually via\n" + " -DDEAL_II_CXX11_FLAG="..."\n\n" ) ENDIF() @@ -264,14 +266,14 @@ IF(DEAL_II_WITH_CXX11) ADD_FLAGS(DEAL_II_CXX_FLAGS "${DEAL_II_CXX11_FLAG}") MESSAGE(STATUS "DEAL_II_WITH_CXX11 successfully set up") - PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}") + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}") CHECK_CXX_SOURCE_COMPILES( " #include int main(){ std::is_trivially_copyable bob; } " DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE) - POP_TEST_FLAG() + RESET_CMAKE_REQUIRED() ELSE() MESSAGE(STATUS "DEAL_II_WITH_CXX11 disabled") ENDIF() diff --git a/deal.II/cmake/checks/check_03_compiler_bugs.cmake b/deal.II/cmake/checks/check_03_compiler_bugs.cmake index 364bad027e..c913deb19c 100644 --- a/deal.II/cmake/checks/check_03_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_03_compiler_bugs.cmake @@ -29,8 +29,8 @@ # # - Wolfgang Bangerth, Matthias Maier, rewritten 2012 # -PUSH_TEST_FLAG("-Wreturn-type") -PUSH_TEST_FLAG("-Werror") +PUSH_CMAKE_REQUIRED("-Wreturn-type") +PUSH_CMAKE_REQUIRED("-Werror") CHECK_CXX_COMPILER_BUG( " const double foo() { return 1.; } @@ -38,8 +38,7 @@ CHECK_CXX_COMPILER_BUG( " DEAL_II_WRETURN_TYPE_CONST_QUALIFIER_BUG ) -POP_TEST_FLAG() -POP_TEST_FLAG() +RESET_CMAKE_REQUIRED() IF(DEAL_II_WRETURN_TYPE_CONST_QUALIFIER_BUG) ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-return-type) diff --git a/deal.II/cmake/macros/macro_pop_test_flag.cmake b/deal.II/cmake/macros/macro_pop_test_flag.cmake deleted file mode 100644 index 045fe43e2f..0000000000 --- a/deal.II/cmake/macros/macro_pop_test_flag.cmake +++ /dev/null @@ -1,35 +0,0 @@ -## --------------------------------------------------------------------- -## $Id$ -## -## Copyright (C) 2012 - 2013 by the deal.II authors -## -## This file is part of the deal.II library. -## -## The deal.II library is free software; you can use it, redistribute -## it, and/or modify it under the terms of the GNU Lesser General -## Public License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## The full text of the license can be found in the file LICENSE at -## the top level of the deal.II distribution. -## -## --------------------------------------------------------------------- - -# -# A small macro used in the platform checks to remove the right most flag in -# CMAKE_REQUIRED_FLAGS -# -# We assume that the flags in CMAKE_REQUIRED_FLAGS are space separated -# -# Usage: -# POP_TEST_FLAG() -# - -MACRO(POP_TEST_FLAG) - SET(CMAKE_REQUIRED_FLAGS " ${CMAKE_REQUIRED_FLAGS}") - STRING(REGEX REPLACE " [^ ]+$" "" - CMAKE_REQUIRED_FLAGS - "${CMAKE_REQUIRED_FLAGS}" - ) - STRING(STRIP "${CMAKE_REQUIRED_FLAGS}" CMAKE_REQUIRED_FLAGS) -ENDMACRO() - diff --git a/deal.II/cmake/macros/macro_push_test_flag.cmake b/deal.II/cmake/macros/macro_push_cmake_required.cmake similarity index 93% rename from deal.II/cmake/macros/macro_push_test_flag.cmake rename to deal.II/cmake/macros/macro_push_cmake_required.cmake index 905ce92e16..180df5981d 100644 --- a/deal.II/cmake/macros/macro_push_test_flag.cmake +++ b/deal.II/cmake/macros/macro_push_cmake_required.cmake @@ -19,10 +19,10 @@ # CMAKE_REQUIRED_FLAGS # # Usage: -# PUSH_TEST_FLAG("flag") +# PUSH_CMAKE_REQUIRED("flag") # -MACRO(PUSH_TEST_FLAG _flag) +MACRO(PUSH_CMAKE_REQUIRED _flag) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${_flag}") STRING(STRIP "${CMAKE_REQUIRED_FLAGS}" CMAKE_REQUIRED_FLAGS) diff --git a/deal.II/cmake/macros/macro_reset_cmake_required.cmake b/deal.II/cmake/macros/macro_reset_cmake_required.cmake index 53a4818786..02254b27a2 100644 --- a/deal.II/cmake/macros/macro_reset_cmake_required.cmake +++ b/deal.II/cmake/macros/macro_reset_cmake_required.cmake @@ -25,6 +25,6 @@ MACRO(RESET_CMAKE_REQUIRED) SET(CMAKE_REQUIRED_FLAGS ${DEAL_II_CXX_FLAGS_SAVED}) SET(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_REQUIRED_LIBRARIES) + SET(CMAKE_REQUIRED_LIBRARIES ${DEAL_II_LINKER_FLAGS_SAVED}) ENDMACRO() diff --git a/deal.II/cmake/modules/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake index 8857da9f82..877e550f65 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.cmake @@ -183,7 +183,7 @@ IF(TRILINOS_FOUND) ENDIF() LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIRS}) - PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}") + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}") CHECK_CXX_SOURCE_COMPILES( " @@ -196,7 +196,7 @@ IF(TRILINOS_FOUND) # # Try whether exporting HAS_C99_TR1_CMATH helps: # - PUSH_TEST_FLAG("-DHAS_C99_TR1_CMATH") + PUSH_CMAKE_REQUIRED("-DHAS_C99_TR1_CMATH") CHECK_CXX_SOURCE_COMPILES( " #include diff --git a/deal.II/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake index 913aba891c..897d36befa 100644 --- a/deal.II/cmake/setup_cached_variables.cmake +++ b/deal.II/cmake/setup_cached_variables.cmake @@ -353,7 +353,7 @@ It is not possible to install into the build directory. Please set CMAKE_INSTALL_PREFIX to a designated install directory different than CMAKE_BINARY_DIR. (Please note that you can use deal.II directly out of a build directory -if this is what you tried to do.) +without the need to install it, if this is what you tried to do.) " ) ENDIF() diff --git a/deal.II/doc/developers/cmake-internals.html b/deal.II/doc/developers/cmake-internals.html index aea4a22765..3517b168bb 100644 --- a/deal.II/doc/developers/cmake-internals.html +++ b/deal.II/doc/developers/cmake-internals.html @@ -292,13 +292,13 @@ CHECK_CXX_COMPILER_FLAG(flag variable)
  • Necessary compiler flags can easily set in the string variable - CMAKE_REQUIRED_FLAGS. There are two small macros - that do this job nicely: + CMAKE_REQUIRED_FLAGS. There is a small macro that does this + job nicely:
    -PUSH_TEST_FLAG("-Werror")
    +PUSH_CMAKE_REQUIRED("-Werror")
     CHECK_CXX_SOURCE_COMPILES(...)
    -POP_TEST_FLAG()
    +RESET_CMAKE_REQUIRED()
     
  • Necessary include directories and libraries necessary for -- 2.39.5