xref: /glogg/tests/CMakeLists.txt (revision c540156c41190af6e419dffb1b2c43c87fdd3cde)
187e05652SNicolas BonnefonINCLUDE (CheckSymbolExists)
287e05652SNicolas Bonnefon
384af0c9bSNicolas Bonnefoncmake_minimum_required(VERSION 3.0.0)
484af0c9bSNicolas Bonnefonproject(glogg_tests)
584af0c9bSNicolas Bonnefon
687e05652SNicolas 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
1487e05652SNicolas Bonnefon# Configuration
1587e05652SNicolas Bonnefoncheck_symbol_exists( symlink "unistd.h" HAVE_SYMLINK )
1687e05652SNicolas Bonnefon
1787e05652SNicolas Bonnefonconfigure_file(../config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
1887e05652SNicolas 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}/
25a0936e1eSNicolas Bonnefon    ../src/
26a0936e1eSNicolas Bonnefon)
2784af0c9bSNicolas Bonnefonlink_directories($ENV{GMOCK_HOME}/mybuild $ENV{GMOCK_HOME}/mybuild/gtest)
2884af0c9bSNicolas Bonnefon
2984af0c9bSNicolas Bonnefon# Sources
3084af0c9bSNicolas Bonnefonset(glogg_SOURCES
3184af0c9bSNicolas Bonnefon    ../src/session.cpp
3284af0c9bSNicolas Bonnefon    ../src/data/abstractlogdata.cpp
3384af0c9bSNicolas Bonnefon    ../src/data/logdata.cpp
3484af0c9bSNicolas Bonnefon    ../src/data/logfiltereddata.cpp
3584af0c9bSNicolas Bonnefon    ../src/data/logfiltereddataworkerthread.cpp
3684af0c9bSNicolas Bonnefon    ../src/data/logdataworkerthread.cpp
3784af0c9bSNicolas Bonnefon    ../src/mainwindow.cpp
3884af0c9bSNicolas Bonnefon    ../src/crawlerwidget.cpp
3984af0c9bSNicolas Bonnefon    ../src/abstractlogview.cpp
4084af0c9bSNicolas Bonnefon    ../src/logmainview.cpp
4184af0c9bSNicolas Bonnefon    ../src/filteredview.cpp
4284af0c9bSNicolas Bonnefon    ../src/optionsdialog.cpp
4384af0c9bSNicolas Bonnefon    ../src/persistentinfo.cpp
4484af0c9bSNicolas Bonnefon    ../src/configuration.cpp
4584af0c9bSNicolas Bonnefon    ../src/filtersdialog.cpp
4684af0c9bSNicolas Bonnefon    ../src/filterset.cpp
4784af0c9bSNicolas Bonnefon    ../src/savedsearches.cpp
4884af0c9bSNicolas Bonnefon    ../src/infoline.cpp
4984af0c9bSNicolas Bonnefon    ../src/menuactiontooltipbehavior.cpp
5084af0c9bSNicolas Bonnefon    ../src/selection.cpp
5184af0c9bSNicolas Bonnefon    ../src/quickfind.cpp
5284af0c9bSNicolas Bonnefon    ../src/quickfindpattern.cpp
5384af0c9bSNicolas Bonnefon    ../src/quickfindwidget.cpp
5484af0c9bSNicolas Bonnefon    ../src/sessioninfo.cpp
5584af0c9bSNicolas Bonnefon    ../src/recentfiles.cpp
5684af0c9bSNicolas Bonnefon    ../src/overview.cpp
5784af0c9bSNicolas Bonnefon    ../src/overviewwidget.cpp
5884af0c9bSNicolas Bonnefon    ../src/marks.cpp
5984af0c9bSNicolas Bonnefon    ../src/quickfindmux.cpp
6084af0c9bSNicolas Bonnefon    ../src/signalmux.cpp
6184af0c9bSNicolas Bonnefon    ../src/qtfilewatcher.cpp
6284af0c9bSNicolas Bonnefon    ../src/tabbedcrawlerwidget.cpp
6384af0c9bSNicolas Bonnefon    ../src/filewatcher.cpp
64*c540156cSNicolas Bonnefon    ../src/watchtowerlist.cpp
65a0936e1eSNicolas Bonnefon    ../src/watchtower.cpp
6684b2179eSNicolas Bonnefon    ../src/platformfilewatcher.cpp
6787e05652SNicolas Bonnefon)
6884af0c9bSNicolas Bonnefon
6984af0c9bSNicolas Bonnefonset(glogg_HEADERS
7084af0c9bSNicolas Bonnefon    ../src/mainwindow.h
7184af0c9bSNicolas Bonnefon    ../src/marks.h
7284af0c9bSNicolas Bonnefon    ../src/filewatcher.h)
7384af0c9bSNicolas Bonnefon
7484af0c9bSNicolas Bonnefonset(glogg_TESTS
7584af0c9bSNicolas Bonnefon    testtest.cpp
76a0936e1eSNicolas Bonnefon    filewatcherTest.cpp
7784af0c9bSNicolas Bonnefon    watchtowerTest.cpp
7884af0c9bSNicolas Bonnefon)
7984af0c9bSNicolas Bonnefon
8084af0c9bSNicolas Bonnefon# Options
8184af0c9bSNicolas Bonnefonif (WIN32)
82a0936e1eSNicolas Bonnefon    set(FileWatcherEngine_SOURCES
83a0936e1eSNicolas Bonnefon        ../src/winwatchtower.cpp
84a0936e1eSNicolas Bonnefon    )
8587e05652SNicolas Bonnefonelse (WIN32)
86*c540156cSNicolas Bonnefon    set(FileWatcherEngine_SOURCES ../src/inotifywatchtowerdriver.cpp)
8784af0c9bSNicolas Bonnefonendif (WIN32)
8884af0c9bSNicolas Bonnefon
8984af0c9bSNicolas Bonnefon# Qt
9084af0c9bSNicolas Bonnefon# QT4_WRAP_CPP(glogg_HEADERS_MOC ${glogg_HEADERS})
9184af0c9bSNicolas Bonnefon# INCLUDE(${QT_USE_FILE})
9284af0c9bSNicolas Bonnefon# ADD_DEFINITIONS(${QT_DEFINITIONS})
93b827fa8eSNicolas Bonnefonset(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -DGLOGG_VERSION=\\\"unit_tests\\\" -g -gdwarf-2")
9484af0c9bSNicolas Bonnefon
9584af0c9bSNicolas Bonnefon# Add test cpp file
9684af0c9bSNicolas Bonnefonadd_executable(glogg_tests
9784af0c9bSNicolas Bonnefon    ${glogg_SOURCES}
9884af0c9bSNicolas Bonnefon    ${FileWatcherEngine_SOURCES}
9984af0c9bSNicolas Bonnefon    ${glogg_HEADERS_MOC}
10084af0c9bSNicolas Bonnefon    ${glogg_TESTS}
10184af0c9bSNicolas Bonnefon)
10284af0c9bSNicolas Bonnefon
10384af0c9bSNicolas Bonnefon# Link test executable against gtest & gtest_main
10484af0c9bSNicolas Bonnefontarget_link_libraries(glogg_tests gmock gtest gtest_main pthread Qt5::Widgets)
10584af0c9bSNicolas Bonnefon
10684af0c9bSNicolas Bonnefonadd_test(
10784af0c9bSNicolas Bonnefon    NAME glogg_tests
10884af0c9bSNicolas Bonnefon    COMMAND glogg_tests
10984af0c9bSNicolas Bonnefon)
11084af0c9bSNicolas Bonnefon
111