diff options
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index bf6cd21..a9c7519 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -80,6 +80,8 @@ Create custom targets to build projects in external trees ``UPDATE_COMMAND <cmd>...`` Source work-tree update command + ``UPDATE_DISCONNECTED 1`` + Never update automatically from the remote repository ``PATCH_COMMAND <cmd>...`` Command to patch downloaded source @@ -203,6 +205,16 @@ Create custom targets to build projects in external trees options. The ``URL`` option may refer locally to a directory or source tarball, or refer to a remote tarball (e.g. ``http://.../src.tgz``). + If ``UPDATE_DISCONNECTED`` is set, the update step is not executed + automatically when building the main target. The update step can still + be added as a step target and called manually. This is useful if you + want to allow to build the project when you are disconnected from the + network (you might still need the network for the download step). + This is disabled by default. + The directory property ``EP_UPDATE_DISCONNECTED`` can be used to change + the default value for all the external projects in the current + directory and its subdirectories. + .. command:: ExternalProject_Add_Step The ``ExternalProject_Add_Step`` function adds a custom step to an @@ -439,6 +451,13 @@ define_property(DIRECTORY PROPERTY "EP_INDEPENDENT_STEP_TARGETS" INHERITED "ExternalProject module." ) +define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED + BRIEF_DOCS "Never update automatically from the remote repo." + FULL_DOCS + "See documentation of the ExternalProject_Add() function in the " + "ExternalProject module." + ) + function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) file(WRITE ${script_filename} "if(\"${git_tag}\" STREQUAL \"\") @@ -1825,6 +1844,12 @@ function(_ep_add_update_command name) get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY) get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) get_property(hg_repository TARGET ${name} PROPERTY _EP_HG_REPOSITORY ) + get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET) + if(update_disconnected_set) + get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED) + else() + get_property(update_disconnected DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED) + endif() set(work_dir) set(comment) @@ -1914,10 +1939,26 @@ Update to Mercurial >= 2.1.1. COMMENT ${comment} COMMAND ${cmd} ALWAYS ${always} + EXCLUDE_FROM_MAIN ${update_disconnected} WORKING_DIRECTORY ${work_dir} DEPENDEES download ${log} ) + + if(always AND update_disconnected) + _ep_get_step_stampfile(${name} skip-update skip-update_stamp_file) + string(REPLACE "Performing" "Skipping" comment "${comment}") + ExternalProject_Add_Step(${name} skip-update + COMMENT ${comment} + ALWAYS 1 + EXCLUDE_FROM_MAIN 1 + WORKING_DIRECTORY ${work_dir} + DEPENDEES download + ${log} + ) + set_property(SOURCE ${skip-update_stamp_file} PROPERTY SYMBOLIC 1) + endif() + endfunction() @@ -2039,10 +2080,22 @@ function(_ep_add_configure_command name) set(log "") endif() + get_property(update_disconnected_set TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED SET) + if(update_disconnected_set) + get_property(update_disconnected TARGET ${name} PROPERTY _EP_UPDATE_DISCONNECTED) + else() + get_property(update_disconnected DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED) + endif() + if(update_disconnected) + set(update_dep skip-update) + else() + set(update_dep update) + endif() + ExternalProject_Add_Step(${name} configure COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} - DEPENDEES update patch + DEPENDEES ${update_dep} patch DEPENDS ${file_deps} ${log} ) |