I added googletest to my build using FetchContent like this:
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG main
)
FetchContent_MakeAvailable(googletest)
But after I did this, each time CMake needs to rerun its configure/generate steps it takes about ~25 seconds. This is really interfering with my workflow when making iterative changes to the build.
C:\NSEW>cmake --build .
[0/2] Re-checking globbed directories...
[1/2] Re-running CMake...
| It takes about 20 seconds until the following output is shown |
-- Could NOT find Python (missing: Python_EXECUTABLE Interpreter)
-- Found SFML 2.5.1 in C:/install/lib/cmake/SFML
-- Configuring done
-- Generating done
-- Build files have been written to: C:/NSEW
[0/2] Re-checking globbed directories...
ninja: no work to do.
googletest has an optional Python dependency but since Python isn't installed, CMake tries every possible installation path which takes very long. CMake appears to do this search on every reconfigure. How to stop CMake from doing this very slow search for a component I don't need?
I tried to set the cache variable Python_EXECUTABLE to NO / Python-NOTFOUND but that didn't seem to help.