Parcourir la source

Merge branch 'add-external-project-vars-in-ctkconfig'

* add-external-project-vars-in-ctkconfig:
  External project specific variable can be automatically added to CTKConfig
Jean-Christophe Fillion-Robin il y a 13 ans
Parent
commit
335b6387cc

+ 8 - 8
CMakeExternals/CTKData.cmake

@@ -3,24 +3,24 @@
 #
 SET(CTKData_DEPENDS)
 IF(BUILD_TESTING)
-  
+
   # Sanity checks
   IF(DEFINED CTKData_DIR AND NOT EXISTS ${CTKData_DIR})
     MESSAGE(FATAL_ERROR "CTKData_DIR variable is defined but corresponds to non-existing directory")
   ENDIF()
-  
+
   SET(proj CTKData)
   set(proj_DEPENDENCIES)
-  
+
   SET(CTKData_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED CTKData_DIR)
-  
+
     SET(revision_tag cc07f1ff391b7828459c)
     IF(${proj}_REVISION_TAG)
       SET(revision_tag ${${proj}_REVISION_TAG})
     ENDIF()
-  
+
 #    MESSAGE(STATUS "Adding project:${proj}")
     ExternalProject_Add(${proj}
       SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
@@ -39,6 +39,6 @@ IF(BUILD_TESTING)
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DCTKData_DIR:PATH=${CTKData_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS CTKData_DIR:PATH)
 ENDIF()

+ 10 - 10
CMakeExternals/DCMTK.cmake

@@ -5,19 +5,19 @@
 SET(DCMTK_DEPENDS)
 ctkMacroShouldAddExternalProject(DCMTK_LIBRARIES add_project)
 IF(${add_project})
-  
+
   # Sanity checks
   IF(DEFINED DCMTK_DIR AND NOT EXISTS ${DCMTK_DIR})
     MESSAGE(FATAL_ERROR "DCMTK_DIR variable is defined but corresponds to non-existing directory")
   ENDIF()
 
   SET(DCMTK_enabling_variable DCMTK_LIBRARIES)
-  
+
   SET(proj DCMTK)
   SET(proj_DEPENDENCIES)
-  
+
   SET(DCMTK_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED DCMTK_DIR)
     SET(revision_tag 085525e643cab5ac82)
     IF(${proj}_REVISION_TAG)
@@ -52,7 +52,7 @@ IF(${add_project})
         -DDCMTK_WITH_PNG:BOOL=OFF # see github issue #25
         -DDCMTK_WITH_TIFF:BOOL=OFF  # see github issue #25
         -DDCMTK_WITH_XML:BOOL=OFF  # see github issue #25
-        -DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON 
+        -DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON
         ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
         #-DBUILD_TESTING:BOOL=OFF # Not used
         -DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS:BOOL=OFF
@@ -71,15 +71,15 @@ IF(${add_project})
 #      DEPENDS
 #        ${proj_DEPENDENCIES}
 #      )
-      
-    # Since DCMTK is statically build, there is not need to add its corresponding 
+
+    # Since DCMTK is statically build, there is not need to add its corresponding
     # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
-  
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DDCMTK_DIR:PATH=${DCMTK_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS DCMTK_DIR:PATH)
 
   SET(${DCMTK_enabling_variable}_INCLUDE_DIRS DCMTK_INCLUDE_DIR)
   SET(${DCMTK_enabling_variable}_FIND_PACKAGE_CMD DCMTK)

+ 10 - 10
CMakeExternals/ITK.cmake

@@ -10,19 +10,19 @@ IF(${add_project})
   ENDIF()
 
   SET(ITK_enabling_variable ITK_LIBRARIES)
-  
+
   SET(proj ITK)
   SET(proj_DEPENDENCIES)
-  
+
   SET(ITK_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED ITK_DIR)
-  
+
     SET(revision_tag "v3.20.0")
     IF(${proj}_REVISION_TAG)
       SET(revision_tag ${${proj}_REVISION_TAG})
     ENDIF()
-  
+
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
     if(APPLE)
@@ -62,16 +62,16 @@ IF(${add_project})
         ${proj_DEPENDENCIES}
       )
     SET(ITK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
-    
-    # Since the link directories associated with ITK is used, it makes sens to 
+
+    # Since the link directories associated with ITK is used, it makes sens to
     # update CTK_EXTERNAL_LIBRARY_DIRS with its associated library output directory
     LIST(APPEND CTK_EXTERNAL_LIBRARY_DIRS ${ITK_DIR}/bin)
-    
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DITK_DIR:PATH=${ITK_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS ITK_DIR:PATH)
 
   SET(${ITK_enabling_variable}_LIBRARY_DIRS ITK_LIBRARY_DIRS)
   SET(${ITK_enabling_variable}_INCLUDE_DIRS ITK_INCLUDE_DIRS)

+ 10 - 10
CMakeExternals/KWStyle.cmake

@@ -3,17 +3,17 @@
 #
 SET(kwstyle_DEPENDS)
 IF(CTK_USE_KWSTYLE)
-  
+
   # Sanity checks
   IF(DEFINED CTK_KWSTYLE_EXECUTABLE AND NOT EXISTS ${CTK_KWSTYLE_EXECUTABLE})
     MESSAGE(FATAL_ERROR "CTK_KWSTYLE_EXECUTABLE variable is defined but corresponds to non-existing executable")
   ENDIF()
-  
+
   SET(proj KWStyle-CVSHEAD)
   SET(proj_DEPENDENCIES)
-  
+
   SET(kwstyle_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED CTK_KWSTYLE_EXECUTABLE)
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
@@ -42,14 +42,14 @@ IF(CTK_USE_KWSTYLE)
       DEPENDS
         ${proj_DEPENDENCIES}
       )
