ExternalProject: Integration with cmake --fresh
The cmake --fresh
option added in CMake 3.24 doesn't clean ExternalProject. For example, switching build generators still fails when using --fresh
. Example CMakeLists.txt:
cmake_minimum_required(VERSION 3.24)
project(fresh LANGUAGES NONE)
include(ExternalProject)
ExternalProject_Add(minimal
GIT_REPOSITORY https://github.com/scivision/cmake-externalproject
GIT_TAG main
TLS_VERIFY true
BUILD_COMMAND ""
TEST_COMMAND ""
INSTALL_COMMAND ""
)
then do:
cmake -B build -G Ninja
cmake --build build
cmake -B build -G "Unix Makefiles" --fresh
cmake --build build
results in error like:
CMake Error: Error: generator : Unix Makefiles
Does not match the generator used previously: Ninja
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
Edited by Brad King