diff options
author | Brad King <brad.king@kitware.com> | 2016-10-19 12:48:40 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-10-19 12:48:40 (GMT) |
commit | a08a48c2da1ad0aa760c127511fb96c92d7890af (patch) | |
tree | e56553c57d58c4c1d17e272a5688cfa03bf6bdcb /Modules/ExternalProject.cmake | |
parent | c61b6f7f37386eb06bb50d9fc25cb40efe44c9cc (diff) | |
parent | 615f3ed2b43129bd7d2466d369beef3003e1e0de (diff) | |
download | CMake-a08a48c2da1ad0aa760c127511fb96c92d7890af.zip CMake-a08a48c2da1ad0aa760c127511fb96c92d7890af.tar.gz CMake-a08a48c2da1ad0aa760c127511fb96c92d7890af.tar.bz2 |
Merge topic 'external-project-source-subdir-usage'
615f3ed2 ExternalProject: make SOURCE_SUBDIR directly appendable
fdce782b ExternalProject: error out only if the property is unset
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 4ba8537..4551cc8 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1087,10 +1087,14 @@ function(_ep_set_directories name) endforeach() get_property(source_subdir TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR) if(NOT source_subdir) - set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR ".") + set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR "") elseif(IS_ABSOLUTE "${source_subdir}") message(FATAL_ERROR "External project ${name} has non-relative SOURCE_SUBDIR!") + else() + # Prefix with a slash so that when appended to the source directory, it + # behaves as expected. + set_property(TARGET ${name} PROPERTY _EP_SOURCE_SUBDIR "/${source_subdir}") endif() if(build_in_source) get_property(source_dir TARGET ${name} PROPERTY _EP_SOURCE_DIR) @@ -1184,10 +1188,11 @@ endfunction() function(ExternalProject_Get_Property name) foreach(var ${ARGN}) string(TOUPPER "${var}" VAR) - get_property(${var} TARGET ${name} PROPERTY _EP_${VAR}) - if(NOT ${var}) + get_property(is_set TARGET ${name} PROPERTY _EP_${VAR} SET) + if(NOT is_set) message(FATAL_ERROR "External project \"${name}\" has no ${var}") endif() + get_property(${var} TARGET ${name} PROPERTY _EP_${VAR}) set(${var} "${${var}}" PARENT_SCOPE) endforeach() endfunction() @@ -2256,11 +2261,7 @@ function(_ep_add_configure_command name) endif() endif() - if(source_subdir STREQUAL ".") - list(APPEND cmd "${source_dir}") - else() - list(APPEND cmd "${source_dir}/${source_subdir}") - endif() + list(APPEND cmd "${source_dir}${source_subdir}") endif() # If anything about the configure command changes, (command itself, cmake |