diff options
author | Brad King <brad.king@kitware.com> | 2013-01-24 18:35:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-01-28 20:31:02 (GMT) |
commit | 7bb8344d50fa317580068dedd00b019be8a6cb98 (patch) | |
tree | 02cabced4c3299063e0a06e806cf64d0c97a992c /Modules/ExternalData.cmake | |
parent | 00d801fbfe9c5170e3a83019cc2e3f6b1ce64200 (diff) | |
download | CMake-7bb8344d50fa317580068dedd00b019be8a6cb98.zip CMake-7bb8344d50fa317580068dedd00b019be8a6cb98.tar.gz CMake-7bb8344d50fa317580068dedd00b019be8a6cb98.tar.bz2 |
ExternalData: Do not match directory names when resolving DATA{}
Our content link and object download infrastructure supports only
blobs (files), not trees (directories). Do not allow references
to end in a slash.
Diffstat (limited to 'Modules/ExternalData.cmake')
-rw-r--r-- | Modules/ExternalData.cmake | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 4ab2186..29ddffd 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -304,6 +304,13 @@ function(_ExternalData_arg target arg options var_file) list(GET options 0 data) list(REMOVE_AT options 0) + # Reject trailing slashes. + if("x${data}" MATCHES "[/\\]$") + message(FATAL_ERROR "Data file reference in argument\n" + " ${arg}\n" + "may not end in a slash!") + endif() + # Convert to full path. if(IS_ABSOLUTE "${data}") set(absdata "${data}") @@ -376,7 +383,7 @@ function(_ExternalData_arg target arg options var_file) " ${arg}\n" "corresponds to source tree path\n" " ${reldata}\n" - "that does not exist (with or without an extension)!") + "that does not exist as a file (with or without an extension)!") endif() if(external) @@ -470,7 +477,7 @@ function(_ExternalData_arg_find_files pattern regex) foreach(entry IN LISTS globbed) string(REGEX REPLACE "^(${regex})(\\.md5|)$" "\\1;\\2" tuple "${entry}") list(LENGTH tuple len) - if("${len}" EQUAL 2) + if("${len}" EQUAL 2 AND NOT IS_DIRECTORY "${top_src}/${entry}") list(GET tuple 0 relname) list(GET tuple 1 alg) set(name "${top_src}/${relname}") |