# !! Please read the generic detection procedure in SalomeMacros.cmake !!
#
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Core Qt5Core_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Gui Qt5Gui_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Widgets Qt5Widgets_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Network Qt5Network_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Xml Qt5Xml_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5OpenGL Qt5OpenGL_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5PrintSupport Qt5PrintSupport_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5WebKit Qt5WebKit_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5WebKitWidgets Qt5WebKitWidgets_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
+# Qt5_FIND_COMPONENTS variable is set here to prevent ParaView to reset list of Qt5 modules,
+# just to avoid extra dependencies
+SET(Qt5_FIND_COMPONENTS Core Gui Widgets Network Xml OpenGL PrintSupport WebKit WebKitWidgets Help Test Sql Sensors Positioning Quick Qml Multimedia MultimediaWidgets WebChannel UiTools)
+
IF(NOT WIN32)
- SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5X11Extras Qt5X11Extras_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
+ LIST(APPEND Qt5_FIND_COMPONENTS X11Extras)
ENDIF()
-get_filename_component(LINGUIST_PATH ${Qt5Core_DIR} DIRECTORY)
-get_filename_component(LINGUIST_PATH ${LINGUIST_PATH} DIRECTORY)
-get_filename_component(LINGUIST_PATH ${LINGUIST_PATH} DIRECTORY)
-
-set(LINGUIST_PATH ${LINGUIST_PATH}/bin)
-
-FIND_PROGRAM(QT_LUPDATE_EXECUTABLE NAMES lupdate PATHS ${LINGUIST_PATH} NO_DEFAULT_PATH)
-if(QT_LUPDATE_EXECUTABLE)
- message(STATUS "Found lupdate: " ${QT_LUPDATE_EXECUTABLE})
-else(QT_LUPDATE_EXECUTABLE)
- if(Linguist_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find lupdate")
- endif(Linguist_FIND_REQUIRED)
-endif(QT_LUPDATE_EXECUTABLE)
+SET(QT_INCLUDES)
+SET(QT_DEFINITIONS)
+SET(QT_LIBRARIES)
-FIND_PROGRAM(QT_LRELEASE_EXECUTABLE NAMES lrelease PATHS ${LINGUIST_PATH} NO_DEFAULT_PATH)
-if(QT_LRELEASE_EXECUTABLE)
- message(STATUS "Found lrelease: " ${QT_LRELEASE_EXECUTABLE})
-else(QT_LRELEASE_EXECUTABLE)
- if(Linguist_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find lrelease")
- endif(Linguist_FIND_REQUIRED)
-endif(QT_LRELEASE_EXECUTABLE)
+FOREACH(_Qt5_COMPONENT ${Qt5_FIND_COMPONENTS})
+ SET(_Qt5_COMPONENT Qt5${_Qt5_COMPONENT})
+ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(${_Qt5_COMPONENT} ${_Qt5_COMPONENT}_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
+ LIST(APPEND QT_INCLUDES ${${_Qt5_COMPONENT}_INCLUDE_DIRS})
+ LIST(APPEND QT_DEFINITIONS ${${_Qt5_COMPONENT}_DEFINITIONS})
+ LIST(APPEND QT_LIBRARIES ${${_Qt5_COMPONENT}_LIBRARIES})
+ENDFOREACH()
-SET(QT_INCLUDES
- ${Qt5Core_INCLUDE_DIRS}
- ${Qt5Gui_INCLUDE_DIRS}
- ${Qt5Widgets_INCLUDE_DIRS}
- ${Qt5Network_INCLUDE_DIRS}
- ${Qt5Xml_INCLUDE_DIRS}
- ${Qt5OpenGL_INCLUDE_DIRS}
- ${Qt5PrintSupport_INCLUDE_DIRS}
- ${Qt5WebKit_INCLUDE_DIRS}
- ${Qt5WebKitWidgets_INCLUDE_DIRS}
- )
-SET(QT_DEFINITIONS
- ${Qt5Core_DEFINITIONS}
- ${Qt5Gui_DEFINITIONS}
- ${Qt5Widgets_DEFINITIONS}
- ${Qt5Network_DEFINITIONS}
- ${Qt5Xml_DEFINITIONS}
- ${Qt5OpenGL_DEFINITIONS}
- ${Qt5PrintSupport_DEFINITIONS}
- ${Qt5WebKit_DEFINITIONS}
- ${Qt5WebKitWidgets_DEFINITIONS}
- )
-SET(QT_LIBRARIES
- ${Qt5Core_LIBRARIES}
- ${Qt5Gui_LIBRARIES}
- ${Qt5Widgets_LIBRARIES}
- ${Qt5Network_LIBRARIES}
- ${Qt5Xml_LIBRARIES}
- ${Qt5OpenGL_LIBRARIES}
- ${Qt5PrintSupport_LIBRARIES}
- ${Qt5WebKit_LIBRARIES}
- ${Qt5WebKitWidgets_LIBRARIES}
- )
+FIND_PACKAGE(Qt5LinguistTools)
+GET_TARGET_PROPERTY(QT_LRELEASE_EXECUTABLE ${Qt5_LRELEASE_EXECUTABLE} LOCATION)
+MARK_AS_ADVANCED(QT_LRELEASE_EXECUTABLE)
-IF(NOT WIN32)
- LIST(APPEND QT_INCLUDES ${Qt5X11Extras_INCLUDE_DIRS})
- LIST(APPEND QT_DEFINITIONS ${Qt5X11Extras_DEFINITIONS})
- LIST(APPEND QT_LIBRARIES ${Qt5X11Extras_LIBRARIES})
-ENDIF()
+GET_FILENAME_COMPONENT(QT_BINARY_DIR ${QT_LRELEASE_EXECUTABLE} DIRECTORY)
+MARK_AS_ADVANCED(QT_BINARY_DIR)
-MARK_AS_ADVANCED(LINGUIST_PATH)
+# This is only needed to correctly detect Qt help generator tool, to workaround an error
+# coming from ParaView detection procedure
+FIND_PROGRAM(QT_HELP_GENERATOR
+ qhelpgenerator
+ PATHS "${QT_BINARY_DIR}"
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ DOC "qhelpgenerator used to compile Qt help project files")
+MARK_AS_ADVANCED(QT_HELP_GENERATOR)
IF(Qt5Core_FOUND)
SALOME_ACCUMULATE_HEADERS(QT_INCLUDES)