187e05652SNicolas BonnefonINCLUDE (CheckSymbolExists) 2*f09fa651SNicolas BonnefonINCLUDE (CheckCXXSourceCompiles) 387e05652SNicolas Bonnefon 4*f09fa651SNicolas Bonnefoncmake_minimum_required(VERSION 2.8.12) 584af0c9bSNicolas Bonnefonproject(glogg_tests) 684af0c9bSNicolas Bonnefon 787e05652SNicolas Bonnefon# Qt 884af0c9bSNicolas Bonnefonfind_program(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QT_DIR}/bin) 984af0c9bSNicolas Bonnefonfind_package(Qt5Widgets REQUIRED) 1084af0c9bSNicolas Bonnefon 1184af0c9bSNicolas Bonnefonset(CMAKE_AUTOMOC ON) 1284af0c9bSNicolas Bonnefonset(CMAKE_AUTOUIC ON) 1384af0c9bSNicolas Bonnefonset(CMAKE_INCLUDE_CURRENT_DIR ON) 1484af0c9bSNicolas Bonnefon 1587e05652SNicolas Bonnefon# Configuration 1687e05652SNicolas Bonnefoncheck_symbol_exists( symlink "unistd.h" HAVE_SYMLINK ) 1787e05652SNicolas Bonnefon 18*f09fa651SNicolas Bonnefoncheck_cxx_source_compiles(CMAKE_REQUIRED_FLAGS="-std=c++11" " 19*f09fa651SNicolas Bonnefon #include <memory> 20*f09fa651SNicolas Bonnefon int main(int, int) 21*f09fa651SNicolas Bonnefon { 22*f09fa651SNicolas Bonnefon auto test = std::make_unique<void>(); 23*f09fa651SNicolas Bonnefon return 0; 24*f09fa651SNicolas Bonnefon } 25*f09fa651SNicolas Bonnefon" HAVE_MAKE_UNIQUE) 26*f09fa651SNicolas Bonnefon 2787e05652SNicolas Bonnefonconfigure_file(../config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) 2887e05652SNicolas Bonnefon 2984af0c9bSNicolas Bonnefon# Setup testing 3084af0c9bSNicolas Bonnefonenable_testing() 3184af0c9bSNicolas Bonnefoninclude_directories( 3284af0c9bSNicolas Bonnefon $ENV{GMOCK_HOME}/include 3384af0c9bSNicolas Bonnefon $ENV{GMOCK_HOME}/gtest/include 3484af0c9bSNicolas Bonnefon $ENV{BOOST_ROOT}/ 35a0936e1eSNicolas Bonnefon ../src/ 36a0936e1eSNicolas Bonnefon) 3784af0c9bSNicolas Bonnefonlink_directories($ENV{GMOCK_HOME}/mybuild $ENV{GMOCK_HOME}/mybuild/gtest) 3884af0c9bSNicolas Bonnefon 3984af0c9bSNicolas Bonnefon# Sources 4084af0c9bSNicolas Bonnefonset(glogg_SOURCES 4184af0c9bSNicolas Bonnefon ../src/session.cpp 4284af0c9bSNicolas Bonnefon ../src/data/abstractlogdata.cpp 4384af0c9bSNicolas Bonnefon ../src/data/logdata.cpp 4484af0c9bSNicolas Bonnefon ../src/data/logfiltereddata.cpp 4584af0c9bSNicolas Bonnefon ../src/data/logfiltereddataworkerthread.cpp 4684af0c9bSNicolas Bonnefon ../src/data/logdataworkerthread.cpp 4784af0c9bSNicolas Bonnefon ../src/mainwindow.cpp 4884af0c9bSNicolas Bonnefon ../src/crawlerwidget.cpp 4984af0c9bSNicolas Bonnefon ../src/abstractlogview.cpp 5084af0c9bSNicolas Bonnefon ../src/logmainview.cpp 5184af0c9bSNicolas Bonnefon ../src/filteredview.cpp 5284af0c9bSNicolas Bonnefon ../src/optionsdialog.cpp 5384af0c9bSNicolas Bonnefon ../src/persistentinfo.cpp 5484af0c9bSNicolas Bonnefon ../src/configuration.cpp 5584af0c9bSNicolas Bonnefon ../src/filtersdialog.cpp 5684af0c9bSNicolas Bonnefon ../src/filterset.cpp 5784af0c9bSNicolas Bonnefon ../src/savedsearches.cpp 5884af0c9bSNicolas Bonnefon ../src/infoline.cpp 5984af0c9bSNicolas Bonnefon ../src/menuactiontooltipbehavior.cpp 6084af0c9bSNicolas Bonnefon ../src/selection.cpp 6184af0c9bSNicolas Bonnefon ../src/quickfind.cpp 6284af0c9bSNicolas Bonnefon ../src/quickfindpattern.cpp 6384af0c9bSNicolas Bonnefon ../src/quickfindwidget.cpp 6484af0c9bSNicolas Bonnefon ../src/sessioninfo.cpp 6584af0c9bSNicolas Bonnefon ../src/recentfiles.cpp 6684af0c9bSNicolas Bonnefon ../src/overview.cpp 6784af0c9bSNicolas Bonnefon ../src/overviewwidget.cpp 6884af0c9bSNicolas Bonnefon ../src/marks.cpp 6984af0c9bSNicolas Bonnefon ../src/quickfindmux.cpp 7084af0c9bSNicolas Bonnefon ../src/signalmux.cpp 7184af0c9bSNicolas Bonnefon ../src/qtfilewatcher.cpp 7284af0c9bSNicolas Bonnefon ../src/tabbedcrawlerwidget.cpp 7384af0c9bSNicolas Bonnefon ../src/filewatcher.cpp 74c540156cSNicolas Bonnefon ../src/watchtowerlist.cpp 75a0936e1eSNicolas Bonnefon ../src/watchtower.cpp 7684b2179eSNicolas Bonnefon ../src/platformfilewatcher.cpp 7787e05652SNicolas Bonnefon) 7884af0c9bSNicolas Bonnefon 7984af0c9bSNicolas Bonnefonset(glogg_HEADERS 8084af0c9bSNicolas Bonnefon ../src/mainwindow.h 8184af0c9bSNicolas Bonnefon ../src/marks.h 8284af0c9bSNicolas Bonnefon ../src/filewatcher.h) 8384af0c9bSNicolas Bonnefon 8484af0c9bSNicolas Bonnefonset(glogg_TESTS 8584af0c9bSNicolas Bonnefon testtest.cpp 86a0936e1eSNicolas Bonnefon filewatcherTest.cpp 8784af0c9bSNicolas Bonnefon watchtowerTest.cpp 8884af0c9bSNicolas Bonnefon) 8984af0c9bSNicolas Bonnefon 9084af0c9bSNicolas Bonnefon# Options 9184af0c9bSNicolas Bonnefonif (WIN32) 92a0936e1eSNicolas Bonnefon set(FileWatcherEngine_SOURCES 93*f09fa651SNicolas Bonnefon ../src/winwatchtowerdriver.cpp 94a0936e1eSNicolas Bonnefon ) 9587e05652SNicolas Bonnefonelse (WIN32) 96c540156cSNicolas Bonnefon set(FileWatcherEngine_SOURCES ../src/inotifywatchtowerdriver.cpp) 9784af0c9bSNicolas Bonnefonendif (WIN32) 9884af0c9bSNicolas Bonnefon 9984af0c9bSNicolas Bonnefon# Qt 10084af0c9bSNicolas Bonnefon# QT4_WRAP_CPP(glogg_HEADERS_MOC ${glogg_HEADERS}) 10184af0c9bSNicolas Bonnefon# INCLUDE(${QT_USE_FILE}) 10284af0c9bSNicolas Bonnefon# ADD_DEFINITIONS(${QT_DEFINITIONS}) 103b827fa8eSNicolas Bonnefonset(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -DGLOGG_VERSION=\\\"unit_tests\\\" -g -gdwarf-2") 10484af0c9bSNicolas Bonnefon 10584af0c9bSNicolas Bonnefon# Add test cpp file 10684af0c9bSNicolas Bonnefonadd_executable(glogg_tests 10784af0c9bSNicolas Bonnefon ${glogg_SOURCES} 10884af0c9bSNicolas Bonnefon ${FileWatcherEngine_SOURCES} 10984af0c9bSNicolas Bonnefon ${glogg_HEADERS_MOC} 11084af0c9bSNicolas Bonnefon ${glogg_TESTS} 11184af0c9bSNicolas Bonnefon) 11284af0c9bSNicolas Bonnefon 11384af0c9bSNicolas Bonnefon# Link test executable against gtest & gtest_main 11484af0c9bSNicolas Bonnefontarget_link_libraries(glogg_tests gmock gtest gtest_main pthread Qt5::Widgets) 11584af0c9bSNicolas Bonnefon 11684af0c9bSNicolas Bonnefonadd_test( 11784af0c9bSNicolas Bonnefon NAME glogg_tests 11884af0c9bSNicolas Bonnefon COMMAND glogg_tests 11984af0c9bSNicolas Bonnefon) 12084af0c9bSNicolas Bonnefon 121