FetchContent: Fix syntax to forward FIND_PACKAGE_ARGS arguments correctly

Previously we incorrectly mixed list operations with string operations.
This commit is contained in:
Adam Šulc
2023-11-13 04:01:53 -05:00
committed by Brad King
parent 1af14eda2d
commit 42dbdf8914

View File

@@ -1194,10 +1194,10 @@ function(__FetchContent_declareDetails contentName)
set(propertyName "_FetchContent_${contentNameLower}_find_package_args")
define_property(GLOBAL PROPERTY ${propertyName})
if(NOT __sawQuietKeyword)
list(INSERT __findPackageArgs 0 QUIET)
string(PREPEND __findPackageArgs "QUIET ")
endif()
if(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL AND NOT __sawGlobalKeyword)
list(APPEND __findPackageArgs GLOBAL)
string(APPEND __findPackageArgs " GLOBAL")
endif()
cmake_language(EVAL CODE
"set_property(GLOBAL PROPERTY ${propertyName} ${__findPackageArgs})"