FetchContent always uses CMP0097 NEW behavior
When FetchContent creates its sub-build, it does not pass through the state of the CMP0097 policy at the time FetchContent_Declare()
was called. The sub-build always gets the NEW policy behavior because the sub-build's CMakeLists.txt
file specifies cmake_minimum_required(VERSION <currently-running-version>)
, which will always be a version that gives the NEW behavior. The cmake_minimum_required()
call not specifying an actual version is a separate problem.
The consequence of this bug is that when using CMake 3.16 or later, if a project uses GIT_SUBMODULES ""
in a call to FetchContent_Declare()
, that will always result in no git submodules being initialised or updated. When using CMake 3.11-3.15, all git submodules will be initialised and updated. The policy setting for CMP0097 is ignored in all cases.