Commit 54502d3d authored by jcfr's avatar jcfr
Browse files

COMP: Introduced variable Slicer_REQUIRED_QT_MODULES

This variable will be used within UseSlicer when building extension

At configuration time, the list of enabled and used Qt modules is also
printed.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@16340 3bd1e089-480b-0410-8dfb-8563597acbee
parent 182d8e96
......@@ -23,6 +23,17 @@
# it can be used in both Slicer/CMakelists.txt and Slicer/UseSlicer.cmake
#
# Sanity checks - Check if variable are defined
SET(expected_defined_vars
Slicer_REQUIRED_QT_VERSION
Slicer_REQUIRED_QT_MODULES
)
FOREACH(v ${expected_defined_vars})
IF(NOT DEFINED ${v})
MESSAGE(FATAL_ERROR "error: ${v} CMake variable is not defined.")
ENDIF()
ENDFOREACH()
SET(extra_error_message)
IF(NOT DEFINED QT_QMAKE_EXECUTABLE AND EXISTS "${VTK_QT_QMAKE_EXECUTABLE}")
SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE})
......@@ -38,3 +49,19 @@ ENDIF()
IF("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}" VERSION_LESS "${Slicer_REQUIRED_QT_VERSION}")
MESSAGE(FATAL_ERROR "error: Slicer requires Qt >= ${Slicer_REQUIRED_QT_VERSION} -- you cannot use Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}. ${extra_error_message}")
ENDIF()
set(command_separated_module_list)
# Check if all expected Qt modules have been discovered
FOREACH(module ${Slicer_REQUIRED_QT_MODULES})
IF(NOT ${QT_QT${module}_FOUND})
MESSAGE(FATAL_ERROR "error: ")
ENDIF()
IF(NOT ${module} STREQUAL "CORE" AND NOT ${module} STREQUAL "GUI")
SET(QT_USE_QT${module} ON)
ENDIF()
set(command_separated_module_list "${command_separated_module_list}${module}, ")
ENDFOREACH()
INCLUDE(${QT_USE_FILE})
MESSAGE(STATUS "Configuring ${PROJECT_NAME} with Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} (using modules: ${command_separated_module_list})")
......@@ -440,16 +440,15 @@ INCLUDE(${VTK_USE_FILE})
# Qt
#-----------------------------------------------------------------------------
IF(Slicer_USE_QT)
# Module name should be specified as they appear in FindQt4.cmake
# For example, the module name associated with the variable QT_USE_QTXML is XML.
SET(Slicer_REQUIRED_QT_MODULES CORE GUI NETWORK)
IF(BUILD_TESTING)
LIST(APPEND Slicer_REQUIRED_QT_MODULES TEST)
ENDIF()
INCLUDE(${Slicer_CMAKE_DIR}/SlicerFindQtAndCheckVersion.cmake)
MESSAGE(STATUS "Configuring Slicer with Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
# Enable modules
SET(QT_USE_QTNETWORK ON)
SET(QT_USE_QTTEST ${BUILD_TESTING})
INCLUDE(${QT_USE_FILE})
ENDIF()
#-----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment