ctkMacroSetupQt.cmake 1.8 KB

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