-    SET(CTK_KWSTYLE_EXECUTABLE ${ep_install_dir}/bin/KWStyle)
-    
-    # Since KWStyle is an executable, there is not need to add its corresponding 
+    SET(KWSTYLE_EXECUTABLE ${ep_install_dir}/bin/KWStyle)
+
+    # Since KWStyle is an executable, there is not need to add its corresponding
     # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DCTK_KWSTYLE_EXECUTABLE:FILEPATH=${CTK_KWSTYLE_EXECUTABLE})
-  
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS KWSTYLE_EXECUTABLE:PATH)
+
 ENDIF()

+ 10 - 10
CMakeExternals/Log4Qt.cmake

@@ -11,19 +11,19 @@ IF(${add_project})
   ENDIF()
 
   SET(Log4Qt_enabling_variable Log4Qt_LIBRARIES)
-  
+
   SET(proj Log4Qt)
   SET(proj_DEPENDENCIES)
-  
+
   SET(Log4Qt_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED Log4Qt_DIR)
-  
+
     SET(revision_tag 8d3558b0f636cbf8ff83)
     IF(${proj}_REVISION_TAG)
       SET(revision_tag ${${proj}_REVISION_TAG})
     ENDIF()
-  
+
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
     if(APPLE)
@@ -54,15 +54,15 @@ IF(${add_project})
         ${proj_DEPENDENCIES}
       )
     SET(Log4Qt_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
-    
-    # Since Log4Qt is statically build, there is not need to add its corresponding 
+
+    # Since Log4Qt is statically build, there is not need to add its corresponding
     # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
-    
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DLog4Qt_DIR:PATH=${Log4Qt_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS Log4Qt_DIR:PATH)
 
   SET(${Log4Qt_enabling_variable}_INCLUDE_DIRS Log4Qt_INCLUDE_DIRS)
   SET(${Log4Qt_enabling_variable}_FIND_PACKAGE_CMD Log4Qt)

+ 10 - 10
CMakeExternals/OpenIGTLink.cmake

@@ -4,19 +4,19 @@
 SET (OpenIGTLink_DEPENDS)
 ctkMacroShouldAddExternalProject(OpenIGTLink_LIBRARIES add_project)
 IF(${add_project})
-  
+
   # Sanity checks
   IF(DEFINED OpenIGTLink_DIR AND NOT EXISTS ${OpenIGTLink_DIR})
     MESSAGE(FATAL_ERROR "OpenIGTLink_DIR variable is defined but corresponds to non-existing directory")
   ENDIF()
-  
+
   SET(OpenIGTLink_enabling_variable OpenIGTLink_LIBRARIES)
-  
+
   SET(proj OpenIGTLink)
   SET(proj_DEPENDENCIES)
-  
+
   SET(OpenIGTLink_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED OpenIGTLink_DIR)
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
@@ -45,15 +45,15 @@ IF(${add_project})
         ${proj_DEPENDENCIES}
       )
     SET(OpenIGTLink_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
-  
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DOpenIGTLink_DIR:PATH=${OpenIGTLink_DIR})
-  
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS OpenIGTLink_DIR:PATH)
+
   SET(${OpenIGTLink_enabling_variable}_LIBRARY_DIRS OpenIGTLink_LIBRARY_DIRS)
   SET(${OpenIGTLink_enabling_variable}_INCLUDE_DIRS OpenIGTLink_INCLUDE_DIRS)
   SET(${OpenIGTLink_enabling_variable}_FIND_PACKAGE_CMD OpenIGTLink)
-  
+
 ENDIF()

+ 18 - 18
CMakeExternals/PythonQt.cmake

@@ -4,31 +4,31 @@
 SET(PythonQt_DEPENDS)
 ctkMacroShouldAddExternalProject(PYTHONQT_LIBRARIES add_project)
 IF(${add_project})
