How can I cache the results of FetchContent after initial download?
Hello. Suppose I have the following CMake file:
cmake_minimum_required(VERSION 3.11)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.0
)
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
message(STATUS "Fetching Google Test...")
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif()
add_executable(example
main.cpp)
target_link_libraries(example PUBLIC gtest gtest_main)
During the generation step Google Test is downloaded and I get "Fetching Google Test..." message as I expect. But if I later change something about this CMake file, I get:
-- Fetching Google Test...
-- Configuring done
-- Generating done
-- Build files have been written to: ...
...
However, Google Test is not downloaded again, which is good, but I can't find a way to not display this message again. What can I do?
I'm using cmake version 3.12.20180802-ga1d130, Ubuntu 18.04, "Unix Makefiles" generator.