diff options
author | Brad King <brad.king@kitware.com> | 2015-03-25 13:29:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-03-27 18:44:49 (GMT) |
commit | 564c07f7dd819d9ea070b22ad16849d3be6bb89a (patch) | |
tree | 6e29d015863e31eeea52cf81721b75d329c86bba /Modules/ExternalData.cmake | |
parent | 166e29e453e6a48e191b02835b08cf5bd3d0f988 (diff) | |
download | CMake-564c07f7dd819d9ea070b22ad16849d3be6bb89a.zip CMake-564c07f7dd819d9ea070b22ad16849d3be6bb89a.tar.gz CMake-564c07f7dd819d9ea070b22ad16849d3be6bb89a.tar.bz2 |
ExternalData: Parameterize internal file(GLOB) operation selection
Extend the _ExternalData_arg_find_files signature with an option to
specify the kind of file(GLOB) operation to be performed. Set
CMP0009 to NEW so that GLOB_RECURSE does not follow symlinks.
Diffstat (limited to 'Modules/ExternalData.cmake')
-rw-r--r-- | Modules/ExternalData.cmake | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index b3206be..eab266f 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -685,7 +685,8 @@ macro(_ExternalData_arg_associated) # Find files named explicitly. foreach(file ${associated_files}) _ExternalData_exact_regex(file_regex "${file}") - _ExternalData_arg_find_files("${reldir}${file}" "${reldir_regex}${file_regex}") + _ExternalData_arg_find_files(GLOB "${reldir}${file}" + "${reldir_regex}${file_regex}") endforeach() # Find files matching the given regular expressions. @@ -695,13 +696,13 @@ macro(_ExternalData_arg_associated) set(all "${all}${sep}${reldir_regex}${regex}") set(sep "|") endforeach() - _ExternalData_arg_find_files("${reldir}" "${all}") + _ExternalData_arg_find_files(GLOB "${reldir}" "${all}") endmacro() macro(_ExternalData_arg_single) # Match only the named data by itself. _ExternalData_exact_regex(data_regex "${reldata}") - _ExternalData_arg_find_files("${reldata}" "${data_regex}") + _ExternalData_arg_find_files(GLOB "${reldata}" "${data_regex}") endmacro() macro(_ExternalData_arg_series) @@ -756,12 +757,15 @@ macro(_ExternalData_arg_series) # Then match base, number, and extension. _ExternalData_exact_regex(series_base "${relbase}") _ExternalData_exact_regex(series_ext "${ext}") - _ExternalData_arg_find_files("${relbase}*${ext}" + _ExternalData_arg_find_files(GLOB "${relbase}*${ext}" "${series_base}${series_match}${series_ext}") endmacro() -function(_ExternalData_arg_find_files pattern regex) - file(GLOB globbed RELATIVE "${top_src}" "${top_src}/${pattern}*") +function(_ExternalData_arg_find_files glob pattern regex) + cmake_policy(PUSH) + cmake_policy(SET CMP0009 NEW) + file(${glob} globbed RELATIVE "${top_src}" "${top_src}/${pattern}*") + cmake_policy(POP) foreach(entry IN LISTS globbed) if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$") set(relname "${CMAKE_MATCH_1}") |