diff options
author | Brad King <brad.king@kitware.com> | 2013-11-13 15:03:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-13 15:03:36 (GMT) |
commit | 8eb20eeabeb2b0196723a3e6dcfbe0501dceb5e7 (patch) | |
tree | 50534048d9c01fc54e03673199a19dd1759375bc /Modules/ExternalData.cmake | |
parent | 558a6f1f920defdfcd7651fba3a85fded84d6a63 (diff) | |
download | CMake-8eb20eeabeb2b0196723a3e6dcfbe0501dceb5e7.zip CMake-8eb20eeabeb2b0196723a3e6dcfbe0501dceb5e7.tar.gz CMake-8eb20eeabeb2b0196723a3e6dcfbe0501dceb5e7.tar.bz2 |
ExternalData: Allow local stores without any URL templates
Allow ExternalData_URL_TEMPLATES to be empty if a value for
ExternalData_OBJECT_STORES is provided. Assume in this use case that
the object stores will already contain all needed objects. Extend the
Module.ExternalData test to cover this case (all objects in stores).
Extend the RunCMake.ExternalData test to cover the non-failure message
case when stores are provided without URL templates.
Diffstat (limited to 'Modules/ExternalData.cmake')
-rw-r--r-- | Modules/ExternalData.cmake | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 1e1d32f..1e2698c 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -58,7 +58,7 @@ # # It creates custom commands in the target as necessary to make data # files available for each ``DATA{}`` reference previously evaluated by -# other functions provided by this module. A list of URL templates must +# other functions provided by this module. A list of URL templates may # be provided in the variable ``ExternalData_URL_TEMPLATES`` using the # placeholders ``%(algo)`` and ``%(hash)`` in each template. Data fetch # rules try each URL template in order by substituting the hash @@ -202,8 +202,9 @@ function(ExternalData_add_test target) endfunction() function(ExternalData_add_target target) - if(NOT ExternalData_URL_TEMPLATES) - message(FATAL_ERROR "ExternalData_URL_TEMPLATES is not set!") + if(NOT ExternalData_URL_TEMPLATES AND NOT ExternalData_OBJECT_STORES) + message(FATAL_ERROR + "Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set!") endif() if(NOT ExternalData_OBJECT_STORES) set(ExternalData_OBJECT_STORES ${CMAKE_BINARY_DIR}/ExternalData/Objects) @@ -625,8 +626,9 @@ endif() if(ExternalData_CONFIG) include(${ExternalData_CONFIG}) endif() -if(NOT ExternalData_URL_TEMPLATES) - message(FATAL_ERROR "No ExternalData_URL_TEMPLATES set!") +if(NOT ExternalData_URL_TEMPLATES AND NOT ExternalData_OBJECT_STORES) + message(FATAL_ERROR + "Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set!") endif() function(_ExternalData_link_or_copy src dst) @@ -754,6 +756,9 @@ function(_ExternalData_download_object name hash algo var_obj) set(obj "${staged}") message(STATUS "Staged object: \"${obj}\"") else() + if(NOT tried) + set(tried "\n (No ExternalData_URL_TEMPLATES given)") + endif() message(FATAL_ERROR "Object ${algo}=${hash} not found at:${tried}") endif() |