ctkMacroSetupQt.cmake 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ###########################################################################
  2. #
  3. # Library: CTK
  4. #
  5. # Copyright (c) Kitware Inc.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0.txt
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. ###########################################################################
  20. #! \ingroup CMakeUtilities
  21. macro(ctkMacroSetupQt)
  22. set(minimum_required_qt_version "4.6")
  23. find_package(Qt4)
  24. if(QT4_FOUND)
  25. if("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_LESS "${minimum_required_qt_version}")
  26. message(FATAL_ERROR "error: CTK requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}.")
  27. endif()
  28. set(QT_USE_QTNETWORK ON)
  29. set(QT_USE_QTSQL ON)
  30. set(QT_USE_QTOPENGL ON)
  31. set(QT_USE_QTXML ON)
  32. set(QT_USE_QTXMLPATTERNS ON)
  33. set(QT_USE_QTTEST ${BUILD_TESTING})
  34. include(${QT_USE_FILE})
  35. # Set variable QT_INSTALLED_LIBRARY_DIR that will contains
  36. # Qt shared library
  37. set(QT_INSTALLED_LIBRARY_DIR ${QT_LIBRARY_DIR})
  38. if(WIN32)
  39. get_filename_component(QT_INSTALLED_LIBRARY_DIR ${QT_QMAKE_EXECUTABLE} PATH)
  40. endif()
  41. mark_as_superbuild(QT_QMAKE_EXECUTABLE)
  42. else()
  43. message(FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable")
  44. endif()
  45. endmacro()