Commit 559e3deb authored by jcfr's avatar jcfr

ENH: Support restricting list bundled extension external projects dependencies

This commit allows to constrain the list of external project dependencies
appended to Slicer_DEPENDENCIES. This is particularly useful when not all
external projects found in an extension superbuild folder should be added
as Slicer dependency.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@27562 3bd1e089-480b-0410-8dfb-8563597acbee
parent d9a6181a
......@@ -1068,6 +1068,8 @@ configure_file(
#
# * List of external project names is extracted from the "External_<projectName>.cmake"
# files and appended to Slicer_DEPENDENCIES. This ensures they are build before Slicer inner build.
# Setting variable "<extension_name>_EXTERNAL_PROJECT_DEPENDENCIES" to a list of <projectName> allows
# to override the list of <projectName> appended to Slicer_DEPENDENCIES.
#
# * Variable Slicer_BUNDLED_EXTENSION_NAMES is updated with the names of external project
# and passed to Slicer inner build. It is then used in SlicerCPack. to package associated
......
......@@ -351,6 +351,9 @@ foreach(extension_dir ${Slicer_EXTENSION_SOURCE_DIRS})
list(APPEND EXTERNAL_PROJECT_ADDITIONAL_DIRS "${extension_dir}/SuperBuild")
list(APPEND EXTERNAL_PROJECT_ADDITIONAL_DIRS "${extension_dir}/Superbuild")
endif()
if(NOT DEFINED ${extension_name}_EXTERNAL_PROJECT_DEPENDENCIES)
set(${extension_name}_EXTERNAL_PROJECT_DEPENDENCIES )
endif()
set(_external_project_cmake_files)
......@@ -369,11 +372,22 @@ foreach(extension_dir ${Slicer_EXTENSION_SOURCE_DIRS})
foreach (_external_project_cmake_file ${_external_project_cmake_files})
string(REGEX MATCH "External_(.+)\.cmake" _match ${_external_project_cmake_file})
set(_additional_project_name "${CMAKE_MATCH_1}")
if(NOT ${extension_name}_EXTERNAL_PROJECT_EXCLUDE_ALL)
list(APPEND _extension_depends ${_additional_project_name})
list(APPEND _msg_extension_depends ${_additional_project_name})
if(${extension_name}_EXTERNAL_PROJECT_EXCLUDE_ALL)
set(_include FALSE)
else()
set(_include TRUE)
if(NOT "${${extension_name}_EXTERNAL_PROJECT_DEPENDENCIES}" STREQUAL "")
list(FIND ${extension_name}_EXTERNAL_PROJECT_DEPENDENCIES ${_additional_project_name} _index)
if(_index EQUAL -1)
set(_include FALSE)
endif()
endif()
endif()
if(_include)
list(APPEND _extension_depends ${_additional_project_name})
list(APPEND _msg_extension_depends ${_additional_project_name})
else()
list(APPEND _msg_extension_depends "ignore(${_additional_project_name})")
list(APPEND _msg_extension_depends "exclude(${_additional_project_name})")
endif()
endforeach()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment