ctkMacroSetupQt.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ###########################################################################
  2. #
  3. # Library: CTK
  4. #
  5. # Copyright (c) 2010 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_QTTEST ${BUILD_TESTING})
  36. INCLUDE(${QT_USE_FILE})
  37. # Set variable QT_INSTALLED_LIBRARY_DIR that will contains
  38. # Qt shared library
  39. SET(QT_INSTALLED_LIBRARY_DIR ${QT_LIBRARY_DIR})
  40. IF (WIN32)
  41. GET_FILENAME_COMPONENT(QT_INSTALLED_LIBRARY_DIR ${QT_QMAKE_EXECUTABLE} PATH)
  42. ENDIF()
  43. ELSE(QT4_FOUND)
  44. MESSAGE(FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable")
  45. ENDIF(QT4_FOUND)
  46. ENDMACRO()