2 # see http://qt-project.org/doc/qt-5/cmake-manual.html
4 # see also http://www.kdab.com/using-cmake-with-qt-5/
5 # see also http://stackoverflow.com/questions/16245147/unable-to-include-a-ui-form-header-of-qt5-in-cmake
6 # see also http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
8 cmake_minimum_required(VERSION 2.8.11)
11 include(GNUInstallDirs)
13 # As moc files are generated in the binary dir, tell CMake
14 # to always look for includes there:
15 set(CMAKE_INCLUDE_CURRENT_DIR ON)
17 # Instruct CMake to run moc automatically when needed.
20 option(UseQt5 "Use Qt5?" ON)
22 find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
23 set(QT_LIBRARIES Qt5::Widgets)
28 macro(qt_add_resources)
29 qt5_add_resources(${ARGN})
32 find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui)
33 include(${QT_USE_FILE})
38 macro(qt_add_resources)
39 qt4_add_resources(${ARGN})
44 ${CMAKE_SOURCE_DIR}/src
53 src/customactionimpl.cpp
56 src/exceptionmanager.cpp
71 src/rangeselectimpl.cpp
79 # UIS_HDRS will be used later in add_executable
93 # and finally an resource file
98 # this command will generate rules that will run rcc on all files from SAMPLE_RCS
99 # in result SAMPLE_RC_SRCS variable will contain paths to files produced by rcc
100 QT_ADD_RESOURCES(RC_SRCS ${RESOURCE_FILES})
102 add_executable(qgit ${CPP_SOURCES} ${UIS_HDRS} ${RC_SRCS})
103 target_link_libraries(qgit ${QT_LIBRARIES})
106 install(TARGETS qgit DESTINATION bin)
109 install(FILES src/resources/qgit.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps)
110 install(FILES qgit.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
111 install(FILES qgit.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
114 # kate: indent-width 4; replace-tabs on;
117 # http://stackoverflow.com/questions/15054117/aligning-qgraphicsitems-to-a-grid-when-dragging-and-dropping