ctkMacroSetupQt.cmake 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_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()