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