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. # This option won't show up in the main CMake configure panel
  25. MARK_AS_ADVANCED(QT_QMAKE_EXECUTABLE)
  26. IF(QT4_FOUND)
  27. IF("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_LESS "${minimum_required_qt_version}")
  28. MESSAGE(FATAL_ERROR "error: CTK requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}.")
  29. ENDIF()
  30. SET(QT_USE_QTNETWORK ON)
  31. SET(QT_USE_QTSQL ON)
  32. SET(QT_USE_QTOPENGL ON)
  33. SET(QT_USE_QTXML ON)
  34. SET(QT_USE_QTTEST ${BUILD_TESTING})
  35. INCLUDE(${QT_USE_FILE})
  36. # Set variable QT_INSTALLED_LIBRARY_DIR that will contains
  37. # Qt shared library
  38. SET(QT_INSTALLED_LIBRARY_DIR ${QT_LIBRARY_DIR})
  39. IF(WIN32)
  40. GET_FILENAME_COMPONENT(QT_INSTALLED_LIBRARY_DIR ${QT_QMAKE_EXECUTABLE} PATH)
  41. ENDIF()
  42. ELSE(QT4_FOUND)
  43. MESSAGE(FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable")
  44. ENDIF(QT4_FOUND)
  45. ENDMACRO()