Warning, /graphics/kst-plot/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 2.8.7)
0002 
0003 if(kst_clang)
0004     set(CMAKE_C_COMPILER    "clang")
0005     SET (CMAKE_CXX_COMPILER "clang++")
0006     message(STATUS "Using clang  ${CMAKE_CXX_COMPILER}")
0007 endif()
0008 
0009 if(POLICY CMP0020)
0010     cmake_policy(SET CMP0020 OLD)
0011 endif()
0012 
0013 if(${CMAKE_MAJOR_VERSION} EQUAL 3)
0014     cmake_policy(SET CMP0043 OLD)
0015 endif()
0016 
0017 # figure out if we use MinGW with Ninja: call with -DCC=gcc
0018 if(WIN32 AND CMAKE_GENERATOR MATCHES Ninja AND CC MATCHES gcc)
0019     find_file(mingw_make mingw32-make.exe)
0020     get_filename_component(mingw_bin_dir ${mingw_make} PATH)
0021     set(CMAKE_RC_COMPILER ${mingw_bin_dir}/windres.exe)
0022 endif()
0023 
0024 
0025 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
0026 include(KstMacros)
0027 
0028 get_filename_component(kst_dir ${CMAKE_SOURCE_DIR} ABSOLUTE)
0029 get_filename_component(kst_build_dir ${CMAKE_BINARY_DIR}/build ABSOLUTE)
0030 
0031 set(kst_binary_name kst2)
0032 
0033 
0034 kst_option_init()
0035 kst_option(string ""  all version_string    "Version string")
0036 kst_option(bool   OFF all release           "Build release version: optimize for speed, don't embedded debug symbols")
0037 kst_option(bool   OFF gcc deploy            "Deploy into install dir")
0038 kst_option(bool   OFF all merge_files       "Merge files to speedup build about factor 5")
0039 kst_option(bool   OFF all merge_rebuild     "Rebuild generated files from merged files build")
0040 kst_option(bool   OFF all verbose           "Make verbose CMake run and Makefiles")
0041 kst_option(string ""  all install_prefix    "Install path for Kst, using a default if not set")
0042 kst_option(string ""  all install_libdir    "Install directory name for libraries")
0043 kst_option(bool   ON  all 3rdparty          "Build plugins depending on 3rd party libraries")
0044 kst_option(bool   ON  all dataobjects       "Build dataobject plugins")
0045 kst_option(bool   OFF all test              "Build unit tests")
0046 kst_option(bool   ON  all pch               "Use precompiled headers")
0047 kst_option(bool   ON  all svnversion        "Use svnversion's output for Kst's version information")
0048 kst_option(bool   OFF gcc rpath             "Use rpath")
0049 kst_option(bool   OFF all 3rdparty_build    "Download and build 3rd party libraries")
0050 kst_option(bool   OFF win 3rdparty_download "Download precompiled 3rd party libraries")
0051 kst_option(bool   OFF win console           "Open console on Windows")
0052 kst_option(bool   OFF win edit_cont         "Enable \"Edit and Continue\" for Visual Studio")
0053 kst_option(bool   OFF all python            "Install Python support")
0054 kst_option(bool   OFF all python_depend     "Download and build NumPy/SciPy then install Python support")
0055 kst_option(string ""  all python_prefix     "Path for installing python bindings")
0056 kst_option(string OFF all cross             "Cross-compile on Linux for Windows")
0057 kst_option(string ""  all qt4               "Use cross compiled Qt4 at given path")
0058 kst_option(string ""  all qt5               "Use Qt5")
0059 kst_option(bool   ON  all qt5base_only      "Only use Qt5 features available in qtbase")
0060 kst_option(bool   OFF all clang             "Use Clang compiler")
0061 kst_option(bool   OFF all sanitize          "Use Clang's sanitizers")
0062 kst_option(bool   OFF all dbgsym            "Build with debug symbols enabled")
0063 kst_option(bool   OFF win noinstaller       "Don't build installer")
0064 
0065 message(STATUS)
0066 
0067 if(kst_cross)
0068     include(KstCrossCompile)
0069 endif()
0070 
0071 
0072 project(Kst)
0073 
0074 
0075 if(kst_release)
0076     set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
0077     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_WARNING_OUTPUT")
0078 else()
0079     set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
0080 endif()
0081 
0082 
0083 if(kst_sanitize)
0084     include(Clang-sanitize)
0085     set(clang_flags "${clang_flags}")
0086     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${clang_flags}")
0087 endif()
0088 
0089 
0090 set(kst_version_major 2)
0091 if(kst_version_string)
0092     set(kst_version ${kst_version_string})
0093     set(CPACK_PACKAGE_INSTALL_DIRECTORY "${kst_version}")
0094 else()
0095     set(kst_version_minor 0)
0096     set(kst_version_patch x)
0097     set(kst_version ${kst_version_major}.${kst_version_minor}.${kst_version_patch})
0098     set(kst_version_string ${kst_version})
0099     set(CPACK_PACKAGE_INSTALL_DIRECTORY "Kst ${kst_version}")
0100 endif()
0101 
0102 if(CMAKE_COMPILER_IS_GNUCC)
0103     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
0104     message(STATUS "Using GCC version ${GCC_VERSION}")
0105 endif()
0106 
0107 
0108 if(kst_3rdparty_build)
0109     set(kst_3rdparty_dir ${CMAKE_BINARY_DIR}/3rdparty/installed)
0110     add_subdirectory(cmake/3rdparty)
0111 elseif(kst_3rdparty_download)
0112     if(MINGW)
0113         if(GCC_VERSION VERSION_EQUAL 4.7.2 OR GCC_VERSION VERSION_GREATER 4.7.2)
0114             set(ver -dw2-4.7.2)
0115             set(md5 53edc4009d5c3ee5e11d1ba24cd8ae61)
0116         elseif(GCC_VERSION VERSION_EQUAL 4.7 OR GCC_VERSION VERSION_GREATER 4.7)
0117             set(ver 4.7)
0118             set(md5 de6e8dbab1bb17eee6057941fddc93e3)
0119         elseif(GCC_VERSION VERSION_EQUAL 4.6 OR GCC_VERSION VERSION_GREATER 4.6)
0120             set(ver 4.6)
0121             set(md5 70d8670af9c21eb8fb466654c95d8e4d)
0122         elseif(GCC_VERSION VERSION_GREATER 4.4)
0123             set(ver 4.4)
0124             set(md5 999248fb40a44543af4dd4cd1be0ceeb)
0125         else()
0126             message(FATA_ERROR "MinGW version ${GCC_VERSION} not supported")
0127         endif()
0128     endif()
0129     message(STATUS "Checking downloaded 3rd party binaries.")
0130     set(_deps kst-3rdparty-win32-gcc${ver})
0131     set(_file ${_deps}.zip)
0132     set(_downloaded _downloaded-NOTFOUND CACHE PATH "3rd party binaries already downloaded" FORCE)
0133     find_file(_downloaded ${_file} ${CMAKE_BINARY_DIR})
0134     if (NOT _downloaded)
0135         file(DOWNLOAD http://sourceforge.net/projects/kst/files/3rdparty/${_file}
0136             ${CMAKE_BINARY_DIR}/${_file}
0137             EXPECTED_MD5 ${md5}
0138             SHOW_PROGRESS)
0139         execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xfj ${CMAKE_BINARY_DIR}/${_file})
0140     endif()
0141     set(kst_3rdparty_dir ${CMAKE_BINARY_DIR}/${_deps})
0142 endif()
0143 
0144 
0145 kst_revision_project_name(Revision)
0146 add_definitions(-DKST_HAVE_REVISION_H)
0147 if(kst_revision)
0148     file(WRITE ${CMAKE_BINARY_DIR}/kstrevision.h.tmp "#define KST_REVISION \"${kst_revision}\"\n")
0149     configure_file(${CMAKE_BINARY_DIR}/kstrevision.h.tmp ${CMAKE_BINARY_DIR}/kstrevision.h COPYONLY)
0150 elseif(kst_svnversion)
0151     include(KstRevisionHeader)
0152     KstRevisionHeader(${kst_dir} ${kst_revision_project} ${CMAKE_BINARY_DIR}/kstrevision.h _modified)
0153 else()
0154     file(WRITE ${CMAKE_BINARY_DIR}/kstrevision.h.tmp "#define KST_REVISION \"unknown\"\n")
0155     configure_file(${CMAKE_BINARY_DIR}/kstrevision.h.tmp ${CMAKE_BINARY_DIR}/kstrevision.h COPYONLY)
0156 endif()
0157 
0158 
0159 # Find 3rd party libraries
0160 if(kst_3rdparty)
0161   message(STATUS "3rd party libs for plugins--------------------")
0162   find_package(Getdata)
0163   find_package(Gsl)
0164   find_package(Netcdf)
0165   find_package(Matio)
0166   find_package(CFITSIO)
0167   find_package(LibTiff)
0168   find_package(HDF5)
0169   message(STATUS "----------------------------------------------")
0170 else()
0171   message(STATUS "Building plugins depending on 3rd party libraries suppressed")
0172 endif()
0173 message(STATUS)
0174 
0175 #set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG_OUTPUT -DQT_NO_WARNING_OUTPUT")
0176 
0177 
0178 # Find 3rd party libraries
0179 if (kst_qt5)
0180     # http://doc-snapshot.qt-project.org/5.0/cmake-manual.htm
0181     if(kst_cross)
0182         # Cross-compiled Qt, branch 4.8.4 from https://gitorious.org/~syntheticpp/qt/qt4
0183         set(QT_MINGW_DIR ${kst_qt5} CACHE PATH "Qt for Mingw" FORCE)
0184         set(CMAKE_FIND_ROOT_PATH /usr/${TOOLNAME} ${QT_MINGW_DIR} CACHE PATH "Mingw find root path" FORCE)
0185         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
0186     endif()
0187     macro(use_qt5lib qt5lib)
0188         find_package(${qt5lib} REQUIRED)
0189         include_directories(${${qt5lib}_INCLUDE_DIRS})
0190     endmacro()
0191     use_qt5lib(Qt5Core)
0192     get_target_property(qmakebin Qt5::qmake IMPORTED_LOCATION)
0193     get_filename_component(QT_BINARY_DIR ${qmakebin} PATH)
0194     message(STATUS "Using Qt5 from ${QT_BINARY_DIR}")
0195     set(CMAKE_PREFIX_PATH ${QT_BINARY_DIR}/..)
0196     use_qt5lib(Qt5Concurrent)
0197     use_qt5lib(Qt5Widgets)
0198     use_qt5lib(Qt5Network)
0199     use_qt5lib(Qt5Xml)
0200     use_qt5lib(Qt5PrintSupport)
0201     use_qt5lib(Qt5Svg)
0202 
0203     add_definitions(-DQT5=1 -DQT_DISABLE_DEPRECATED_BEFORE)
0204     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG")
0205     include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) # Qt5 bug?
0206 else()
0207     if(kst_cross)
0208         # Cross-compiled Qt, branch 4.8.4 from https://gitorious.org/~syntheticpp/qt/qt4
0209         set(QT_MINGW_DIR ${kst_qt4} CACHE PATH "Qt for Mingw" FORCE)
0210         set(CMAKE_FIND_ROOT_PATH /usr/${TOOLNAME} ${QT_MINGW_DIR} CACHE PATH "Mingw find root path" FORCE)
0211     endif()
0212     find_package(Qt4 REQUIRED)
0213     include(${QT_USE_FILE})
0214     if(MINGW)
0215         # seems there is a bug in FindQt4
0216         macro(fix_it)
0217             foreach(_it ${ARGN})
0218                 if(QT_${_it}_LIBRARY_DEBUG AND QT_${_it}_LIBRARY_RELEASE)
0219                     set(QT_${_it}_LIBRARY debug ${QT_${_it}_LIBRARY_DEBUG} optimized ${QT_${_it}_LIBRARY_RELEASE} CACHE STRING "Fixed ${_it}" FORCE)
0220                 endif()
0221             endforeach()
0222         endmacro()
0223         fix_it(QTCORE QTGUI QTXML QTSVG QTNETWORK)
0224     endif()
0225 endif()
0226 
0227 #linguist tools
0228 if(WITH_QT5)
0229 find_package(Qt5LinguistTools)
0230     if(Qt5LinguistTools_FOUND)
0231         find_package(Qt5LinguistForKst)
0232     endif()
0233 else()
0234     find_package(LinguistForKst)
0235 endif()
0236 
0237 message(STATUS)
0238 
0239 
0240 # React on options
0241 
0242 
0243 if(kst_verbose)
0244     set(CMAKE_VERBOSE_MAKEFILE 1)
0245 else()
0246     set(CMAKE_VERBOSE_MAKEFILE 0)
0247 endif()
0248 
0249 if(kst_install_prefix)
0250     set(CMAKE_INSTALL_PREFIX ${kst_install_prefix} CACHE PATH "User's choice for install prefix" FORCE)
0251     set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
0252 else()
0253     set(kst_install_prefix ${CMAKE_BINARY_DIR}/INSTALLED)
0254     set(CMAKE_INSTALL_PREFIX ${kst_install_prefix} CACHE PATH "Kst's default install prefix" FORCE)
0255 endif()
0256 
0257 if(NOT kst_install_libdir)
0258   set(kst_install_libdir lib${LIB_SUFFIX})
0259 endif()
0260 
0261 if(NOT kst_install_plugins)
0262     set(kst_install_plugins ${kst_install_libdir}/${kst_binary_name}/plugins)
0263 endif()
0264 
0265 if(kst_rpath)
0266     # the RPATH to be used when installing
0267     set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${kst_install_libdir}")
0268 endif()
0269 
0270 #path to install the .desktop files
0271 set(kst_install_plugin_desktop_file_path share/services/kst)
0272 
0273 
0274 
0275 if(NOT kst_console)
0276     set(kst_win32 WIN32)
0277     if(kst_qt5 AND WIN32)
0278         set(kst_qtmain_library Qt5::WinMain)
0279     else()
0280         set(kst_qtmain_library ${QT_QTMAIN_LIBRARY})
0281     endif()
0282 endif()
0283 
0284 if(APPLE AND NOT CMAKE_GENERATOR STREQUAL Xcode)
0285     set(kst_win32 MACOSX_BUNDLE)
0286 endif()
0287 
0288 if(APPLE OR kst_clang)
0289     set(kst_pch 0 CACHE BOOL "Disable pch on Mac, not supported yet" FORCE)
0290 endif()
0291 
0292 if (APPLE)
0293     set(CMAKE_MACOSX_RPATH 1)
0294 endif()
0295 
0296 if(kst_merge_files)
0297     set(kst_pch 0 CACHE BOOL "Disable pch because we build merged" FORCE)
0298 endif()
0299 
0300 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
0301     set(x64 TRUE)
0302 endif()
0303 
0304 
0305 if(WIN32)
0306     add_definitions(-D_WIN32_WINNT=0x0501) # Windows XP
0307     # on 32 bit Windows we must explicitly enable >2GB support
0308     # maybe you have to ' 4-gigabyte tune' your Windows XP 32 bit system:
0309     # http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx
0310     macro(large_address var flag)
0311         set(${var} "${${var}} ${flag}")
0312     endmacro()
0313     macro(link_large_address flag)
0314         large_address(CMAKE_EXE_LINKER_FLAGS    ${flag})
0315         large_address(CMAKE_SHARED_LINKER_FLAGS ${flag})
0316         large_address(CMAKE_MODULE_LINKER_FLAGS ${flag})
0317     endmacro()
0318     if(MSVC)
0319         link_large_address(/LARGEADDRESSAWARE)
0320     elseif(NOT x64)
0321         link_large_address(-Wl,--large-address-aware)
0322     endif()
0323 endif()
0324 
0325 if(MSVC)
0326     add_definitions(-D_USE_MATH_DEFINES -DNOMINMAX)
0327 else()
0328     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
0329     if(kst_dbgsym)
0330         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
0331     endif()
0332 endif()
0333 
0334 if(MSVC_IDE AND kst_edit_cont)
0335     # Enable <Edit and Continue> in Visual Studio
0336     set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI")
0337     if(kst_pch)
0338         # Studio bug: <Visual Studio 2005 "Force Includes" Breaks Edit and Continue with Pre-compiled Headers>
0339         set(kst_pch 0 CACHE BOOL "Disable pch because of Edit&Continue" FORCE)
0340     endif()
0341 endif()
0342 
0343 
0344 
0345 if(MSVC)
0346     set(kst_debug_postfix d)
0347 endif()
0348 
0349 configure_file(${kst_dir}/cmake/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
0350 
0351 include_directories(${CMAKE_BINARY_DIR} ${QT_INCLUDES})
0352 
0353 message(STATUS "Build summary----------------------------------")
0354 message(STATUS)
0355 message(STATUS "Version       : ${kst_version}")
0356 message(STATUS "Path to source: ${kst_dir}")
0357 message(STATUS "Installation  :")
0358 message(STATUS "        ${kst_install_prefix}/bin")
0359 message(STATUS "        ${kst_install_prefix}/${kst_install_libdir}")
0360 message(STATUS "        ${kst_install_prefix}/${kst_install_plugins}")
0361 message(STATUS)
0362 message(STATUS "Used options:")
0363 kst_option_list_all()
0364 message(STATUS "-----------------------------------------------")
0365 message(STATUS)
0366 
0367 
0368 add_subdirectory(src)
0369 
0370 if(kst_test)
0371     enable_testing()
0372     add_subdirectory(tests)
0373 endif()
0374 
0375 if (NOT APPLE)
0376     add_subdirectory(misc)
0377 endif()
0378 
0379 if(kst_python)
0380     add_subdirectory(pyKst)
0381 endif()
0382 
0383 # CPack packaging
0384 #
0385 # http://cmake.org/cmake/help/cmake-2-8-docs.html#module:CPack
0386 
0387 if(WIN32)
0388     if(kst_noinstaller)
0389         set(CPACK_GENERATOR ZIP)
0390         set(CPACK_BINARY_ZIP 1)
0391     else()
0392         set(CPACK_GENERATOR NSIS)
0393     endif()
0394 endif()
0395 
0396 #adapted from [trojita.git] / CMakeLists.txt
0397 if(LinguistForKst_FOUND OR Qt5LinguistForKst_FOUND)
0398     file(GLOB_RECURSE kst_PO "${CMAKE_SOURCE_DIR}/po/kst_common_*.po")
0399     if(WITH_QT5)
0400         qt5_wrap_po(kst_QM ${kst_PO})
0401     else()
0402         qt4_wrap_po(kst_QM ${kst_PO})
0403     endif()
0404     set(language_summary "")
0405     foreach(po ${kst_PO})
0406         string(REGEX REPLACE "^(.*)/kst_common_(.*).po" "\\2" lang ${po})
0407         list(APPEND language_summary ${lang})
0408     endforeach()
0409     list(SORT language_summary)
0410     list(LENGTH language_summary num_languages)
0411     if(num_languages)
0412         message(STATUS "Available languages: ${language_summary}")
0413         add_custom_target(qm DEPENDS ${kst_QM})
0414         add_dependencies(${kst_binary_name} qm)
0415         install(DIRECTORY ${CMAKE_BINARY_DIR}/locale/ DESTINATION share/kst/locale FILES_MATCHING PATTERN *.qm)
0416     else()
0417         message(STATUS "No .po files found, will not install any languages")
0418     endif()
0419 else()
0420     message(STATUS "Qt Linguist (lupdate/lrelease/lconvert) not found, disabling localization support")
0421 endif()
0422 
0423 if(kst_install_prefix)
0424     if(WIN32)
0425         if(x64)
0426             set(CPACK_PACKAGE_FILE_NAME ${kst_install_prefix}-win64)
0427         else()
0428             set(CPACK_PACKAGE_FILE_NAME ${kst_install_prefix}-win32)
0429         endif()
0430     else()
0431         set(CPACK_PACKAGE_FILE_NAME kst-${kst_version_string}-binary)
0432     endif()
0433     set(CPACK_SOURCE_PACKAGE_FILE_NAME ${kst_install_prefix})
0434 else()
0435     set(CPACK_SOURCE_PACKAGE_FILE_NAME Kst-${kst_version})
0436 endif()
0437 set(CPACK_INSTALL_PREFIX "")
0438 
0439 
0440 set(CPACK_PACKAGE_NAME   Kst)
0441 set(CPACK_PACKAGE_EXECUTABLES ${kst_binary_name} Kst2)
0442 set(CPACK_PACKAGE_VENDOR "The Kst Team")
0443 set(CPACK_PACKAGE_VERSION_MAJOR ${kst_version_major})
0444 set(CPACK_PACKAGE_VERSION_MINOR ${kst_version_minor})
0445 set(CPACK_PACKAGE_VERSION_PATCH ${kst_version_patch})
0446 
0447 
0448 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Kst 2")
0449 set(CPACK_PACKAGE_DESCRIPTION_FILE    ${kst_dir}/README)
0450 set(CPACK_PACKAGE_CONTACT "http://bugs.kde.org}")
0451 set(CPACK_STRIP_FILES 1)
0452 
0453 
0454 
0455 # cmake bug, problems with the quotes in the gpl, fixed in 2.8.4
0456 set(CPACK_RESOURCE_FILE_LICENSE "${kst_dir}/COPYING")
0457 
0458 
0459 
0460 # sources
0461 set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${kst_dir};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
0462 if(WIN32)
0463     set(CPACK_SOURCE_GENERATOR ZIP)
0464 else()
0465     set(CPACK_SOURCE_GENERATOR TGZ)
0466 endif()
0467 
0468 
0469 # rpm
0470 if(UNIX)
0471     set(CPACK_SET_DESTDIR "ON")
0472 endif()
0473 FILE(READ ${CPACK_RESOURCE_FILE_LICENSE} CPACK_RPM_PACKAGE_LICENSE)
0474 set(CPACK_RPM_PACKAGE_GROUP "Applications/Science")
0475 set(CPACK_RPM_PACKAGE_VENDOR ${CPACK_PACKAGE_VENDOR})
0476 
0477 # deb
0478 # This is experimental
0479 # check also for plugin's 3rdparty libraries?
0480 set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqtgui4 (>= 4.4.3-0)")
0481 
0482 
0483 
0484 
0485 # Usage
0486 #
0487 # Source only .targz, .tar.bz2, .zip:
0488 #   make package_source
0489 #
0490 # Binary .tar.gz and install .sh:
0491 #   make package
0492 #
0493 # Binary .deb:
0494 # create : cpack -G DEB --config CPackConfig.cmake
0495 # list   : dpkg-deb -c Kst-*.deb
0496 # install: dpkg -i Kst-*.deb
0497 #
0498 # Binary .rpm:
0499 # create : cpack -G RPM --config CPackConfig.cmake
0500 # list   : rpm -qlp Kst-*.rpm
0501 # install: rpm -U Kst-*.rpm
0502 
0503 
0504 # CPack and Ubuntu
0505 # Found this:
0506 # http://www.purplekarrot.net/blog/dputCMake.html
0507 
0508 
0509 if(APPLE)
0510     # We start from build/bin/kst2.app, all is build into the final bundle folder
0511     # On the mac the paths to needed shared libraries are hardcoded in the binary/library
0512     # which could be changed by the macro 'fixup_bundle'
0513     # libs which are hardcoded are resolved automatically
0514     # but the plugins must be passed as extra argument because they are not hardcoded in the binary
0515 
0516     set(bundle_dir ${kst_build_dir}/bin)
0517     set(contents_dir ${kst_binary_name}.app/Contents)
0518 
0519     set(app ${bundle_dir}/${kst_binary_name}.app)
0520     install(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${bundle_dir}/${contents_dir}/plugins COMPONENT Runtime)
0521 
0522     install(CODE
0523         "file(GLOB qt_plugins \"${bundle_dir}/${contents_dir}/plugins/imageformats/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
0524         file(GLOB kst_plugins \"${bundle_dir}/${contents_dir}/plugins/*${CMAKE_SHARED_MODULE_SUFFIX}\")
0525         set(libs \${qt_plugins} \${kst_plugins})
0526         include(BundleUtilities)
0527         fixup_bundle(\"${app}\" \"\${libs}\" \"${dir}\") "
0528         COMPONENT RUNTIME)
0529 
0530     file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "")
0531     install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${contents_dir}/Resources COMPONENT Runtime)
0532 
0533     set(CPACK_GENERATOR DragNDrop)
0534 endif()
0535 
0536 
0537 include(CPack)
0538 
0539