From abc30e7b55c5845e8a28030378f0904f9a15ba96 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 27 Jan 2013 09:47:07 -0600 Subject: [PATCH 1/6] ENH: Create a common template format for external projects The extensive external projects in slicer are being re-used in many other packages (BRAINSTools, ANTs, DTIAtlasBuilder, DTIPrep etc ... ). In many cases the files only have very minor differences to change the variable names to avoid collision with Slicer. By removing the Slicer string and resplacing with these modules become generic and can be included in many other tookits without modifications. By re-organizing and providing package name variables proj/extProjName at the top of each External_.cmake file, there can be consistency across the different package names, and that make development maintenance of these projects much easier as well. The desire is to help keep the various NAMIC community toolkits in near syncrony by giving developers an easier mainenance task. %% Ease propogation of new features/cmake version fixes/conditional options accross toolkits for toolkit in BRAINSStandAlone ANTs DTIAtlasBuilder DTIPrep; do for extProjName in ITKv4 VTK Boost SimpleITK PCRE Swig; do vimdiff Slicer/SuperBuild/External_${extProjName}.cmake ${toolkit}/SuperBuild/External_${extProjName}.cmake done done %% Ease propogation/genration of new External_${extProjName}.cmake within toolkit for extProjName in ITKv4 VTK Boost SimpleITK PCRE Swig; do vimdiff Slicer/SuperBuild/External_ITKv4.cmake Slicer/SuperBuild/External_${extProjName}.cmake done --- SuperBuild/External_ITKv4.cmake | 110 ++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 40 deletions(-) diff --git a/SuperBuild/External_ITKv4.cmake b/SuperBuild/External_ITKv4.cmake index efa09aa88..02cda0872 100644 --- a/SuperBuild/External_ITKv4.cmake +++ b/SuperBuild/External_ITKv4.cmake @@ -6,22 +6,29 @@ if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +# Include dependent projects if any +set(extProjName ITK) #The find_package known name +set(proj ITKv4) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#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") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(ITKv4_DEPENDENCIES "") -if(Slicer_BUILD_DICOM_SUPPORT) - list(APPEND ITKv4_DEPENDENCIES DCMTK) +set(${proj}_DEPENDENCIES "") +if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT) + list(APPEND ${proj}_DEPENDENCIES DCMTK) endif() # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(ITKv4) -set(proj ITKv4) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ITK_DIR) +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project @@ -33,18 +40,29 @@ if(NOT DEFINED ITK_DIR) -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() - set(ITKv4_DCMTK_ARGS) - if(Slicer_BUILD_DICOM_SUPPORT) - set(ITKv4_DCMTK_ARGS + set(${proj}_DCMTK_ARGS) + if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT) + set(${proj}_DCMTK_ARGS -DITK_USE_SYSTEM_DCMTK:BOOL=ON -DDCMTK_DIR:PATH=${DCMTK_DIR} -DModule_ITKIODCMTK:BOOL=ON ) endif() - set(ITKv4_WRAP_ARGS) + if(${PROJECT_NAME}_BUILD_FFTWF_SUPPORT) + set(${proj}_FFTWF_ARGS + -DITK_USE_FFTWF:BOOL=ON + ) + endif() + if(${PROJECT_NAME}_BUILD_FFTWD_SUPPORT) + set(${proj}_FFTWD_ARGS + -DITK_USE_FFTWD:BOOL=ON + ) + endif() + + set(${proj}_WRAP_ARGS) #if(foo) - #set(ITKv4_WRAP_ARGS + #set(${proj}_WRAP_ARGS # -DINSTALL_WRAP_ITK_COMPATIBILITY:BOOL=OFF # -DWRAP_float:BOOL=ON # -DWRAP_unsigned_char:BOOL=ON @@ -74,12 +92,33 @@ if(NOT DEFINED ITK_DIR) set(git_protocol "git") endif() - set(ITKv4_REPOSITORY ${git_protocol}://itk.org/ITK.git) - set(ITKv4_GIT_TAG c313377e1b54c82f4e5f4941edb55f8e5a3af733) # 2013-01-06 - + set(${proj}_CMAKE_OPTIONS + -DBUILD_TESTING:BOOL=OFF + -DBUILD_EXAMPLES:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DBUILD_SHARED_LIBS:BOOL=ON + -DITK_INSTALL_ARCHIVE_DIR:PATH=${${PROJECT_NAME}_INSTALL_LIB_DIR} + -DITK_INSTALL_LIBRARY_DIR:PATH=${${PROJECT_NAME}_INSTALL_LIB_DIR} + -DITK_LEGACY_REMOVE:BOOL=OFF + -DITKV3_COMPATIBILITY:BOOL=ON + -DITK_BUILD_ALL_MODULES:BOOL=ON + -DITK_USE_REVIEW:BOOL=ON + -DITK_INSTALL_NO_DEVELOPMENT:BOOL=ON + -DITK_BUILD_ALL_MODULES:BOOL=ON + -DKWSYS_USE_MD5:BOOL=ON # Required by SlicerExecutionModel + -DITK_WRAPPING:BOOL=OFF #${BUILD_SHARED_LIBS} ## HACK: QUICK CHANGE + -DITK_USE_SYSTEM_DCMTK:BOOL=${${PROJECT_NAME}_BUILD_DICOM_SUPPORT} + ${${proj}_DCMTK_ARGS} + ${${proj}_WRAP_ARGS} + ${${proj}_FFTWF_ARGS} + ${${proj}_FFTWD_ARGS} + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY ${git_protocol}://itk.org/ITK.git) + set(${proj}_GIT_TAG c313377e1b54c82f4e5f4941edb55f8e5a3af733) # 2013-01-06 ExternalProject_Add(${proj} - GIT_REPOSITORY ${ITKv4_REPOSITORY} - GIT_TAG ${ITKv4_GIT_TAG} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} "${slicer_external_update}" SOURCE_DIR ${proj} BINARY_DIR ${proj}-build @@ -90,31 +129,22 @@ if(NOT DEFINED ITK_DIR) -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DITK_INSTALL_ARCHIVE_DIR:PATH=${Slicer_INSTALL_LIB_DIR} - -DITK_INSTALL_LIBRARY_DIR:PATH=${Slicer_INSTALL_LIB_DIR} - -DBUILD_TESTING:BOOL=OFF - -DBUILD_EXAMPLES:BOOL=OFF - -DITK_LEGACY_REMOVE:BOOL=OFF - -DITKV3_COMPATIBILITY:BOOL=ON - -DITK_BUILD_ALL_MODULES:BOOL=ON - -DITK_USE_REVIEW:BOOL=ON - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DBUILD_SHARED_LIBS:BOOL=ON - -DITK_INSTALL_NO_DEVELOPMENT:BOOL=ON - -DITK_BUILD_ALL_MODULES:BOOL=ON - -DKWSYS_USE_MD5:BOOL=ON # Required by SlicerExecutionModel - -DITK_WRAPPING:BOOL=OFF #${BUILD_SHARED_LIBS} ## HACK: QUICK CHANGE - -DITK_USE_SYSTEM_DCMTK:BOOL=${Slicer_BUILD_DICOM_SUPPORT} - ${ITKv4_DCMTK_ARGS} - ${ITKv4_WRAP_ARGS} + ${${proj}_CMAKE_OPTIONS} INSTALL_COMMAND "" DEPENDS - ${ITKv4_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) - set(ITK_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) else() - # The project is provided using ITK_DIR, nevertheless since other project may depend on ITK, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${ITKv4_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${proj}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() -- GitLab From 40f213ac01df2ae5ccc37bffb17b9540acc22816 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 27 Jan 2013 09:54:24 -0600 Subject: [PATCH 2/6] ENH: Change slicer_external_update to cmakeversion_eternal_update The new variablename better represents the intent of this variable and it is more appropriate for the many other non-slicer projects that use derivatives of these External_.cmake files. --- SuperBuild.cmake | 4 ++-- SuperBuild/External_BRAINSTools.cmake | 2 +- SuperBuild/External_BatchMake.cmake | 2 +- SuperBuild/External_CTK.cmake | 2 +- SuperBuild/External_CTKAPPLAUNCHER.cmake | 2 +- SuperBuild/External_ChangeTrackerPy.cmake | 2 +- SuperBuild/External_DCMTK.cmake | 2 +- SuperBuild/External_EMSegment.cmake | 2 +- SuperBuild/External_ITKv3.cmake | 2 +- SuperBuild/External_ITKv4.cmake | 2 +- SuperBuild/External_LibArchive.cmake | 2 +- SuperBuild/External_MultiVolumeExplorer.cmake | 2 +- SuperBuild/External_MultiVolumeImporter.cmake | 2 +- SuperBuild/External_OpenIGTLink.cmake | 2 +- SuperBuild/External_OpenIGTLinkIF.cmake | 2 +- SuperBuild/External_SciPy.cmake | 2 +- SuperBuild/External_SimpleITK.cmake | 2 +- SuperBuild/External_SlicerExecutionModel.cmake | 2 +- SuperBuild/External_VTK.cmake | 2 +- SuperBuild/External_cmcurl.cmake | 2 +- SuperBuild/External_jqPlot.cmake | 2 +- SuperBuild/External_qCDashAPI.cmake | 2 +- SuperBuild/External_qMidasAPI.cmake | 2 +- SuperBuild/External_teem.cmake | 2 +- SuperBuild/External_zlib.cmake | 2 +- 25 files changed, 26 insertions(+), 26 deletions(-) diff --git a/SuperBuild.cmake b/SuperBuild.cmake index 406799e3f..93cfa6a18 100644 --- a/SuperBuild.cmake +++ b/SuperBuild.cmake @@ -67,9 +67,9 @@ include(SlicerMacroCheckExternalProjectDependency) # undesirable rebuild. set(slicer_external_disable_update UPDATE_COMMAND "") if(CMAKE_VERSION VERSION_LESS 2.8.9) - set(slicer_external_update ${slicer_external_disable_update}) + set(cmakeversion_external_update ${slicer_external_disable_update}) else() - set(slicer_external_update LOG_UPDATE 1) + set(cmakeversion_external_update LOG_UPDATE 1) endif() set(ep_base "${CMAKE_BINARY_DIR}") diff --git a/SuperBuild/External_BRAINSTools.cmake b/SuperBuild/External_BRAINSTools.cmake index 5e8ae5aa9..14de138a2 100644 --- a/SuperBuild/External_BRAINSTools.cmake +++ b/SuperBuild/External_BRAINSTools.cmake @@ -33,7 +33,7 @@ endif() ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/BRAINSia/BRAINSStandAlone.git" GIT_TAG "${GIT_TAG}" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_BatchMake.cmake b/SuperBuild/External_BatchMake.cmake index 59aa6c1da..4c968a69f 100644 --- a/SuperBuild/External_BatchMake.cmake +++ b/SuperBuild/External_BatchMake.cmake @@ -30,7 +30,7 @@ endif() ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://batchmake.org/BatchMake.git" GIT_TAG "1f5bf4f92e8678c34dc6f7558be5e6613804d988" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR BatchMake BINARY_DIR BatchMake-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_CTK.cmake b/SuperBuild/External_CTK.cmake index 825354f75..c8ae8bbea 100644 --- a/SuperBuild/External_CTK.cmake +++ b/SuperBuild/External_CTK.cmake @@ -67,7 +67,7 @@ if(NOT DEFINED CTK_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/commontk/CTK.git" GIT_TAG "b183487871c43408890b2785e58643ba8d6b1b13" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_CTKAPPLAUNCHER.cmake b/SuperBuild/External_CTKAPPLAUNCHER.cmake index ee90d73fc..addb99c32 100644 --- a/SuperBuild/External_CTKAPPLAUNCHER.cmake +++ b/SuperBuild/External_CTKAPPLAUNCHER.cmake @@ -40,7 +40,7 @@ if(Slicer_USE_CTKAPPLAUNCHER) URL http://packages.kitware.com/api/rest?method=midas.item.download&id=${item_id}&dummy=CTKAppLauncher-${launcher_version}-${CTKAPPLAUNCHER_OS}-${CTKAPPLAUNCHER_ARCHITECTURE}.tar.gz URL_MD5 ${md5} SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} - "${slicer_external_update}" + "${cmakeversion_external_update}" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" diff --git a/SuperBuild/External_ChangeTrackerPy.cmake b/SuperBuild/External_ChangeTrackerPy.cmake index e1b4358a6..57fb97839 100644 --- a/SuperBuild/External_ChangeTrackerPy.cmake +++ b/SuperBuild/External_ChangeTrackerPy.cmake @@ -28,7 +28,7 @@ if(NOT DEFINED ChangeTrackerPy_SOURCE_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/fedorov/ChangeTrackerPy.git" GIT_TAG "6459708494ebdf7ae8c25cf771397a40ba63c248" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_DCMTK.cmake b/SuperBuild/External_DCMTK.cmake index cdf071728..75169e81c 100644 --- a/SuperBuild/External_DCMTK.cmake +++ b/SuperBuild/External_DCMTK.cmake @@ -38,7 +38,7 @@ if(NOT DEFINED DCMTK_DIR) SOURCE_DIR ${proj} BINARY_DIR ${proj}-build INSTALL_DIR ${proj}-install - "${slicer_external_update}" + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= diff --git a/SuperBuild/External_EMSegment.cmake b/SuperBuild/External_EMSegment.cmake index 2c01df78c..81eff9b30 100644 --- a/SuperBuild/External_EMSegment.cmake +++ b/SuperBuild/External_EMSegment.cmake @@ -23,7 +23,7 @@ if(NOT DEFINED EMSegment_SOURCE_DIR) ExternalProject_Add(${proj} SVN_REPOSITORY "http://svn.slicer.org/Slicer3/trunk/Modules/EMSegment" SVN_REVISION -r "17018" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_ITKv3.cmake b/SuperBuild/External_ITKv3.cmake index c5dabd92d..10c3dc503 100644 --- a/SuperBuild/External_ITKv3.cmake +++ b/SuperBuild/External_ITKv3.cmake @@ -49,7 +49,7 @@ if(NOT DEFINED ITK_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}" GIT_TAG ${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG} - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_ITKv4.cmake b/SuperBuild/External_ITKv4.cmake index 02cda0872..617ed488c 100644 --- a/SuperBuild/External_ITKv4.cmake +++ b/SuperBuild/External_ITKv4.cmake @@ -119,7 +119,7 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) ExternalProject_Add(${proj} GIT_REPOSITORY ${${proj}_REPOSITORY} GIT_TAG ${${proj}_GIT_TAG} - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_LibArchive.cmake b/SuperBuild/External_LibArchive.cmake index 982e4b663..1f149584c 100644 --- a/SuperBuild/External_LibArchive.cmake +++ b/SuperBuild/External_LibArchive.cmake @@ -62,7 +62,7 @@ if(NOT DEFINED LibArchive_DIR) SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build INSTALL_DIR LibArchive-install - "${slicer_external_update}" + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CMAKE_ARGS # Not used -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} diff --git a/SuperBuild/External_MultiVolumeExplorer.cmake b/SuperBuild/External_MultiVolumeExplorer.cmake index 808a48fcc..da8a58194 100644 --- a/SuperBuild/External_MultiVolumeExplorer.cmake +++ b/SuperBuild/External_MultiVolumeExplorer.cmake @@ -28,7 +28,7 @@ if(NOT DEFINED MultiVolumeExplorer_SOURCE_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/fedorov/MultiVolumeExplorer.git" GIT_TAG "72d55d2ab12e7301ca8ced49ad05ce28346e625d" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_MultiVolumeImporter.cmake b/SuperBuild/External_MultiVolumeImporter.cmake index d9bd64154..b6d068b66 100644 --- a/SuperBuild/External_MultiVolumeImporter.cmake +++ b/SuperBuild/External_MultiVolumeImporter.cmake @@ -28,7 +28,7 @@ if(NOT DEFINED MultiVolumeImporter_SOURCE_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/fedorov/MultiVolumeImporter.git" GIT_TAG "63883c9176c2ee1fe24803cbc2cc5268ab086aa8" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_OpenIGTLink.cmake b/SuperBuild/External_OpenIGTLink.cmake index efb100d05..bf2575d9a 100644 --- a/SuperBuild/External_OpenIGTLink.cmake +++ b/SuperBuild/External_OpenIGTLink.cmake @@ -33,7 +33,7 @@ endif() ExternalProject_Add(${proj} SVN_REPOSITORY "http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink" SVN_REVISION -r "7701" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR OpenIGTLink BINARY_DIR OpenIGTLink-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_OpenIGTLinkIF.cmake b/SuperBuild/External_OpenIGTLinkIF.cmake index f8bf5c963..e8cc4bb14 100644 --- a/SuperBuild/External_OpenIGTLinkIF.cmake +++ b/SuperBuild/External_OpenIGTLinkIF.cmake @@ -23,7 +23,7 @@ if(NOT DEFINED OpenIGTLinkIF_SOURCE_DIR) ExternalProject_Add(${proj} SVN_REPOSITORY "http://svn.na-mic.org/NAMICSandBox/trunk/IGTLoadableModules/QtModules/OpenIGTLinkIF/" SVN_REVISION -r "8024" - "${slicer_external_update}" + "${cmakeversion_external_update}" #GIT_REPOSITORY "${git_protocol}://github.com/Slicer/OpenIGTLinkIF.git" #GIT_TAG "8330b769cc8c607067134296d577b64ae7c92b87" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} diff --git a/SuperBuild/External_SciPy.cmake b/SuperBuild/External_SciPy.cmake index 64bb29412..1927816cf 100644 --- a/SuperBuild/External_SciPy.cmake +++ b/SuperBuild/External_SciPy.cmake @@ -17,7 +17,7 @@ set(proj SciPy) ExternalProject_Add(${proj} SVN_REPOSITORY "http://svn.scipy.org/svn/scipy/branches/0.7.x" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR python/scipy CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/SuperBuild/External_SimpleITK.cmake b/SuperBuild/External_SimpleITK.cmake index 551aa60f9..608710c8a 100644 --- a/SuperBuild/External_SimpleITK.cmake +++ b/SuperBuild/External_SimpleITK.cmake @@ -49,7 +49,7 @@ ExternalProject_add(SimpleITK BINARY_DIR SimpleITK-build GIT_REPOSITORY http://itk.org/SimpleITK.git GIT_TAG c9d890337f1b582acb0482e16c06aa62f3af0886 - "${slicer_external_update}" + "${cmakeversion_external_update}" CMAKE_ARGS -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} diff --git a/SuperBuild/External_SlicerExecutionModel.cmake b/SuperBuild/External_SlicerExecutionModel.cmake index 526f9f827..c226804f2 100644 --- a/SuperBuild/External_SlicerExecutionModel.cmake +++ b/SuperBuild/External_SlicerExecutionModel.cmake @@ -37,7 +37,7 @@ if(NOT DEFINED SlicerExecutionModel_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/Slicer/SlicerExecutionModel.git" GIT_TAG "2986286df7819b4bd2c0b7e2d25efe7fd23ff51f" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_VTK.cmake b/SuperBuild/External_VTK.cmake index 3dabd8dab..5c7db7e90 100644 --- a/SuperBuild/External_VTK.cmake +++ b/SuperBuild/External_VTK.cmake @@ -140,7 +140,7 @@ if(NOT DEFINED VTK_DIR OR NOT DEFINED VTK_SOURCE_DIR) BINARY_DIR ${proj}-build GIT_REPOSITORY "${git_protocol}://${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}" GIT_TAG ${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG} - "${slicer_external_update}" + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} ${CUSTOM_BUILD_COMMAND} CMAKE_ARGS diff --git a/SuperBuild/External_cmcurl.cmake b/SuperBuild/External_cmcurl.cmake index 2bbdb1ba0..b69336f8e 100644 --- a/SuperBuild/External_cmcurl.cmake +++ b/SuperBuild/External_cmcurl.cmake @@ -26,7 +26,7 @@ endif() ExternalProject_Add(${proj} SVN_REPOSITORY "http://svn.slicer.org/Slicer3-lib-mirrors/trunk/cmcurl" SVN_REVISION -r "185" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR cmcurl BINARY_DIR cmcurl-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_jqPlot.cmake b/SuperBuild/External_jqPlot.cmake index 3c13ba168..3ba84ac25 100644 --- a/SuperBuild/External_jqPlot.cmake +++ b/SuperBuild/External_jqPlot.cmake @@ -19,7 +19,7 @@ if(NOT DEFINED jqPlot_DIR) ExternalProject_Add(${proj} URL http://cloud.github.com/downloads/Slicer/jqplot/jquery.jqplot.1.0.4r1115.tar.gz URL_MD5 5c5d73730145c3963f09e1d3ca355580 - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/jqPlot BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/jqPlot-build CONFIGURE_COMMAND "" diff --git a/SuperBuild/External_qCDashAPI.cmake b/SuperBuild/External_qCDashAPI.cmake index 50a657838..abc4a2924 100644 --- a/SuperBuild/External_qCDashAPI.cmake +++ b/SuperBuild/External_qCDashAPI.cmake @@ -37,7 +37,7 @@ if(NOT DEFINED qCDashAPI_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/jcfr/qCDashAPI.git" GIT_TAG "9cd19663c1884b28ba4ad4153b290bf9da5500ab" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_qMidasAPI.cmake b/SuperBuild/External_qMidasAPI.cmake index d0cb179f7..9cef1d36b 100644 --- a/SuperBuild/External_qMidasAPI.cmake +++ b/SuperBuild/External_qMidasAPI.cmake @@ -37,7 +37,7 @@ if(NOT DEFINED qMidasAPI_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/Slicer/qMidasAPI.git" GIT_TAG "2fae646e963a43d0cae7af52c18e78ce43a75f0c" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build CMAKE_GENERATOR ${gen} diff --git a/SuperBuild/External_teem.cmake b/SuperBuild/External_teem.cmake index fd56c09d4..5538bff58 100644 --- a/SuperBuild/External_teem.cmake +++ b/SuperBuild/External_teem.cmake @@ -50,7 +50,7 @@ ExternalProject_Add(${proj} DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} SOURCE_DIR teem BINARY_DIR teem-build - "${slicer_external_update}" + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CMAKE_ARGS -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} diff --git a/SuperBuild/External_zlib.cmake b/SuperBuild/External_zlib.cmake index 1753b912c..880fdd8ed 100644 --- a/SuperBuild/External_zlib.cmake +++ b/SuperBuild/External_zlib.cmake @@ -38,7 +38,7 @@ if(NOT DEFINED zlib_DIR) ExternalProject_Add(${proj} GIT_REPOSITORY "${git_protocol}://github.com/commontk/zlib.git" GIT_TAG "66a753054b356da85e1838a081aa94287226823e" - "${slicer_external_update}" + "${cmakeversion_external_update}" SOURCE_DIR zlib BINARY_DIR zlib-build INSTALL_DIR zlib-install -- GitLab From c751ab41f920740cf85a293d9b74a37a13d42455 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 27 Jan 2013 15:54:36 -0600 Subject: [PATCH 3/6] STYLE: Regularize External_${extProjName}.cmake A rigourous regularization of all External_${extProjName}.cmake files was conducted. The files were made to conform to the External_ITKv4.cmake template format as much as possible in order to enforce consistency, and to allow these SuperBuild files to be used in other projects (Like BRAINS, ANTs, DTIPrep) with little or no modificaitons. --- ...rMacroCheckExternalProjectDependency.cmake | 12 ++ SuperBuild.cmake | 16 +- SuperBuild/External_BRAINSTools.cmake | 92 ++++++--- SuperBuild/External_BatchMake.cmake | 132 +++++++++---- SuperBuild/External_CTK.cmake | 98 +++++++--- SuperBuild/External_CTKAPPLAUNCHER.cmake | 127 +++++++----- SuperBuild/External_ChangeTrackerPy.cmake | 79 ++++++-- SuperBuild/External_DCMTK.cmake | 96 +++++++--- SuperBuild/External_EMSegment.cmake | 72 +++++-- SuperBuild/External_ITKv3.cmake | 103 ++++++---- SuperBuild/External_ITKv4.cmake | 32 +++- SuperBuild/External_LibArchive.cmake | 111 +++++++---- SuperBuild/External_MultiVolumeExplorer.cmake | 81 ++++++-- SuperBuild/External_MultiVolumeImporter.cmake | 81 ++++++-- SuperBuild/External_NUMPY.cmake | 39 +++- SuperBuild/External_OpenIGTLink.cmake | 128 +++++++++---- SuperBuild/External_OpenIGTLinkIF.cmake | 80 ++++++-- SuperBuild/External_PCRE.cmake | 34 +++- SuperBuild/External_SciPy.cmake | 36 +++- SuperBuild/External_SimpleITK.cmake | 181 +++++++++++------- .../External_SlicerExecutionModel.cmake | 92 ++++++--- SuperBuild/External_Swig.cmake | 36 +++- SuperBuild/External_VTK.cmake | 120 ++++++++---- SuperBuild/External_cmcurl.cmake | 115 +++++++---- SuperBuild/External_incrTcl.cmake | 35 +++- SuperBuild/External_jqPlot.cmake | 76 ++++++-- SuperBuild/External_python.cmake | 46 ++++- SuperBuild/External_python_unix.cmake | 2 - SuperBuild/External_qCDashAPI.cmake | 82 +++++--- SuperBuild/External_qMidasAPI.cmake | 76 ++++++-- SuperBuild/External_tcl.cmake | 49 ++++- SuperBuild/External_teem.cmake | 87 --------- SuperBuild/External_tk.cmake | 53 ++++- SuperBuild/External_weave.cmake | 36 +++- SuperBuild/External_zlib.cmake | 97 +++++++--- 35 files changed, 1863 insertions(+), 769 deletions(-) delete mode 100644 SuperBuild/External_teem.cmake diff --git a/CMake/SlicerMacroCheckExternalProjectDependency.cmake b/CMake/SlicerMacroCheckExternalProjectDependency.cmake index 3ad4b1e4c..fa92e51ae 100644 --- a/CMake/SlicerMacroCheckExternalProjectDependency.cmake +++ b/CMake/SlicerMacroCheckExternalProjectDependency.cmake @@ -22,6 +22,18 @@ if(NOT EXISTS "${EXTERNAL_PROJECT_DIR}") set(EXTERNAL_PROJECT_DIR ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/SuperBuild) endif() +### +macro(ProjectDependancyPush CACHE_LIST VALUE) + list(APPEND ${CACHE_LIST} ${VALUE}) + #message(STATUS "PUSHING ${VALUE} onto ${CACHE_LIST}: --> ${${CACHE_LIST}}") +endmacro() + +macro(ProjectDependancyPop CACHE_LIST TVAR) + list(GET ${CACHE_LIST} -1 ${TVAR}) + list(REMOVE_AT ${CACHE_LIST} -1) + #message(STATUS "POPING ${${TVAR}} from ${CACHE_LIST}: --> ${${CACHE_LIST}}") +endmacro() + macro(SlicerMacroCheckExternalProjectDependency proj) # Set indent variable if needed if(NOT DEFINED __indent) diff --git a/SuperBuild.cmake b/SuperBuild.cmake index 93cfa6a18..c99fcd54d 100644 --- a/SuperBuild.cmake +++ b/SuperBuild.cmake @@ -90,10 +90,14 @@ endif() #------------------------------------------------------------------------------ # Slicer dependency list #------------------------------------------------------------------------------ +option(USE_SYSTEM_ITK "Build using an externally defined version of ITK" OFF) +option(USE_SYSTEM_SlicerExecutionModel "Build using an externally defined version of SlicerExecutionModel" OFF) +option(USE_SYSTEM_VTK "Build using an externally defined version of VTK" OFF) +option(USE_SYSTEM_DCMTK "Build using an externally defined version of DCMTK" OFF) set(ITK_EXTERNAL_NAME ITKv${ITK_VERSION_MAJOR}) -set(Slicer_DEPENDENCIES cmcurl teem VTK ${ITK_EXTERNAL_NAME} CTK jqPlot LibArchive) +set(Slicer_DEPENDENCIES cmcurl Teem VTK ${ITK_EXTERNAL_NAME} CTK jqPlot LibArchive) if(Slicer_USE_OpenIGTLink) list(APPEND Slicer_DEPENDENCIES OpenIGTLink) @@ -127,7 +131,7 @@ if(Slicer_BUILD_EXTENSIONMANAGER_SUPPORT) list(APPEND Slicer_DEPENDENCIES qMidasAPI) endif() -if(Slicer_BUILD_DICOM_SUPPORT) +if(Slicer_BUILD_DICOM_SUPPORT AND NOT DCMTK_DIR) ## NOTE: if dependancy already added, then don't add it again. list(APPEND Slicer_DEPENDENCIES DCMTK) endif() @@ -167,7 +171,12 @@ if(DEFINED Slicer_ADDITIONAL_DEPENDENCIES) list(APPEND Slicer_DEPENDENCIES ${Slicer_ADDITIONAL_DEPENDENCIES}) endif() -SlicerMacroCheckExternalProjectDependency(Slicer) +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName Slicer) #The find_package known name +set(proj Slicer) #This local name +SlicerMacroCheckExternalProjectDependency(${proj}) #----------------------------------------------------------------------------- # Dump Slicer external project dependencies @@ -364,7 +373,6 @@ endif() #------------------------------------------------------------------------------ # Configure and build Slicer #------------------------------------------------------------------------------ -set(proj Slicer) ExternalProject_Add(${proj} DEPENDS ${Slicer_DEPENDENCIES} diff --git a/SuperBuild/External_BRAINSTools.cmake b/SuperBuild/External_BRAINSTools.cmake index 14de138a2..ca34e80e9 100644 --- a/SuperBuild/External_BRAINSTools.cmake +++ b/SuperBuild/External_BRAINSTools.cmake @@ -1,51 +1,99 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName BRAINSTools) #The find_package known name +set(proj BRAINSTools) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED BRAINSTools_SOURCE_DIR AND NOT EXISTS ${BRAINSTools_SOURCE_DIR}) - message(FATAL_ERROR "BRAINSTools_SOURCE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_SOURCE_DIR AND NOT EXISTS ${${extProjName}_SOURCE_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(BRAINSTools_DEPENDENCIES ${ITK_EXTERNAL_NAME} SlicerExecutionModel VTK ) +set(${proj}_DEPENDENCIES ${ITK_EXTERNAL_NAME} SlicerExecutionModel VTK ) +if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT) + list(APPEND ${proj}_DEPENDENCIES DCMTK) +endif() # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(BRAINSTools) -set(proj BRAINSTools) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED BRAINSTools_SOURCE_DIR) +if(NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") -if(${ITK_VERSION_MAJOR} STREQUAL "3") - set(GIT_TAG "fa2159607df370451e7a26d09e4e2a61b6e6c5c8" CACHE STRING "" FORCE) -else() - set(GIT_TAG "796a96d7b0b4c5faf8188919d77ffa863f0af216" CACHE STRING "" FORCE) # 2013-01-07 tag DWIConvert -endif() + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/BRAINSia/BRAINSStandAlone.git") +if(${ITK_VERSION_MAJOR} STREQUAL "3") + set(${proj}_GIT_TAG "fa2159607df370451e7a26d09e4e2a61b6e6c5c8" CACHE STRING "" FORCE) +else() + set(${proj}_GIT_TAG "796a96d7b0b4c5faf8188919d77ffa863f0af216" CACHE STRING "" FORCE) # 2013-01-07 tag DWIConvert +endif() ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/BRAINSia/BRAINSStandAlone.git" - GIT_TAG "${GIT_TAG}" - "${cmakeversion_external_update}" + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${BRAINSTools_DEPENDENCIES} - ) - set(BRAINSTools_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) else() - # The project is provided using BRAINSTools_DIR, nevertheless since other project may depend on BRAINSTools, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${BRAINSTools_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_BatchMake.cmake b/SuperBuild/External_BatchMake.cmake index 4c968a69f..2735862c9 100644 --- a/SuperBuild/External_BatchMake.cmake +++ b/SuperBuild/External_BatchMake.cmake @@ -1,56 +1,104 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName BatchMake) #The find_package known name +set(proj BatchMake) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(BatchMake_DEPENDENCIES ${ITK_EXTERNAL_NAME}) +set(${proj}_DEPENDENCIES ${ITK_EXTERNAL_NAME}) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(BatchMake) -set(proj BatchMake) - -# Set CMake OSX variable to pass down the external project -set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) -if(APPLE) - list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) -endif() +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED git_protocol) - set(git_protocol "git") -endif() +if(NOT DEFINED ${extProjName}_DIR) # AND NOT ${USE_SYSTEM_${extProjName}}) + #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here + if(NOT DEFINED git_protocol) + set(git_protocol "git") + endif() -#message(STATUS "${__indent}Adding project ${proj}") -ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://batchmake.org/BatchMake.git" - GIT_TAG "1f5bf4f92e8678c34dc6f7558be5e6613804d988" - "${cmakeversion_external_update}" - SOURCE_DIR BatchMake - BINARY_DIR BatchMake-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DBUILD_TESTING:BOOL=OFF - -DBUILD_SHARED_LIBS:BOOL=ON - -DUSE_FLTK:BOOL=OFF - -DDASHBOARD_SUPPORT:BOOL=OFF - -DGRID_SUPPORT:BOOL=ON - -DUSE_SPLASHSCREEN:BOOL=OFF - -DITK_DIR:PATH=${ITK_DIR} - INSTALL_COMMAND "" - DEPENDS - ${BatchMake_DEPENDENCIES} + set(${proj}_CMAKE_OPTIONS + -DBUILD_TESTING:BOOL=OFF + -DBUILD_SHARED_LIBS:BOOL=ON + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DUSE_FLTK:BOOL=OFF + -DDASHBOARD_SUPPORT:BOOL=OFF + -DGRID_SUPPORT:BOOL=ON + -DUSE_SPLASHSCREEN:BOOL=OFF + -DITK_DIR:PATH=${ITK_DIR} ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://batchmake.org/BatchMake.git") + set(${proj}_GIT_TAG "1f5bf4f92e8678c34dc6f7558be5e6613804d988") + ExternalProject_Add(${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} + INSTALL_COMMAND "" + DEPENDS + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) +else() + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") +endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) -set(BatchMake_DIR ${CMAKE_BINARY_DIR}/BatchMake-build) +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_CTK.cmake b/SuperBuild/External_CTK.cmake index c8ae8bbea..10db3aef5 100644 --- a/SuperBuild/External_CTK.cmake +++ b/SuperBuild/External_CTK.cmake @@ -1,30 +1,48 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName CTK) #The find_package known name +set(proj CTK) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED CTK_DIR AND NOT EXISTS ${CTK_DIR}) - message(FATAL_ERROR "CTK_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(CTK_DEPENDENCIES VTK ${ITK_EXTERNAL_NAME}) +set(${proj}_DEPENDENCIES VTK ${ITK_EXTERNAL_NAME}) if(Slicer_USE_PYTHONQT) - list(APPEND CTK_DEPENDENCIES python) + list(APPEND ${proj}_DEPENDENCIES python) endif() if(Slicer_BUILD_DICOM_SUPPORT) - list(APPEND CTK_DEPENDENCIES DCMTK) + list(APPEND ${proj}_DEPENDENCIES DCMTK) endif() # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(CTK) -set(proj CTK) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED CTK_DIR) +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project @@ -36,6 +54,7 @@ if(NOT DEFINED CTK_DIR) -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + ### --- Project specific additions here set(optional_ep_args) if(Slicer_USE_PYTHONQT) list(APPEND optional_ep_args @@ -61,26 +80,14 @@ if(NOT DEFINED CTK_DIR) endif() if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() - ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/commontk/CTK.git" - GIT_TAG "b183487871c43408890b2785e58643ba8d6b1b13" - "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} - BINARY_DIR ${proj}-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + set(${proj}_CMAKE_OPTIONS + -DBUILD_TESTING:BOOL=OFF -DADDITIONAL_C_FLAGS:STRING=${ADDITIONAL_C_FLAGS} -DADDITIONAL_CXX_FLAGS:STRING=${ADDITIONAL_CXX_FLAGS} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DBUILD_TESTING:BOOL=OFF -DCTK_INSTALL_BIN_DIR:STRING=${Slicer_INSTALL_BIN_DIR} -DCTK_INSTALL_LIB_DIR:STRING=${Slicer_INSTALL_LIB_DIR} -DCTK_INSTALL_QTPLUGIN_DIR:STRING=${Slicer_INSTALL_QtPlugins_DIR} @@ -100,14 +107,43 @@ if(NOT DEFINED CTK_DIR) -DCTK_USE_QTTESTING:BOOL=${Slicer_USE_QtTesting} -DGIT_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE} ${optional_ep_args} + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/commontk/CTK.git") + set(${proj}_GIT_TAG "b183487871c43408890b2785e58643ba8d6b1b13") + ExternalProject_Add(${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} INSTALL_COMMAND "" DEPENDS - ${CTK_DEPENDENCIES} - ) - set(CTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build) - + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) else() - # The project is provided using CTK_DIR, nevertheless since other project may depend on CTK, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${CTK_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_CTKAPPLAUNCHER.cmake b/SuperBuild/External_CTKAPPLAUNCHER.cmake index addb99c32..3831d316e 100644 --- a/SuperBuild/External_CTKAPPLAUNCHER.cmake +++ b/SuperBuild/External_CTKAPPLAUNCHER.cmake @@ -1,5 +1,6 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() @@ -7,51 +8,91 @@ endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) if(Slicer_USE_CTKAPPLAUNCHER) - # Sanity checks - if(DEFINED CTKAPPLAUNCHER_DIR AND NOT EXISTS ${CTKAPPLAUNCHER_DIR}) - message(FATAL_ERROR "CTKAPPLAUNCHER_DIR variable is defined but corresponds to non-existing directory") +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName CTKAPPLAUNCHER) #The find_package known name +set(proj CTKAPPLAUNCHER) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + +# Set dependency list +set(${proj}_DEPENDENCIES "") + +# Include dependent projects if any +SlicerMacroCheckExternalProjectDependency(${proj}) + +if(NOT DEFINED ${extProjName}_DIR ) #AND NOT ${USE_SYSTEM_${extProjName}}) + #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() - # Set dependency list - set(CTKAPPLAUNCHER_DEPENDENCIES "") - - # Include dependent projects if any - SlicerMacroCheckExternalProjectDependency(CTKAPPLAUNCHER) - set(proj CTKAPPLAUNCHER) - - if(NOT DEFINED CTKAPPLAUNCHER_DIR) - SlicerMacroGetOperatingSystemArchitectureBitness(VAR_PREFIX CTKAPPLAUNCHER) - set(launcher_version "0.1.10") - set(item_id "") - # On windows, use i386 launcher unconditionally - if("${CTKAPPLAUNCHER_OS}" STREQUAL "win") - set(CTKAPPLAUNCHER_ARCHITECTURE "i386") - set(md5 "fee82ee869cfedb54f48c58d0bad3710") - set(item_id "53") - elseif("${CTKAPPLAUNCHER_OS}" STREQUAL "linux") - set(md5 "7da4bcc68ab09833aebc156a7d0a5f06") - set(item_id "65") - elseif("${CTKAPPLAUNCHER_OS}" STREQUAL "macosx") - set(md5 "de87ffad9d5909c7525c61dac50b0c9e") - set(item_id "63") + ### --- Project specific additions here + SlicerMacroGetOperatingSystemArchitectureBitness(VAR_PREFIX CTKAPPLAUNCHER) + set(launcher_version "0.1.10") + set(item_id "") + # On windows, use i386 launcher unconditionally + if("${CTKAPPLAUNCHER_OS}" STREQUAL "win") + set(CTKAPPLAUNCHER_ARCHITECTURE "i386") + set(md5 "fee82ee869cfedb54f48c58d0bad3710") + set(item_id "53") + elseif("${CTKAPPLAUNCHER_OS}" STREQUAL "linux") + set(md5 "7da4bcc68ab09833aebc156a7d0a5f06") + set(item_id "65") + elseif("${CTKAPPLAUNCHER_OS}" STREQUAL "macosx") + set(md5 "de87ffad9d5909c7525c61dac50b0c9e") + set(item_id "63") + endif() + ### --- End Project specific additions + ExternalProject_Add(${proj} + URL http://packages.kitware.com/api/rest?method=midas.item.download&id=${item_id}&dummy=CTKAppLauncher-${launcher_version}-${CTKAPPLAUNCHER_OS}-${CTKAPPLAUNCHER_ARCHITECTURE}.tar.gz + URL_MD5 ${md5} + SOURCE_DIR ${proj} + "${cmakeversion_external_update}" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + DEPENDS + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}) +else() + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") endif() - #message(STATUS "${__indent}Adding project ${proj}") - ExternalProject_Add(${proj} - URL http://packages.kitware.com/api/rest?method=midas.item.download&id=${item_id}&dummy=CTKAppLauncher-${launcher_version}-${CTKAPPLAUNCHER_OS}-${CTKAPPLAUNCHER_ARCHITECTURE}.tar.gz - URL_MD5 ${md5} - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} - "${cmakeversion_external_update}" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - DEPENDS - ${CTKAPPLAUNCHER_DEPENDENCIES} - ) - set(CTKAPPLAUNCHER_DIR ${CMAKE_BINARY_DIR}/${proj}) - else() - # The project is provided using CTKAPPLAUNCHER_DIR, nevertheless since other - # project may depend on CTKAPPLAUNCHER, let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${CTKAPPLAUNCHER_DEPENDENCIES}") + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") +endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) endif() diff --git a/SuperBuild/External_ChangeTrackerPy.cmake b/SuperBuild/External_ChangeTrackerPy.cmake index 57fb97839..c553b173e 100644 --- a/SuperBuild/External_ChangeTrackerPy.cmake +++ b/SuperBuild/External_ChangeTrackerPy.cmake @@ -1,46 +1,91 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName ChangeTrackerPy) #The find_package known name +set(proj ChangeTrackerPy) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED ChangeTrackerPy_SOURCE_DIR AND NOT EXISTS ${ChangeTrackerPy_SOURCE_DIR}) - message(FATAL_ERROR "ChangeTrackerPy_SOURCE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_SOURCE_DIR AND NOT EXISTS ${${extProjName}_SOURCE_DIR}) + message(FATAL_ERROR "${extProjName}_SOURCE_DIR variable is defined but corresponds to non-existing directory") endif() # Set dependency list -set(ChangeTrackerPy_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(ChangeTrackerPy) -set(proj ChangeTrackerPy) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ChangeTrackerPy_SOURCE_DIR) +if(NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/fedorov/ChangeTrackerPy.git") + set(${proj}_GIT_TAG "6459708494ebdf7ae8c25cf771397a40ba63c248") ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/fedorov/ChangeTrackerPy.git" - GIT_TAG "6459708494ebdf7ae8c25cf771397a40ba63c248" - "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${ChangeTrackerPy_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) - set(ChangeTrackerPy_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) + set(${extProjName}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) else() - # The project is provided using ChangeTrackerPy_DIR, nevertheless since other project may depend on EMSegment, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${ChangeTrackerPy_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_DCMTK.cmake b/SuperBuild/External_DCMTK.cmake index 75169e81c..678fb7f85 100644 --- a/SuperBuild/External_DCMTK.cmake +++ b/SuperBuild/External_DCMTK.cmake @@ -1,19 +1,44 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName DCMTK) #The find_package known name +set(proj DCMTK) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(DCMTK_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(DCMTK) -set(proj DCMTK) +SlicerMacroCheckExternalProjectDependency(${proj}) + +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) + #message(STATUS "${__indent}Adding project ${proj}") -if(NOT DEFINED DCMTK_DIR) # Set CMake OSX variable to pass down the external project set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) if(APPLE) @@ -26,47 +51,62 @@ if(NOT DEFINED DCMTK_DIR) set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG) if(CTEST_USE_LAUNCHERS) set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG - "-DCMAKE_PROJECT_DCMTK_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake") + "-DCMAKE_PROJECT_${proj}_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake") endif() - set(DCMTK_REPOSITORY ${git_protocol}://github.com/commontk/DCMTK.git) - set(DCMTK_GIT_TAG "d06e2b7d9bafb23df4e969482a68b50fc75aaaa9") - + ### --- Project specific additions here + set(${proj}_CMAKE_OPTIONS + -DDCMTK_WITH_DOXYGEN:BOOL=OFF + -DDCMTK_WITH_ZLIB:BOOL=OFF # see CTK github issue #25 + -DDCMTK_WITH_OPENSSL:BOOL=OFF # see CTK github issue #25 + -DDCMTK_WITH_PNG:BOOL=OFF # see CTK github issue #25 + -DDCMTK_WITH_TIFF:BOOL=OFF # see CTK github issue #25 + -DDCMTK_WITH_XML:BOOL=OFF # see CTK github issue #25 + -DDCMTK_WITH_ICONV:BOOL=OFF # see CTK github issue #178 + -DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON + -DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS:BOOL=OFF + -DDCMTK_WITH_WRAP:BOOL=OFF # CTK does not build on Mac with this option turned ON due to library dependencies missing + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY ${git_protocol}://github.com/commontk/DCMTK.git) + set(${proj}_GIT_TAG "d06e2b7d9bafb23df4e969482a68b50fc75aaaa9") ExternalProject_Add(${proj} - GIT_REPOSITORY ${DCMTK_REPOSITORY} - GIT_TAG ${DCMTK_GIT_TAG} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} SOURCE_DIR ${proj} BINARY_DIR ${proj}-build INSTALL_DIR ${proj}-install "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + -DCMAKE_INSTALL_PREFIX:PATH= ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} ${CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=OFF - -DDCMTK_WITH_DOXYGEN:BOOL=OFF - -DDCMTK_WITH_ZLIB:BOOL=OFF # see CTK github issue #25 - -DDCMTK_WITH_OPENSSL:BOOL=OFF # see CTK github issue #25 - -DDCMTK_WITH_PNG:BOOL=OFF # see CTK github issue #25 - -DDCMTK_WITH_TIFF:BOOL=OFF # see CTK github issue #25 - -DDCMTK_WITH_XML:BOOL=OFF # see CTK github issue #25 - -DDCMTK_WITH_ICONV:BOOL=OFF # see CTK github issue #178 - -DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON - -DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS:BOOL=OFF - -DDCMTK_WITH_WRAP:BOOL=OFF # CTK does not build on Mac with this option turned ON due to library dependencies missing + ${${proj}_CMAKE_OPTIONS} DEPENDS - ${DCMTK_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) - - set(DCMTK_DIR ${CMAKE_BINARY_DIR}/${proj}-install) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install) else() - # The project is provided with DCMTK_DIR, nevertheless since other project may depend on DCMTK_DIR, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${DCMTK_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_EMSegment.cmake b/SuperBuild/External_EMSegment.cmake index 81eff9b30..09409e268 100644 --- a/SuperBuild/External_EMSegment.cmake +++ b/SuperBuild/External_EMSegment.cmake @@ -1,41 +1,85 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName EMSegment) #The find_package known name +set(proj EMSegment) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED EMSegment_SOURCE_DIR AND NOT EXISTS ${EMSegment_SOURCE_DIR}) - message(FATAL_ERROR "EMSegment_SOURCE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_SOURCE_DIR AND NOT EXISTS ${${extProjName}_SOURCE_DIR}) + message(FATAL_ERROR "${extProjName}_SOURCE_DIR variable is defined but corresponds to non-existing directory") endif() # Set dependency list -set(EMSegment_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(EMSegment) -set(proj EMSegment) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED EMSegment_SOURCE_DIR) +if(NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here + set(${proj}_CMAKE_OPTIONS + ) + ### --- End Project specific additions ExternalProject_Add(${proj} SVN_REPOSITORY "http://svn.slicer.org/Slicer3/trunk/Modules/EMSegment" SVN_REVISION -r "17018" - "${cmakeversion_external_update}" SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${EMSegment_DEPENDENCIES} - ) - set(EMSegment_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) else() - # The project is provided using EMSegment_DIR, nevertheless since other project may depend on EMSegment, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${EMSegment_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_ITKv3.cmake b/SuperBuild/External_ITKv3.cmake index 10c3dc503..d2b5b9486 100644 --- a/SuperBuild/External_ITKv3.cmake +++ b/SuperBuild/External_ITKv3.cmake @@ -1,24 +1,42 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName ITK) #The find_package known name +set(proj ITKv3) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#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") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(ITKv3_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(ITKv3) -set(proj ITKv3) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ITK_DIR) +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project @@ -30,57 +48,70 @@ if(NOT DEFINED ITK_DIR) -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + ### --- Project specific additions here set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG) if(CTEST_USE_LAUNCHERS) set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG "-DCMAKE_PROJECT_ITK_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake") endif() - set(${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY "github.com/Kitware/ITK.git" CACHE STRING "Repository from which to get ITK" FORCE) - # release-3.20 branch on 2012-11-27. - set(${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG "787200e5250da02069964063548a39d5e46662e2" CACHE STRING "ITK git tag to use" FORCE) - - mark_as_advanced(${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY ${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG) if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() - ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}" - GIT_TAG ${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG} - "${cmakeversion_external_update}" - SOURCE_DIR ${proj} - BINARY_DIR ${proj}-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + set(${proj}_CMAKE_OPTIONS ${CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DBUILD_TESTING:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=ON - -DBUILD_TESTING:BOOL=OFF -DITK_INSTALL_LIB_DIR:PATH=${Slicer_INSTALL_LIB_DIR} + -DITK_LEGACY_REMOVE:BOOL=ON -DITK_USE_REVIEW:BOOL=ON -DITK_USE_REVIEW_STATISTICS:BOOL=ON -DITK_USE_OPTIMIZED_REGISTRATION_METHODS:BOOL=ON #-DITK_USE_PORTABLE_ROUND:BOOL=ON # Unused -DITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY:BOOL=ON -DITK_USE_TRANSFORM_IO_FACTORIES:BOOL=ON - -DITK_LEGACY_REMOVE:BOOL=ON -DKWSYS_USE_MD5:BOOL=ON # Required by SlicerExecutionModel + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY ${git_protocol}://itk.org/ITK.git) + set(${proj}_GIT_TAG 787200e5250da02069964063548a39d5e46662e2) + ExternalProject_Add(${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} INSTALL_COMMAND "" DEPENDS - ${ITKv3_DEPENDENCIES} - ) - set(ITK_DIR ${CMAKE_BINARY_DIR}/${proj}-build) - + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) else() - # The project is provided using ITK_DIR, nevertheless since other project may depend on ITK, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${ITKv3_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_ITKv4.cmake b/SuperBuild/External_ITKv4.cmake index 617ed488c..36e9c941d 100644 --- a/SuperBuild/External_ITKv4.cmake +++ b/SuperBuild/External_ITKv4.cmake @@ -1,14 +1,25 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) -# Include dependent projects if any +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency set(extProjName ITK) #The find_package known name -set(proj ITKv4) #This local name +set(proj ITKv4) #This local name #if(${USE_SYSTEM_${extProjName}}) # unset(${extProjName}_DIR CACHE) @@ -40,6 +51,7 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + ### --- Project specific additions here set(${proj}_DCMTK_ARGS) if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT) set(${proj}_DCMTK_ARGS @@ -112,16 +124,16 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) ${${proj}_WRAP_ARGS} ${${proj}_FFTWF_ARGS} ${${proj}_FFTWD_ARGS} - ) + ) ### --- End Project specific additions set(${proj}_REPOSITORY ${git_protocol}://itk.org/ITK.git) set(${proj}_GIT_TAG c313377e1b54c82f4e5f4941edb55f8e5a3af733) # 2013-01-06 ExternalProject_Add(${proj} GIT_REPOSITORY ${${proj}_REPOSITORY} GIT_TAG ${${proj}_GIT_TAG} - "${cmakeversion_external_update}" SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CMAKE_ARGS -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} @@ -133,9 +145,8 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) INSTALL_COMMAND "" DEPENDS ${${proj}_DEPENDENCIES} - ) + ) set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) - else() if(${USE_SYSTEM_${extProjName}}) find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) @@ -145,6 +156,11 @@ else() message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") endif() # The project is provided using ${extProjName}_DIR, nevertheless since other - # project may depend on ${proj}, let's add an 'empty' one + # project may depend on ${extProjName}, let's add an 'empty' one SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_LibArchive.cmake b/SuperBuild/External_LibArchive.cmake index 1f149584c..31bb44dc9 100644 --- a/SuperBuild/External_LibArchive.cmake +++ b/SuperBuild/External_LibArchive.cmake @@ -1,28 +1,57 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName LibArchive) #The find_package known name +set(proj LibArchive) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED LibArchive_DIR AND NOT EXISTS ${LibArchive_DIR}) - message(FATAL_ERROR "LibArchive_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(LibArchive_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") if(WIN32) - list(APPEND LibArchive_DEPENDENCIES zlib) + list(APPEND ${proj}_DEPENDENCIES zlib) endif() # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(LibArchive) -set(proj LibArchive) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED LibArchive_DIR) +if(NOT DEFINED ${extProjName}_DIR) #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here # # NOTE: - a stable, recent release (3.0.4) of LibArchive is now checked out from git # for all platforms. For notes on cross-platform issues with earlier versions @@ -42,24 +71,28 @@ if(NOT DEFINED LibArchive_DIR) -DBUILD_TESTING:BOOL=OFF -DENABLE_OPENSSL:BOOL=OFF ) - - # Set CMake OSX variable to pass down the external project - set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) - if(APPLE) - list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) - endif() - if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DBUILD_SHARED_LIBS:BOOL=ON + -DENABLE_ACL:BOOL=OFF + -DENABLE_CPIO:BOOL=OFF + -DENABLE_TAR:BOOL=OFF + -DENABLE_TEST:BOOL=OFF + -DENABLE_XATTR:BOOL=OFF + ${ADDITIONAL_CMAKE_ARGS} + -DCMAKE_INSTALL_PREFIX:PATH= + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/libarchive/libarchive.git") + set(${proj}_GIT_TAG "v3.0.4") ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/libarchive/libarchive.git" - GIT_TAG "v3.0.4" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} BINARY_DIR ${proj}-build INSTALL_DIR LibArchive-install "${cmakeversion_external_update}" @@ -70,21 +103,25 @@ if(NOT DEFINED LibArchive_DIR) -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DBUILD_SHARED_LIBS:BOOL=ON - -DENABLE_ACL:BOOL=OFF - -DENABLE_CPIO:BOOL=OFF - -DENABLE_TAR:BOOL=OFF - -DENABLE_TEST:BOOL=OFF - -DENABLE_XATTR:BOOL=OFF - ${ADDITIONAL_CMAKE_ARGS} - -DCMAKE_INSTALL_PREFIX:PATH= + ${${proj}_CMAKE_OPTIONS} DEPENDS - ${LibArchive_DEPENDENCIES} - ) - set(LibArchive_DIR ${CMAKE_BINARY_DIR}/LibArchive-install) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install) else() - # The project is provided using LibArchive_DIR, nevertheless since other project may depend on LibArchive, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${LibArchive_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_MultiVolumeExplorer.cmake b/SuperBuild/External_MultiVolumeExplorer.cmake index da8a58194..86c2dbc1f 100644 --- a/SuperBuild/External_MultiVolumeExplorer.cmake +++ b/SuperBuild/External_MultiVolumeExplorer.cmake @@ -1,46 +1,91 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName MultiVolumeExplorer) #The find_package known name +set(proj MultiVolumeExplorer) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED MultiVolumeExplorer_SOURCE_DIR AND NOT EXISTS ${MultiVolumeExplorer_SOURCE_DIR}) - message(FATAL_ERROR "MultiVolumeExplorer_SOURCE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_SOURCE_DIR AND NOT EXISTS ${${extProjName}_SOURCE_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(MultiVolumeExplorer_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(MultiVolumeExplorer) -set(proj MultiVolumeExplorer) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED MultiVolumeExplorer_SOURCE_DIR) +if(NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/fedorov/MultiVolumeExplorer.git") + set(${proj}_GIT_TAG "72d55d2ab12e7301ca8ced49ad05ce28346e625d") ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/fedorov/MultiVolumeExplorer.git" - GIT_TAG "72d55d2ab12e7301ca8ced49ad05ce28346e625d" - "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${MultiVolumeExplorer_DEPENDENCIES} - ) - set(MultiVolumeExplorer_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) else() - # The project is provided using MultiVolumeExplorer_DIR, nevertheless since other project may depend on EMSegment, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${MultiVolumeExplorer_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_MultiVolumeImporter.cmake b/SuperBuild/External_MultiVolumeImporter.cmake index b6d068b66..1ac681e5f 100644 --- a/SuperBuild/External_MultiVolumeImporter.cmake +++ b/SuperBuild/External_MultiVolumeImporter.cmake @@ -1,46 +1,91 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName MultiVolumeImporter) #The find_package known name +set(proj MultiVolumeImporter) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED MultiVolumeImporter_SOURCE_DIR AND NOT EXISTS ${MultiVolumeImporter_SOURCE_DIR}) - message(FATAL_ERROR "MultiVolumeImporter_SOURCE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_SOURCE_DIR AND NOT EXISTS ${${extProjName}_SOURCE_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(MultiVolumeImporter_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(MultiVolumeImporter) -set(proj MultiVolumeImporter) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED MultiVolumeImporter_SOURCE_DIR) +if(NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/fedorov/MultiVolumeImporter.git") + set(${proj}_GIT_TAG "63883c9176c2ee1fe24803cbc2cc5268ab086aa8") ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/fedorov/MultiVolumeImporter.git" - GIT_TAG "63883c9176c2ee1fe24803cbc2cc5268ab086aa8" - "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${MultiVolumeImporter_DEPENDENCIES} - ) - set(MultiVolumeImporter_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) else() - # The project is provided using MultiVolumeImporter_DIR, nevertheless since other project may depend on EMSegment, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${MultiVolumeImporter_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_NUMPY.cmake b/SuperBuild/External_NUMPY.cmake index b636bb36f..9f4e2ab65 100644 --- a/SuperBuild/External_NUMPY.cmake +++ b/SuperBuild/External_NUMPY.cmake @@ -1,27 +1,49 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName NUMPY) #The find_package known name +set(proj NUMPY) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(NUMPY_DEPENDENCIES python) +set(${proj}_DEPENDENCIES python) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(NUMPY) -set(proj NUMPY) +SlicerMacroCheckExternalProjectDependency(${proj}) message(STATUS "${__${proj}_superbuild_message} - Building without Fortran compiler - Non-optimized code will be built !") - #message(STATUS "${__indent}Adding project ${proj}") set(numpy_URL http://svn.slicer.org/Slicer3-lib-mirrors/trunk/numpy-1.4.1.tar.gz) set(numpy_MD5 5c7b5349dc3161763f7f366ceb96516b) #------------------------------------------------------------------------------ -set(NUMPY_DIR "${CMAKE_BINARY_DIR}/${proj}") +set(${extProjName}_DIR "${CMAKE_BINARY_DIR}/${proj}") configure_file( SuperBuild/${proj}_environment.cmake.in @@ -57,5 +79,8 @@ ExternalProject_Add(${proj} -DNUMPY_SRC_DIR=${Slicer_BINARY_DIR}/NUMPY -P ${CMAKE_CURRENT_LIST_DIR}/${proj}_patch.cmake DEPENDS - ${NUMPY_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_OpenIGTLink.cmake b/SuperBuild/External_OpenIGTLink.cmake index bf2575d9a..68a74a0c5 100644 --- a/SuperBuild/External_OpenIGTLink.cmake +++ b/SuperBuild/External_OpenIGTLink.cmake @@ -1,56 +1,102 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName OpenIGTLink) #The find_package known name +set(proj OpenIGTLink) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(OpenIGTLink_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(OpenIGTLink) -set(proj OpenIGTLink) - -# Set CMake OSX variable to pass down the external project -set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) -if(APPLE) - list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) -endif() +SlicerMacroCheckExternalProjectDependency(${proj}) + +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) + #message(STATUS "${__indent}Adding project ${proj}") -set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG) -if(CTEST_USE_LAUNCHERS) - set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG) + if(CTEST_USE_LAUNCHERS) + set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG "-DCMAKE_PROJECT_OpenIGTLink_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake") -endif() + endif() + ### --- Project specific additions here + -#message(STATUS "${__indent}Adding project ${proj}") - -ExternalProject_Add(${proj} - SVN_REPOSITORY "http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink" - SVN_REVISION -r "7701" - "${cmakeversion_external_update}" - SOURCE_DIR OpenIGTLink - BINARY_DIR OpenIGTLink-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - ${CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DBUILD_TESTING:BOOL=OFF - -DBUILD_SHARED_LIBS:BOOL=ON - -DOpenIGTLink_PROTOCOL_VERSION_2:BOOL=ON - INSTALL_COMMAND "" - DEPENDS - ${OpenIGTLink_DEPENDENCIES} + set(${proj}_CMAKE_OPTIONS + ${CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG} + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DBUILD_TESTING:BOOL=OFF + -DBUILD_SHARED_LIBS:BOOL=ON + -DOpenIGTLink_PROTOCOL_VERSION_2:BOOL=ON ) + ### --- End Project specific additions + ExternalProject_Add(${proj} + SVN_REPOSITORY "http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink" + SVN_REVISION -r "7701" + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} + INSTALL_COMMAND "" + DEPENDS + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) +else() + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") +endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) -set(OpenIGTLink_DIR ${CMAKE_BINARY_DIR}/OpenIGTLink-build) +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_OpenIGTLinkIF.cmake b/SuperBuild/External_OpenIGTLinkIF.cmake index e8cc4bb14..7850c4966 100644 --- a/SuperBuild/External_OpenIGTLinkIF.cmake +++ b/SuperBuild/External_OpenIGTLinkIF.cmake @@ -1,43 +1,89 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName OpenIGTLinkIF) #The find_package known name +set(proj OpenIGTLinkIF) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED OpenIGTLinkIF_SOURCE_DIR AND NOT EXISTS ${OpenIGTLinkIF_SOURCE_DIR}) - message(FATAL_ERROR "OpenIGTLinkIF_SOURCE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_SOURCE_DIR AND NOT EXISTS ${${extProjName}_SOURCE_DIR}) + message(FATAL_ERROR "${extProjName}_SOURCE_DIR variable is defined but corresponds to non-existing directory") endif() # Set dependency list -set(OpenIGTLinkIF_DEPENDENCIES OpenIGTLink) +set(${proj}_DEPENDENCIES OpenIGTLink) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(OpenIGTLinkIF) -set(proj OpenIGTLinkIF) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED OpenIGTLinkIF_SOURCE_DIR) +if(NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here + set(${proj}_CMAKE_OPTIONS + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/Slicer/OpenIGTLinkIF.git") + set(${proj}_GIT_TAG "8330b769cc8c607067134296d577b64ae7c92b87") ExternalProject_Add(${proj} + #GIT_REPOSITORY ${${proj}_REPOSITORY} + #GIT_TAG ${${proj}_GIT_TAG} SVN_REPOSITORY "http://svn.na-mic.org/NAMICSandBox/trunk/IGTLoadableModules/QtModules/OpenIGTLinkIF/" SVN_REVISION -r "8024" - "${cmakeversion_external_update}" - #GIT_REPOSITORY "${git_protocol}://github.com/Slicer/OpenIGTLinkIF.git" - #GIT_TAG "8330b769cc8c607067134296d577b64ae7c92b87" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} + SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${OpenIGTLinkIF_DEPENDENCIES} - ) - set(OpenIGTLinkIF_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) else() - # The project is provided using OpenIGTLinkIF_SOURCE_DIR, nevertheless since other project may depend on OpenIGTLinkIF, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${OpenIGTLinkIF_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_PCRE.cmake b/SuperBuild/External_PCRE.cmake index ab3b31b9f..9b4038ba2 100644 --- a/SuperBuild/External_PCRE.cmake +++ b/SuperBuild/External_PCRE.cmake @@ -1,21 +1,40 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName PCRE) #The find_package known name +set(proj PCRE) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED PCRE_DIR AND NOT EXISTS ${PCRE_DIR}) - message(FATAL_ERROR "PCRE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(PCRE_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(PCRE) +SlicerMacroCheckExternalProjectDependency(${proj}) # # PCRE (Perl Compatible Regular Expressions) @@ -32,9 +51,12 @@ configure_file( @ONLY) set(pcre_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/pcre_configure_step.cmake) -ExternalProject_add(PCRE +ExternalProject_Add(${proj} URL http://downloads.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz URL_MD5 fa69e4c5d8971544acd71d1f10d59193 "${slicer_external_disable_update}" CONFIGURE_COMMAND ${pcre_CONFIGURE_COMMAND} ) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_SciPy.cmake b/SuperBuild/External_SciPy.cmake index 1927816cf..4316f7c0e 100644 --- a/SuperBuild/External_SciPy.cmake +++ b/SuperBuild/External_SciPy.cmake @@ -1,17 +1,40 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName SciPy) #The find_package known name +set(proj SciPy) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(SciPy_DEPENDENCIES NUMPY) +set(${proj}_DEPENDENCIES NUMPY) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(SciPy) -set(proj SciPy) +SlicerMacroCheckExternalProjectDependency(${proj}) #message(STATUS "${__indent}Adding project ${proj}") @@ -23,5 +46,8 @@ ExternalProject_Add(${proj} BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${SciPy_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_SimpleITK.cmake b/SuperBuild/External_SimpleITK.cmake index 608710c8a..b8991a904 100644 --- a/SuperBuild/External_SimpleITK.cmake +++ b/SuperBuild/External_SimpleITK.cmake @@ -1,80 +1,133 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName SimpleITK) #The find_package known name +set(proj SimpleITK) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED SimpleITK_DIR AND NOT EXISTS ${SimpleITK_DIR}) - message(FATAL_ERROR "SimpleITK_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(SimpleITK_DEPENDENCIES ITKv4 Swig python) +set(${proj}_DEPENDENCIES ITKv4 Swig python) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(SimpleITK) - -# -# SimpleITK externalBuild -# -include(ExternalProject) - -if(APPLE) - set(SIMPLEITK_PYTHON_ARGS - -DPYTHON_EXECUTABLE:PATH=${slicer_PYTHON_EXECUTABLE} - -DPYTHON_FRAMEWORKS:PATH=${slicer_PYTHON_FRAMEWORK} - -DPYTHON_LIBRARY:FILEPATH=${slicer_PYTHON_LIBRARY} - -DPYTHON_INCLUDE_DIR:PATH=${slicer_PYTHON_INCLUDE} - ) -else() - set(SIMPLEITK_PYTHON_ARGS - -DPYTHON_EXECUTABLE:PATH=${slicer_PYTHON_EXECUTABLE} - -DPYTHON_LIBRARY:FILEPATH=${slicer_PYTHON_LIBRARY} - -DPYTHON_INCLUDE_DIR:PATH=${slicer_PYTHON_INCLUDE} - ) -endif() +SlicerMacroCheckExternalProjectDependency(${proj}) + +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) + #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here + if(APPLE) + set(SIMPLEITK_PYTHON_ARGS + -DPYTHON_EXECUTABLE:PATH=${slicer_PYTHON_EXECUTABLE} + -DPYTHON_FRAMEWORKS:PATH=${slicer_PYTHON_FRAMEWORK} + -DPYTHON_LIBRARY:FILEPATH=${slicer_PYTHON_LIBRARY} + -DPYTHON_INCLUDE_DIR:PATH=${slicer_PYTHON_INCLUDE} + ) + else() + set(SIMPLEITK_PYTHON_ARGS + -DPYTHON_EXECUTABLE:PATH=${slicer_PYTHON_EXECUTABLE} + -DPYTHON_LIBRARY:FILEPATH=${slicer_PYTHON_LIBRARY} + -DPYTHON_INCLUDE_DIR:PATH=${slicer_PYTHON_INCLUDE} + ) + endif() -configure_file(SuperBuild/SimpleITK_install_step.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/SimpleITK_install_step.cmake - @ONLY) - -set(SimpleITK_INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/SimpleITK_install_step.cmake) - - -ExternalProject_add(SimpleITK - SOURCE_DIR SimpleITK - BINARY_DIR SimpleITK-build - GIT_REPOSITORY http://itk.org/SimpleITK.git - GIT_TAG c9d890337f1b582acb0482e16c06aa62f3af0886 - "${cmakeversion_external_update}" - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + configure_file(SuperBuild/SimpleITK_install_step.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/SimpleITK_install_step.cmake + @ONLY) + + set(SimpleITK_INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/SimpleITK_install_step.cmake) + + set(${proj}_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - # SimpleITK does not work with shared libs turned on - -DBUILD_SHARED_LIBS:BOOL=OFF - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR} - -DITK_DIR:PATH=${ITK_DIR} - -DBUILD_EXAMPLES:BOOL=OFF - -DBUILD_TESTING:BOOL=OFF - -DBUILD_DOXYGEN:BOOL=OFF - -DWRAP_PYTHON:BOOL=ON - -DWRAP_TCL:BOOL=OFF - -DWRAP_JAVA:BOOL=OFF - -DWRAP_RUBY:BOOL=OFF - -DWRAP_LUA:BOOL=OFF - -DWRAP_CSHARP:BOOL=OFF - -DWRAP_R:BOOL=OFF - ${SIMPLEITK_PYTHON_ARGS} - -DSWIG_EXECUTABLE:PATH=${SWIG_EXECUTABLE} - # - INSTALL_COMMAND ${SimpleITK_INSTALL_COMMAND} - # - DEPENDS ${SimpleITK_DEPENDENCIES} + # SimpleITK does not work with shared libs turned on + -DBUILD_SHARED_LIBS:BOOL=OFF + -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR} + -DITK_DIR:PATH=${ITK_DIR} + -DBUILD_EXAMPLES:BOOL=OFF + -DBUILD_TESTING:BOOL=OFF + -DBUILD_DOXYGEN:BOOL=OFF + -DWRAP_PYTHON:BOOL=ON + -DWRAP_TCL:BOOL=OFF + -DWRAP_JAVA:BOOL=OFF + -DWRAP_RUBY:BOOL=OFF + -DWRAP_LUA:BOOL=OFF + -DWRAP_CSHARP:BOOL=OFF + -DWRAP_R:BOOL=OFF + ${SIMPLEITK_PYTHON_ARGS} + -DSWIG_EXECUTABLE:PATH=${SWIG_EXECUTABLE} + # + ) + + ### --- End Project specific additions + set(${proj}_REPOSITORY http://itk.org/SimpleITK.git) + set(${proj}_GIT_TAG c9d890337f1b582acb0482e16c06aa62f3af0886) + ExternalProject_Add(${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} + INSTALL_COMMAND ${SimpleITK_INSTALL_COMMAND} + DEPENDS + ${${proj}_DEPENDENCIES} ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) +else() + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") +endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) + diff --git a/SuperBuild/External_SlicerExecutionModel.cmake b/SuperBuild/External_SlicerExecutionModel.cmake index c226804f2..20bb8442d 100644 --- a/SuperBuild/External_SlicerExecutionModel.cmake +++ b/SuperBuild/External_SlicerExecutionModel.cmake @@ -1,24 +1,42 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName SlicerExecutionModel) #The find_package known name +set(proj SlicerExecutionModel) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED SlicerExecutionModel_DIR AND NOT EXISTS ${SlicerExecutionModel_DIR}) - message(FATAL_ERROR "SlicerExecutionModel_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(SlicerExecutionModel_DEPENDENCIES ${ITK_EXTERNAL_NAME}) +set(${proj}_DEPENDENCIES ${ITK_EXTERNAL_NAME}) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(SlicerExecutionModel) -set(proj SlicerExecutionModel) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED SlicerExecutionModel_DIR) +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project @@ -31,22 +49,9 @@ if(NOT DEFINED SlicerExecutionModel_DIR) endif() if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() - - ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/Slicer/SlicerExecutionModel.git" - GIT_TAG "2986286df7819b4bd2c0b7e2d25efe7fd23ff51f" - "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} - BINARY_DIR ${proj}-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} # Unused - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + set(${proj}_CMAKE_OPTIONS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_TESTING:BOOL=OFF -DITK_DIR:PATH=${ITK_DIR} @@ -61,13 +66,44 @@ if(NOT DEFINED SlicerExecutionModel_DIR) -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_RUNTIME_DESTINATION:STRING=${Slicer_INSTALL_CLIMODULES_BIN_DIR} -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_LIBRARY_DESTINATION:STRING=${Slicer_INSTALL_CLIMODULES_LIB_DIR} -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_ARCHIVE_DESTINATION:STRING=${Slicer_INSTALL_CLIMODULES_LIB_DIR} + ) + + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/Slicer/SlicerExecutionModel.git" ) + set(${proj}_GIT_TAG "2986286df7819b4bd2c0b7e2d25efe7fd23ff51f" ) + ExternalProject_Add(${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} INSTALL_COMMAND "" DEPENDS - ${SlicerExecutionModel_DEPENDENCIES} - ) - set(SlicerExecutionModel_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) else() - # The project is provided using SlicerExecutionModel_DIR, nevertheless since other project may depend on SlicerExecutionModel, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${SlicerExecutionModel_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_Swig.cmake b/SuperBuild/External_Swig.cmake index 7821430ee..aff97591f 100644 --- a/SuperBuild/External_Swig.cmake +++ b/SuperBuild/External_Swig.cmake @@ -1,21 +1,40 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName Swig) #The find_package known name +set(proj Swig) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED Swig_DIR AND NOT EXISTS ${Swig_DIR}) - message(FATAL_ERROR "Swig_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory") endif() set( TARGET_SWIG_VERSION 2.0.8 ) if(NOT SWIG_DIR) if(WIN32) # swig.exe available as pre-built binary on Windows: - ExternalProject_Add(Swig + ExternalProject_Add(${proj} URL http://prdownloads.sourceforge.net/swig/swigwin-${TARGET_SWIG_VERSION}.zip URL_MD5 4ab8064b1a8894c8577ef9d0fb2523c8 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${TARGET_SWIG_VERSION} @@ -30,10 +49,10 @@ if(NOT SWIG_DIR) set(Swig_DEPEND Swig) else() # Set dependency list - set(Swig_DEPENDENCIES "PCRE") + set(${proj}_DEPENDENCIES "PCRE") # Include dependent projects if any - SlicerMacroCheckExternalProjectDependency(Swig) + SlicerMacroCheckExternalProjectDependency(${proj}) # # SWIG # @@ -54,7 +73,7 @@ if(NOT SWIG_DIR) @ONLY) set ( swig_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/swig_configure_step.cmake ) - ExternalProject_add(Swig + ExternalProject_Add(${proj} URL http://prdownloads.sourceforge.net/swig/swig-${TARGET_SWIG_VERSION}.tar.gz URL_MD5 69f917e870efc0712c06ab53217b28d1 CONFIGURE_COMMAND ${swig_CONFIGURE_COMMAND} @@ -66,3 +85,6 @@ if(NOT SWIG_DIR) set(Swig_DEPEND Swig) endif() endif() + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_VTK.cmake b/SuperBuild/External_VTK.cmake index 5c7db7e90..8fd634c9f 100644 --- a/SuperBuild/External_VTK.cmake +++ b/SuperBuild/External_VTK.cmake @@ -1,32 +1,62 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName VTK) #The find_package known name +set(proj VTK) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED VTK_DIR AND NOT EXISTS ${VTK_DIR}) - message(FATAL_ERROR "VTK_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() -if(DEFINED VTK_SOURCE_DIR AND NOT EXISTS ${VTK_SOURCE_DIR}) - message(FATAL_ERROR "VTK_SOURCE_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_SOURCE_DIR AND NOT EXISTS ${${extProjName}_SOURCE_DIR}) + message(FATAL_ERROR "${extProjName}_SOURCE_DIR variable is defined but corresponds to non-existing directory") endif() # Set dependency list -set(VTK_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") if (Slicer_USE_PYTHONQT) - list(APPEND VTK_DEPENDENCIES python) + list(APPEND ${proj}_DEPENDENCIES python) endif() # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(VTK) -set(proj VTK) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED VTK_DIR OR NOT DEFINED VTK_SOURCE_DIR) +if( ( NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}} ) + OR NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here set(VTK_WRAP_TCL OFF) set(VTK_WRAP_PYTHON OFF) @@ -117,14 +147,6 @@ if(NOT DEFINED VTK_DIR OR NOT DEFINED VTK_SOURCE_DIR) -P ${CMAKE_CURRENT_BINARY_DIR}/VTK_build_step.cmake) endif() - # Set CMake OSX variable to pass down the external project - set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) - if(APPLE) - list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) - endif() set(${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY "github.com/Slicer/VTK.git" CACHE STRING "Repository from which to get VTK" FORCE) set(${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG "03ddda8cd503b957268fee138c7b57465e5842a4" CACHE STRING "VTK git tag to use" FORCE) @@ -132,26 +154,13 @@ if(NOT DEFINED VTK_DIR OR NOT DEFINED VTK_SOURCE_DIR) mark_as_advanced(${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY ${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG) if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() - ExternalProject_Add(${proj} - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} - BINARY_DIR ${proj}-build - GIT_REPOSITORY "${git_protocol}://${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}" - GIT_TAG ${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG} - "${cmakeversion_external_update}" - CMAKE_GENERATOR ${gen} - ${CUSTOM_BUILD_COMMAND} - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + set(${proj}_CMAKE_OPTIONS -DBUILD_TESTING:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=ON -DVTK_USE_PARALLEL:BOOL=ON -DVTK_DEBUG_LEAKS:BOOL=${Slicer_USE_VTK_DEBUG_LEAKS} @@ -164,16 +173,45 @@ if(NOT DEFINED VTK_DIR OR NOT DEFINED VTK_SOURCE_DIR) ${VTK_PYTHON_ARGS} ${VTK_QT_ARGS} ${VTK_MAC_ARGS} + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://${${CMAKE_PROJECT_NAME}_${proj}_GIT_REPOSITORY}" ) + set(${proj}_GIT_TAG ${${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG} ) + ExternalProject_Add(${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + ${CUSTOM_BUILD_COMMAND} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} INSTALL_COMMAND "" DEPENDS - ${VTK_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) - set(VTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build) - set(VTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) - + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + set(${extProjName}_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}) else() - # The project is provided using VTK_DIR and VTK_SOURCE_DIR, nevertheless since other - # project may depend on VTK, let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${VTK_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_cmcurl.cmake b/SuperBuild/External_cmcurl.cmake index b69336f8e..b1be6ab5b 100644 --- a/SuperBuild/External_cmcurl.cmake +++ b/SuperBuild/External_cmcurl.cmake @@ -1,49 +1,94 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName cmcurl) #The find_package known name +set(proj cmcurl) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(cmcurl_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(cmcurl) -set(proj cmcurl) - -# Set CMake OSX variable to pass down the external project -set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) -if(APPLE) - list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) -endif() +SlicerMacroCheckExternalProjectDependency(${proj}) + +if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) + #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() -#message(STATUS "${__indent}Adding project ${proj}") -ExternalProject_Add(${proj} - SVN_REPOSITORY "http://svn.slicer.org/Slicer3-lib-mirrors/trunk/cmcurl" - SVN_REVISION -r "185" - "${cmakeversion_external_update}" - SOURCE_DIR cmcurl - BINARY_DIR cmcurl-build - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - #Not needed -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - #Not needed -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DSLICERLIBCURL_TESTING:BOOL=OFF - #Not used -DBUILD_TESTING:BOOL=OFF - -DBUILD_SHARED_LIBS:BOOL=ON - INSTALL_COMMAND "" - DEPENDS - ${cmcurl_DEPENDENCIES} + ### --- Project specific additions here + set(${proj}_CMAKE_OPTIONS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DSLICERLIBCURL_TESTING:BOOL=OFF + #Not used -DBUILD_TESTING:BOOL=OFF + -DBUILD_SHARED_LIBS:BOOL=ON ) + ### --- End Project specific additions + ExternalProject_Add(${proj} + SVN_REPOSITORY "http://svn.slicer.org/Slicer3-lib-mirrors/trunk/cmcurl" + SVN_REVISION -r "185" + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + #Not needed -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + #Not needed -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} + INSTALL_COMMAND "" + DEPENDS + ${${proj}_DEPENDENCIES} + ) + set(SLICERLIBCURL_DIR ${CMAKE_BINARY_DIR}/${proj}-build) +else() + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") +endif() -set(SLICERLIBCURL_DIR ${CMAKE_BINARY_DIR}/cmcurl-build) +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_incrTcl.cmake b/SuperBuild/External_incrTcl.cmake index 41750a08c..24ad31b8e 100644 --- a/SuperBuild/External_incrTcl.cmake +++ b/SuperBuild/External_incrTcl.cmake @@ -1,17 +1,40 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName incrTcl) #The find_package known name +set(proj incrTcl) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(incrTcl_DEPENDENCIES tcl tk) +set(${proj}_DEPENDENCIES tcl tk) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(incrTcl) -set(proj incrTcl) +SlicerMacroCheckExternalProjectDependency(${proj}) #message(STATUS "${__indent}Adding project ${proj}") @@ -65,7 +88,7 @@ if(NOT WIN32) BUILD_COMMAND ${incrTcl_BUILD_COMMAND} INSTALL_COMMAND ${incrTcl_INSTALL_COMMAND} DEPENDS - ${incrTcl_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) ExternalProject_Add_Step(${proj} CHMOD_incrTcl_configure @@ -75,3 +98,5 @@ if(NOT WIN32) ) endif() +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_jqPlot.cmake b/SuperBuild/External_jqPlot.cmake index 3ba84ac25..ea0b56b44 100644 --- a/SuperBuild/External_jqPlot.cmake +++ b/SuperBuild/External_jqPlot.cmake @@ -1,39 +1,85 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName jqPlot) #The find_package known name +set(proj jqPlot) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(jqPlot_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(jqPlot) -set(proj jqPlot) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED jqPlot_DIR) +if(NOT DEFINED ${extProjName}_DIR) #message(STATUS "${__indent}Adding project ${proj}") + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here + set(${proj}_CMAKE_OPTIONS + ) + ### --- End Project specific additions ExternalProject_Add(${proj} URL http://cloud.github.com/downloads/Slicer/jqplot/jquery.jqplot.1.0.4r1115.tar.gz URL_MD5 5c5d73730145c3963f09e1d3ca355580 + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/jqPlot - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/jqPlot-build CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${jqPlot_DEPENDENCIES} - ) - set(jqPlot_DIR ${CMAKE_BINARY_DIR}/${proj}) - mark_as_advanced(jqPlot_DIR) - + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}) + mark_as_advanced(${extProjName}_DIR) else() - # The project is provided using jqPlot_DIR, nevertheless since other project may depend on jqPlot, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${jqPlot_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_python.cmake b/SuperBuild/External_python.cmake index 8ac0614ac..eba4eeda4 100644 --- a/SuperBuild/External_python.cmake +++ b/SuperBuild/External_python.cmake @@ -1,11 +1,35 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName python) #The find_package known name +set(proj python) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list set(python_DEPENDENCIES CTKAPPLAUNCHER) if(Slicer_USE_PYTHONQT_WITH_TCL) @@ -17,11 +41,22 @@ if(Slicer_USE_PYTHONQT_WITH_TCL) endif() # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(python) -set(proj python) +SlicerMacroCheckExternalProjectDependency(${proj}) +if(NOT DEFINED ${extProjName}_DIR) # AND NOT ${USE_SYSTEM_${extProjName}}) #message(STATUS "${__indent}Adding project ${proj}") +# Set CMake OSX variable to pass down the external project +set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) +if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) +endif() + +### --- Project specific additions here + set(python_base ${CMAKE_CURRENT_BINARY_DIR}/${proj}) set(python_build ${CMAKE_CURRENT_BINARY_DIR}/${proj}-build) # @@ -58,5 +93,10 @@ endif() #message(STATUS "slicer_PYTHON_INCLUDE:${slicer_PYTHON_INCLUDE}") #message(STATUS "slicer_PYTHON_LIBRARY:${slicer_PYTHON_LIBRARY}") #message(STATUS "slicer_PYTHON_EXECUTABLE:${slicer_PYTHON_EXECUTABLE}") +else() +endif() +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_python_unix.cmake b/SuperBuild/External_python_unix.cmake index c339821dd..29f2dab33 100644 --- a/SuperBuild/External_python_unix.cmake +++ b/SuperBuild/External_python_unix.cmake @@ -6,8 +6,6 @@ endif() set(python_SOURCE_DIR python) set(python_BUILD_IN_SOURCE 1) - - # Set slicer_PYTHON_INCLUDE, slicer_PYTHON_LIBRARY and slicer_PYTHON_EXECUTABLE variables set(python_IMPORT_SUFFIX so) if(APPLE) diff --git a/SuperBuild/External_qCDashAPI.cmake b/SuperBuild/External_qCDashAPI.cmake index abc4a2924..199e80783 100644 --- a/SuperBuild/External_qCDashAPI.cmake +++ b/SuperBuild/External_qCDashAPI.cmake @@ -1,24 +1,42 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName qCDashAPI) #The find_package known name +set(proj qCDashAPI) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED qCDashAPI_DIR AND NOT EXISTS ${qCDashAPI_DIR}) - message(FATAL_ERROR "qCDashAPI_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory") endif() # Set dependency list -set(qCDashAPI_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(qCDashAPI) -set(proj qCDashAPI) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED qCDashAPI_DIR) +if(NOT DEFINED ${extProjName}_DIR) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project @@ -30,32 +48,52 @@ if(NOT DEFINED qCDashAPI_DIR) -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + ### --- Project specific additions here if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DBUILD_TESTING:BOOL=OFF + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/jcfr/qCDashAPI.git") + set(${proj}_GIT_TAG "9cd19663c1884b28ba4ad4153b290bf9da5500ab") ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/jcfr/qCDashAPI.git" - GIT_TAG "9cd19663c1884b28ba4ad4153b290bf9da5500ab" - "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CMAKE_ARGS - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + #-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} #-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} # Unused - -DBUILD_TESTING:BOOL=OFF - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} INSTALL_COMMAND "" DEPENDS - ${qCDashAPI_DEPENDENCIES} - ) - set(qCDashAPI_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) else() - # The project is provided using qCDashAPI_DIR, nevertheless since other project may depend on qCDashAPI, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${qCDashAPI_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_qMidasAPI.cmake b/SuperBuild/External_qMidasAPI.cmake index 9cef1d36b..49528280f 100644 --- a/SuperBuild/External_qMidasAPI.cmake +++ b/SuperBuild/External_qMidasAPI.cmake @@ -1,24 +1,42 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName qMidasAPI) #The find_package known name +set(proj qMidasAPI) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + # Sanity checks -if(DEFINED qMidasAPI_DIR AND NOT EXISTS ${qMidasAPI_DIR}) - message(FATAL_ERROR "qMidasAPI_DIR variable is defined but corresponds to non-existing directory") +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") endif() # Set dependency list -set(qMidasAPI_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(qMidasAPI) -set(proj qMidasAPI) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED qMidasAPI_DIR) +if(NOT DEFINED ${extProjName}_DIR) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project @@ -30,16 +48,25 @@ if(NOT DEFINED qMidasAPI_DIR) -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + ### --- Project specific additions here if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DBUILD_TESTING:BOOL=OFF + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/Slicer/qMidasAPI.git") + set(${proj}_GIT_TAG "2fae646e963a43d0cae7af52c18e78ce43a75f0c") ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/Slicer/qMidasAPI.git" - GIT_TAG "2fae646e963a43d0cae7af52c18e78ce43a75f0c" - "${cmakeversion_external_update}" - SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} BINARY_DIR ${proj}-build + "${cmakeversion_external_update}" CMAKE_GENERATOR ${gen} CMAKE_ARGS -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} @@ -47,17 +74,26 @@ if(NOT DEFINED qMidasAPI_DIR) -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} #-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} # Unused ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DBUILD_TESTING:BOOL=OFF - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + ${${proj}_CMAKE_OPTIONS} INSTALL_COMMAND "" DEPENDS - ${qMidasAPI_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) - set(qMidasAPI_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) else() - # The project is provided using qMidasAPI_DIR, nevertheless since other project may depend on qMidasAPI, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${qMidasAPI_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_tcl.cmake b/SuperBuild/External_tcl.cmake index c78861801..bdd34aea6 100644 --- a/SuperBuild/External_tcl.cmake +++ b/SuperBuild/External_tcl.cmake @@ -1,20 +1,53 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName tcl) #The find_package known name +set(proj tcl) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(tcl_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(tcl) -set(proj tcl) +SlicerMacroCheckExternalProjectDependency(${proj}) -#message(STATUS "${__indent}Adding project ${proj}") + #message(STATUS "${__indent}Adding project ${proj}") + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here set(tcl_SVN_REPOSITORY) set(tcl_SOURCE_DIR "") set(tcl_BINARY_DIR "") @@ -85,7 +118,7 @@ ExternalProject_Add(${proj} BUILD_COMMAND ${tcl_BUILD_COMMAND} INSTALL_COMMAND ${tcl_INSTALL_COMMAND} DEPENDS - ${tcl_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) #----------------------------------------------------------------------------- @@ -96,5 +129,9 @@ if(APPLE) COMMAND chmod u+xw ${tcl_build}/lib/libtcl${TCL_TK_VERSION_DOT}.dylib DEPENDEES install ) +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + endif() +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_teem.cmake b/SuperBuild/External_teem.cmake deleted file mode 100644 index 5538bff58..000000000 --- a/SuperBuild/External_teem.cmake +++ /dev/null @@ -1,87 +0,0 @@ - -# Make sure this file is included only once -get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) -if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) - return() -endif() -set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) - -# Set dependency list -set(teem_DEPENDENCIES VTK) - -# Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(teem) -set(proj teem) - -# Set CMake OSX variable to pass down the external project -set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) -if(APPLE) - list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS - -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} - -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) -endif() - -set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG) -if(CTEST_USE_LAUNCHERS) - set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG - "-DCMAKE_PROJECT_Teem_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake") -endif() - -#message(STATUS "${__indent}Adding project ${proj}") - -if(WIN32) - set(teem_ZLIB_LIBRARY ${VTK_DIR}/bin/${CMAKE_CFG_INTDIR}/vtkzlib.lib) - set(teem_PNG_LIBRARY ${VTK_DIR}/bin/${CMAKE_CFG_INTDIR}/vtkpng.lib) -elseif(APPLE) - set(teem_ZLIB_LIBRARY ${VTK_DIR}/bin/libvtkzlib.dylib) - set(teem_PNG_LIBRARY ${VTK_DIR}/bin/libvtkpng.dylib) -else() - set(teem_ZLIB_LIBRARY ${VTK_DIR}/bin/libvtkzlib.so) - set(teem_PNG_LIBRARY ${VTK_DIR}/bin/libvtkpng.so) -endif() - -set(teem_URL http://svn.slicer.org/Slicer3-lib-mirrors/trunk/teem-1.10.0-src.tar.gz) -set(teem_MD5 efe219575adc89f6470994154d86c05b) - -ExternalProject_Add(${proj} - URL ${teem_URL} - URL_MD5 ${teem_MD5} - DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} - SOURCE_DIR teem - BINARY_DIR teem-build - "${cmakeversion_external_update}" - CMAKE_GENERATOR ${gen} - CMAKE_ARGS - -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} - # Not needed -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} - -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DBUILD_TESTING:BOOL=OFF - -DBUILD_SHARED_LIBS:BOOL=ON - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - ${CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG} - -DTeem_USE_LIB_INSTALL_SUBDIR:BOOL=ON - -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF - -DTeem_PTHREAD:BOOL=OFF - -DTeem_BZIP2:BOOL=OFF - -DTeem_ZLIB:BOOL=ON - -DTeem_PNG:BOOL=ON - -DTeem_VTK_MANGLE:BOOL=ON - -DTeem_VTK_TOOLKITS_IPATH:FILEPATH=${VTK_DIR} - -DZLIB_INCLUDE_DIR:PATH=${VTK_SOURCE_DIR}/Utilities - -DTeem_VTK_ZLIB_MANGLE_IPATH:PATH=${VTK_SOURCE_DIR}/Utilities/vtkzlib - -DTeem_ZLIB_DLLCONF_IPATH:PATH=${VTK_DIR}/Utilities - -DZLIB_LIBRARY:FILEPATH=${teem_ZLIB_LIBRARY} - -DPNG_PNG_INCLUDE_DIR:PATH=${VTK_SOURCE_DIR}/Utilities/vtkpng - -DTeem_PNG_DLLCONF_IPATH:PATH=${VTK_DIR}/Utilities - -DPNG_LIBRARY:FILEPATH=${teem_PNG_LIBRARY} - INSTALL_COMMAND "" - DEPENDS - ${teem_DEPENDENCIES} - ) - -set(Teem_DIR ${CMAKE_BINARY_DIR}/teem-build) - diff --git a/SuperBuild/External_tk.cmake b/SuperBuild/External_tk.cmake index 679f4f861..5285660e2 100644 --- a/SuperBuild/External_tk.cmake +++ b/SuperBuild/External_tk.cmake @@ -1,5 +1,6 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() @@ -7,16 +8,47 @@ endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) if(NOT WIN32) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName tk) #The find_package known name +set(proj tk) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() - # Set dependency list - set(tk_DEPENDENCIES tcl) +# Set dependency list +set(${proj}_DEPENDENCIES "tcl") - # Include dependent projects if any - SlicerMacroCheckExternalProjectDependency(tk) - set(proj tk) +# Include dependent projects if any +SlicerMacroCheckExternalProjectDependency(${proj}) #message(STATUS "${__indent}Adding project ${proj}") + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + ### --- Project specific additions here set(tk_SVN_REPOSITORY "http://svn.slicer.org/Slicer3-lib-mirrors/trunk/tcl/tk") set(tk_SVN_REVISION -r "114") set(tk_SOURCE_DIR "") @@ -54,6 +86,7 @@ if(NOT WIN32) set(tk_INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/tk_install_step.cmake) + ### --- End Project specific additions ExternalProject_Add(${proj} SVN_REPOSITORY ${tk_SVN_REPOSITORY} SVN_REVISION ${tk_SVN_REVISION} @@ -64,7 +97,7 @@ if(NOT WIN32) BUILD_COMMAND ${tk_BUILD_COMMAND} INSTALL_COMMAND ${tk_INSTALL_COMMAND} DEPENDS - ${tk_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) ExternalProject_Add_Step(${proj} Install_default.h @@ -91,5 +124,9 @@ if(NOT WIN32) DEPENDEES install ) endif() -endif() +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) +endif() diff --git a/SuperBuild/External_weave.cmake b/SuperBuild/External_weave.cmake index e3f49dd2e..8ebb410f1 100644 --- a/SuperBuild/External_weave.cmake +++ b/SuperBuild/External_weave.cmake @@ -1,17 +1,40 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName weave) #The find_package known name +set(proj weave) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(weave_DEPENDENCIES python NUMPY) +set(${proj}_DEPENDENCIES python NUMPY) # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(weave) -set(proj weave) +SlicerMacroCheckExternalProjectDependency(${proj}) #message(STATUS "${__indent}Adding project ${proj}") @@ -44,5 +67,8 @@ ExternalProject_Add(weave CONFIGURE_COMMAND "" INSTALL_COMMAND "" DEPENDS - ${weave_DEPENDENCIES} + ${${proj}_DEPENDENCIES} ) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) diff --git a/SuperBuild/External_zlib.cmake b/SuperBuild/External_zlib.cmake index 880fdd8ed..79e7bb561 100644 --- a/SuperBuild/External_zlib.cmake +++ b/SuperBuild/External_zlib.cmake @@ -1,27 +1,44 @@ -# Make sure this file is included only once +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) return() endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName zlib) #The find_package known name +set(proj zlib) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + # Set dependency list -set(zlib_DEPENDENCIES "") +set(${proj}_DEPENDENCIES "") # Include dependent projects if any -SlicerMacroCheckExternalProjectDependency(zlib) -set(proj zlib) +SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED zlib_DIR) +if(NOT DEFINED ${extProjName}_DIR) #message(STATUS "${__indent}Adding project ${proj}") - set(ADDITIONAL_CMAKE_ARGS) - set(zlib_c_flags ${ep_common_c_flags}) - if(WIN32) - set(zlib_c_flags "${ep_common_c_flags} /DZLIB_WINAPI") - endif() - # Set CMake OSX variable to pass down the external project set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) if(APPLE) @@ -31,33 +48,59 @@ if(NOT DEFINED zlib_DIR) -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + ### --- Project specific additions here + set(ADDITIONAL_CMAKE_ARGS) + set(zlib_c_flags ${ep_common_c_flags}) + if(WIN32) + set(zlib_c_flags "${ep_common_c_flags} /DZLIB_WINAPI") + endif() + if(NOT DEFINED git_protocol) - set(git_protocol "git") + set(git_protocol "git") endif() + set(${proj}_CMAKE_OPTIONS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DZLIB_MANGLE_PREFIX:STRING=la_zlib_ + ${ADDITIONAL_CMAKE_ARGS} + -DCMAKE_INSTALL_PREFIX:PATH= + ) + ### --- End Project specific additions + set(${proj}_REPOSITORY "${git_protocol}://github.com/commontk/zlib.git") + set(${proj}_GIT_TAG "66a753054b356da85e1838a081aa94287226823e") ExternalProject_Add(${proj} - GIT_REPOSITORY "${git_protocol}://github.com/commontk/zlib.git" - GIT_TAG "66a753054b356da85e1838a081aa94287226823e" + GIT_REPOSITORY ${${proj}_REPOSITORY} + GIT_TAG ${${proj}_GIT_TAG} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build "${cmakeversion_external_update}" - SOURCE_DIR zlib - BINARY_DIR zlib-build INSTALL_DIR zlib-install CMAKE_GENERATOR ${gen} CMAKE_ARGS - ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + #-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} # -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} # Not used + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_C_FLAGS:STRING=${zlib_c_flags} - -DZLIB_MANGLE_PREFIX:STRING=la_zlib_ - ${ADDITIONAL_CMAKE_ARGS} - -DCMAKE_INSTALL_PREFIX:PATH= + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + ${${proj}_CMAKE_OPTIONS} DEPENDS - ${zlib_DEPENDENCIES} - ) - set(zlib_DIR ${CMAKE_BINARY_DIR}/zlib-install) + ${${proj}_DEPENDENCIES} + ) + set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install) else() - # The project is provided using zlib_DIR, nevertheless since other project may depend on zlib, - # let's add an 'empty' one - SlicerMacroEmptyExternalProject(${proj} "${zlib_DEPENDENCIES}") + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") endif() +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) -- GitLab From 9b0bfadd71abef9a8a861630a37807a22cda5449 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 27 Jan 2013 16:08:56 -0600 Subject: [PATCH 4/6] STYLE: Use more generic names for variables Using more generic varible names so that the External_.cmake can be reused in other packages. --- CMake/SlicerCPack.cmake | 2 +- SuperBuild.cmake | 4 +- SuperBuild/External_CTK.cmake | 42 +++++++++---------- SuperBuild/External_CTKAPPLAUNCHER.cmake | 2 +- SuperBuild/External_ITKv3.cmake | 2 +- SuperBuild/External_NUMPY.cmake | 4 +- SuperBuild/External_PCRE.cmake | 2 +- .../External_SlicerExecutionModel.cmake | 22 +++++----- SuperBuild/External_Swig.cmake | 2 +- SuperBuild/External_VTK.cmake | 12 +++--- SuperBuild/External_incrTcl.cmake | 2 +- SuperBuild/External_python.cmake | 2 +- SuperBuild/External_python_unix.cmake | 2 +- SuperBuild/External_python_win.cmake | 8 ++-- SuperBuild/External_tcl.cmake | 2 +- SuperBuild/External_tk.cmake | 2 +- SuperBuild/External_weave.cmake | 4 +- SuperBuild/python_configure_step.cmake.in | 4 +- SuperBuild/python_install_step.cmake.in | 4 +- SuperBuild/python_make_step.cmake.in | 4 +- SuperBuild/python_patch_step_win.cmake.in | 2 +- 21 files changed, 65 insertions(+), 65 deletions(-) diff --git a/CMake/SlicerCPack.cmake b/CMake/SlicerCPack.cmake index 9c958c32d..29d5ddf27 100644 --- a/CMake/SlicerCPack.cmake +++ b/CMake/SlicerCPack.cmake @@ -10,7 +10,7 @@ endif() set(SlicerBlockInstallQtPlugins_subdirectories imageformats sqldrivers) include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQtPlugins.cmake) -if(Slicer_BUILD_DICOM_SUPPORT) +if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT) include(${Slicer_CMAKE_DIR}/SlicerBlockInstallDCMTKApps.cmake) endif() diff --git a/SuperBuild.cmake b/SuperBuild.cmake index c99fcd54d..dbf05115c 100644 --- a/SuperBuild.cmake +++ b/SuperBuild.cmake @@ -65,9 +65,9 @@ include(SlicerMacroCheckExternalProjectDependency) # With CMake 2.8.9 or later, the UPDATE_COMMAND is required for updates to occur. # For earlier versions, we nullify the update state to prevent updates and # undesirable rebuild. -set(slicer_external_disable_update UPDATE_COMMAND "") +set(cmakeversion_external_disable_update UPDATE_COMMAND "") if(CMAKE_VERSION VERSION_LESS 2.8.9) - set(cmakeversion_external_update ${slicer_external_disable_update}) + set(cmakeversion_external_update ${cmakeversion_external_disable_update}) else() set(cmakeversion_external_update LOG_UPDATE 1) endif() diff --git a/SuperBuild/External_CTK.cmake b/SuperBuild/External_CTK.cmake index 10db3aef5..0fdd64cf8 100644 --- a/SuperBuild/External_CTK.cmake +++ b/SuperBuild/External_CTK.cmake @@ -32,10 +32,10 @@ endif() # Set dependency list set(${proj}_DEPENDENCIES VTK ${ITK_EXTERNAL_NAME}) -if(Slicer_USE_PYTHONQT) +if(${PROJECT_NAME}_USE_PYTHONQT) list(APPEND ${proj}_DEPENDENCIES python) endif() -if(Slicer_BUILD_DICOM_SUPPORT) +if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT) list(APPEND ${proj}_DEPENDENCIES DCMTK) endif() @@ -56,24 +56,24 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) ### --- Project specific additions here set(optional_ep_args) - if(Slicer_USE_PYTHONQT) + if(${PROJECT_NAME}_USE_PYTHONQT) list(APPEND optional_ep_args -DPYTHON_LIBRARY:FILEPATH=${slicer_PYTHON_LIBRARY} -DPYTHON_INCLUDE_DIR:PATH=${slicer_PYTHON_INCLUDE} -DPYTHON_EXECUTABLE:FILEPATH=${slicer_PYTHON_EXECUTABLE} - -DCTK_LIB_Scripting/Python/Core:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTGUI:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTUITOOLS:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTNETWORK:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKIT:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_LIB_Scripting/Python/Widgets:BOOL=${Slicer_USE_PYTHONQT} - -DCTK_ENABLE_Python_Wrapping:BOOL=${Slicer_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Core:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTCORE:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTGUI:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTUITOOLS:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTNETWORK:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKIT:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_LIB_Scripting/Python/Widgets:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} + -DCTK_ENABLE_Python_Wrapping:BOOL=${${PROJECT_NAME}_USE_PYTHONQT} ) endif() - if(Slicer_BUILD_DICOM_SUPPORT) + if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT) list(APPEND optional_ep_args -DDCMTK_DIR:PATH=${DCMTK_DIR} ) @@ -88,10 +88,10 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) -DADDITIONAL_C_FLAGS:STRING=${ADDITIONAL_C_FLAGS} -DADDITIONAL_CXX_FLAGS:STRING=${ADDITIONAL_CXX_FLAGS} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCTK_INSTALL_BIN_DIR:STRING=${Slicer_INSTALL_BIN_DIR} - -DCTK_INSTALL_LIB_DIR:STRING=${Slicer_INSTALL_LIB_DIR} - -DCTK_INSTALL_QTPLUGIN_DIR:STRING=${Slicer_INSTALL_QtPlugins_DIR} - -DCTK_USE_GIT_PROTOCOL:BOOL=${Slicer_USE_GIT_PROTOCOL} + -DCTK_INSTALL_BIN_DIR:STRING=${${PROJECT_NAME}_INSTALL_BIN_DIR} + -DCTK_INSTALL_LIB_DIR:STRING=${${PROJECT_NAME}_INSTALL_LIB_DIR} + -DCTK_INSTALL_QTPLUGIN_DIR:STRING=${${PROJECT_NAME}_INSTALL_QtPlugins_DIR} + -DCTK_USE_GIT_PROTOCOL:BOOL=${${PROJECT_NAME}_USE_GIT_PROTOCOL} -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DVTK_DIR:PATH=${VTK_DIR} -DITK_DIR:PATH=${ITK_DIR} @@ -101,10 +101,10 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) -DCTK_LIB_ImageProcessing/ITK/Core:BOOL=ON -DCTK_LIB_PluginFramework:BOOL=OFF -DCTK_PLUGIN_org.commontk.eventbus:BOOL=OFF - -DCTK_APP_ctkDICOM:BOOL=${Slicer_BUILD_DICOM_SUPPORT} - -DCTK_LIB_DICOM/Core:BOOL=${Slicer_BUILD_DICOM_SUPPORT} - -DCTK_LIB_DICOM/Widgets:BOOL=${Slicer_BUILD_DICOM_SUPPORT} - -DCTK_USE_QTTESTING:BOOL=${Slicer_USE_QtTesting} + -DCTK_APP_ctkDICOM:BOOL=${${PROJECT_NAME}_BUILD_DICOM_SUPPORT} + -DCTK_LIB_DICOM/Core:BOOL=${${PROJECT_NAME}_BUILD_DICOM_SUPPORT} + -DCTK_LIB_DICOM/Widgets:BOOL=${${PROJECT_NAME}_BUILD_DICOM_SUPPORT} + -DCTK_USE_QTTESTING:BOOL=${${PROJECT_NAME}_USE_QtTesting} -DGIT_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE} ${optional_ep_args} ) diff --git a/SuperBuild/External_CTKAPPLAUNCHER.cmake b/SuperBuild/External_CTKAPPLAUNCHER.cmake index 3831d316e..4744d6ada 100644 --- a/SuperBuild/External_CTKAPPLAUNCHER.cmake +++ b/SuperBuild/External_CTKAPPLAUNCHER.cmake @@ -7,7 +7,7 @@ if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) endif() set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) -if(Slicer_USE_CTKAPPLAUNCHER) +if(${PROJECT_NAME}_USE_CTKAPPLAUNCHER) ## External_${extProjName}.cmake files can be recurisvely included, ## and cmake variables are global, so when including sub projects it ## is important make the extProjName and proj variables diff --git a/SuperBuild/External_ITKv3.cmake b/SuperBuild/External_ITKv3.cmake index d2b5b9486..5e311808d 100644 --- a/SuperBuild/External_ITKv3.cmake +++ b/SuperBuild/External_ITKv3.cmake @@ -66,7 +66,7 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) -DBUILD_EXAMPLES:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=ON - -DITK_INSTALL_LIB_DIR:PATH=${Slicer_INSTALL_LIB_DIR} + -DITK_INSTALL_LIB_DIR:PATH=${${PROJECT_NAME}_INSTALL_LIB_DIR} -DITK_LEGACY_REMOVE:BOOL=ON -DITK_USE_REVIEW:BOOL=ON -DITK_USE_REVIEW_STATISTICS:BOOL=ON diff --git a/SuperBuild/External_NUMPY.cmake b/SuperBuild/External_NUMPY.cmake index 9f4e2ab65..b09ecd6a6 100644 --- a/SuperBuild/External_NUMPY.cmake +++ b/SuperBuild/External_NUMPY.cmake @@ -68,7 +68,7 @@ ExternalProject_Add(${proj} DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/NUMPY BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/NUMPY - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/${proj}_configure_step.cmake BUILD_COMMAND ${CMAKE_COMMAND} @@ -76,7 +76,7 @@ ExternalProject_Add(${proj} INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/${proj}_install_step.cmake PATCH_COMMAND ${CMAKE_COMMAND} - -DNUMPY_SRC_DIR=${Slicer_BINARY_DIR}/NUMPY + -DNUMPY_SRC_DIR=${${PROJECT_NAME}_BINARY_DIR}/NUMPY -P ${CMAKE_CURRENT_LIST_DIR}/${proj}_patch.cmake DEPENDS ${${proj}_DEPENDENCIES} diff --git a/SuperBuild/External_PCRE.cmake b/SuperBuild/External_PCRE.cmake index 9b4038ba2..514781123 100644 --- a/SuperBuild/External_PCRE.cmake +++ b/SuperBuild/External_PCRE.cmake @@ -54,7 +54,7 @@ set(pcre_CONFIGURE_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/pcre_ ExternalProject_Add(${proj} URL http://downloads.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz URL_MD5 fa69e4c5d8971544acd71d1f10d59193 - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" CONFIGURE_COMMAND ${pcre_CONFIGURE_COMMAND} ) diff --git a/SuperBuild/External_SlicerExecutionModel.cmake b/SuperBuild/External_SlicerExecutionModel.cmake index 20bb8442d..c800cfc53 100644 --- a/SuperBuild/External_SlicerExecutionModel.cmake +++ b/SuperBuild/External_SlicerExecutionModel.cmake @@ -55,17 +55,17 @@ if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_TESTING:BOOL=OFF -DITK_DIR:PATH=${ITK_DIR} - -DSlicerExecutionModel_LIBRARY_PROPERTIES:STRING=${Slicer_LIBRARY_PROPERTIES} - -DSlicerExecutionModel_INSTALL_BIN_DIR:PATH=${Slicer_INSTALL_LIB_DIR} - -DSlicerExecutionModel_INSTALL_LIB_DIR:PATH=${Slicer_INSTALL_LIB_DIR} - #-DSlicerExecutionModel_INSTALL_SHARE_DIR:PATH=${Slicer_INSTALL_ROOT}share/${SlicerExecutionModel} - -DSlicerExecutionModel_INSTALL_NO_DEVELOPMENT:BOOL=${Slicer_INSTALL_NO_DEVELOPMENT} - -DSlicerExecutionModel_DEFAULT_CLI_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_BIN_DIR} - -DSlicerExecutionModel_DEFAULT_CLI_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_LIB_DIR} - -DSlicerExecutionModel_DEFAULT_CLI_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${Slicer_BINARY_INNER_SUBDIR}/${Slicer_CLIMODULES_LIB_DIR} - -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_RUNTIME_DESTINATION:STRING=${Slicer_INSTALL_CLIMODULES_BIN_DIR} - -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_LIBRARY_DESTINATION:STRING=${Slicer_INSTALL_CLIMODULES_LIB_DIR} - -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_ARCHIVE_DESTINATION:STRING=${Slicer_INSTALL_CLIMODULES_LIB_DIR} + -DSlicerExecutionModel_LIBRARY_PROPERTIES:STRING=${${PROJECT_NAME}_LIBRARY_PROPERTIES} + -DSlicerExecutionModel_INSTALL_BIN_DIR:PATH=${${PROJECT_NAME}_INSTALL_LIB_DIR} + -DSlicerExecutionModel_INSTALL_LIB_DIR:PATH=${${PROJECT_NAME}_INSTALL_LIB_DIR} + #-DSlicerExecutionModel_INSTALL_SHARE_DIR:PATH=${${PROJECT_NAME}_INSTALL_ROOT}share/${SlicerExecutionModel} + -DSlicerExecutionModel_INSTALL_NO_DEVELOPMENT:BOOL=${${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT} + -DSlicerExecutionModel_DEFAULT_CLI_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${${PROJECT_NAME}_BINARY_INNER_SUBDIR}/${${PROJECT_NAME}_CLIMODULES_BIN_DIR} + -DSlicerExecutionModel_DEFAULT_CLI_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${${PROJECT_NAME}_BINARY_INNER_SUBDIR}/${${PROJECT_NAME}_CLIMODULES_LIB_DIR} + -DSlicerExecutionModel_DEFAULT_CLI_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_BINARY_DIR}/${${PROJECT_NAME}_BINARY_INNER_SUBDIR}/${${PROJECT_NAME}_CLIMODULES_LIB_DIR} + -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_RUNTIME_DESTINATION:STRING=${${PROJECT_NAME}_INSTALL_CLIMODULES_BIN_DIR} + -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_LIBRARY_DESTINATION:STRING=${${PROJECT_NAME}_INSTALL_CLIMODULES_LIB_DIR} + -DSlicerExecutionModel_DEFAULT_CLI_INSTALL_ARCHIVE_DESTINATION:STRING=${${PROJECT_NAME}_INSTALL_CLIMODULES_LIB_DIR} ) ### --- End Project specific additions diff --git a/SuperBuild/External_Swig.cmake b/SuperBuild/External_Swig.cmake index aff97591f..2f50cb946 100644 --- a/SuperBuild/External_Swig.cmake +++ b/SuperBuild/External_Swig.cmake @@ -38,7 +38,7 @@ if(NOT SWIG_DIR) URL http://prdownloads.sourceforge.net/swig/swigwin-${TARGET_SWIG_VERSION}.zip URL_MD5 4ab8064b1a8894c8577ef9d0fb2523c8 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/swigwin-${TARGET_SWIG_VERSION} - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" diff --git a/SuperBuild/External_VTK.cmake b/SuperBuild/External_VTK.cmake index 8fd634c9f..1755f834a 100644 --- a/SuperBuild/External_VTK.cmake +++ b/SuperBuild/External_VTK.cmake @@ -36,7 +36,7 @@ endif() # Set dependency list set(${proj}_DEPENDENCIES "") -if (Slicer_USE_PYTHONQT) +if (${PROJECT_NAME}_USE_PYTHONQT) list(APPEND ${proj}_DEPENDENCIES python) endif() @@ -60,12 +60,12 @@ if( ( NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}} ) set(VTK_WRAP_TCL OFF) set(VTK_WRAP_PYTHON OFF) - if (Slicer_USE_PYTHONQT) + if (${PROJECT_NAME}_USE_PYTHONQT) set(VTK_WRAP_PYTHON ON) endif() set(VTK_PYTHON_ARGS) - if(Slicer_USE_PYTHONQT) + if(${PROJECT_NAME}_USE_PYTHONQT) set(VTK_PYTHON_ARGS -DVTK_INSTALL_PYTHON_USING_CMAKE:BOOL=ON -DPYTHON_EXECUTABLE:PATH=${slicer_PYTHON_EXECUTABLE} @@ -98,7 +98,7 @@ if( ( NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}} ) endif() # Disable Tk when Python wrapping is enabled - if (Slicer_USE_PYTHONQT) + if (${PROJECT_NAME}_USE_PYTHONQT) list(APPEND VTK_QT_ARGS -DVTK_USE_TK:BOOL=OFF) endif() @@ -163,13 +163,13 @@ if( ( NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}} ) -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS:BOOL=ON -DVTK_USE_PARALLEL:BOOL=ON - -DVTK_DEBUG_LEAKS:BOOL=${Slicer_USE_VTK_DEBUG_LEAKS} + -DVTK_DEBUG_LEAKS:BOOL=${${PROJECT_NAME}_USE_VTK_DEBUG_LEAKS} -DVTK_LEGACY_REMOVE:BOOL=ON -DVTK_WRAP_TCL:BOOL=${VTK_WRAP_TCL} #-DVTK_USE_RPATH:BOOL=ON # Unused ${VTK_TCL_ARGS} -DVTK_WRAP_PYTHON:BOOL=${VTK_WRAP_PYTHON} - -DVTK_INSTALL_LIB_DIR:PATH=${Slicer_INSTALL_LIB_DIR} + -DVTK_INSTALL_LIB_DIR:PATH=${${PROJECT_NAME}_INSTALL_LIB_DIR} ${VTK_PYTHON_ARGS} ${VTK_QT_ARGS} ${VTK_MAC_ARGS} diff --git a/SuperBuild/External_incrTcl.cmake b/SuperBuild/External_incrTcl.cmake index 24ad31b8e..628313dd7 100644 --- a/SuperBuild/External_incrTcl.cmake +++ b/SuperBuild/External_incrTcl.cmake @@ -80,7 +80,7 @@ if(NOT WIN32) ExternalProject_Add(${proj} SVN_REPOSITORY ${incrTcl_SVN_REPOSITORY} SVN_REVISION ${incrTcl_SVN_REVISION} - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" SOURCE_DIR tcl/incrTcl BUILD_IN_SOURCE ${incrTcl_BUILD_IN_SOURCE} PATCH_COMMAND ${incrTcl_PATCH_COMMAND} diff --git a/SuperBuild/External_python.cmake b/SuperBuild/External_python.cmake index eba4eeda4..a2e7792d3 100644 --- a/SuperBuild/External_python.cmake +++ b/SuperBuild/External_python.cmake @@ -32,7 +32,7 @@ endif() # Set dependency list set(python_DEPENDENCIES CTKAPPLAUNCHER) -if(Slicer_USE_PYTHONQT_WITH_TCL) +if(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL) if(WIN32) list(APPEND python_DEPENDENCIES tcl) else() diff --git a/SuperBuild/External_python_unix.cmake b/SuperBuild/External_python_unix.cmake index 29f2dab33..ac920f99a 100644 --- a/SuperBuild/External_python_unix.cmake +++ b/SuperBuild/External_python_unix.cmake @@ -46,7 +46,7 @@ set(python_INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/pytho ExternalProject_Add(${proj} URL ${python_URL} URL_MD5 ${python_MD5} - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} SOURCE_DIR ${python_SOURCE_DIR} BUILD_IN_SOURCE ${python_BUILD_IN_SOURCE} diff --git a/SuperBuild/External_python_win.cmake b/SuperBuild/External_python_win.cmake index 2b1428e03..81f423501 100644 --- a/SuperBuild/External_python_win.cmake +++ b/SuperBuild/External_python_win.cmake @@ -38,7 +38,7 @@ endif() # Point the tkinter build file to the slicer tcl-build set(python_PATCH_COMMAND "") -if(Slicer_USE_PYTHONQT_WITH_TCL) +if(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL) set(python_tkinter ${python_base}/pyproject.vsprops) # The following if statement is specific to VS2010 if("${MSVC_VERSION}" VERSION_GREATER "1599") @@ -85,7 +85,7 @@ set_ep_build_command_args(select) ExternalProject_Add(${proj} URL ${python_URL} URL_MD5 ${python_MD5} - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} SOURCE_DIR python-build PATCH_COMMAND ${python_PATCH_COMMAND} @@ -104,7 +104,7 @@ build_python_target(w9xpopen Build_kill_python) build_python_target(pythoncore Build_w9xpopen) build_python_target(_socket Build_pythoncore) -if(Slicer_USE_PYTHONQT_WITH_TCL) +if(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL) build_python_target(_tkinter Build__socket) build_python_target(_testcapi Build__tkinter) else() @@ -154,7 +154,7 @@ ExternalProject_Add_Step(${proj} CopyPyconfigHeader DEPENDEES install ) -if(Slicer_USE_PYTHONQT_WITH_TCL) +if(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL) ExternalProject_Add_Step(${proj} Copy_tkinterPyd COMMAND ${CMAKE_COMMAND} -E copy ${PythonPCBuildDir}/_tkinter.pyd ${CMAKE_BINARY_DIR}/python-build/Lib/_tkinter.pyd DEPENDEES install diff --git a/SuperBuild/External_tcl.cmake b/SuperBuild/External_tcl.cmake index bdd34aea6..8a8a45953 100644 --- a/SuperBuild/External_tcl.cmake +++ b/SuperBuild/External_tcl.cmake @@ -111,7 +111,7 @@ endif() ExternalProject_Add(${proj} SVN_REPOSITORY ${tcl_SVN_REPOSITORY} SVN_REVISION ${tcl_SVN_REVISION} - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" SOURCE_DIR ${tcl_SOURCE_DIR} BUILD_IN_SOURCE ${tcl_BUILD_IN_SOURCE} CONFIGURE_COMMAND ${tcl_CONFIGURE_COMMAND} diff --git a/SuperBuild/External_tk.cmake b/SuperBuild/External_tk.cmake index 5285660e2..8ee0f3ed9 100644 --- a/SuperBuild/External_tk.cmake +++ b/SuperBuild/External_tk.cmake @@ -90,7 +90,7 @@ SlicerMacroCheckExternalProjectDependency(${proj}) ExternalProject_Add(${proj} SVN_REPOSITORY ${tk_SVN_REPOSITORY} SVN_REVISION ${tk_SVN_REVISION} - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" SOURCE_DIR ${tk_SOURCE_DIR} BUILD_IN_SOURCE ${tk_BUILD_IN_SOURCE} CONFIGURE_COMMAND ${tk_CONFIGURE_COMMAND} diff --git a/SuperBuild/External_weave.cmake b/SuperBuild/External_weave.cmake index 8ebb410f1..4432c621a 100644 --- a/SuperBuild/External_weave.cmake +++ b/SuperBuild/External_weave.cmake @@ -56,10 +56,10 @@ configure_file( # create an external project to download weave, # and configure and build it ExternalProject_Add(weave - # URL ${Slicer_SOURCE_DIR}/Modules/Python/FilteredTractography/weave + # URL ${${PROJECT_NAME}_SOURCE_DIR}/Modules/Python/FilteredTractography/weave SVN_REPOSITORY http://svn.slicer.org/Slicer3-lib-mirrors/trunk/weave SVN_REVISION -r "154" - "${slicer_external_disable_update}" + "${cmakeversion_external_disable_update}" BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/weave SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/weave BUILD_COMMAND ${CMAKE_COMMAND} diff --git a/SuperBuild/python_configure_step.cmake.in b/SuperBuild/python_configure_step.cmake.in index e9dec1b77..182e7f99f 100644 --- a/SuperBuild/python_configure_step.cmake.in +++ b/SuperBuild/python_configure_step.cmake.in @@ -9,9 +9,9 @@ if(UNIX) set(CPPFLAGS) set(LD_LIBRARY_PATH "@CMAKE_CURRENT_BINARY_DIR@/python-build/lib") - set(Slicer_USE_PYTHONQT_WITH_TCL "@Slicer_USE_PYTHONQT_WITH_TCL@") + set(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL "@${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL@") set(with_tcl_param) - if(Slicer_USE_PYTHONQT_WITH_TCL) + if(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL) set(LD_LIBRARY_PATH "@CMAKE_CURRENT_BINARY_DIR@/tcl-build/lib:${LD_LIBRARY_PATH}") set(LDFLAGS "-L@CMAKE_CURRENT_BINARY_DIR@/tcl-build/lib") set(CPPFLAGS "-I@CMAKE_CURRENT_BINARY_DIR@/tcl-build/include") diff --git a/SuperBuild/python_install_step.cmake.in b/SuperBuild/python_install_step.cmake.in index 9dc6c6a2a..890b0ea28 100644 --- a/SuperBuild/python_install_step.cmake.in +++ b/SuperBuild/python_install_step.cmake.in @@ -9,8 +9,8 @@ if(UNIX) set(CPPFLAGS) set(LD_LIBRARY_PATH "@CMAKE_CURRENT_BINARY_DIR@/python-build/lib") - set(Slicer_USE_PYTHONQT_WITH_TCL "@Slicer_USE_PYTHONQT_WITH_TCL@") - if(Slicer_USE_PYTHONQT_WITH_TCL) + set(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL "@${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL@") + if(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL) set(LD_LIBRARY_PATH "@CMAKE_CURRENT_BINARY_DIR@/tcl-build/lib:${LD_LIBRARY_PATH}") set(LDFLAGS "-L@CMAKE_CURRENT_BINARY_DIR@/tcl-build/lib") set(CPPFLAGS "-I@CMAKE_CURRENT_BINARY_DIR@/tcl-build/include") diff --git a/SuperBuild/python_make_step.cmake.in b/SuperBuild/python_make_step.cmake.in index 6ac98140b..37f3dd5c8 100644 --- a/SuperBuild/python_make_step.cmake.in +++ b/SuperBuild/python_make_step.cmake.in @@ -10,9 +10,9 @@ if(UNIX) set(CPPFLAGS) set(LD_LIBRARY_PATH "@CMAKE_CURRENT_BINARY_DIR@/python-build/lib") - set(Slicer_USE_PYTHONQT_WITH_TCL "@Slicer_USE_PYTHONQT_WITH_TCL@") + set(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL "@${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL@") - if(Slicer_USE_PYTHONQT_WITH_TCL) + if(${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL) set(LD_LIBRARY_PATH "@CMAKE_CURRENT_BINARY_DIR@/tcl-build/lib:${LD_LIBRARY_PATH}") set(LDFLAGS "-L@CMAKE_CURRENT_BINARY_DIR@/tcl-build/lib") set(CPPFLAGS "-I@CMAKE_CURRENT_BINARY_DIR@/tcl-build/include") diff --git a/SuperBuild/python_patch_step_win.cmake.in b/SuperBuild/python_patch_step_win.cmake.in index 185ddd627..d46bad197 100644 --- a/SuperBuild/python_patch_step_win.cmake.in +++ b/SuperBuild/python_patch_step_win.cmake.in @@ -24,7 +24,7 @@ configure_file( # Prevent warning about if(ON). cmake_policy(SET CMP0012 NEW) -if(@Slicer_USE_PYTHONQT_WITH_TCL@) +if(@${PROJECT_NAME}_USE_PYTHONQT_WITH_TCL@) # 32-bit or 64-bit if(@CMAKE_SIZEOF_VOID_P@ EQUAL 8) execute_process(COMMAND ${CMAKE_COMMAND} -Din:FILEPATH=@in@ -Dout:FILEPATH=@out@ -Dfind=\\tcltk64 -Dreplace=\\tcl-build -P "@script@") -- GitLab From d9b80ed6cffb56ced7efca73d9c4515a3a8127b8 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 27 Jan 2013 16:54:24 -0600 Subject: [PATCH 5/6] ENH: Allow ${extProjName}_USE_SYSTEM flags Allow skipping the internal Slicer build of packages when they are available on the system. NOTE: This does not guaranntee that the rest of Slicer can use the system versions, or even that Slicer presents options for using the system versions, only that the External_${extProjName}.cmake respects the ${extProjName}_USE_SYSTEM variable and skips building internal private versions. Since the same External_${extProjName}.cmake files are used in BRAINSTools, this allows setting the ITK_USE_SYSTEM=ON and ANTs, DTIPrep, BRAINSTools will use the ITK_DIR passed from Slicer. --- SuperBuild/External_BatchMake.cmake | 2 +- SuperBuild/External_CTK.cmake | 2 +- SuperBuild/External_CTKAPPLAUNCHER.cmake | 2 +- SuperBuild/External_DCMTK.cmake | 2 +- SuperBuild/External_ITKv3.cmake | 2 +- SuperBuild/External_ITKv4.cmake | 2 +- SuperBuild/External_OpenIGTLink.cmake | 2 +- SuperBuild/External_SimpleITK.cmake | 2 +- SuperBuild/External_SlicerExecutionModel.cmake | 2 +- SuperBuild/External_VTK.cmake | 4 ++-- SuperBuild/External_cmcurl.cmake | 2 +- SuperBuild/External_python.cmake | 2 +- SuperBuild/External_qMidasAPI.cmake | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/SuperBuild/External_BatchMake.cmake b/SuperBuild/External_BatchMake.cmake index 2735862c9..a67bac165 100644 --- a/SuperBuild/External_BatchMake.cmake +++ b/SuperBuild/External_BatchMake.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES ${ITK_EXTERNAL_NAME}) # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR) # AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_CTK.cmake b/SuperBuild/External_CTK.cmake index 0fdd64cf8..248cafebd 100644 --- a/SuperBuild/External_CTK.cmake +++ b/SuperBuild/External_CTK.cmake @@ -42,7 +42,7 @@ endif() # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_CTKAPPLAUNCHER.cmake b/SuperBuild/External_CTKAPPLAUNCHER.cmake index 4744d6ada..2b0f4a20d 100644 --- a/SuperBuild/External_CTKAPPLAUNCHER.cmake +++ b/SuperBuild/External_CTKAPPLAUNCHER.cmake @@ -37,7 +37,7 @@ set(${proj}_DEPENDENCIES "") # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR ) #AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_DCMTK.cmake b/SuperBuild/External_DCMTK.cmake index 678fb7f85..065570c98 100644 --- a/SuperBuild/External_DCMTK.cmake +++ b/SuperBuild/External_DCMTK.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES "") # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_ITKv3.cmake b/SuperBuild/External_ITKv3.cmake index 5e311808d..06a0a71ab 100644 --- a/SuperBuild/External_ITKv3.cmake +++ b/SuperBuild/External_ITKv3.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES "") # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_ITKv4.cmake b/SuperBuild/External_ITKv4.cmake index 36e9c941d..fec21d7a7 100644 --- a/SuperBuild/External_ITKv4.cmake +++ b/SuperBuild/External_ITKv4.cmake @@ -39,7 +39,7 @@ endif() # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_OpenIGTLink.cmake b/SuperBuild/External_OpenIGTLink.cmake index 68a74a0c5..505b4671a 100644 --- a/SuperBuild/External_OpenIGTLink.cmake +++ b/SuperBuild/External_OpenIGTLink.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES "") # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_SimpleITK.cmake b/SuperBuild/External_SimpleITK.cmake index b8991a904..362a4d58f 100644 --- a/SuperBuild/External_SimpleITK.cmake +++ b/SuperBuild/External_SimpleITK.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES ITKv4 Swig python) # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_SlicerExecutionModel.cmake b/SuperBuild/External_SlicerExecutionModel.cmake index c800cfc53..83f3832ad 100644 --- a/SuperBuild/External_SlicerExecutionModel.cmake +++ b/SuperBuild/External_SlicerExecutionModel.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES ${ITK_EXTERNAL_NAME}) # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_VTK.cmake b/SuperBuild/External_VTK.cmake index 1755f834a..d9de1f27e 100644 --- a/SuperBuild/External_VTK.cmake +++ b/SuperBuild/External_VTK.cmake @@ -43,8 +43,8 @@ endif() # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if( ( NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}} ) - OR NOT DEFINED ${extProjName}_SOURCE_DIR) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) +#OR NOT DEFINED ${extProjName}_SOURCE_DIR) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_cmcurl.cmake b/SuperBuild/External_cmcurl.cmake index b1be6ab5b..2bbac1517 100644 --- a/SuperBuild/External_cmcurl.cmake +++ b/SuperBuild/External_cmcurl.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES "") # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_python.cmake b/SuperBuild/External_python.cmake index a2e7792d3..68f41bbac 100644 --- a/SuperBuild/External_python.cmake +++ b/SuperBuild/External_python.cmake @@ -43,7 +43,7 @@ endif() # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR) # AND NOT ${USE_SYSTEM_${extProjName}}) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project diff --git a/SuperBuild/External_qMidasAPI.cmake b/SuperBuild/External_qMidasAPI.cmake index 49528280f..1b170d72c 100644 --- a/SuperBuild/External_qMidasAPI.cmake +++ b/SuperBuild/External_qMidasAPI.cmake @@ -36,7 +36,7 @@ set(${proj}_DEPENDENCIES "") # Include dependent projects if any SlicerMacroCheckExternalProjectDependency(${proj}) -if(NOT DEFINED ${extProjName}_DIR) +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) #message(STATUS "${__indent}Adding project ${proj}") # Set CMake OSX variable to pass down the external project -- GitLab From 0c48f433dfb23decd1b1a409e4d85df90969b0bd Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 27 Jan 2013 17:12:53 -0600 Subject: [PATCH 6/6] ENH: Rename External_teem.cmake to External_Teem.cmake. Needed to make module name and variable case consistent. --- SuperBuild/External_Teem.cmake | 130 +++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 SuperBuild/External_Teem.cmake diff --git a/SuperBuild/External_Teem.cmake b/SuperBuild/External_Teem.cmake new file mode 100644 index 000000000..a51812f20 --- /dev/null +++ b/SuperBuild/External_Teem.cmake @@ -0,0 +1,130 @@ + +# Make sure this file is included only once by creating globally unique varibles +# based on the name of this included file. +get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE) +if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED) + return() +endif() +set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1) + +## External_${extProjName}.cmake files can be recurisvely included, +## and cmake variables are global, so when including sub projects it +## is important make the extProjName and proj variables +## appear to stay constant in one of these files. +## Store global variables before overwriting (then restore at end of this file.) +ProjectDependancyPush(CACHED_extProjName ${extProjName}) +ProjectDependancyPush(CACHED_proj ${proj}) + +# Make sure that the ExtProjName/IntProjName variables are unique globally +# even if other External_${ExtProjName}.cmake files are sourced by +# SlicerMacroCheckExternalProjectDependency +set(extProjName Teem) #The find_package known name +set(proj Teem) #This local name + +#if(${USE_SYSTEM_${extProjName}}) +# unset(${extProjName}_DIR CACHE) +#endif() + +# Sanity checks +if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR}) + message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})") +endif() + +# Set dependency list +set(${proj}_DEPENDENCIES VTK) + +# Include dependent projects if any +SlicerMacroCheckExternalProjectDependency(${proj}) + +if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) ) + #message(STATUS "${__indent}Adding project ${proj}") + + # Set CMake OSX variable to pass down the external project + set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS) + if(APPLE) + list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) + endif() + + set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG) + if(CTEST_USE_LAUNCHERS) + set(CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG + "-DCMAKE_PROJECT_Teem_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake") + endif() + + ### --- Project specific additions here + + if(WIN32) + set(${proj}_ZLIB_LIBRARY ${VTK_DIR}/bin/${CMAKE_CFG_INTDIR}/vtkzlib.lib) + set(${proj}_PNG_LIBRARY ${VTK_DIR}/bin/${CMAKE_CFG_INTDIR}/vtkpng.lib) + elseif(APPLE) + set(${proj}_ZLIB_LIBRARY ${VTK_DIR}/bin/libvtkzlib.dylib) + set(${proj}_PNG_LIBRARY ${VTK_DIR}/bin/libvtkpng.dylib) + else() + set(${proj}_ZLIB_LIBRARY ${VTK_DIR}/bin/libvtkzlib.so) + set(${proj}_PNG_LIBRARY ${VTK_DIR}/bin/libvtkpng.so) + endif() + + set(${proj}_CMAKE_OPTIONS + -DTeem_USE_LIB_INSTALL_SUBDIR:BOOL=ON + -DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF + -DTeem_PTHREAD:BOOL=OFF + -DTeem_BZIP2:BOOL=OFF + -DTeem_ZLIB:BOOL=ON + -DTeem_PNG:BOOL=ON + -DTeem_VTK_MANGLE:BOOL=ON + -DTeem_VTK_TOOLKITS_IPATH:FILEPATH=${VTK_DIR} + -DZLIB_INCLUDE_DIR:PATH=${VTK_SOURCE_DIR}/Utilities + -DTeem_VTK_ZLIB_MANGLE_IPATH:PATH=${VTK_SOURCE_DIR}/Utilities/vtkzlib + -DTeem_ZLIB_DLLCONF_IPATH:PATH=${VTK_DIR}/Utilities + -DZLIB_LIBRARY:FILEPATH=${${proj}_ZLIB_LIBRARY} + -DPNG_PNG_INCLUDE_DIR:PATH=${VTK_SOURCE_DIR}/Utilities/vtkpng + -DTeem_PNG_DLLCONF_IPATH:PATH=${VTK_DIR}/Utilities + -DPNG_LIBRARY:FILEPATH=${${proj}_PNG_LIBRARY} + ) + ### --- End Project specific additions + set(${proj}_URL http://svn.slicer.org/Slicer3-lib-mirrors/trunk/teem-1.10.0-src.tar.gz) + set(${proj}_MD5 efe219575adc89f6470994154d86c05b) + ExternalProject_Add(${proj} + URL ${${proj}_URL} + URL_MD5 ${${proj}_MD5} + DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} + SOURCE_DIR ${proj} + BINARY_DIR ${proj}-build + INSTALL_COMMAND "" + "${cmakeversion_external_update}" + CMAKE_GENERATOR ${gen} + CMAKE_ARGS + -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} + # Not needed -DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags} + -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:STRING=${ep_common_c_flags} + ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS} + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DBUILD_TESTING:BOOL=OFF + -DBUILD_SHARED_LIBS:BOOL=ON + ${CMAKE_PROJECT_INCLUDE_EXTERNAL_PROJECT_ARG} + ${${proj}_CMAKE_OPTIONS} + DEPENDS + ${${proj}_DEPENDENCIES} + ) + set(${proj}_DIR ${CMAKE_BINARY_DIR}/${proj}-build) +else() + if(${USE_SYSTEM_${extProjName}}) + find_package(${extProjName} REQUIRED) + if(NOT ${extProjName}_DIR) + message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR") + endif() + message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}") + endif() + # The project is provided using ${extProjName}_DIR, nevertheless since other + # project may depend on ${extProjName}, let's add an 'empty' one + SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}") +endif() + +list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH) + +ProjectDependancyPop(CACHED_extProjName extProjName) +ProjectDependancyPop(CACHED_proj proj) -- GitLab