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.)
This commit is contained in:
Martin Storsjö committed 2022-10-01 13:29:15 +03:00
1 parent d57de8ba8b
commit 972b3b2725
5 files changed
+5

No files matched your search

+1
View File
@@ -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 \
+1
View File
@@ -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 \
+1
View File
@@ -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" \
+1
View File
@@ -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 \
+1
View File
@@ -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" \