summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-30 15:37:29 (GMT)
committerBrad King <brad.king@kitware.com>2009-03-30 15:37:29 (GMT)
commitaa7e41c16e10dd2c3648f0e35d4d2547b88bbd7d (patch)
treeb2f2aa999419f3c53f87a805e58ad2f84f2e53b2 /Modules
parentfeef81b34f148f3fcceb5ea772f15c1014548fcf (diff)
downloadCMake-aa7e41c16e10dd2c3648f0e35d4d2547b88bbd7d.zip
CMake-aa7e41c16e10dd2c3648f0e35d4d2547b88bbd7d.tar.gz
CMake-aa7e41c16e10dd2c3648f0e35d4d2547b88bbd7d.tar.bz2
ENH: Simpler AddExternalProject update step
This simplifies the implementation with add_external_project_step.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/AddExternalProject.cmake105
1 files changed, 26 insertions, 79 deletions
diff --git a/Modules/AddExternalProject.cmake b/Modules/AddExternalProject.cmake
index c8725fb..e3b96bd 100644
--- a/Modules/AddExternalProject.cmake
+++ b/Modules/AddExternalProject.cmake
@@ -390,96 +390,43 @@ function(add_external_project_update_command name)
get_external_project_directories(base_dir build_dir downloads_dir install_dir
sentinels_dir source_dir tmp_dir)
+ get_property(cmd TARGET ${name} PROPERTY AEP_UPDATE_COMMAND)
+ get_property(cvs_repository TARGET ${name} PROPERTY AEP_CVS_REPOSITORY)
+ get_property(svn_repository TARGET ${name} PROPERTY AEP_SVN_REPOSITORY)
- get_target_property(cmd ${name} AEP_UPDATE_COMMAND)
- if(cmd STREQUAL "")
- # Explicit empty string means no update step for this project
- add_custom_command(
- OUTPUT ${sentinels_dir}/${name}-update
- COMMAND ${CMAKE_COMMAND} -E touch ${sentinels_dir}/${name}-update
- WORKING_DIRECTORY ${sentinels_dir}
- COMMENT "No update step for '${name}'"
- DEPENDS ${sentinels_dir}/${name}-download
- )
- return()
- else()
- if(cmd)
- add_custom_command(
- OUTPUT ${sentinels_dir}/${name}-update
- COMMAND ${cmd}
- COMMAND ${CMAKE_COMMAND} -E touch ${sentinels_dir}/${name}-update
- WORKING_DIRECTORY ${source_dir}/${name}
- COMMENT "Performing update step for '${name}'"
- DEPENDS ${sentinels_dir}/${name}-download
- VERBATIM
- )
- return()
- else()
- # No explicit UPDATE_COMMAND property. Look for other properties
- # indicating which update method to use in the logic below...
- endif()
- endif()
-
-
- get_target_property(cvs_repository ${name} AEP_CVS_REPOSITORY)
- if(cvs_repository)
+ set(work_dir)
+ set(comment)
+ set(symbolic)
+ if(cmd)
+ set(work_dir ${source_dir}/${name})
+ elseif(cvs_repository)
if(NOT CVS_EXECUTABLE)
message(FATAL_ERROR "error: could not find cvs for update of ${name}")
endif()
-
- get_property(cvs_tag TARGET ${name} PROPERTY AEP_CVS_TAG)
-
- set(args -d ${cvs_repository} -q up -dP ${cvs_tag})
-
mkdir("${source_dir}/${name}")
- add_custom_command(
- OUTPUT ${sentinels_dir}/${name}-update
- COMMAND ${CVS_EXECUTABLE} ${args}
- WORKING_DIRECTORY ${source_dir}/${name}
- COMMENT "Performing update step (CVS update) for '${name}'"
- DEPENDS ${sentinels_dir}/${name}-download
- VERBATIM
- )
- # Since the update sentinel is not actually written:
- set_property(SOURCE ${sentinels_dir}/${name}-update
- PROPERTY SYMBOLIC 1)
- return()
- endif()
-
-
- get_target_property(svn_repository ${name} AEP_SVN_REPOSITORY)
- if(svn_repository)
+ set(work_dir ${source_dir}/${name})
+ set(comment "Performing update step (CVS update) for '${name}'")
+ get_property(cvs_tag TARGET ${name} PROPERTY AEP_CVS_TAG)
+ set(cmd ${CVS_EXECUTABLE} -d ${cvs_repository} -q up -dP ${cvs_tag})
+ set(symbolic 1)
+ elseif(svn_repository)
if(NOT Subversion_SVN_EXECUTABLE)
message(FATAL_ERROR "error: could not find svn for update of ${name}")
endif()
-
- get_property(svn_tag TARGET ${name} PROPERTY AEP_SVN_TAG)
-
- set(args up ${svn_tag})
-
mkdir("${source_dir}/${name}")
- add_custom_command(
- OUTPUT ${sentinels_dir}/${name}-update
- COMMAND ${Subversion_SVN_EXECUTABLE} ${args}
- WORKING_DIRECTORY ${source_dir}/${name}
- COMMENT "Performing update step (SVN update) for '${name}'"
- DEPENDS ${sentinels_dir}/${name}-download
- VERBATIM
- )
- # Since the update sentinel is not actually written:
- set_property(SOURCE ${sentinels_dir}/${name}-update
- PROPERTY SYMBOLIC 1)
- return()
+ set(work_dir ${source_dir}/${name})
+ set(comment "Performing update step (SVN update) for '${name}'")
+ get_property(svn_tag TARGET ${name} PROPERTY AEP_SVN_TAG)
+ set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_tag})
+ set(symbolic 1)
endif()
-
- add_custom_command(
- OUTPUT ${sentinels_dir}/${name}-update
- COMMAND ${CMAKE_COMMAND} -E touch ${sentinels_dir}/${name}-update
- WORKING_DIRECTORY ${sentinels_dir}
- COMMENT "No update step for '${name}'"
- DEPENDS ${sentinels_dir}/${name}-download
- VERBATIM
+ add_external_project_step(${name} update
+ COMMENT ${comment}
+ COMMAND ${cmd}
+ SYMBOLIC ${symbolic}
+ WORKING_DIRECTORY ${work_dir}
+ DEPENDEES download
)
endfunction(add_external_project_update_command)