# 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(
"
# that as well.
#
IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
- PUSH_TEST_FLAG("-pthread")
+ PUSH_CMAKE_REQUIRED("-pthread")
CHECK_CXX_SOURCE_RUNS(
"
#include <thread>
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 "")
#
# 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.
#
" -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()
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 <type_traits>
int main(){ std::is_trivially_copyable<int> bob; }
"
DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE)
- POP_TEST_FLAG()
+ RESET_CMAKE_REQUIRED()
ELSE()
MESSAGE(STATUS "DEAL_II_WITH_CXX11 disabled")
ENDIF()
#
# - 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.; }
"
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)
+++ /dev/null
-## ---------------------------------------------------------------------
-## $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()
-
# 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)
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()
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(
"
#
# 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 <Sacado_cmath.hpp>
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()
</pre>
<li> Necessary compiler flags can easily set in the string variable
- <code>CMAKE_REQUIRED_FLAGS</code>. There are two small macros
- that do this job nicely:
+ <code>CMAKE_REQUIRED_FLAGS</code>. There is a small macro that does this
+ job nicely:
<pre class="cmake">
-PUSH_TEST_FLAG("-Werror")
+PUSH_CMAKE_REQUIRED("-Werror")
CHECK_CXX_SOURCE_COMPILES(...)
-POP_TEST_FLAG()
+RESET_CMAKE_REQUIRED()
</pre>
<li> Necessary include directories and libraries necessary for