-  
+
   # Sanity checks
   IF(DEFINED PYTHONQT_INSTALL_DIR AND NOT EXISTS ${PYTHONQT_INSTALL_DIR})
     MESSAGE(FATAL_ERROR "PYTHONQT_INSTALL_DIR variable is defined but corresponds to non-existing directory")
   ENDIF()
 
   SET(PythonQt_enabling_variable PYTHONQT_LIBRARIES)
-  
+
   SET(proj PythonQt)
   SET(proj_DEPENDENCIES)
-  
+
   SET(PythonQt_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED PYTHONQT_INSTALL_DIR)
   #   MESSAGE(STATUS "Adding project:${proj}")
-    
+
     SET(ep_PythonQt_args)
-    
-    # Should PythonQt use VTK 
+
+    # Should PythonQt use VTK
     IF(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
       LIST(APPEND proj_DEPENDENCIES VTK)
       LIST(APPEND ep_PythonQt_args -DVTK_DIR:PATH=${VTK_DIR})
     ENDIF()
     LIST(APPEND ep_PythonQt_args -DPythonQt_USE_VTK:BOOL=${CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK})
-    
+
     # Enable Qt libraries PythonQt wrapping if required
     foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
       STRING(TOUPPER ${qtlib} qtlib_uppercase)
@@ -49,7 +49,7 @@ IF(${add_project})
         -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
         -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
     endif()
-    
+
     SET(revision_tag 3171a94e16ba9bfee137)
     IF(${proj}_REVISION_TAG)
       SET(revision_tag ${${proj}_REVISION_TAG})
@@ -78,19 +78,19 @@ IF(${add_project})
         ${proj_DEPENDENCIES}
       )
     SET(PYTHONQT_INSTALL_DIR ${ep_install_dir})
-    
-    # Since the full path of PythonQt library is used, there is not need to add 
+
+    # Since the full path of PythonQt library is used, there is not need to add
     # its corresponding library output directory to CTK_EXTERNAL_LIBRARY_DIRS
-  
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-    
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS 
-    -DPYTHONQT_INSTALL_DIR:PATH=${PYTHONQT_INSTALL_DIR}
-    -DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}   # FindPythonInterp expects PYTHON_EXECUTABLE variable to be defined
-    -DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}     # FindPythonQt expects PYTHON_INCLUDE_DIR variable to be defined
-    -DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}         # FindPythonQt expects PYTHON_LIBRARY variable to be defined
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS
+    PYTHONQT_INSTALL_DIR:PATH
+    PYTHON_EXECUTABLE:FILEPATH # FindPythonInterp expects PYTHON_EXECUTABLE variable to be defined
+    PYTHON_INCLUDE_DIR:PATH # FindPythonQt expects PYTHON_INCLUDE_DIR variable to be defined
+    PYTHON_LIBRARY:FILEPATH # FindPythonQt expects PYTHON_LIBRARY variable to be defined
     )
 
   SET(${PythonQt_enabling_variable}_INCLUDE_DIRS PYTHONQT_INCLUDE_DIR PYTHON_INCLUDE_DIRS)

+ 16 - 16
CMakeExternals/PythonQtGenerator.cmake

@@ -4,12 +4,12 @@
 
 SET(PythonQtGenerator_DEPENDS)
 IF(CTK_WRAP_PYTHONQT_FULL)
-  
+
   # Sanity checks
   IF(DEFINED PYTHONQTGENERATOR_EXECUTABLE AND NOT EXISTS ${PYTHONQTGENERATOR_EXECUTABLE})
     MESSAGE(FATAL_ERROR "PYTHONQTGENERATOR_EXECUTABLE variable is defined but corresponds to non-existing executable")
   ENDIF()
-  
+
   IF(NOT DEFINED PYTHONQTGENERATOR_EXECUTABLE)
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
@@ -21,7 +21,7 @@ IF(CTK_WRAP_PYTHONQT_FULL)
     endif()
 
     #
-    # PythonQtGenerator is the tool allowing to generate the PythonQt decorators using 
+    # PythonQtGenerator is the tool allowing to generate the PythonQt decorators using
     # typesystem xml files. If called without any option, it will generate the bindings for Qt.
     #
     # See http://www.pyside.org/docs/apiextractor/typesystem.html
@@ -31,11 +31,11 @@ IF(CTK_WRAP_PYTHONQT_FULL)
     SET(proj PythonQtGenerator)
   #   MESSAGE(STATUS "Adding project:${proj}")
     SET(PythonQtGenerator_DEPENDS ${proj})
-    
+
     #
-    # If directory PythonQt already exists, the corresponding project will 
-    # be cloned. Since PythonQt and PythonQtGenerator source code are hosted 
-    # on the same repository, we will assume that if the directory PythonQt 
+    # If directory PythonQt already exists, the corresponding project will
+    # be cloned. Since PythonQt and PythonQtGenerator source code are hosted
+    # on the same repository, we will assume that if the directory PythonQt
     # exists, the generator code will also be available.
     #
     IF(EXISTS ${CMAKE_BINARY_DIR}/PythonQt)
