From 2e9272384da54956c4c187b85b8d83986eefe932 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Mon, 11 Nov 2013 16:57:26 +0100 Subject: [PATCH] build system: prevent endless loop when using dunecontrol this seems to be a bug in cmake 2.8.10.2: if the user sets the CMAKE_CXX_COMPILER variable for a build directory where this variable has already been set, one gets an endless loop. This stings especially if using the dunecontrol compatibility layer as the compiler flags are unconditionally set via the CXX_FLAGS environment variable in the options file. Running duncontrol on a module twice will thus trigger the infinite loop if some compiler flags are set by the user. The solution is relatively simple: Delete the CMakeFiles directory before calling cmake. for the dunecontrol compatibility mode, we do this in the configure script. For details about the cmake bug, see http://www.cmake.org/Bug/view.php?id=14119 --- cmake/Scripts/configure | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/Scripts/configure b/cmake/Scripts/configure index 29e3e5d0a..785fa13c3 100755 --- a/cmake/Scripts/configure +++ b/cmake/Scripts/configure @@ -510,6 +510,13 @@ done # only wrap in env command if any variable were actually passed [ -n "${ENVVARS}" ] && ENVVARS="env ${ENVVARS} " +# delete the previous 'CMakeFiles' directory. this prevents an endless +# 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 + # 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}" echo --- calling CMake ---