devilutionX/CMake/functions/FetchContent_MakeAvailableExcludeFromAll.cmake
Gleb Mazovetskiy 4848632db2 CMake: Organize files
1. Platform and toolchain files are now all under `platforms/`, with a
   single `CMake/platforms/${platform}.cmake` per platform.

2. Custom functions/macros are under `functions/`.

3. Finder modules are in `/finders`.
2021-12-07 18:32:25 +01:00

14 lines
669 B
CMake

# Like `FetchContent_MakeAvailable` but passes EXCLUDE_FROM_ALL to `add_subdirectory`.
macro(FetchContent_MakeAvailableExcludeFromAll)
foreach(contentName IN ITEMS ${ARGV})
string(TOLOWER ${contentName} contentNameLower)
FetchContent_GetProperties(${contentName})
if(NOT ${contentNameLower}_POPULATED)
FetchContent_Populate(${contentName})
if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt)
add_subdirectory(${${contentNameLower}_SOURCE_DIR}
${${contentNameLower}_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()
endforeach()
endmacro()