Close the output window by clicking "Enter"
[qgit4/redivivus.git] / CMakeLists.txt
blobf55977d3a71d92ab9b2e8005fe542ea0e727ef0f
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)
10 project(qgit)
12 # As moc files are generated in the binary dir, tell CMake
13 # to always look for includes there:
14 set(CMAKE_INCLUDE_CURRENT_DIR ON)
16 # Instruct CMake to run moc automatically when needed.
17 set(CMAKE_AUTOMOC ON)
19 option(UseQt5 "Use Qt5?" ON)
20 if (UseQt5)
21   find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
22   set(QT_LIBRARIES Qt5::Widgets)
24   macro(qt_wrap_ui)
25     qt5_wrap_ui(${ARGN})
26   endmacro()
27   macro(qt_add_resources)
28     qt5_add_resources(${ARGN})
29   endmacro()
30 else()
31   find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui)
32   include(${QT_USE_FILE})
34   macro(qt_wrap_ui)
35     qt4_wrap_ui(${ARGN})
36   endmacro()
37   macro(qt_add_resources)
38     qt4_add_resources(${ARGN})
39   endmacro()
40 endif()
42 include_directories(
43     ${CMAKE_SOURCE_DIR}/src
46 set(CPP_SOURCES
47     src/annotate.cpp
48     src/cache.cpp
49     src/commitimpl.cpp
50     src/common.cpp
51     src/consoleimpl.cpp
52     src/customactionimpl.cpp
53     src/dataloader.cpp
54     src/domain.cpp
55     src/exceptionmanager.cpp
56     src/filecontent.cpp
57     src/FileHistory.cc
58     src/filelist.cpp
59     src/fileview.cpp
60     src/git.cpp
61     src/lanes.cpp
62     src/listview.cpp
63     src/mainimpl.cpp
64     src/myprocess.cpp
65     src/namespace_def.cpp
66     src/patchcontent.cpp
67     src/patchview.cpp
68     src/qgit.cpp
69     src/rangeselectimpl.cpp
70     src/revdesc.cpp
71     src/revsview.cpp
72     src/settingsimpl.cpp
73     src/smartbrowse.cpp
74     src/treeview.cpp
77 # UIS_HDRS will be used later in add_executable
78 QT_WRAP_UI(UIS_HDRS
79     src/commit.ui
80     src/console.ui
81     src/customaction.ui
82     src/fileview.ui
83     src/help.ui
84     src/mainview.ui
85     src/patchview.ui
86     src/rangeselect.ui
87     src/revsview.ui
88     src/settings.ui
91 # and finally an resource file
92 SET(RESOURCE_FILES
93     src/icons.qrc
96 # this command will generate rules that will run rcc on all files from SAMPLE_RCS
97 # in result SAMPLE_RC_SRCS variable will contain paths to files produced by rcc
98 QT_ADD_RESOURCES(RC_SRCS ${RESOURCE_FILES})
100 add_executable(qgit ${CPP_SOURCES} ${UIS_HDRS} ${RC_SRCS})
101 target_link_libraries(qgit ${QT_LIBRARIES})
104 install(TARGETS qgit DESTINATION bin)
106 # kate: indent-width 4; replace-tabs on;
108 # notes:
109 # http://stackoverflow.com/questions/15054117/aligning-qgraphicsitems-to-a-grid-when-dragging-and-dropping