From 4c1f238fb37aff28157f740e0996c47ee098a0c9 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 13 Nov 2013 15:21:39 +0100 Subject: [PATCH] configure script: add a stub implementation for the --config-cache argument so far, it is only a flag which prevents the cache from being deleted. To warn the user about a potential infinite loop, a warning is printed if this flag was specified and some compiler or some compiler flags were set by the user. This idea was proposed by Roland Kaufmann. --- cmake/Scripts/configure | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/Scripts/configure b/cmake/Scripts/configure index 35470712..f14a7f9f 100755 --- a/cmake/Scripts/configure +++ b/cmake/Scripts/configure @@ -168,6 +168,9 @@ for OPT in "$@"; do OPTARG=${OPT#--} # OPTARG now contains everything after double dashes case "${OPTARG}" in + config-cache*) + config_cache="1" + ;; src-dir=*) # allow the user to use these build macros for another # project (so source-dir is not relative to us) @@ -514,9 +517,14 @@ done # loop if variables that require a full regeneration of the cache are # set (most notably 'CXX' and 'CXX_FLAGS'). # For more details, see http://www.cmake.org/Bug/view.php?id=14119 -echo "--- deleting previous CMake files ---" -rm -rf CMakeFiles -rm -f CMakeCache.txt +if test "$config_cache" = ""; then + echo "--- deleting previous CMake files ---" + rm -rf CMakeFiles + rm -f CMakeCache.txt +elif test "$c_compiler$c_opts$cxx_compiler$cxx_opts$fort_compiler$fort_opts" != ""; then + echo "--- WARNING '--config-cache' option specified but a compiler was set" + echo "--- from the command line. This may lead to an infinite loop!" +fi # pass everything on to CMake CMDLINE="${ENVVARS}${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples}${use_underscoring}${c_compiler}${c_opts}${cxx_compiler}${cxx_opts}${fort_compiler}${fort_opts}${boost_opts}${buildname}${site} ${FEATURES}"