QtConfiguration.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. set(QTROOT "/usr/local/Qt/Qt5.5" CACHE PATH "Root of the QT binaries.")
  2. set(REQUIRED_QT_VERSION "5.5.0")
  3. set(QTCONFIGROOT ${QTROOT}/lib/cmake/Qt5)
  4. set(components Core Network WebChannel Qml Quick Xml WebEngine)
  5. if(OPENELEC)
  6. set(components ${components} DBus)
  7. endif(OPENELEC)
  8. foreach(COMP ${components})
  9. set(mod Qt5${COMP})
  10. # look for the config files in the QtConfigRoot defined above
  11. set(${mod}_DIR ${QTCONFIGROOT}${COMP})
  12. # look for the actual package
  13. find_package(${mod} ${REQUIRED_QT_VERSION} REQUIRED)
  14. include_directories(${${mod}_INCLUDE_DIRS})
  15. if(OPENELEC)
  16. include_directories(${${mod}_PRIVATE_INCLUDE_DIRS})
  17. endif(OPENELEC)
  18. list(APPEND QT5_LIBRARIES ${${mod}_LIBRARIES})
  19. list(APPEND QT5_CFLAGS ${${mod}_EXECUTABLE_COMPILE_FLAGS})
  20. endforeach(COMP ${components})
  21. list(REMOVE_DUPLICATES QT5_CFLAGS)
  22. message(STATUS "Qt version: ${Qt5Core_VERSION_STRING}")
  23. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QT5_CFLAGS}")
  24. set(CMAKE_REQUIRED_INCLUDES ${Qt5WebEngine_INCLUDE_DIRS};${Qt5WebEngine_PRIVATE_INCLUDE_DIRS})
  25. set(CMAKE_REQUIRED_LIBRARIES ${QT5_LIBRARIES})
  26. OPTION(SKIP_QT_TEST "Skip tests for required Qt features" OFF)
  27. if(NOT SKIP_QT_TEST)
  28. include(CheckCXXSourceCompiles)
  29. check_cxx_source_compiles("
  30. #include <private/qquickwebengineview_p.h>
  31. #include <QColor>
  32. int main()
  33. {
  34. QQuickWebEngineView* view = new QQuickWebEngineView(NULL);
  35. view->setBackgroundColor(QColor(\"transparent\"));
  36. }
  37. " WebEngineBackgroundProperty)
  38. if(NOT WebEngineBackgroundProperty)
  39. message(FATAL_ERROR "QQuickWebEngineView doesn't have the background property."
  40. "This will break video playback. As of Qt 5.5 you need to manually patch and build Qt to get this property."
  41. "With the release of Qt5.6 it will no longer be required. See qt-patches/README for more details.")
  42. endif(NOT WebEngineBackgroundProperty)
  43. endif(NOT SKIP_QT_TEST)