aboutsummaryrefslogtreecommitdiff
path: root/cmake/ThirdParty.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/ThirdParty.cmake')
-rw-r--r--cmake/ThirdParty.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmake/ThirdParty.cmake b/cmake/ThirdParty.cmake
new file mode 100644
index 0000000..8e5b1cc
--- /dev/null
+++ b/cmake/ThirdParty.cmake
@@ -0,0 +1,17 @@
+function(download_third_party path url archive hash_type hash)
+
+ if(NOT EXISTS ${CMAKE_SOURCE_DIR}/third-party/${path})
+
+ if(NOT EXISTS ${CMAKE_BINARY_DIR}/${archive})
+ message("${CMAKE_BINARY_DIR}/${archive} missing")
+ message("Downloading ${url}...")
+ file(DOWNLOAD ${url} ${CMAKE_BINARY_DIR}/${archive}
+ TIMEOUT 60 TLS_VERIFY ON
+ EXPECTED_HASH ${hash_type}=${hash})
+ endif()
+
+ file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/${archive}
+ DESTINATION ${CMAKE_SOURCE_DIR}/third-party)
+ endif()
+
+endfunction()