Skip to content
Snippets Groups Projects
Commit c5f69413 authored by Lars Bilke's avatar Lars Bilke
Browse files

[cmake] Update CPM to 0.38.2.

parent 0e52c46c
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ if(NOT COMMAND cpm_message) ...@@ -42,7 +42,7 @@ if(NOT COMMAND cpm_message)
endfunction() endfunction()
endif() endif()
set(CURRENT_CPM_VERSION 0.37.0) set(CURRENT_CPM_VERSION 0.38.2)
get_filename_component(CPM_CURRENT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" REALPATH) get_filename_component(CPM_CURRENT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
if(CPM_DIRECTORY) if(CPM_DIRECTORY)
...@@ -513,8 +513,8 @@ function(CPMAddPackage) ...@@ -513,8 +513,8 @@ function(CPMAddPackage)
if(argnLength EQUAL 1) if(argnLength EQUAL 1)
cpm_parse_add_package_single_arg("${ARGN}" ARGN) cpm_parse_add_package_single_arg("${ARGN}" ARGN)
# The shorthand syntax implies EXCLUDE_FROM_ALL # The shorthand syntax implies EXCLUDE_FROM_ALL and SYSTEM
set(ARGN "${ARGN};EXCLUDE_FROM_ALL;YES") set(ARGN "${ARGN};EXCLUDE_FROM_ALL;YES;SYSTEM;YES;")
endif() endif()
set(oneValueArgs set(oneValueArgs
...@@ -531,6 +531,7 @@ function(CPMAddPackage) ...@@ -531,6 +531,7 @@ function(CPMAddPackage)
DOWNLOAD_COMMAND DOWNLOAD_COMMAND
FIND_PACKAGE_ARGUMENTS FIND_PACKAGE_ARGUMENTS
NO_CACHE NO_CACHE
SYSTEM
GIT_SHALLOW GIT_SHALLOW
EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL
SOURCE_SUBDIR SOURCE_SUBDIR
...@@ -626,6 +627,7 @@ function(CPMAddPackage) ...@@ -626,6 +627,7 @@ function(CPMAddPackage)
NAME "${CPM_ARGS_NAME}" NAME "${CPM_ARGS_NAME}"
SOURCE_DIR "${PACKAGE_SOURCE}" SOURCE_DIR "${PACKAGE_SOURCE}"
EXCLUDE_FROM_ALL "${CPM_ARGS_EXCLUDE_FROM_ALL}" EXCLUDE_FROM_ALL "${CPM_ARGS_EXCLUDE_FROM_ALL}"
SYSTEM "${CPM_ARGS_SYSTEM}"
OPTIONS "${CPM_ARGS_OPTIONS}" OPTIONS "${CPM_ARGS_OPTIONS}"
SOURCE_SUBDIR "${CPM_ARGS_SOURCE_SUBDIR}" SOURCE_SUBDIR "${CPM_ARGS_SOURCE_SUBDIR}"
DOWNLOAD_ONLY "${DOWNLOAD_ONLY}" DOWNLOAD_ONLY "${DOWNLOAD_ONLY}"
...@@ -646,19 +648,21 @@ function(CPMAddPackage) ...@@ -646,19 +648,21 @@ function(CPMAddPackage)
return() return()
endif() endif()
if(CPM_USE_LOCAL_PACKAGES OR CPM_LOCAL_PACKAGES_ONLY) if(NOT CPM_ARGS_FORCE)
cpm_find_package(${CPM_ARGS_NAME} "${CPM_ARGS_VERSION}" ${CPM_ARGS_FIND_PACKAGE_ARGUMENTS}) if(CPM_USE_LOCAL_PACKAGES OR CPM_LOCAL_PACKAGES_ONLY)
cpm_find_package(${CPM_ARGS_NAME} "${CPM_ARGS_VERSION}" ${CPM_ARGS_FIND_PACKAGE_ARGUMENTS})
if(CPM_PACKAGE_FOUND) if(CPM_PACKAGE_FOUND)
cpm_export_variables(${CPM_ARGS_NAME}) cpm_export_variables(${CPM_ARGS_NAME})
return() return()
endif() endif()
if(CPM_LOCAL_PACKAGES_ONLY) if(CPM_LOCAL_PACKAGES_ONLY)
message( message(
SEND_ERROR SEND_ERROR
"${CPM_INDENT} ${CPM_ARGS_NAME} not found via find_package(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION})" "${CPM_INDENT} ${CPM_ARGS_NAME} not found via find_package(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION})"
) )
endif()
endif() endif()
endif() endif()
...@@ -713,9 +717,15 @@ function(CPMAddPackage) ...@@ -713,9 +717,15 @@ function(CPMAddPackage)
get_filename_component(download_directory ${download_directory} ABSOLUTE) get_filename_component(download_directory ${download_directory} ABSOLUTE)
list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS SOURCE_DIR ${download_directory}) list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS SOURCE_DIR ${download_directory})
file(LOCK ${download_directory}/../cmake.lock) if(CPM_SOURCE_CACHE)
file(LOCK ${download_directory}/../cmake.lock)
endif()
if(EXISTS ${download_directory}) if(EXISTS ${download_directory})
if(CPM_SOURCE_CACHE)
file(LOCK ${download_directory}/../cmake.lock RELEASE)
endif()
cpm_store_fetch_properties( cpm_store_fetch_properties(
${CPM_ARGS_NAME} "${download_directory}" ${CPM_ARGS_NAME} "${download_directory}"
"${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-build" "${CPM_FETCHCONTENT_BASE_DIR}/${lower_case_name}-build"
...@@ -733,9 +743,13 @@ function(CPMAddPackage) ...@@ -733,9 +743,13 @@ function(CPMAddPackage)
endif() endif()
cpm_add_subdirectory( cpm_add_subdirectory(
"${CPM_ARGS_NAME}" "${DOWNLOAD_ONLY}" "${CPM_ARGS_NAME}"
"${${CPM_ARGS_NAME}_SOURCE_DIR}/${CPM_ARGS_SOURCE_SUBDIR}" "${${CPM_ARGS_NAME}_BINARY_DIR}" "${DOWNLOAD_ONLY}"
"${CPM_ARGS_EXCLUDE_FROM_ALL}" "${CPM_ARGS_OPTIONS}" "${${CPM_ARGS_NAME}_SOURCE_DIR}/${CPM_ARGS_SOURCE_SUBDIR}"
"${${CPM_ARGS_NAME}_BINARY_DIR}"
"${CPM_ARGS_EXCLUDE_FROM_ALL}"
"${CPM_ARGS_SYSTEM}"
"${CPM_ARGS_OPTIONS}"
) )
set(PACKAGE_INFO "${PACKAGE_INFO} at ${download_directory}") set(PACKAGE_INFO "${PACKAGE_INFO} at ${download_directory}")
...@@ -783,20 +797,23 @@ function(CPMAddPackage) ...@@ -783,20 +797,23 @@ function(CPMAddPackage)
"${CPM_ARGS_NAME}" "${CPM_ARGS_VERSION}" "${PACKAGE_INFO}" "${CPM_ARGS_UNPARSED_ARGUMENTS}" "${CPM_ARGS_NAME}" "${CPM_ARGS_VERSION}" "${PACKAGE_INFO}" "${CPM_ARGS_UNPARSED_ARGUMENTS}"
) )
cpm_fetch_package("${CPM_ARGS_NAME}" populated) cpm_fetch_package("${CPM_ARGS_NAME}" populated)
if(CPM_SOURCE_CACHE AND download_directory)
file(LOCK ${download_directory}/../cmake.lock RELEASE)
endif()
if(${populated}) if(${populated})
cpm_add_subdirectory( cpm_add_subdirectory(
"${CPM_ARGS_NAME}" "${DOWNLOAD_ONLY}" "${CPM_ARGS_NAME}"
"${${CPM_ARGS_NAME}_SOURCE_DIR}/${CPM_ARGS_SOURCE_SUBDIR}" "${${CPM_ARGS_NAME}_BINARY_DIR}" "${DOWNLOAD_ONLY}"
"${CPM_ARGS_EXCLUDE_FROM_ALL}" "${CPM_ARGS_OPTIONS}" "${${CPM_ARGS_NAME}_SOURCE_DIR}/${CPM_ARGS_SOURCE_SUBDIR}"
"${${CPM_ARGS_NAME}_BINARY_DIR}"
"${CPM_ARGS_EXCLUDE_FROM_ALL}"
"${CPM_ARGS_SYSTEM}"
"${CPM_ARGS_OPTIONS}"
) )
endif() endif()
cpm_get_fetch_properties("${CPM_ARGS_NAME}") cpm_get_fetch_properties("${CPM_ARGS_NAME}")
endif() endif()
if(EXISTS ${download_directory}/../cmake.lock)
file(LOCK ${download_directory}/../cmake.lock RELEASE)
endif()
set(${CPM_ARGS_NAME}_ADDED YES) set(${CPM_ARGS_NAME}_ADDED YES)
cpm_export_variables("${CPM_ARGS_NAME}") cpm_export_variables("${CPM_ARGS_NAME}")
endfunction() endfunction()
...@@ -942,13 +959,18 @@ function( ...@@ -942,13 +959,18 @@ function(
SOURCE_DIR SOURCE_DIR
BINARY_DIR BINARY_DIR
EXCLUDE EXCLUDE
SYSTEM
OPTIONS OPTIONS
) )
if(NOT DOWNLOAD_ONLY AND EXISTS ${SOURCE_DIR}/CMakeLists.txt) if(NOT DOWNLOAD_ONLY AND EXISTS ${SOURCE_DIR}/CMakeLists.txt)
set(addSubdirectoryExtraArgs "")
if(EXCLUDE) if(EXCLUDE)
set(addSubdirectoryExtraArgs EXCLUDE_FROM_ALL) list(APPEND addSubdirectoryExtraArgs EXCLUDE_FROM_ALL)
else() endif()
set(addSubdirectoryExtraArgs "") if("${SYSTEM}" AND "${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.25")
# https://cmake.org/cmake/help/latest/prop_dir/SYSTEM.html#prop_dir:SYSTEM
list(APPEND addSubdirectoryExtraArgs SYSTEM)
endif() endif()
if(OPTIONS) if(OPTIONS)
foreach(OPTION ${OPTIONS}) foreach(OPTION ${OPTIONS})
...@@ -1079,6 +1101,7 @@ function(cpm_prettify_package_arguments OUT_VAR IS_IN_COMMENT) ...@@ -1079,6 +1101,7 @@ function(cpm_prettify_package_arguments OUT_VAR IS_IN_COMMENT)
DOWNLOAD_COMMAND DOWNLOAD_COMMAND
FIND_PACKAGE_ARGUMENTS FIND_PACKAGE_ARGUMENTS
NO_CACHE NO_CACHE
SYSTEM
GIT_SHALLOW GIT_SHALLOW
) )
set(multiValueArgs OPTIONS) set(multiValueArgs OPTIONS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment