Prevent FetchContent_MakeAvailable to execute CMakeLists.txt

After seeing the deprecation warnings for FetchContent_Populate I replaced it with FetchContent_MakeAvailable but now my project is failing.

I use to do this (in a nutshell)

# ...
FetchContent_Declare(re-logging ...)
FetchContent_Populate(re-logging)
include("${re-logging_ROOT_DIR}/re-logging.cmake")

The issue I am facing with replacing FetchContent_Populate with FetchContent_MakeAvailable is that FetchContent_MakeAvailable seems to automatically “execute” CMakeLists.txt included in re-logging but I don’t want this to happen. FetchContent_Populate did not do that.

I want to load re-logging.cmake instead.

Is there a way to do this?

Use the SOURCE_SUBDIR option and set it to a path that doesn’t exist. Issue 26220 asks for a dedicated keyword to say “don’t add the subdirectory, only populate it”.

Thank you for the workaround.