xref: /glogg/tests/CMakeLists.txt (revision a0936e1e21791a259b77497eb5cb6e01c4eea5a4)
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/watchtower.cpp
65)
66
67set(glogg_HEADERS
68    ../src/mainwindow.h
69    ../src/marks.h
70    ../src/filewatcher.h)
71
72set(glogg_TESTS
73    testtest.cpp
74    filewatcherTest.cpp
75    watchtowerTest.cpp
76)
77
78# Options
79if (WIN32)
80    set(FileWatcherEngine_SOURCES
81        ../src/winwatchtower.cpp
82    )
83else (WIN32)
84    set(FileWatcherEngine_SOURCES ../src/inotifywatchtower.cpp)
85endif (WIN32)
86
87# Qt
88# QT4_WRAP_CPP(glogg_HEADERS_MOC ${glogg_HEADERS})
89# INCLUDE(${QT_USE_FILE})
90# ADD_DEFINITIONS(${QT_DEFINITIONS})
91set(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -DGLOGG_VERSION=\\\"unit_tests\\\" -g -gdwarf-2")
92
93# Add test cpp file
94add_executable(glogg_tests
95    ${glogg_SOURCES}
96    ${FileWatcherEngine_SOURCES}
97    ${glogg_HEADERS_MOC}
98    ${glogg_TESTS}
99)
100
101# Link test executable against gtest & gtest_main
102target_link_libraries(glogg_tests gmock gtest gtest_main pthread Qt5::Widgets)
103
104add_test(
105    NAME glogg_tests
106    COMMAND glogg_tests
107)
108
109