xref: /glogg/tests/CMakeLists.txt (revision 87e056522fcbb3c5f21f5154425e1df944f6954c)
1*87e05652SNicolas BonnefonINCLUDE (CheckSymbolExists)
2*87e05652SNicolas Bonnefon
384af0c9bSNicolas Bonnefoncmake_minimum_required(VERSION 3.0.0)
484af0c9bSNicolas Bonnefonproject(glogg_tests)
584af0c9bSNicolas Bonnefon
6*87e05652SNicolas Bonnefon# Qt
784af0c9bSNicolas Bonnefonfind_program(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QT_DIR}/bin)
884af0c9bSNicolas Bonnefonfind_package(Qt5Widgets REQUIRED)
984af0c9bSNicolas Bonnefon
1084af0c9bSNicolas Bonnefonset(CMAKE_AUTOMOC ON)
1184af0c9bSNicolas Bonnefonset(CMAKE_AUTOUIC ON)
1284af0c9bSNicolas Bonnefonset(CMAKE_INCLUDE_CURRENT_DIR ON)
1384af0c9bSNicolas Bonnefon
14*87e05652SNicolas Bonnefon# Configuration
15*87e05652SNicolas Bonnefoncheck_symbol_exists( symlink "unistd.h" HAVE_SYMLINK )
16*87e05652SNicolas Bonnefon
17*87e05652SNicolas Bonnefonconfigure_file(../config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
18*87e05652SNicolas Bonnefon
1984af0c9bSNicolas Bonnefon# Setup testing
2084af0c9bSNicolas Bonnefonenable_testing()
2184af0c9bSNicolas Bonnefoninclude_directories(
2284af0c9bSNicolas Bonnefon    $ENV{GMOCK_HOME}/include
2384af0c9bSNicolas Bonnefon    $ENV{GMOCK_HOME}/gtest/include
2484af0c9bSNicolas Bonnefon    $ENV{BOOST_ROOT}/
2584af0c9bSNicolas Bonnefon    ../src/ )
2684af0c9bSNicolas Bonnefonlink_directories($ENV{GMOCK_HOME}/mybuild $ENV{GMOCK_HOME}/mybuild/gtest)
2784af0c9bSNicolas Bonnefon
2884af0c9bSNicolas Bonnefon# Sources
2984af0c9bSNicolas Bonnefonset(glogg_SOURCES
3084af0c9bSNicolas Bonnefon    ../src/session.cpp
3184af0c9bSNicolas Bonnefon    ../src/data/abstractlogdata.cpp
3284af0c9bSNicolas Bonnefon    ../src/data/logdata.cpp
3384af0c9bSNicolas Bonnefon    ../src/data/logfiltereddata.cpp
3484af0c9bSNicolas Bonnefon    ../src/data/logfiltereddataworkerthread.cpp
3584af0c9bSNicolas Bonnefon    ../src/data/logdataworkerthread.cpp
3684af0c9bSNicolas Bonnefon    ../src/mainwindow.cpp
3784af0c9bSNicolas Bonnefon    ../src/crawlerwidget.cpp
3884af0c9bSNicolas Bonnefon    ../src/abstractlogview.cpp
3984af0c9bSNicolas Bonnefon    ../src/logmainview.cpp
4084af0c9bSNicolas Bonnefon    ../src/filteredview.cpp
4184af0c9bSNicolas Bonnefon    ../src/optionsdialog.cpp
4284af0c9bSNicolas Bonnefon    ../src/persistentinfo.cpp
4384af0c9bSNicolas Bonnefon    ../src/configuration.cpp
4484af0c9bSNicolas Bonnefon    ../src/filtersdialog.cpp
4584af0c9bSNicolas Bonnefon    ../src/filterset.cpp
4684af0c9bSNicolas Bonnefon    ../src/savedsearches.cpp
4784af0c9bSNicolas Bonnefon    ../src/infoline.cpp
4884af0c9bSNicolas Bonnefon    ../src/menuactiontooltipbehavior.cpp
4984af0c9bSNicolas Bonnefon    ../src/selection.cpp
5084af0c9bSNicolas Bonnefon    ../src/quickfind.cpp
5184af0c9bSNicolas Bonnefon    ../src/quickfindpattern.cpp
5284af0c9bSNicolas Bonnefon    ../src/quickfindwidget.cpp
5384af0c9bSNicolas Bonnefon    ../src/sessioninfo.cpp
5484af0c9bSNicolas Bonnefon    ../src/recentfiles.cpp
5584af0c9bSNicolas Bonnefon    ../src/overview.cpp
5684af0c9bSNicolas Bonnefon    ../src/overviewwidget.cpp
5784af0c9bSNicolas Bonnefon    ../src/marks.cpp
5884af0c9bSNicolas Bonnefon    ../src/quickfindmux.cpp
5984af0c9bSNicolas Bonnefon    ../src/signalmux.cpp
6084af0c9bSNicolas Bonnefon    ../src/qtfilewatcher.cpp
6184af0c9bSNicolas Bonnefon    ../src/tabbedcrawlerwidget.cpp
6284af0c9bSNicolas Bonnefon    ../src/filewatcher.cpp
63*87e05652SNicolas Bonnefon)
6484af0c9bSNicolas Bonnefon
6584af0c9bSNicolas Bonnefonset(glogg_HEADERS
6684af0c9bSNicolas Bonnefon    ../src/mainwindow.h
6784af0c9bSNicolas Bonnefon    ../src/marks.h
6884af0c9bSNicolas Bonnefon    ../src/filewatcher.h)
6984af0c9bSNicolas Bonnefon
7084af0c9bSNicolas Bonnefonset(glogg_TESTS
7184af0c9bSNicolas Bonnefon    testtest.cpp
7284af0c9bSNicolas Bonnefon    watchtowerTest.cpp
7384af0c9bSNicolas Bonnefon)
7484af0c9bSNicolas Bonnefon
7584af0c9bSNicolas Bonnefon# Options
7684af0c9bSNicolas Bonnefonif (WIN32)
77*87e05652SNicolas Bonnefon    set(FileWatcherEngine_SOURCES ../src/winwatchtower.cpp)
78*87e05652SNicolas Bonnefonelse (WIN32)
79*87e05652SNicolas Bonnefon    set(FileWatcherEngine_SOURCES ../src/inotifywatchtower.cpp)
8084af0c9bSNicolas Bonnefonendif (WIN32)
8184af0c9bSNicolas Bonnefon
8284af0c9bSNicolas Bonnefon# Qt
8384af0c9bSNicolas Bonnefon# QT4_WRAP_CPP(glogg_HEADERS_MOC ${glogg_HEADERS})
8484af0c9bSNicolas Bonnefon# INCLUDE(${QT_USE_FILE})
8584af0c9bSNicolas Bonnefon# ADD_DEFINITIONS(${QT_DEFINITIONS})
86b827fa8eSNicolas Bonnefonset(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -DGLOGG_VERSION=\\\"unit_tests\\\" -g -gdwarf-2")
8784af0c9bSNicolas Bonnefon
8884af0c9bSNicolas Bonnefon# Add test cpp file
8984af0c9bSNicolas Bonnefonadd_executable(glogg_tests
9084af0c9bSNicolas Bonnefon    ${glogg_SOURCES}
9184af0c9bSNicolas Bonnefon    ${FileWatcherEngine_SOURCES}
9284af0c9bSNicolas Bonnefon    ${glogg_HEADERS_MOC}
9384af0c9bSNicolas Bonnefon    ${glogg_TESTS}
9484af0c9bSNicolas Bonnefon)
9584af0c9bSNicolas Bonnefon
9684af0c9bSNicolas Bonnefon# Link test executable against gtest & gtest_main
9784af0c9bSNicolas Bonnefontarget_link_libraries(glogg_tests gmock gtest gtest_main pthread Qt5::Widgets)
9884af0c9bSNicolas Bonnefon
9984af0c9bSNicolas Bonnefonadd_test(
10084af0c9bSNicolas Bonnefon    NAME glogg_tests
10184af0c9bSNicolas Bonnefon    COMMAND glogg_tests
10284af0c9bSNicolas Bonnefon)
10384af0c9bSNicolas Bonnefon
104