summaryrefslogtreecommitdiffhomepage
path: root/cmake/modules/MakeAvailable.cmake
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-03-06 21:47:34 +0100
committerAki <please@ignore.pl>2024-03-06 21:47:34 +0100
commita85fcbf8720562e77e0441ac26cb99d89564400c (patch)
treea15d30b7d00645685c50c291871d34aa5b188bc0 /cmake/modules/MakeAvailable.cmake
parent54fa233a00607b9436c03c78b50b9107a33baa0a (diff)
parent1c558822681bbed5121bcc19816cbbac6a437b2a (diff)
downloadstarshatter-a85fcbf8720562e77e0441ac26cb99d89564400c.zip
starshatter-a85fcbf8720562e77e0441ac26cb99d89564400c.tar.gz
starshatter-a85fcbf8720562e77e0441ac26cb99d89564400c.tar.bz2
External projects with established upstream are no longer part of this source tree
Diffstat (limited to 'cmake/modules/MakeAvailable.cmake')
-rw-r--r--cmake/modules/MakeAvailable.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/cmake/modules/MakeAvailable.cmake b/cmake/modules/MakeAvailable.cmake
new file mode 100644
index 0000000..16e976c
--- /dev/null
+++ b/cmake/modules/MakeAvailable.cmake
@@ -0,0 +1,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()