summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-06-28 13:19:22 (GMT)
committerBrad King <brad.king@kitware.com>2023-06-29 13:49:51 (GMT)
commit9ede4cab2ba8a405749c09922a7fe54c70ecc190 (patch)
tree283d7965429baf61d5360189c6a7512aa6ed9501 /Modules
parentf9fe9099ab1b02239f5904c8c4ca477f63de1f2c (diff)
downloadCMake-9ede4cab2ba8a405749c09922a7fe54c70ecc190.zip
CMake-9ede4cab2ba8a405749c09922a7fe54c70ecc190.tar.gz
CMake-9ede4cab2ba8a405749c09922a7fe54c70ecc190.tar.bz2
FetchContent: Protect ExternalProject keywords from unknown arguments
`ExternalProject_Add` treats all keyword arguments as multi-valued. FetchContent re-orders some keyword arguments w.r.t. unparsed arguments. Add an internal keyword argument to separate the keyword values from following unparsed arguments. This was exposed by commit 550f63447d (ExternalProject/FetchContent: Support relative remote URLs, 2023-04-21, v3.27.0-rc1~156^2) by adding `GIT_REPOSITORY` to the set of re-ordered keyword arguments. This caused its value to absorb following unparsed arguments. Fixes: #25029
Diffstat (limited to 'Modules')
-rw-r--r--Modules/ExternalProject.cmake4
-rw-r--r--Modules/FetchContent.cmake4
2 files changed, 7 insertions, 1 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 574b339..605908d 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -4266,6 +4266,10 @@ function(ExternalProject_Add name)
# Miscellaneous options
#
LIST_SEPARATOR
+ #
+ # Internal options (undocumented)
+ #
+ EXTERNALPROJECT_INTERNAL_ARGUMENT_SEPARATOR
)
_ep_parse_arguments(
ExternalProject_Add
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index 56fc0ed..4ff43ed 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -1336,9 +1336,11 @@ function(FetchContent_Declare contentName)
endif()
# Add back in the keyword args we pulled out and potentially tweaked/added
+ set(sep EXTERNALPROJECT_INTERNAL_ARGUMENT_SEPARATOR)
foreach(key IN LISTS oneValueArgs)
if(DEFINED ARG_${key})
- list(PREPEND ARG_UNPARSED_ARGUMENTS ${key} "${ARG_${key}}")
+ list(PREPEND ARG_UNPARSED_ARGUMENTS ${key} "${ARG_${key}}" ${sep})
+ set(sep "")
endif()
endforeach()