CMakeLists.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #=============================================================================
  2. # CMake - Cross Platform Makefile Generator
  3. # Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. #
  5. # Distributed under the OSI-approved BSD License (the "License");
  6. # see accompanying file Copyright.txt for details.
  7. #
  8. # This software is distributed WITHOUT ANY WARRANTY; without even the
  9. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. # See the License for more information.
  11. #=============================================================================
  12. PROJECT(QtDialog)
  13. SET(QT_MIN_VERSION "4.3.0")
  14. FIND_PACKAGE(Qt4 REQUIRED)
  15. IF(NOT QT4_FOUND)
  16. MESSAGE(SEND_ERROR "Failed to find Qt 4.3 or greater.")
  17. ELSE(NOT QT4_FOUND)
  18. INCLUDE(${QT_USE_FILE})
  19. SET(CMAKE_PACKAGE_QTGUI TRUE)
  20. # i don't want to install or package the qt gui on windows
  21. # unless qt is static
  22. IF(WIN32 AND NOT QT_CONFIG MATCHES "static")
  23. SET(CMAKE_PACKAGE_QTGUI FALSE)
  24. MESSAGE(STATUS
  25. "WARNING: QtDialog requires a static built qt for installation.")
  26. ENDIF(WIN32 AND NOT QT_CONFIG MATCHES "static")
  27. SET(SRCS
  28. AddCacheEntry.cxx
  29. AddCacheEntry.h
  30. CMakeSetup.cxx
  31. CMakeSetupDialog.cxx
  32. CMakeSetupDialog.h
  33. FirstConfigure.cxx
  34. FirstConfigure.h
  35. QCMake.cxx
  36. QCMake.h
  37. QCMakeCacheView.cxx
  38. QCMakeCacheView.h
  39. QCMakeWidgets.cxx
  40. QCMakeWidgets.h
  41. QMacInstallDialog.cxx
  42. QMacInstallDialog.h
  43. )
  44. QT4_WRAP_UI(UI_SRCS
  45. CMakeSetupDialog.ui
  46. Compilers.ui
  47. CrossCompiler.ui
  48. AddCacheEntry.ui
  49. MacInstallDialog.ui
  50. )
  51. QT4_WRAP_CPP(MOC_SRCS
  52. AddCacheEntry.h
  53. Compilers.h
  54. CMakeSetupDialog.h
  55. FirstConfigure.h
  56. QCMake.h
  57. QCMakeCacheView.h
  58. QCMakeWidgets.h
  59. QMacInstallDialog.h
  60. )
  61. QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc)
  62. SET(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS})
  63. IF(Q_WS_WIN)
  64. SET(SRCS ${SRCS} CMakeSetup.rc)
  65. ENDIF(Q_WS_WIN)
  66. IF(Q_WS_MAC)
  67. SET(SRCS ${SRCS} CMakeSetup.icns)
  68. SET(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns)
  69. SET_SOURCE_FILES_PROPERTIES(CMakeSetup.icns PROPERTIES
  70. MACOSX_PACKAGE_LOCATION Resources)
  71. ENDIF(Q_WS_MAC)
  72. INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
  73. INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
  74. ADD_EXECUTABLE(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS})
  75. TARGET_LINK_LIBRARIES(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES})
  76. IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
  77. IF(APPLE)
  78. SET_TARGET_PROPERTIES(cmake-gui PROPERTIES
  79. OUTPUT_NAME ${CMAKE_BUNDLE_NAME})
  80. ENDIF(APPLE)
  81. SET(CMAKE_INSTALL_DESTINATION_ARGS
  82. BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}")
  83. ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
  84. # if qt is not static and we are on windows then skip the install
  85. # I don't want to distribute qt dlls
  86. IF(CMAKE_PACKAGE_QTGUI)
  87. INSTALL(TARGETS cmake-gui RUNTIME DESTINATION bin
  88. ${CMAKE_INSTALL_DESTINATION_ARGS})
  89. ENDIF(CMAKE_PACKAGE_QTGUI)
  90. IF(UNIX)
  91. # install a desktop file so CMake appears in the application start menu
  92. # with an icon
  93. INSTALL(FILES CMake.desktop DESTINATION share/applications )
  94. INSTALL(FILES CMakeSetup.png DESTINATION share/pixmaps )
  95. INSTALL(FILES cmakecache.xml DESTINATION share/mime/packages )
  96. ENDIF(UNIX)
  97. IF(APPLE)
  98. SET(CMAKE_POSTFLIGHT_SCRIPT
  99. "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh")
  100. SET(CMAKE_POSTUPGRADE_SCRIPT
  101. "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh")
  102. configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postflight.sh.in"
  103. "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh")
  104. configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in"
  105. "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh")
  106. INSTALL(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui
  107. WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)")
  108. INSTALL(CODE "set(input_file
  109. \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}\")")
  110. INSTALL(SCRIPT "${CMake_SOURCE_DIR}/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake")
  111. ENDIF(APPLE)
  112. CONFIGURE_FILE("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in"
  113. "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY)
  114. ENDIF(NOT QT4_FOUND)