From e12b3ac6c07c16e918b2032e09f121cd2fb1789b Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sat, 27 Jul 2013 12:12:34 +0000 Subject: [PATCH] CMake: Cleanup and restructure git-svn-id: https://svn.dealii.org/trunk@30172 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 2 + deal.II/cmake/setup_cached_variables.cmake | 6 ++- deal.II/cmake/setup_deal_ii.cmake | 48 ------------------- deal.II/cmake/setup_finalize.cmake | 13 +++++ deal.II/cmake/setup_post_project_call.cmake | 53 +++++++++++++++++++++ 5 files changed, 72 insertions(+), 50 deletions(-) create mode 100644 deal.II/cmake/setup_post_project_call.cmake diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 04dba539c6..45d1ad2964 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -72,6 +72,8 @@ PROJECT(deal.II CXX) ENABLE_LANGUAGE_OPTIONAL(C) ENABLE_LANGUAGE_OPTIONAL(Fortran) +INCLUDE(setup_post_project_call) + INCLUDE(setup_deal_ii) INCLUDE(setup_compiler_flags) diff --git a/deal.II/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake index e8667e17c1..7260738c67 100644 --- a/deal.II/cmake/setup_cached_variables.cmake +++ b/deal.II/cmake/setup_cached_variables.cmake @@ -142,7 +142,7 @@ ENDIF() OPTION(DEAL_II_ALLOW_PLATFORM_INTROSPECTION - "Allow platform introspection for CPU command set, SSE and AVX" + "Allow platform introspection for CPU command sets, SSE and AVX" ON ) MARK_AS_ADVANCED(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) @@ -201,7 +201,6 @@ OPTION(DEAL_II_WITH_64BIT_INDICES ) - # # Tell the user very prominently, that we're doing things differently w.r.t # CMAKE_(C|CXX)_FLAGS_(DEBUG|RELEASE) @@ -213,6 +212,7 @@ FOREACH(_flag SHARED_LINKER_FLAGS_DEBUG ) IF(NOT "${CMAKE_${_flag}}" STREQUAL "") + UNSET(${CMAKE_${_flag}} CACHE) MESSAGE(FATAL_ERROR "\nThe deal.II cmake build system does not use CMAKE_${_flag}.\n" "Use DEAL_II_${_flag}, instead!\n\n" @@ -220,6 +220,7 @@ FOREACH(_flag ENDIF() ENDFOREACH() + # # Hide all unused compiler flag variables: # @@ -246,6 +247,7 @@ FOREACH(_flag SET(${_flag} "" CACHE INTERNAL "" FORCE) ENDFOREACH() + # # Set cached compiler flags to an empty string: # diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index 931bf618f3..b9078a241e 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -51,8 +51,6 @@ # DEAL_II_PROJECT_CONFIG_RELDIR *) # # DEAL_II_BUILD_TYPES -# DEAL_II_WITH_BUNDLED_DIRECTORY -# DEAL_II_WITH_DOC_DIRECTORY # # *) Can be overwritten by the command line via -D<...> # @@ -146,49 +144,3 @@ IF(CMAKE_BUILD_TYPE MATCHES "Release") LIST(APPEND DEAL_II_BUILD_TYPES "RELEASE") ENDIF() - -######################################################################## -# # -# Cleanup and setup that has to happen after the call to PROJECT(): # -# # -######################################################################## - -# -# Cleanup some files used for storing the names of all object targets that -# will be bundled to the deal.II library. -# (Right now, i.e. cmake 2.8.8, this is the only reliable way to get -# information into a global scope...) -# -FOREACH(_build ${DEAL_II_BUILD_TYPES}) - STRING(TOLOWER "${_build}" _build_lowercase) - FILE(REMOVE - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase} - ) -ENDFOREACH() - -IF(DEAL_II_PREFER_STATIC_LIBS) - # - # Invert the search order for libraries when DEAL_II_PREFER_STATIC_LIBS - # is set. This will prefer static archives instead of shared libraries: - # - # TODO: Does this work on a Windows or CYGWIN target? - LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) -ENDIF() - -# -# Cross compilation stuff: -# -IF(CMAKE_CROSSCOMPILING) - # - # Disable platform introspection when cross compiling - # - SET(DEAL_II_ALLOW_PLATFORM_INTROSPECTION OFF CACHE BOOL "" FORCE) - - # - # Import native expand_instantiations for use in cross compilation: - # - SET(DEAL_II_NATIVE "DEAL_II_NATIVE-NOTFOUND" CACHE FILEPATH - "A pointer to a native deal.Ii build directory" - ) - INCLUDE(${DEAL_II_NATIVE}/cmake/scripts/importExecutables.cmake) -ENDIF() diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index e2f919a309..c530dc2cb3 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -60,6 +60,19 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ENDIF() ENDFOREACH() +# +# Cleanup some files used for storing the names of all object targets that +# will be bundled to the deal.II library. +# (Right now, i.e. cmake 2.8.8, this is the only reliable way to get +# information into a global scope...) +# +FOREACH(_build ${DEAL_II_BUILD_TYPES}) + STRING(TOLOWER "${_build}" _build_lowercase) + FILE(REMOVE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase} + ) +ENDFOREACH() + ######################################################################## # # diff --git a/deal.II/cmake/setup_post_project_call.cmake b/deal.II/cmake/setup_post_project_call.cmake new file mode 100644 index 0000000000..690acf5d5d --- /dev/null +++ b/deal.II/cmake/setup_post_project_call.cmake @@ -0,0 +1,53 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 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. +## +## --------------------------------------------------------------------- + + +######################################################################## +# # +# Setup that has to happen after the call to PROJECT(): # +# # +######################################################################## + +# +# Library search order: +# +IF(DEAL_II_PREFER_STATIC_LIBS) + # + # Invert the search order for libraries when DEAL_II_PREFER_STATIC_LIBS + # is set. This will prefer static archives instead of shared libraries: + # + # TODO: Does this work on a Windows or CYGWIN target? + LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) +ENDIF() + + +# +# Cross compilation stuff: +# +IF(CMAKE_CROSSCOMPILING) + # + # Disable platform introspection when cross compiling + # + SET(DEAL_II_ALLOW_PLATFORM_INTROSPECTION OFF CACHE BOOL "" FORCE) + + # + # Import native expand_instantiations for use in cross compilation: + # + SET(DEAL_II_NATIVE "DEAL_II_NATIVE-NOTFOUND" CACHE FILEPATH + "A pointer to a native deal.Ii build directory" + ) + INCLUDE(${DEAL_II_NATIVE}/cmake/scripts/importExecutables.cmake) +ENDIF() -- 2.39.5