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.
This commit is contained in:
Brad King 2009-03-04 09:21:16 -05:00
parent c0e0180f28
commit 726114077d
1 changed files with 13 additions and 28 deletions

View File

@ -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)