0031014: Inspectors - variables for Qt in CMake
[occt.git] / adm / cmake / qt.cmake
... / ...
CommitLineData
1#qt
2
3# Qt is searched manually first (just determine root)
4message (STATUS "Processing Qt 3-rd party")
5
6if (NOT DEFINED ${3RDPARTY_QT_DIR} AND ${3RDPARTY_QT_DIR} STREQUAL "")
7 FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" Qt 3RDPARTY_QT_DIR_NAME)
8
9 if (NOT DEFINED ${3RDPARTY_QT_DIR_NAME} AND ${3RDPARTY_QT_DIR_NAME} STREQUAL "")
10 set (3RDPARTY_QT_DIR "" CACHE PATH "The directory containing qt")
11 message (FATAL_ERROR "Could not find used third-party product: 3RDPARTY_QT_DIR")
12 endif()
13
14 # Combine directory name with absolute path and show in GUI
15 set (3RDPARTY_QT_DIR "${3RDPARTY_DIR}/${3RDPARTY_QT_DIR_NAME}" CACHE PATH "The directory containing Qt" FORCE)
16 message (STATUS "Info: Qt is used from folder: ${3RDPARTY_QT_DIR}")
17endif()
18
19set (USED_3RDPARTY_QT_DIR "${3RDPARTY_QT_DIR}")
20
21# Now set CMAKE_PREFIX_PATH to point to local Qt installation.
22# Without this setting find_package() will not work
23set(CMAKE_PREFIX_PATH ${3RDPARTY_QT_DIR})
24
25# Now we can apply standard CMake finder for Qt5. We do this mostly
26# to have qt5_wrap_cpp() function available and Qt5_FOUND variable filled
27find_package(Qt5 QUIET COMPONENTS Widgets Quick Xml PATHS ${3RDPARTY_QT_DIR} NO_DEFAULT_PATH)
28if (NOT ${Qt5_FOUND})
29 # Now we can apply standard CMake finder for Qt. We do this mostly
30 # to have qt4_wrap_cpp() function available
31 find_package(Qt4)
32 #message (STATUS "Qt4 cmake configuration")
33else()
34 #message (STATUS "Qt5 cmake configuration")
35endif()
36
37if (3RDPARTY_QT_DIR OR EXISTS "${3RDPARTY_QT_DIR}")
38 list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_QT_DIR}/bin")
39else()
40 list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_QT_DLL_DIR)
41endif()