summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalData.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-01-29 15:26:11 (GMT)
committerBrad King <brad.king@kitware.com>2013-01-30 15:05:07 (GMT)
commit175ed02207ea5fe25aa7156acb2554d706611263 (patch)
tree5a6bc4c8108fb519f4a7e626b9153f17c2b5a2f6 /Modules/ExternalData.cmake
parent4befecc77caa97aeb450d9a2b6bcbe0985dc4054 (diff)
downloadCMake-175ed02207ea5fe25aa7156acb2554d706611263.zip
CMake-175ed02207ea5fe25aa7156acb2554d706611263.tar.gz
CMake-175ed02207ea5fe25aa7156acb2554d706611263.tar.bz2
ExternalData: Allow ()-groups in series match regex
Refactor use of the ExternalData_SERIES_MATCH value to avoid assuming that it has no ()-groups that interfere with group indexing. Extend the Module.ExternalData test to cover this case.
Diffstat (limited to 'Modules/ExternalData.cmake')
-rw-r--r--Modules/ExternalData.cmake13
1 files changed, 8 insertions, 5 deletions
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 0ef514c..6442c3e 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -502,11 +502,14 @@ endmacro()
function(_ExternalData_arg_find_files pattern regex)
file(GLOB globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
foreach(entry IN LISTS globbed)
- string(REGEX REPLACE "^(${regex})(\\.md5|)$" "\\1;\\2" tuple "${entry}")
- list(LENGTH tuple len)
- if("${len}" EQUAL 2 AND NOT IS_DIRECTORY "${top_src}/${entry}")
- list(GET tuple 0 relname)
- list(GET tuple 1 alg)
+ if("x${entry}" MATCHES "^x(.*)(\\.md5)$")
+ set(relname "${CMAKE_MATCH_1}")
+ set(alg "${CMAKE_MATCH_2}")
+ else()
+ set(relname "${entry}")
+ set(alg "")
+ endif()
+ if("x${relname}" MATCHES "^x${regex}$" AND NOT IS_DIRECTORY "${top_src}/${entry}")
set(name "${top_src}/${relname}")
set(file "${top_bin}/${relname}")
if(alg)