xref: /glogg/tests/CMakeLists.txt (revision b827fa8e48a40c9a02ee9edc78c3e8fef0bf062e)
1cmake_minimum_required(VERSION 3.0.0)
2project(glogg_tests)
3
4find_program(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QT_DIR}/bin)
5find_package(Qt5Widgets REQUIRED)
6
7set(CMAKE_AUTOMOC ON)
8set(CMAKE_AUTOUIC ON)
9set(CMAKE_INCLUDE_CURRENT_DIR ON)
10
11# Setup testing
12enable_testing()
13include_directories(
14    $ENV{GMOCK_HOME}/include
15    $ENV{GMOCK_HOME}/gtest/include
16    $ENV{BOOST_ROOT}/
17    ../src/ )
18link_directories($ENV{GMOCK_HOME}/mybuild $ENV{GMOCK_HOME}/mybuild/gtest)
19
20# Sources
21set(glogg_SOURCES
22    ../src/session.cpp
23    ../src/data/abstractlogdata.cpp
24    ../src/data/logdata.cpp
25    ../src/data/logfiltereddata.cpp
26    ../src/data/logfiltereddataworkerthread.cpp
27    ../src/data/logdataworkerthread.cpp
28    ../src/mainwindow.cpp
29    ../src/crawlerwidget.cpp
30    ../src/abstractlogview.cpp
31    ../src/logmainview.cpp
32    ../src/filteredview.cpp
33    ../src/optionsdialog.cpp
34    ../src/persistentinfo.cpp
35    ../src/configuration.cpp
36    ../src/filtersdialog.cpp
37    ../src/filterset.cpp
38    ../src/savedsearches.cpp
39    ../src/infoline.cpp
40    ../src/menuactiontooltipbehavior.cpp
41    ../src/selection.cpp
42    ../src/quickfind.cpp
43    ../src/quickfindpattern.cpp
44    ../src/quickfindwidget.cpp
45    ../src/sessioninfo.cpp
46    ../src/recentfiles.cpp
47    ../src/overview.cpp
48    ../src/overviewwidget.cpp
49    ../src/marks.cpp
50    ../src/quickfindmux.cpp
51    ../src/signalmux.cpp
52    ../src/qtfilewatcher.cpp
53    ../src/tabbedcrawlerwidget.cpp
54    ../src/filewatcher.cpp
55    ../src/inotifywatchtower.cpp )
56
57set(glogg_HEADERS
58    ../src/mainwindow.h
59    ../src/marks.h
60    ../src/filewatcher.h)
61
62set(glogg_TESTS
63    testtest.cpp
64    filewatcherTest.cpp
65    watchtowerTest.cpp
66)
67
68# Options
69if (WIN32)
70    set(FileWatcherEngine_SOURCES ../src/winfilewatcher.cpp)
71endif (WIN32)
72
73# Qt
74# QT4_WRAP_CPP(glogg_HEADERS_MOC ${glogg_HEADERS})
75# INCLUDE(${QT_USE_FILE})
76# ADD_DEFINITIONS(${QT_DEFINITIONS})
77set(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -DGLOGG_VERSION=\\\"unit_tests\\\" -g -gdwarf-2")
78
79# Add test cpp file
80add_executable(glogg_tests
81    ${glogg_SOURCES}
82    ${FileWatcherEngine_SOURCES}
83    ${glogg_HEADERS_MOC}
84    ${glogg_TESTS}
85)
86
87# Link test executable against gtest & gtest_main
88target_link_libraries(glogg_tests gmock gtest gtest_main pthread Qt5::Widgets)
89
90add_test(
91    NAME glogg_tests
92    COMMAND glogg_tests
93)
94
95