@@ -58,12 +58,12 @@ IF(CTK_WRAP_PYTHONQT_FULL)
           "PythonQt" # To make sure the generator code is checked out, let's depend on PythonQt
         )
     ELSE()
-    
+
       SET(revision_tag 3171a94e16ba9bfee137)
       IF(${proj}_REVISION_TAG)
         SET(revision_tag ${${proj}_REVISION_TAG})
       ENDIF()
-    
+
       #MESSAGE(STATUS "ExternalProject/PythonQtGenerator: PythonQt is NOT an ExternalProject")
       ExternalProject_Add(${proj}
         SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
@@ -83,14 +83,14 @@ IF(CTK_WRAP_PYTHONQT_FULL)
           -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
         )
     ENDIF()
-    
+
     SET(PYTHONQTGENERATOR_EXECUTABLE ${CMAKE_BINARY_DIR}/PythonQtGenerator-build/PythonQtGenerator)
-    
-    # Since PythonQtGenerator is an executable, there is no need to add its corresponding 
+
+    # Since PythonQtGenerator is an executable, there is no need to add its corresponding
     # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
-        
+
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DPYTHONQTGENERATOR_EXECUTABLE:FILEPATH=${PYTHONQTGENERATOR_EXECUTABLE})
-  
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS PYTHONQTGENERATOR_EXECUTABLE:FILEPATH)
+
 ENDIF()

+ 17 - 17
CMakeExternals/QtMobility.cmake

@@ -18,7 +18,7 @@ IF(${add_project})
     IF(NOT CTK_PATCH_EXECUTABLE)
       MESSAGE(FATAL_ERROR "error: Patch is required to build ${proj}. Set CTK_PATCH_EXECUTABLE. If running Windows, you can download it here: http://gnuwin32.sourceforge.net/packages/patch.htm")
     ENDIF()
-    
+
     # Configure patch script
     SET(qtmobility_src_dir ${CMAKE_BINARY_DIR}/${proj})
     SET(qtmobility_patch_dir ${CTK_SOURCE_DIR}/Utilities/QtMobility/)
@@ -39,30 +39,30 @@ IF(${add_project})
     ELSEIF(NOT ${CMAKE_CFG_INTDIR} STREQUAL "Release")
       SET(qtmobility_build_type "debug")
     ENDIf()
-    
+
     SET(qtmobility_make_cmd)
     SET(qtmobility_install_cmd)
     SET(qtmobility_config_in "${qtmobility_patch_dir}/QtMobilityConfig.cmake.in")
     SET(qtmobility_config_out "${qtmobility_configured_patch_dir}/QtMobilityConfig.cmake")
-    
+
     IF(UNIX)
       SET(qtmobility_make_cmd make)
       SET(qtmobility_config_args -${qtmobility_build_type} -libdir ${CTK_CMAKE_LIBRARY_OUTPUT_DIRECTORY} -no-docs -modules ${qtmobility_modules})
       SET(qtmobility_install_cmd ${qtmobility_make_cmd} install)
