From 726114077d76fd0a8222aae6d5da8846994d787e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Mar 2009 09:21:16 -0500 Subject: [PATCH] ENH: Allow empty arguments in external project API This uses the get_property command to simplify property lookup in the AddExternalProject module. It distinguishes for build and install argument properties the cases of unset and set to empty. --- Modules/AddExternalProject.cmake | 41 ++++++++++---------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/Modules/AddExternalProject.cmake b/Modules/AddExternalProject.cmake index 7dcbe558f..4053c1994 100644 --- a/Modules/AddExternalProject.cmake +++ b/Modules/AddExternalProject.cmake @@ -127,11 +127,7 @@ function(add_external_project_download_command name) message(FATAL_ERROR "error: no CVS_MODULE") endif() - get_target_property(tag ${name} AEP_CVS_TAG) - set(cvs_tag) - if(tag) - set(cvs_tag ${tag}) - endif() + get_property(cvs_tag TARGET ${name} PROPERTY AEP_CVS_TAG) set(args -d ${cvs_repository} -q co ${cvs_tag} -d ${name} ${cvs_module}) @@ -164,11 +160,7 @@ function(add_external_project_download_command name) message(FATAL_ERROR "error: could not find svn for checkout of ${name}") endif() - get_target_property(tag ${name} AEP_SVN_TAG) - set(svn_tag) - if(tag) - set(svn_tag ${tag}) - endif() + get_property(svn_tag TARGET ${name} PROPERTY AEP_SVN_TAG) set(args co ${svn_repository} ${svn_tag} ${name}) @@ -356,11 +348,7 @@ function(add_external_project_update_command name) message(FATAL_ERROR "error: could not find cvs for update of ${name}") endif() - get_target_property(tag ${name} AEP_CVS_TAG) - set(cvs_tag) - if(tag) - set(cvs_tag ${tag}) - endif() + get_property(cvs_tag TARGET ${name} PROPERTY AEP_CVS_TAG) set(args -d ${cvs_repository} -q up -dP ${cvs_tag}) @@ -385,11 +373,7 @@ function(add_external_project_update_command name) message(FATAL_ERROR "error: could not find svn for update of ${name}") endif() - get_target_property(tag ${name} AEP_SVN_TAG) - set(svn_tag) - if(tag) - set(svn_tag ${tag}) - endif() + get_property(svn_tag TARGET ${name} PROPERTY AEP_SVN_TAG) set(args up ${svn_tag}) @@ -423,10 +407,7 @@ function(add_external_project_configure_command name) sentinels_dir source_dir tmp_dir) get_configure_build_working_dir(${name} working_dir) - get_target_property(file_deps ${name} AEP_FILE_DEPENDS) - if(NOT file_deps) - set(file_deps) - endif() + get_property(file_deps TARGET ${name} PROPERTY AEP_FILE_DEPENDS) #message(STATUS "info: name='${name}' file_deps='${file_deps}'") # Create the working_dir for configure, build and install steps: @@ -504,8 +485,10 @@ function(add_external_project_build_command name) endif() endif() - get_target_property(args ${name} AEP_BUILD_ARGS) - if(NOT args) + get_property(have_args TARGET ${name} PROPERTY AEP_BUILD_ARGS SET) + if(have_args) + get_target_property(args ${name} AEP_BUILD_ARGS) + else() set(args) if(cfg_cmd_id STREQUAL "cmake") set(args --build ${working_dir} --config ${CMAKE_CFG_INTDIR}) @@ -555,8 +538,10 @@ function(add_external_project_install_command name) endif() endif() - get_target_property(args ${name} AEP_INSTALL_ARGS) - if(NOT args) + get_property(have_args TARGET ${name} PROPERTY AEP_INSTALL_ARGS SET) + if(have_args) + get_target_property(args ${name} AEP_INSTALL_ARGS) + else() set(args) if(cfg_cmd_id STREQUAL "cmake") set(args --build ${working_dir} --config ${CMAKE_CFG_INTDIR} --target install)