# # ITK # set(proj ITK) set(${proj}_DEPENDENCIES "") ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES EP_ARGS_VAR ${proj}_EXTERNAL_PROJECT_ARGS USE_SYSTEM_VAR ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} ) # Let the user to chose whether to use libs installed in the system option(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj} "Use installed ${proj} library in the system" OFF) mark_as_advanced(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) if(${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) unset(ITK_DIR CACHE) find_package(ITK REQUIRED NO_MODULE) endif() # Sanity checks if(DEFINED ITK_DIR AND NOT EXISTS ${ITK_DIR}) message(FATAL_ERROR "ITK_DIR variable is defined but corresponds to non-existing directory") endif() if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) if("${CMAKE_CXX_STANDARD}" STREQUAL "98") set(revision_tag "v4.13.3") else() set(revision_tag "v5.1.2") endif() if(${proj}_REVISION_TAG) set(revision_tag ${${proj}_REVISION_TAG}) endif() ExternalProject_Message(${proj} "${proj}[revision_tag:${revision_tag}]") set(location_args ) if(${proj}_URL) set(location_args URL ${${proj}_URL}) elseif(${proj}_GIT_REPOSITORY) set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY} GIT_TAG ${revision_tag}) else() set(location_args GIT_REPOSITORY "${EP_GIT_PROTOCOL}://github.com/InsightSoftwareConsortium/ITK" GIT_TAG ${revision_tag}) endif() ExternalProject_Add(${proj} ${${proj}_EXTERNAL_PROJECT_ARGS} SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build PREFIX ${proj}${ep_suffix} ${location_args} INSTALL_COMMAND "" CMAKE_CACHE_ARGS ${ep_common_cache_args} -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON -DITK_LEGACY_REMOVE:BOOL=ON DEPENDS ${${proj}_DEPENDENCIES} ) set(ITK_DIR ${CMAKE_BINARY_DIR}/${proj}-build) #----------------------------------------------------------------------------- # Launcher setting specific to build tree set(_lib_subdir lib) if(WIN32) set(_lib_subdir bin) endif() # library paths set(${proj}_LIBRARY_PATHS_LAUNCHER_BUILD ${ITK_DIR}/${_lib_subdir}/) mark_as_superbuild( VARS ${proj}_LIBRARY_PATHS_LAUNCHER_BUILD LABELS "LIBRARY_PATHS_LAUNCHER_BUILD" ) #----------------------------------------------------------------------------- # Launcher setting specific to install tree # NA else() ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES}) endif() mark_as_superbuild( VARS ITK_DIR:PATH LABELS "FIND_PACKAGE" )