diff options
-rw-r--r-- | Modules/ExternalProject.cmake | 46 | ||||
-rw-r--r-- | Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt | 7 |
2 files changed, 31 insertions, 22 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() diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt index 928d88a..7b61678 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt @@ -1,7 +1,7 @@ CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): Using NO_DEPENDS for "configure" step might break parallel builds Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) @@ -11,7 +11,7 @@ This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): Using NO_DEPENDS for "build" step might break parallel builds Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) @@ -21,7 +21,7 @@ This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): Using NO_DEPENDS for "install" step might break parallel builds Call Stack \(most recent call first\): - .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) .*/Modules/ExternalProject.cmake:[0-9]+:EVAL:2 \(ExternalProject_Add_Step\) .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) @@ -31,6 +31,7 @@ This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): Using NO_DEPENDS for "test" step might break parallel builds Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_step_add_target\) NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) CMakeLists.txt:[0-9]+ \(include\) This warning is for project developers. Use -Wno-dev to suppress it. |