From 582fb21467f51fe8ca51fcd8d6e375ccc0e5b501 Mon Sep 17 00:00:00 2001 From: maier Date: Sun, 15 Dec 2013 19:21:56 +0000 Subject: [PATCH] CMake: Improve default config; Rename Config.sample to config.sample git-svn-id: https://svn.dealii.org/trunk@32023 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/modules/FindDEALII_LAPACK.cmake | 1 - deal.II/cmake/setup_finalize.cmake | 47 ++++++++++++++++++- deal.II/doc/users/cmake.html | 29 ++++++++---- .../users/{Config.sample => config.sample} | 43 +++++++++++++---- 4 files changed, 102 insertions(+), 18 deletions(-) rename deal.II/doc/users/{Config.sample => config.sample} (94%) diff --git a/deal.II/cmake/modules/FindDEALII_LAPACK.cmake b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake index 2033f4cf0d..903c19235d 100644 --- a/deal.II/cmake/modules/FindDEALII_LAPACK.cmake +++ b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake @@ -26,7 +26,6 @@ # BLAS_FOUND # BLAS_LIBRARIES # BLAS_LINKER_FLAGS -# METIS_INCLUDE_DIRS # diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index 3221dca03d..fea5613d55 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -125,7 +125,6 @@ MACRO(_summary) FILE(APPEND ${_log_summary} "${ARGN}") ENDMACRO() - _both( "### # @@ -310,3 +309,49 @@ _summary(" to print a help message with a list of top level targets\n") _both("#\n###") + +######################################################################## +# # +# Dump the cache into config.cmake: # +# # +######################################################################## + +SET(_config_cmake "${CMAKE_BINARY_DIR}/config.cmake") +FILE(WRITE ${_config_cmake} +"# +# This is a raw CMake cache dump of this build directory suitable as an +# initial cache file: Use this file to preseed a CMake cache in an empty +# build directory by (note that it is still necessary to declare a source +# directory): +# $ cmake -C [...]/config.cmake ../deal.II +# +# If you want to have a clean configuration file have a look at +# doc/users/config.sample +#\n" + ) + +FUNCTION(_config _var) + # It is absolutely beyond my comprehension why on earth there is + # hardcoded logic built into CMake to throw an error if one uses + # uppercase variants of FindPACKAGE call variables... + IF(NOT _var MATCHES "BOOST_DIR") + UNSET(${_var}) + ENDIF() + # + # We have to get down to the raw entry in the cache, therefore clear the + # current value (and do it in a function to get private scope): + # + FILE(APPEND ${_config_cmake} + "SET(${_var} \"${${_var}}\" CACHE STRING \"\")\n" + ) +ENDFUNCTION() + +GET_CMAKE_PROPERTY(_variables CACHE_VARIABLES) +FOREACH(_var + CMAKE_C_COMPILER + CMAKE_CXX_COMPILER + CMAKE_Fortran_COMPILER + ${_variables} + ) + _config(${_var}) +ENDFOREACH() diff --git a/deal.II/doc/users/cmake.html b/deal.II/doc/users/cmake.html index f702d45242..540bb9a6a5 100644 --- a/deal.II/doc/users/cmake.html +++ b/deal.II/doc/users/cmake.html @@ -674,7 +674,7 @@ cmake -D<feature>_FOUND=true \ call the corresponding Find<lib>.cmake module. Therefore, all information that would be otherwise exported by the module must be specified by hand. (See the - Config.sample file for a + config.sample file for a detailed list of valid variables per feature.)

@@ -692,7 +692,7 @@ cmake -DLAPACK_FOUND=true \ or by providing an initial cache file, see advanced setup section. Possible manual overrides are explained in detail in the - in the Config.sample file. + in the config.sample file.

@@ -961,15 +961,28 @@ DEAL_II_PROJECT_CONFIG_RELDIR

Initial cache file and advanced options

- A sample configuration file for preloading the CMake cache with +

+ A sample configuration file for preloading the CMake cache with

-$ cmake -C Config.sample <...>
+$ cmake -C config.sample <...>
 
- can be found here. - This sample configuration covers all options mentioned in this - documentation as well as some advanced aspects in feature - configuration. + can be found here. + This sample configuration covers all options mentioned in this + documentation as well as some advanced aspects in feature + configuration. +

+

+ The build system automatically exports a config.camke + into the binary directory that can be used to conveniently clone a + build directories cache entries, e.g. assuming that there is a + configured build directory build next to an empty + directory build2: +

+$ cd build2
+$ cmake -C ../build/config.cmake ../deal.II
+
+

Compiling only certain parts

diff --git a/deal.II/doc/users/Config.sample b/deal.II/doc/users/config.sample similarity index 94% rename from deal.II/doc/users/Config.sample rename to deal.II/doc/users/config.sample index c0fdc27e65..c81f471a80 100644 --- a/deal.II/doc/users/Config.sample +++ b/deal.II/doc/users/config.sample @@ -1,9 +1,37 @@ -## ## -# Example configuration file # -# # -# See doc/readme.html and doc/users/cmake.html for further # -# details on how to use the cmake build system of deal.II. # -## ## +## --------------------------------------------------------------------- +## $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. +## +## --------------------------------------------------------------------- + +# +# Example configuration file +# +# This file can be used as a script to preseed the initial cache of a build +# directory. To do so, invoke cmake with +# +# $ cmake -C configuration.cmake [...] +# +# +# Please note that this file is actually intrepeted as a full featured +# CMake script file, so in order to set variables in the cache a statement +# of the form +# +# SET( CACHE "") +# +# has to be used. See doc/readme.html and doc/users/cmake.html for further +# details on how to use the cmake build system of deal.II. +# ########################################################################### @@ -147,7 +175,6 @@ # "If set to ON, then use 64-bit data types to represent global degree of freedom indices. The default is to OFF. You only want to set this to ON if you will solve problems with more than 2^31 (approximately 2 billion) unknowns. If set to ON, you also need to ensure that both Trilinos and/or PETSc support 64-bit indices." # ) # -# ########################################################################### @@ -648,7 +675,7 @@ # "Library suffix for the debug library" # ) # -# SET_IF_EMPTY(DEAL_II_RELEASE_SUFFIX "" CACHE STRING +# SET(DEAL_II_RELEASE_SUFFIX "" CACHE STRING # "Library suffix for the release library" # ) # -- 2.39.5