2 # see http://www.kdab.com/using-cmake-with-qt-5/
3 # see http://stackoverflow.com/questions/16245147/unable-to-include-a-ui-form-header-of-qt5-in-cmake
4 # see http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
6 cmake_minimum_required(VERSION 2.8.7)
8 # Tell CMake to run moc when necessary:
10 # As moc files are generated in the binary dir, tell CMake
11 # to always look for includes there:
12 set(CMAKE_INCLUDE_CURRENT_DIR ON)
14 # Widgets finds its own dependencies (QtGui and QtCore).
15 find_package(Qt5Widgets REQUIRED)
17 # The Qt5Widgets_INCLUDES also includes the include directories for
18 # dependencies QtCore and QtGui
19 include_directories(${Qt5Widgets_INCLUDES}) # TODO: needed?
21 # We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
22 add_definitions(${Qt5Widgets_DEFINITIONS})
24 # Executables fail to build with Qt 5 in the default configuration
25 # without -fPIE. We add that here.
26 set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
30 ${CMAKE_SOURCE_DIR}/src
39 src/customactionimpl.cpp
42 src/exceptionmanager.cpp
56 src/rangeselectimpl.cpp
64 # UIS_HDRS will be used later in add_executable
78 # and finally an resource file
83 # this command will generate rules that will run rcc on all files from SAMPLE_RCS
84 # in result SAMPLE_RC_SRCS variable will contain paths to files produced by rcc
85 QT5_ADD_RESOURCES(RC_SRCS ${RESOURCE_FILES})
88 add_executable(qgit ${CPP_SOURCES} ${UIS_HDRS} ${RC_SRCS})
90 # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
91 target_link_libraries(qgit ${Qt5Widgets_LIBRARIES})
93 install(TARGETS qgit DESTINATION bin)
95 # kate: indent-width 4; replace-tabs on;
98 # http://stackoverflow.com/questions/15054117/aligning-qgraphicsitems-to-a-grid-when-dragging-and-dropping