-      
-      SET(QTMOBILITY_QTSERVICEFW_INCLUDE_DIR 
+
+      SET(QTMOBILITY_QTSERVICEFW_INCLUDE_DIR
           "${CTK_BINARY_DIR}/QtMobility/install/include")
       SET(QTMOBILITY_QTSERVICEFW_LIBRARY_DEBUG
           "${CTK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libQtServiceFrameworkd.so")
       SET(QTMOBILITY_QTSERVICEFW_LIBRARY_RELEASE
           "${CTK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libQtServiceFramework.so")
-      
+
       IF(APPLE)
         CONFIGURE_FILE(${qtmobility_patch_dir}/QtMobility-1.0.0-make-apple.cmake.in
                      ${qtmobility_configured_patch_dir}/QtMobility-1.0.0-make-apple.cmake @ONLY)
         SET(qtmobility_make_cmd ${CMAKE_COMMAND} -P ${qtmobility_configured_patch_dir}/QtMobility-1.0.0-make-apple.cmake)
       ENDIF()
-          
+
       CONFIGURE_FILE("${qtmobility_config_in}" "${qtmobility_config_out}" @ONLY)
     ELSEIF(WIN32)
       SET(qtmobility_make_cmd nmake)
@@ -81,12 +81,12 @@ IF(${add_project})
 
       CONFIGURE_FILE(${qtmobility_patch_dir}/QtMobility-1.0.0-install-win32.cmake.in
                      ${qtmobility_configured_patch_dir}/QtMobility-1.0.0-install-win32.cmake @ONLY)
-				     
+
       SET(qtmobility_install_cmd ${CMAKE_COMMAND} -D INTERMEDIATE_DIRECTORY:STRING=$(IntDir) -P ${qtmobility_configured_patch_dir}/QtMobility-1.0.0-install-win32.cmake)
-      
+
       # On Windows, the QtMobilityConfig.cmake file is written in the install script above
     ENDIF()
-    
+
     ExternalProject_Add(${proj}
       SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
       PREFIX ${proj}${ep_suffix}
@@ -97,19 +97,19 @@ IF(${add_project})
       INSTALL_COMMAND ${qtmobility_install_cmd}
       BUILD_IN_SOURCE 1
       )
-      
+
     SET(QtMobility_DIR ${qtmobility_configured_patch_dir})
-      
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-    
-  # Since the full path of QtMobility library is used, there is not need to add 
+
+  # Since the full path of QtMobility library is used, there is not need to add
   # its corresponding library output directory to CTK_EXTERNAL_LIBRARY_DIRS
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DQtMobility_DIR:PATH=${QtMobility_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS QtMobility_DIR:PATH)
 
   SET(${QtMobility_enabling_variable}_INCLUDE_DIRS QtMobility_INCLUDE_DIRS)
   SET(${QtMobility_enabling_variable}_FIND_PACKAGE_CMD QtMobility)
-	
+
 ENDIF()

+ 8 - 8
CMakeExternals/QtSOAP.cmake

@@ -5,7 +5,7 @@
 SET(QtSOAP_DEPENDS)
 ctkMacroShouldAddExternalProject(QtSOAP_LIBRARIES add_project)
 IF(${add_project})
-  
+
   # Sanity checks
   IF(DEFINED QtSOAP_DIR AND NOT EXISTS ${QtSOAP_DIR})
     MESSAGE(FATAL_ERROR "QtSOAP_DIR variable is defined but corresponds to non-existing directory")
@@ -19,12 +19,12 @@ IF(${add_project})
   SET(QtSOAP_DEPENDS ${proj})
 
   IF(NOT DEFINED QtSOAP_DIR)
-  
+
     SET(revision_tag 6bf1b8c8)
     IF(${proj}_REVISION_TAG)
       SET(revision_tag ${${proj}_REVISION_TAG})
     ENDIF()
-  
+
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
     if(APPLE)
@@ -56,18 +56,18 @@ IF(${add_project})
         ${proj_DEPENDENCIES}
       )
     SET(QtSOAP_DIR "${CMAKE_BINARY_DIR}/${proj}-build")
-    
-    # Since the QtSOAP dll is created directly in CTK-build/bin, there is not need to add a 
+
+    # Since the QtSOAP dll is created directly in CTK-build/bin, there is not need to add a
     # library output directory to CTK_EXTERNAL_LIBRARY_DIRS
 
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DQtSOAP_DIR:PATH=${QtSOAP_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS QtSOAP_DIR:PATH)
 
   SET(${QtSOAP_enabling_variable}_LIBRARY_DIRS QtSOAP_LIBRARY_DIRS)
   SET(${QtSOAP_enabling_variable}_INCLUDE_DIRS QtSOAP_INCLUDE_DIRS)
   SET(${QtSOAP_enabling_variable}_FIND_PACKAGE_CMD QtSOAP)
-      
+
 ENDIF()

+ 12 - 12
CMakeExternals/VTK.cmake

