if(CMAKE_VERSION VERSION_LESS "3.28.0") macro(FetchContent_Declare_ExcludeFromAll) FetchContent_Declare(${ARGV}) endmacro() # Like `FetchContent_MakeAvailable` but passes EXCLUDE_FROM_ALL to `add_subdirectory`. macro(FetchContent_MakeAvailable_ExcludeFromAll) foreach(name ${ARGV}) string(TOLOWER ${name} nameLower) FetchContent_GetProperties(${name}) if(NOT ${${nameLower}_POPULATED}) FetchContent_Populate(${name}) if(EXISTS ${${nameLower}_SOURCE_DIR}/CMakeLists.txt) add_subdirectory(${${nameLower}_SOURCE_DIR} ${${nameLower}_BINARY_DIR} EXCLUDE_FROM_ALL) endif() endif() endforeach() endmacro() else() macro(FetchContent_Declare_ExcludeFromAll) FetchContent_Declare(${ARGV} EXCLUDE_FROM_ALL) endmacro() macro(FetchContent_MakeAvailable_ExcludeFromAll) FetchContent_MakeAvailable(${ARGV}) endmacro() endif()