summaryrefslogtreecommitdiffhomepage
path: root/cmake/modules/MakeAvailable.cmake
blob: 16e976c041bf17d2bab2b862c7142075a4a60458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Populates all declared FetchContent projects. Use this once after everything is set up:
#
#     FetchContent_Declare(zlib ...)
#     FetchContent_Declare(libpng ...)
#     make_available(zlib libpng)

function(make_available)
	foreach(DEPNAME IN LISTS ARGN)
		string(TOLOWER "${DEPNAME}" DEPNAME)
		FetchContent_GetProperties(${DEPNAME})
		if(NOT ${DEPNAME}_POPULATED)
			FetchContent_Populate(${DEPNAME})
			add_subdirectory(${${DEPNAME}_SOURCE_DIR} ${${DEPNAME}_BINARY_DIR} EXCLUDE_FROM_ALL)
		endif()
	endforeach()
endfunction()