@@ -10,12 +10,12 @@ IF(${add_project} OR CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
   ENDIF()
 
   SET(VTK_enabling_variable VTK_LIBRARIES)
-  
+
   SET(additional_vtk_cmakevars )
   IF(MINGW)
     LIST(APPEND additional_vtk_cmakevars -DCMAKE_USE_PTHREADS:BOOL=OFF)
   ENDIF()
-  
+
   IF(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
     LIST(APPEND additional_vtk_cmakevars
       -DPYTHON_EXECUTABLE:PATH=${PYTHON_EXECUTABLE}
@@ -26,16 +26,16 @@ IF(${add_project} OR CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
 
   SET(proj VTK)
   SET(proj_DEPENDENCIES)
-  
+
   SET(VTK_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED VTK_DIR)
-  
+
     SET(revision_tag 0e6c2a52501efab53e1c4d74910bcb1155245e1b)
     IF(${proj}_REVISION_TAG)
       SET(revision_tag ${${proj}_REVISION_TAG})
     ENDIF()
-  
+
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
     if(APPLE)
@@ -67,7 +67,7 @@ IF(${add_project} OR CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
         -DVTK_USE_TK:BOOL=OFF
         -DVTK_WRAP_PYTHON:BOOL=${CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK}
         -DVTK_WRAP_JAVA:BOOL=OFF
-        -DBUILD_SHARED_LIBS:BOOL=ON 
+        -DBUILD_SHARED_LIBS:BOOL=ON
         -DDESIRED_QT_VERSION:STRING=4
         -DVTK_USE_GUISUPPORT:BOOL=ON
         -DVTK_USE_QVTK_QTOPENGL:BOOL=ON
@@ -77,16 +77,16 @@ IF(${add_project} OR CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
         ${proj_DEPENDENCIES}
       )
     SET(VTK_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
-    
-    # Since the link directories associated with VTK is used, it makes sens to 
+
+    # Since the link directories associated with VTK is used, it makes sens to
     # update CTK_EXTERNAL_LIBRARY_DIRS with its associated library output directory
     LIST(APPEND CTK_EXTERNAL_LIBRARY_DIRS ${VTK_DIR}/bin)
-    
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DVTK_DIR:PATH=${VTK_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS VTK_DIR:PATH)
 
   SET(${VTK_enabling_variable}_LIBRARY_DIRS VTK_LIBRARY_DIRS)
   SET(${VTK_enabling_variable}_INCLUDE_DIRS VTK_INCLUDE_DIRS)

+ 9 - 9
CMakeExternals/XIP.cmake

@@ -8,14 +8,14 @@ IF(${add_project})
   IF(DEFINED XIP_DIR AND NOT EXISTS ${XIP_DIR})
     MESSAGE(FATAL_ERROR "XIP_DIR variable is defined but corresponds to non-existing directory")
   ENDIF()
-  
+
   SET(XIP_enabling_variable XIP_LIBRARIES)
-  
+
   SET(proj XIP)
   SET(proj_DEPENDENCIES)
-  
+
   SET(XIP_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED XIP_DIR)
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
@@ -46,15 +46,15 @@ IF(${add_project})
         -DHAS_ITK:BOOL=OFF
       )
     SET(XIP_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
-    
+
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DXIP_DIR:PATH=${XIP_DIR})
-  
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS XIP_DIR:PATH)
+
   SET(${XIP_enabling_variable}_INCLUDE_DIRS XIP_LIBRARY_DIRS)
   SET(${XIP_enabling_variable}_INCLUDE_DIRS XIP_INCLUDE_DIRS)
   SET(${XIP_enabling_variable}_FIND_PACKAGE_CMD XIP)
-  
+
 ENDIF()

+ 8 - 8
CMakeExternals/ZMQ.cmake

@@ -11,19 +11,19 @@ IF(${add_project})
   ENDIF()
 
   SET(ZMQ_enabling_variable ZMQ_LIBRARIES)
-  
+
   SET(proj ZMQ)
   SET(proj_DEPENDENCIES)
-  
+
   SET(ZMQ_DEPENDS ${proj})
-  
+
   IF(NOT DEFINED ZMQ_DIR)
-  
+
     SET(revision_tag d2c2f96b49ed3835a47e)
     IF(${proj}_REVISION_TAG)
       SET(revision_tag ${${proj}_REVISION_TAG})
     ENDIF()
-  
+
     # Set CMake OSX variable to pass down the external project
     set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
     if(APPLE)
@@ -50,7 +50,7 @@ IF(${add_project})
         -DCMAKE_INSTALL_PREFIX:PATH=${ep_install_dir}
         ${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
         -DBUILD_TESTING:BOOL=OFF
-        -DBUILD_SHARED_LIBS:BOOL=ON 
+        -DBUILD_SHARED_LIBS:BOOL=ON
         -DZMQ_BUILD_DEVICES:BOOL=ON
         -DZMQ_BUILD_PERFORMANCE_TESTS:BOOL=ON
        DEPENDS
@@ -61,8 +61,8 @@ IF(${add_project})
   ELSE()
     ctkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
   ENDIF()
-  
-  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -DZMQ_DIR:PATH=${ZMQ_DIR})
+
+  LIST(APPEND CTK_SUPERBUILD_EP_VARS ZMQ_DIR:PATH)
 
   SET(${ZMQ_enabling_variable}_INCLUDE_DIRS ZMQ_LIBRARY_DIRS)
   SET(${ZMQ_enabling_variable}_INCLUDE_DIRS ZMQ_INCLUDE_DIRS)

+ 2 - 2
CTKConfig.cmake.in

@@ -123,8 +123,8 @@ SET(CTK_RUNTIME_LIBRARY_DIRS "@CTK_RUNTIME_LIBRARY_DIRS_CONFIG@")
 # of runtime libraries for each configuration type.
 SET(CTK_QTDESIGNERPLUGINS_DIR "@CTK_QTDESIGNERPLUGINS_DIR_CONFIG@")
 
-# CTK PythonQt install directory
-SET(CTK_PYTHONQT_INSTALL_DIR "@CTK_PYTHONQT_INSTALL_DIR_CONFIG@")
+# CTK external projects variables
+@CTK_SUPERBUILD_EP_VARS_CONFIG@
 
 # Qt configuration
 SET(CTK_QT_RCC_EXECUTABLE "@QT_RCC_EXECUTABLE@")

+ 39 - 15
SuperBuild.cmake

@@ -36,16 +36,16 @@ SET(external_projects
   XIP
   ITK
   )
-  
+
 #-----------------------------------------------------------------------------
-# WARNING - No change should be required after this comment 
+# WARNING - No change should be required after this comment
 #           when you are adding a new external project dependency.
 #-----------------------------------------------------------------------------
-  
+
 #-----------------------------------------------------------------------------
 # Declare CTK_EXTERNAL_LIBRARY_DIRS variable - This variable stores
 # the library output directory associated with the different external project
-# It's then used in Utilities/LastConfigureStep/CTKGenerateCTKConfig.cmake to 
+# It's then used in Utilities/LastConfigureStep/CTKGenerateCTKConfig.cmake to
 # configure CTKConfig.cmake.in
 # This variable would then be exposed to project building against CTK
 SET(CTK_EXTERNAL_LIBRARY_DIRS)
@@ -123,12 +123,16 @@ FIND_PACKAGE(Doxygen QUIET)
 # Include external projects
 #
 
-# This variable will contain the list of CMake variable specific to each external project 
-# that should passed to CTK.
-# The item of this list should have the following form: -D<EP>_DIR:PATH=${<EP>_DIR}
-# where '<EP>' is an external project name.
 SET(CTK_SUPERBUILD_EP_ARGS)
 
+# This variable will contain the list of CMake variable specific to each external project
+# that should passed to CTK.
+# The item of this list should have the following form: <EP_VAR>:<TYPE>
+# where '<EP_VAR>' is an external project variable and TYPE is either BOOL, PATH or FILEPATH.
+# Variable appended to this list will be automatically exported in CTKConfig.cmake, prefix 'CTK_'
+# will be prepended if it applied.
+SET(CTK_SUPERBUILD_EP_VARS)
+
 # This variable will contain the list of external project that CTK depends on.
 SET(CTK_DEPENDS)
 
@@ -137,15 +141,15 @@ FOREACH(p ${external_projects})
   INCLUDE(CMakeExternals/${p}.cmake)
   IF(${p}_enabling_variable)
     # Provides the include and library directories either directly or provides the variable name
-    # used by the corresponding Find<package>.cmake files. 
+    # used by the corresponding Find<package>.cmake files.
     # The top-level CMakeLists.txt file will expand the variable names if not in
-    # superbuild mode. The include and library dirs are then used in 
+    # superbuild mode. The include and library dirs are then used in
     # ctkMacroBuildApp, ctkMacroBuildLib, and ctkMacroBuildPlugin
     STRING(REPLACE ";" "^" _include_dirs "${${${p}_enabling_variable}_INCLUDE_DIRS}")
-    LIST(APPEND dependency_args 
+    LIST(APPEND dependency_args
          -D${${p}_enabling_variable}_INCLUDE_DIRS:STRING=${_include_dirs})
     STRING(REPLACE ";" "^" _library_dirs "${${${p}_enabling_variable}_LIBRARY_DIRS}")
-    LIST(APPEND dependency_args 
+    LIST(APPEND dependency_args
          -D${${p}_enabling_variable}_LIBRARY_DIRS:STRING=${_library_dirs})
     IF(${${p}_enabling_variable}_FIND_PACKAGE_CMD)
       LIST(APPEND dependency_args
@@ -204,12 +208,31 @@ FOREACH(ctk_cmake_arg ${ctk_cmake_boolean_args})
   LIST(APPEND ctk_superbuild_boolean_args -D${ctk_cmake_arg}:BOOL=${${ctk_cmake_arg}})
 ENDFOREACH()
 
-# MESSAGE("CMake args:")
+# MESSAGE("CMake boolean args:")
 # FOREACH(arg ${ctk_superbuild_boolean_args})
 #   MESSAGE("  ${arg}")
 # ENDFOREACH()
 
 #-----------------------------------------------------------------------------
+# Expand superbuild external project args
+#
+SET(CTK_SUPERBUILD_EP_VARNAMES)
+FOREACH(arg ${CTK_SUPERBUILD_EP_VARS})
+  STRING(REPLACE ":" ";" varname_and_vartype ${arg})
+  SET(target_info_list ${target_info_list})
+  LIST(GET varname_and_vartype 0 _varname)
+  LIST(GET varname_and_vartype 1 _vartype)
+  LIST(APPEND CTK_SUPERBUILD_EP_ARGS -D${_varname}:${_vartype}=${${_varname}})
+  LIST(APPEND CTK_SUPERBUILD_EP_VARNAMES ${_varname})
+ENDFOREACH()
+STRING(REPLACE ";" "^" CTK_SUPERBUILD_EP_VARNAMES "${CTK_SUPERBUILD_EP_VARNAMES}")
+
+# MESSAGE("CMake external project args:")
+# FOREACH(arg ${CTK_SUPERBUILD_EP_ARGS})
+#   MESSAGE("  ${arg}")
+# ENDFOREACH()
+
+#-----------------------------------------------------------------------------
 # Set CMake OSX variable to pass down the external project
 set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
 if(APPLE)
@@ -218,7 +241,7 @@ if(APPLE)
     -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
     -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
 endif()
-    
+
 #-----------------------------------------------------------------------------
 # CTK Configure
 #
@@ -249,6 +272,7 @@ ExternalProject_Add(${proj}
     -DCTK_EXTERNAL_LIBRARY_DIRS:STRING=${CTK_EXTERNAL_LIBRARY_DIRS}
     -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
     ${CTK_SUPERBUILD_EP_ARGS}
+    -DCTK_SUPERBUILD_EP_VARNAMES:STRING=${CTK_SUPERBUILD_EP_VARNAMES}
     ${dependency_args}
   SOURCE_DIR ${CTK_SOURCE_DIR}
   BINARY_DIR ${CTK_BINARY_DIR}/CTK-build
@@ -257,7 +281,7 @@ ExternalProject_Add(${proj}
   DEPENDS
     ${CTK_DEPENDS}
   )
-  
+
 IF(CMAKE_GENERATOR MATCHES ".*Makefiles.*")
   SET(ctk_build_cmd "$(MAKE)")
 ELSE()

+ 4 - 4
Utilities/KWStyle/KWStyle.cmake

@@ -8,7 +8,7 @@ IF( CTK_USE_KWSTYLE )
   OPTION(KWSTYLE_USE_MSVC_FORMAT "Set KWStyle to generate errors with a VisualStudio-compatible format." ${msvc_default})
   OPTION(KWSTYLE_USE_GCC_FORMAT "Set KWStyle to generate errors with a GCC-compatible format." OFF)
 
-  FIND_PROGRAM(CTK_KWSTYLE_EXECUTABLE
+  FIND_PROGRAM(KWSTYLE_EXECUTABLE
     NAMES KWStyle
     PATHS
     /usr/local/bin
@@ -25,7 +25,7 @@ IF( CTK_USE_KWSTYLE )
 
   SET(CTK_KWSTYLE_ARGUMENTS
     -xml ${PROJECT_BINARY_DIR}/Utilities/KWStyle/qCTK.kws.xml -v
-      -D ${PROJECT_BINARY_DIR}/Utilities/KWStyle/qCTKFiles.txt  
+      -D ${PROJECT_BINARY_DIR}/Utilities/KWStyle/qCTKFiles.txt
       -o ${PROJECT_SOURCE_DIR}/Utilities/KWStyle/qCTKOverwrite.txt
     )
 
@@ -43,12 +43,12 @@ IF( CTK_USE_KWSTYLE )
 
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CTK_BINARY_DIR}/qCTKStyleReport.txt
-    COMMAND ${CTK_KWSTYLE_EXECUTABLE}
+    COMMAND ${KWSTYLE_EXECUTABLE}
     ARGS    ${CTK_KWSTYLE_ARGUMENTS}
     COMMENT "Coding Style Checker qCTK style"
     )
 
   ADD_CUSTOM_TARGET(qCTKStyleCheck DEPENDS ${CTK_BINARY_DIR}/qCTKStyleReport.txt)
-  ADD_TEST(qCTKStyleTest ${CTK_KWSTYLE_EXECUTABLE} ${CTK_KWSTYLE_ARGUMENTS})
+  ADD_TEST(qCTKStyleTest ${KWSTYLE_EXECUTABLE} ${CTK_KWSTYLE_ARGUMENTS})
 
 ENDIF( CTK_USE_KWSTYLE )

+ 8 - 2
Utilities/LastConfigureStep/CTKGenerateCTKConfig.cmake

@@ -120,8 +120,14 @@ SET(CTK_EXECUTABLE_DIRS_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
 # QtDesigner plugins directory
 SET(CTK_QTDESIGNERPLUGINS_DIR_CONFIG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 
-# PythonQt directory
-SET(CTK_PYTHONQT_INSTALL_DIR_CONFIG ${PYTHONQT_INSTALL_DIR})
+# CTK external projects variables
+STRING(REPLACE "^" ";" CTK_SUPERBUILD_EP_VARNAMES "${CTK_SUPERBUILD_EP_VARNAMES}")
+SET(CTK_SUPERBUILD_EP_VARS_CONFIG)
+FOREACH(varname ${CTK_SUPERBUILD_EP_VARNAMES})
+  SET(CTK_SUPERBUILD_EP_VARS_CONFIG
+   "${CTK_SUPERBUILD_EP_VARS_CONFIG}
+SET(CTK_${varname} \"${${varname}}\")")
+ENDFOREACH()
 
 # Executable locations.