1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
#
# see http://www.kdab.com/using-cmake-with-qt-5/
# see http://stackoverflow.com/questions/16245147/unable-to-include-a-ui-form-header-of-qt5-in-cmake
# see http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
#
cmake_minimum_required(VERSION 2.8.7)
# Tell CMake to run moc when necessary:
set(CMAKE_AUTOMOC ON)
# As moc files are generated in the binary dir, tell CMake
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Widgets finds its own dependencies (QtGui and QtCore).
find_package(Qt5Widgets REQUIRED)
# The Qt5Widgets_INCLUDES also includes the include directories for
# dependencies QtCore and QtGui
include_directories(${Qt5Widgets_INCLUDES}) # TODO: needed?
# We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
add_definitions(${Qt5Widgets_DEFINITIONS})
# Executables fail to build with Qt 5 in the default configuration
# without -fPIE. We add that here.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
include_directories(
.
${CMAKE_SOURCE_DIR}/src
)
set(CPP_SOURCES
src/annotate.cpp
src/cache.cpp
src/commitimpl.cpp
src/common.cpp
src/consoleimpl.cpp
src/customactionimpl.cpp
src/dataloader.cpp
src/domain.cpp
src/exceptionmanager.cpp
src/filecontent.cpp
src/FileHistory.cc
src/filelist.cpp
src/fileview.cpp
src/git.cpp
src/lanes.cpp
src/listview.cpp
src/mainimpl.cpp
src/myprocess.cpp
src/namespace_def.cpp
src/patchcontent.cpp
src/patchview.cpp
src/qgit.cpp
src/rangeselectimpl.cpp
src/revdesc.cpp
src/revsview.cpp
src/settingsimpl.cpp
src/smartbrowse.cpp
src/treeview.cpp
)
# UIS_HDRS will be used later in add_executable
QT5_WRAP_UI(UIS_HDRS
src/commit.ui
src/console.ui
src/customaction.ui
src/fileview.ui
src/help.ui
src/mainview.ui
src/patchview.ui
src/rangeselect.ui
src/revsview.ui
src/settings.ui
)
# and finally an resource file
SET(RESOURCE_FILES
./src/icons.qrc
)
# this command will generate rules that will run rcc on all files from SAMPLE_RCS
# in result SAMPLE_RC_SRCS variable will contain paths to files produced by rcc
QT5_ADD_RESOURCES(RC_SRCS ${RESOURCE_FILES})
add_executable(qgit ${CPP_SOURCES} ${UIS_HDRS} ${RC_SRCS})
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
target_link_libraries(qgit ${Qt5Widgets_LIBRARIES})
install(TARGETS qgit DESTINATION bin)
# kate: indent-width 4; replace-tabs on;
# notes:
# http://stackoverflow.com/questions/15054117/aligning-qgraphicsitems-to-a-grid-when-dragging-and-dropping
|