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/ ) 26link_directories($ENV{GMOCK_HOME}/mybuild $ENV{GMOCK_HOME}/mybuild/gtest) 27 28# Sources 29set(glogg_SOURCES 30 ../src/session.cpp 31 ../src/data/abstractlogdata.cpp 32 ../src/data/logdata.cpp 33 ../src/data/logfiltereddata.cpp 34 ../src/data/logfiltereddataworkerthread.cpp 35 ../src/data/logdataworkerthread.cpp 36 ../src/mainwindow.cpp 37 ../src/crawlerwidget.cpp 38 ../src/abstractlogview.cpp 39 ../src/logmainview.cpp 40 ../src/filteredview.cpp 41 ../src/optionsdialog.cpp 42 ../src/persistentinfo.cpp 43 ../src/configuration.cpp 44 ../src/filtersdialog.cpp 45 ../src/filterset.cpp 46 ../src/savedsearches.cpp 47 ../src/infoline.cpp 48 ../src/menuactiontooltipbehavior.cpp 49 ../src/selection.cpp 50 ../src/quickfind.cpp 51 ../src/quickfindpattern.cpp 52 ../src/quickfindwidget.cpp 53 ../src/sessioninfo.cpp 54 ../src/recentfiles.cpp 55 ../src/overview.cpp 56 ../src/overviewwidget.cpp 57 ../src/marks.cpp 58 ../src/quickfindmux.cpp 59 ../src/signalmux.cpp 60 ../src/qtfilewatcher.cpp 61 ../src/tabbedcrawlerwidget.cpp 62 ../src/filewatcher.cpp 63) 64 65set(glogg_HEADERS 66 ../src/mainwindow.h 67 ../src/marks.h 68 ../src/filewatcher.h) 69 70set(glogg_TESTS 71 testtest.cpp 72 watchtowerTest.cpp 73) 74 75# Options 76if (WIN32) 77 set(FileWatcherEngine_SOURCES ../src/winwatchtower.cpp) 78else (WIN32) 79 set(FileWatcherEngine_SOURCES ../src/inotifywatchtower.cpp) 80endif (WIN32) 81 82# Qt 83# QT4_WRAP_CPP(glogg_HEADERS_MOC ${glogg_HEADERS}) 84# INCLUDE(${QT_USE_FILE}) 85# ADD_DEFINITIONS(${QT_DEFINITIONS}) 86set(CMAKE_CXX_FLAGS "-fPIC -std=c++11 -DGLOGG_VERSION=\\\"unit_tests\\\" -g -gdwarf-2") 87 88# Add test cpp file 89add_executable(glogg_tests 90 ${glogg_SOURCES} 91 ${FileWatcherEngine_SOURCES} 92 ${glogg_HEADERS_MOC} 93 ${glogg_TESTS} 94) 95 96# Link test executable against gtest & gtest_main 97target_link_libraries(glogg_tests gmock gtest gtest_main pthread Qt5::Widgets) 98 99add_test( 100 NAME glogg_tests 101 COMMAND glogg_tests 102) 103 104