summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-09 19:29:34 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-10 22:14:23 (GMT)
commitb637ef494c30532df1fe705c6b6e62419f000a06 (patch)
treeea507931a099f72bfc6080c422505e06b0da909c /Modules/ExternalProject.cmake
parent48ed3bae5874db9f9a470ae18de42222d7a252b4 (diff)
downloadCMake-b637ef494c30532df1fe705c6b6e62419f000a06.zip
CMake-b637ef494c30532df1fe705c6b6e62419f000a06.tar.gz
CMake-b637ef494c30532df1fe705c6b6e62419f000a06.tar.bz2
ExternalProject: Factor out an internal helper to add a step target
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r--Modules/ExternalProject.cmake46
1 files changed, 27 insertions, 19 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 96edbef..5ab9784 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1990,30 +1990,38 @@ function(_ep_get_complete_stampfile name stampfile_var)
endfunction()
+function(_ep_step_add_target name step no_deps)
+ _ep_get_step_stampfile(${name} ${step} stamp_file)
+ add_custom_target(${name}-${step}
+ DEPENDS ${stamp_file})
+ set_property(TARGET ${name}-${step} PROPERTY _EP_IS_EXTERNAL_PROJECT_STEP 1)
+ set_property(TARGET ${name}-${step} PROPERTY LABELS ${name})
+ set_property(TARGET ${name}-${step} PROPERTY FOLDER "ExternalProjectTargets/${name}")
+
+ if(no_deps AND "${step}" MATCHES "^(configure|build|install|test)$")
+ message(AUTHOR_WARNING "Using NO_DEPENDS for \"${step}\" step might break parallel builds")
+ endif()
+
+ # Depend on other external projects (target-level).
+ if(NOT no_deps)
+ get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
+ foreach(arg IN LISTS deps)
+ add_dependencies(${name}-${step} ${arg})
+ endforeach()
+ endif()
+endfunction()
+
+
function(ExternalProject_Add_StepTargets name)
set(steps ${ARGN})
if(ARGC GREATER 1 AND "${ARGV1}" STREQUAL "NO_DEPENDS")
set(no_deps 1)
list(REMOVE_AT steps 0)
+ else()
+ set(no_deps 0)
endif()
foreach(step ${steps})
- if(no_deps AND "${step}" MATCHES "^(configure|build|install|test)$")
- message(AUTHOR_WARNING "Using NO_DEPENDS for \"${step}\" step might break parallel builds")
- endif()
- _ep_get_step_stampfile(${name} ${step} stamp_file)
- add_custom_target(${name}-${step}
- DEPENDS ${stamp_file})
- set_property(TARGET ${name}-${step} PROPERTY _EP_IS_EXTERNAL_PROJECT_STEP 1)
- set_property(TARGET ${name}-${step} PROPERTY LABELS ${name})
- set_property(TARGET ${name}-${step} PROPERTY FOLDER "ExternalProjectTargets/${name}")
-
- # Depend on other external projects (target-level).
- if(NOT no_deps)
- get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS)
- foreach(arg IN LISTS deps)
- add_dependencies(${name}-${step} ${arg})
- endforeach()
- endif()
+ _ep_step_add_target("${name}" "${step}" "${no_deps}")
endforeach()
endfunction()
@@ -2148,7 +2156,7 @@ function(ExternalProject_Add_Step name step)
endif()
foreach(st ${step_targets})
if("${st}" STREQUAL "${step}")
- ExternalProject_Add_StepTargets(${name} ${step})
+ _ep_step_add_target("${name}" "${step}" "FALSE")
break()
endif()
endforeach()
@@ -2159,7 +2167,7 @@ function(ExternalProject_Add_Step name step)
endif()
foreach(st ${independent_step_targets})
if("${st}" STREQUAL "${step}")
- ExternalProject_Add_StepTargets(${name} NO_DEPENDS ${step})
+ _ep_step_add_target("${name}" "${step}" "TRUE")
break()
endif()
endforeach()