File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,10 +12,23 @@ endif()
1212
1313if (NOT (EXISTS ${CPM_DOWNLOAD_LOCATION} ))
1414 message (STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION} " )
15+ get_filename_component (CPM_DOWNLOAD_DIRECTORY "${CPM_DOWNLOAD_LOCATION} " DIRECTORY )
16+ file (MAKE_DIRECTORY "${CPM_DOWNLOAD_DIRECTORY} " )
1517 file (DOWNLOAD
1618 https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
17- ${CPM_DOWNLOAD_LOCATION}
19+ "${CPM_DOWNLOAD_LOCATION} "
20+ STATUS CPM_DOWNLOAD_STATUS
21+ LOG CPM_DOWNLOAD_LOG
22+ TLS_VERIFY ON
1823 )
24+ list (GET CPM_DOWNLOAD_STATUS 0 CPM_DOWNLOAD_STATUS_CODE)
25+ list (GET CPM_DOWNLOAD_STATUS 1 CPM_DOWNLOAD_STATUS_MESSAGE)
26+ if (NOT CPM_DOWNLOAD_STATUS_CODE EQUAL 0)
27+ message (FATAL_ERROR "Failed to download CPM.cmake: ${CPM_DOWNLOAD_STATUS_MESSAGE} \n ${CPM_DOWNLOAD_LOG} " )
28+ endif ()
1929endif ()
2030
21- include (${CPM_DOWNLOAD_LOCATION} )
31+ include ("${CPM_DOWNLOAD_LOCATION} " )
32+ if (NOT COMMAND CPMAddPackage)
33+ message (FATAL_ERROR "Downloaded CPM.cmake did not define CPMAddPackage: ${CPM_DOWNLOAD_LOCATION} " )
34+ endif ()
Original file line number Diff line number Diff line change @@ -67,14 +67,27 @@ else()
6767endif ()
6868
6969if (NOT (EXISTS ${CPM_DOWNLOAD_LOCATION} ))
70- message (STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION} " )
71- file (DOWNLOAD
72- https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
73- ${CPM_DOWNLOAD_LOCATION}
74- )
70+ message (STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION} " )
71+ get_filename_component (CPM_DOWNLOAD_DIRECTORY "${CPM_DOWNLOAD_LOCATION} " DIRECTORY )
72+ file (MAKE_DIRECTORY "${CPM_DOWNLOAD_DIRECTORY} " )
73+ file (DOWNLOAD
74+ https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
75+ "${CPM_DOWNLOAD_LOCATION} "
76+ STATUS CPM_DOWNLOAD_STATUS
77+ LOG CPM_DOWNLOAD_LOG
78+ TLS_VERIFY ON
79+ )
80+ list (GET CPM_DOWNLOAD_STATUS 0 CPM_DOWNLOAD_STATUS_CODE)
81+ list (GET CPM_DOWNLOAD_STATUS 1 CPM_DOWNLOAD_STATUS_MESSAGE)
82+ if (NOT CPM_DOWNLOAD_STATUS_CODE EQUAL 0)
83+ message (FATAL_ERROR "Failed to download CPM.cmake: ${CPM_DOWNLOAD_STATUS_MESSAGE} \n ${CPM_DOWNLOAD_LOG} " )
84+ endif ()
7585endif ()
7686
77- include (${CPM_DOWNLOAD_LOCATION} )
87+ include ("${CPM_DOWNLOAD_LOCATION} " )
88+ if (NOT COMMAND CPMAddPackage)
89+ message (FATAL_ERROR "Downloaded CPM.cmake did not define CPMAddPackage: ${CPM_DOWNLOAD_LOCATION} " )
90+ endif ()
7891#---------------------------------------------------------------------------------------------------
7992
8093
You can’t perform that action at this time.
0 commit comments