#
# CMAKE_BUILD_TYPE
# DEAL_II_ALLOW_PLATFORM_INTROSPECTION
-# DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS
# DEAL_II_SETUP_COVERAGE
# DEAL_II_UNITY_BUILD
# DEAL_II_EARLY_DEPRECATIONS
)
mark_as_advanced(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
-option(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS
- "Configure sensible default CFLAGS and CXXFLAGS depending on platform, compiler and build target."
- ON
- )
-mark_as_advanced(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS)
-
option(DEAL_II_SETUP_COVERAGE
"Setup debug compiler flags to provide additional test coverage information. Currently only gprof is supported."
OFF
# #
########################################################################
-if(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS)
- #
- # *Hooray* We are allowed to set compiler flags :-]
- #
-
+if( CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
+ CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
#
# General setup for GCC and compilers sufficiently close to GCC:
#
- if( CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
- CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
- verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_compiler_flags_gnu.cmake)
- set(DEAL_II_KNOWN_COMPILER TRUE)
- endif()
+ verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_compiler_flags_gnu.cmake)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
#
# Setup for ICC compiler (version >= 10):
#
- if(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
- verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_compiler_flags_intel.cmake)
- set(DEAL_II_KNOWN_COMPILER TRUE)
- endif()
+ verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_compiler_flags_intel.cmake)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
#
# Setup for MSVC compiler (version >= 2012):
#
- if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
- verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_compiler_flags_msvc.cmake)
- set(DEAL_II_KNOWN_COMPILER TRUE)
- endif()
-
- if(NOT DEAL_II_KNOWN_COMPILER)
- message(FATAL_ERROR "\n"
- "Unknown compiler!\n"
- "If you're serious about it, set DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS=OFF "
- "and set the relevant compiler options by hand.\n\n"
- )
- endif()
+ verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_compiler_flags_msvc.cmake)
else()
-
- message(STATUS
- "Skipped setup of default compiler flags "
- "(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS=OFF)"
+ message(WARNING "\nUnknown compiler!\n"
+ "Please populate the CMake variables DEAL_II_CXX_FLAGS(|DEBUG|RELEASE) "
+ "and DEAL_II_LINKER_FLAGS(|DEBUG|RELEASE) as needed."
)
endif()
_detailed("#\n")
-if(NOT DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS)
- _both("# WARNING: DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS is set to OFF\n")
-endif()
_both("# Configured Features (")
if(DEFINED DEAL_II_ALLOW_BUNDLED)
_both("DEAL_II_ALLOW_BUNDLED = ${DEAL_II_ALLOW_BUNDLED}, ")
sets up reasonable default compiler flags.
<ul>
<li>
- To start porting to an unknown compiler, specify
- <code>-DDEAL_II_SETUP_DEFAULT_COMPILER_FLAGS=OFF</code> and set all
+ To start porting to an unknown compiler, specify all
necessary compiler flags by hand via
<pre>
DEAL_II_CXX_FLAGS - used during all builds
target. There are two options to override this behaviour:
<ol>
- <li>
- Override the default configuration by setting the following
- cached variables:
+ <li>
+ Override the default configuration by setting the following
+ cached variables:
<pre class="cmake">
DEAL_II_CXX_FLAGS - used during all builds
DEAL_II_CXX_FLAGS_DEBUG - additional flags for the debug library
DEAL_II_LINKER_FLAGS_RELEASE - additional flags for the release library
</pre>
- The content of the cached variables will be preserved
- and added <i>to the end</i> of the default compiler flags,
- hence providing the possibility for overriding a flag. E.g.:
- <code>-Wsign-compare</code>, set by the build system, can be
- overwritten by specifying:
+ The content of the cached variables will be preserved
+ and added <i>to the end</i> of the default compiler flags,
+ hence providing the possibility for overriding a flag. E.g.:
+ <code>-Wsign-compare</code>, set by the build system, can be
+ overwritten by specifying:
<pre class="cmake">
cmake -DDEAL_II_CXX_FLAGS="-Wno-sign-compare" <...>
</pre>
variables will also be appended after the default compiler flags
(but before the corresponding cached variables).
- <li>
- Disable the configuration completely by adding the flag
- <code>-D DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS=OFF</code>.
- Beware of the fact that certain features
- may still pull in necessary compiler flags.
-
<li>
You can setup additional debug compiler flags to provide test
coverage information by adding the flag
# set(DEAL_II_DEFINITIONS_RELEASE "" CACHE STRING "")
#
# set(DEAL_II_ALLOW_PLATFORM_INTROSPECTION ON CACHE BOOL "")
-# set(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS ON CACHE BOOL "")
# set(DEAL_II_SETUP_COVERAGE OFF CACHE BOOL "")
# set(DEAL_II_UNITY_BUILD OFF CACHE BOOL "")
# set(DEAL_II_EARLY_DEPRECATIONS OFF CACHE BOOL "")