From 972b3b2725bcb36b5057819471972425ba518477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 30 Sep 2022 14:05:34 +0300 Subject: [PATCH] Wipe the cmake cache before rerunning cmake When rebuilding in an already built directory, cmake does use the cache file, containing what variables were set to previously. When changing build configuration (building with a different prefix, or changing build configurations) this can often result in failed cmake runs. Wipe the cache (and the rest of the cmake temp files) by default. This makes sure that the full cmake configuration is run each time when running the build scripts, just like it does the first time. (This doesn't remove the build artifacts; if nothing of significance has changed, ninja would still reuse old built files.) By setting the env variable NO_RECONF, this behaviour can be skipped, rerunning cmake without wiping the cache inbetween. (For cases where the user knows that the configuration hasn't changed since the last build, this can speed up the cmake execution time a bit.) --- build-compiler-rt.sh | 1 + build-libcxx.sh | 1 + build-lldb-mi.sh | 1 + build-llvm.sh | 1 + build-openmp.sh | 1 + 5 files changed, 5 insertions(+) diff --git a/build-compiler-rt.sh b/build-compiler-rt.sh index fc589c5..bbcb4ec 100755 --- a/build-compiler-rt.sh +++ b/build-compiler-rt.sh @@ -96,6 +96,7 @@ for arch in $ARCHS; do [ -z "$CLEAN" ] || rm -rf build-$arch$BUILD_SUFFIX mkdir -p build-$arch$BUILD_SUFFIX cd build-$arch$BUILD_SUFFIX + [ -n "$NO_RECONF" ] || rm -rf CMake* cmake \ ${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/build-libcxx.sh b/build-libcxx.sh index 6b18d97..be0a8bc 100755 --- a/build-libcxx.sh +++ b/build-libcxx.sh @@ -83,6 +83,7 @@ for arch in $ARCHS; do [ -z "$CLEAN" ] || rm -rf build-$arch mkdir -p build-$arch cd build-$arch + [ -n "$NO_RECONF" ] || rm -rf CMake* cmake \ ${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/build-lldb-mi.sh b/build-lldb-mi.sh index d154902..85e0a49 100755 --- a/build-lldb-mi.sh +++ b/build-lldb-mi.sh @@ -112,6 +112,7 @@ cd lldb-mi [ -z "$CLEAN" ] || rm -rf $BUILDDIR mkdir -p $BUILDDIR cd $BUILDDIR +[ -n "$NO_RECONF" ] || rm -rf CMake* cmake \ ${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ diff --git a/build-llvm.sh b/build-llvm.sh index c173ff9..e285046 100755 --- a/build-llvm.sh +++ b/build-llvm.sh @@ -292,6 +292,7 @@ fi [ -z "$CLEAN" ] || rm -rf $BUILDDIR mkdir -p $BUILDDIR cd $BUILDDIR +[ -n "$NO_RECONF" ] || rm -rf CMake* # Building LLDB for macOS fails unless building libc++ is enabled at the # same time, or unless the LLDB tests are disabled. cmake \ diff --git a/build-openmp.sh b/build-openmp.sh index 4ba41b0..ee6f1a5 100755 --- a/build-openmp.sh +++ b/build-openmp.sh @@ -86,6 +86,7 @@ for arch in $ARCHS; do [ -z "$CLEAN" ] || rm -rf build-$arch mkdir -p build-$arch cd build-$arch + [ -n "$NO_RECONF" ] || rm -rf CMake* cmake \ ${CMAKE_GENERATOR+-G} "$CMAKE_GENERATOR" \