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