From 99aa902959352adbcb9fb1b87ff613e37c0170fe Mon Sep 17 00:00:00 2001
From: Matthias Maier
Next, we find our deal.II installation with the help of the
@@ -114,8 +113,9 @@ DEAL_II_SETUP_TARGET(mycode)
Finally, the last two lines define the executable that is to be produced
and its source code. The
-
-The
+ Except in the case of an object library, the specified target will also
+ be set up to link against deal.II (and its transitive link interface) as
+ well.
-Except in the case of an object library, the specified target will be set
-up to link against deal.II (and its transitive link interface) as well.
+ Optionally, the
+ Note: The flags that are added with
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
-FIND_PACKAGE(deal.II 8.0 REQUIRED
+FIND_PACKAGE(deal.II 8.3 REQUIRED
HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
)
DEAL_II_INITIALIZE_CACHED_VARIABLES()
@@ -87,16 +87,15 @@ DEAL_II_SETUP_TARGET(mycode)
FIND_PACKAGE
command. In this case requiring at least
- version 8.0, which is the first version using CMake. The
- HINTS
are a list of directories where the install directory
- of deal.II is likely to be found. First, the location possibly defined in
- the CMake variable DEAL_II_DIR
is considered. After that, we
- check whether we are in a subdirectory (first and second level) of the
- deal.II installation and otherwise use the environment variable
- DEAL_II_DIR
. If all of these hints fail the default system
- locations /usr/
and /usr/local/
are considered.
- The list after HINTS
can be changed according to your
- preferences.
+ version 8.3. The HINTS
are a list of directories where the
+ install directory of deal.II is likely to be found. First, the location
+ possibly defined in the CMake variable DEAL_II_DIR
is
+ considered. After that, we check whether we are in a subdirectory (first
+ and second level) of the deal.II installation and otherwise use the
+ environment variable DEAL_II_DIR
. If all of these hints fail
+ the default system locations /usr/
and
+ /usr/local/
are considered. The list after
+ HINTS
can be changed according to your preferences.
DEAL_II_SETUP_TARGET
macro will set up necessary
- include directories, compile definitions and the link interface.
+ DEAL_II_SETUP_TARGET
macro will set up necessary include
+ directories, compile flags, compile definitions, link flags and the link
+ interface.
CMakeLists.txt
file or to run
DEAL_II_SETUP_TARGET
revisitedDEAL_II_SETUP_TARGET
macro is responsible for setting up a
-target to compile and link against deal.II. It will append the
-INCLUDE_DIRECTORIES
property with the location of the deal.II
-include directories, and the compile definitions and linker flags property
-COMPILE_DEFINITIONS
and LINK_FLAGS
by their
-respective values (depending on build type and available debug and/or
-optimized flavor of the library).
+ The DEAL_II_SETUP_TARGET
macro is responsible for setting up
+ a target to compile and link against deal.II. It will append the
+ INCLUDE_DIRECTORIES
property with the location of the
+ deal.II include directories, and append the properties
+ COMPILE_FLAGS
, COMPILE_DEFINITIONS
and
+ LINK_FLAGS
by their respective values from the deal.II
+ configuration (depending on build type and available debug and/or
+ optimized flavor of the library).
+DEAL_II_SETUP_TARGET
macro takes an
+ additional argument DEBUG
, or RELEASE
, after
+ the target name to explicitly state the library flavor the target should
+ be set up for. If the parameter is omitted, the correct choice is deduced
+ from the current build type (with DEBUG
taking precedence in
+ case of DebugRelease
as build type).
DEAL_II_SETUP_TARGET
to
+ the target come last in the final link compiler invocation, or linker
+ invocation. This means they take precedence over all flags defined via
+ globally via CMAKE_CXX_FLAGS
, etc., or as a directory
+ property. If you wish to modify flags or preprocessor definitions set up
+ with DEAL_II_SETUP_TARGET
modify on of the following
+ variables (see the section about deal.IIConfig.cmake
for
+ details):
+
+DEAL_II_CXX_FLAGS
+DEAL_II_CXX_FLAGS_DEBUG
+DEAL_II_CXX_FLAGS_RELEASE
+DEAL_II_LINKER_FLAGS
+DEAL_II_LINKER_FLAGS_DEBUG
+DEAL_II_LINKER_FLAGS_RELEASE
+DEAL_II_USER_DEFINITIONS
+DEAL_II_USER_DEFINITIONS_DEBUG
+DEAL_II_USER_DEFINITIONS_RELEASE
+
+
@@ -477,15 +510,24 @@ The macro will set an uninitialized DEAL_II_INITIALIZE_CACHED_VARIABLES
revisitedCMAKE_BUILD_TYPE
variable
to Debug
(or Release
if the debug library is not
available). If CMAKE_BUILD_TYPE
is specified it will
automatically be reset if the given value is unsupported by the deal.II
-installation.
+installation (i.e., if it is not equal to Debug
,
+Release
, or DebugRelease
).
-Furthermore, this macro sets the C++ compiler and the compile flags to
-default values (the same values that were used to compile deal.II itself).
-These are CMAKE_CXX_COMPILER
and DEAL_II_CXX_FLAGS
,
-as well as - depending on the configuration -
-DEAL_II_CXX_FLAGS_DEBUG
, or DEAL_II_CXX_FLAGS_RELEASE
, or
-both.
+Furthermore, this macro sets the C++ compiler to the one used for compiling
+the deal.II library. The variables will CMAKE_CXX_FLAGS
,
+CMAKE_CXX_FLAGS_DEBUG
, and
+CMAKE_CXX_FLAGS_RELEASE
will be initialized with the empty
+string.
+
+Note: If you wish to override the flags and definitions set by the
+DEAL_II_SETUP_TARGET
macro you have to override the
+corresponding DEAL_II_*
variable instead. See the
+documentation of DEAL_II_SETUP_TARGET
+for further details.