forked from MickaelG/tomate_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
71 lines (55 loc) · 2.7 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 2.8.7)
project(tomate)
#set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_CXX_FLAGS "-std=c++0x -g -O0")
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories( ${CMAKE_SOURCE_DIR}/src/core/ ${CMAKE_SOURCE_DIR}/lib/
${CMAKE_SOURCE_DIR}/src/gui/ ${CMAKE_SOURCE_DIR}/src/gui/gui_widgets )
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
find_package(Boost 1.53 COMPONENTS date_time filesystem system unit_test_framework REQUIRED)
find_package(Qt4 4.8)
include(${QT_USE_FILE})
file(GLOB WIDGETS_SRC src/gui/gui_widgets/*.cpp)
file(GLOB GUI_SRC src/gui/*.cpp)
file(GLOB CORE_SRC src/core/*.cpp lib/pugixml.cpp)
set( qrc_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_tomate.cxx)
set(ui_FORMS src/gui/gui_widgets/EditCropWidget.ui src/gui/gui_widgets/EnableCalendar.ui)
QT4_WRAP_UI(ui_FORMS_HEADERS ${ui_FORMS})
add_executable(tomate_gui ${CORE_SRC} ${GUI_SRC} ${WIDGETS_SRC} src/main.cpp ${qrc_outfile} ${ui_FORMS_HEADERS})
#qt4_use_modules(tomate_gui Widgets)
target_link_libraries(tomate_gui boost_date_time boost_filesystem boost_system)
target_link_libraries(tomate_gui ${QT_LIBRARIES})
add_executable(test ${CORE_SRC} src/test/test.cpp)
target_link_libraries(test boost_unit_test_framework boost_date_time)
add_executable(test_gui src/test/test_gui.cpp ${CORE_SRC} ${GUI_SRC} ${WIDGETS_SRC} ${ui_FORMS_HEADERS})
target_link_libraries(test_gui boost_date_time)
target_link_libraries(test_gui ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
#qt4_use_modules(test_gui Widgets)
#Translation files
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/tomate_fr.qm
COMMAND lrelease ${CMAKE_SOURCE_DIR}/tomate_fr.ts -qm ${CMAKE_BINARY_DIR}/tomate_fr.qm
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/tomate_fr.ts)
set(qm_files ${CMAKE_BINARY_DIR}/tomate_fr.qm)
set(qrc_srcfile ${CMAKE_CURRENT_SOURCE_DIR}/tomate.qrc)
set(qrc_infile ${CMAKE_CURRENT_BINARY_DIR}/tomate.qrc)
# Copy the QRC file to the output directory, because the files listed in the
# qrc file are relative to that directory.
add_custom_command(
OUTPUT ${qrc_infile}
COMMAND ${CMAKE_COMMAND} -E copy ${qrc_srcfile} ${qrc_infile}
MAIN_DEPENDENCY ${qrc_srcfile}
)
# Run the resource compiler (rcc_options should already be set). We can't
# use QT4_ADD_RESOURCES because the qrc file may not exist yet.
add_custom_command(
OUTPUT ${qrc_outfile}
COMMAND ${QT_RCC_EXECUTABLE}
ARGS ${rcc_options} -name tomate -o ${qrc_outfile} ${qrc_infile}
MAIN_DEPENDENCY ${qrc_infile}
DEPENDS ${qm_files}
)
#Installation
install(TARGETS tomate_gui RUNTIME DESTINATION bin)
install(PROGRAMS tomate.desktop DESTINATION share/applications/)