From d9cd2f1bb72b621659bad87d800257d4ff4a6f0c Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Thu, 24 Dec 2020 15:22:16 +0000 Subject: [PATCH] build(cmake/modules): introduce CPM Signed-off-by: Leonardo Di Donato --- cmake/modules/CPM.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cmake/modules/CPM.cmake diff --git a/cmake/modules/CPM.cmake b/cmake/modules/CPM.cmake new file mode 100644 index 00000000..98436d25 --- /dev/null +++ b/cmake/modules/CPM.cmake @@ -0,0 +1,19 @@ +set(CPM_DOWNLOAD_VERSION 0.27.2) + +if(CPM_SOURCE_CACHE) + set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +elseif(DEFINED ENV{CPM_SOURCE_CACHE}) + set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +else() + set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +endif() + +if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) + message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") + file(DOWNLOAD + https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake + ${CPM_DOWNLOAD_LOCATION} + ) +endif() + +include(${CPM_DOWNLOAD_LOCATION}) \ No newline at end of file