blob: e6a6ae42f6e15396ee3a216600e3a2122e2c52f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
PROJECT(basicwriter)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
SET(CMAKE_AUTOMOC ON)
FIND_PACKAGE(Qt5Widgets REQUIRED)
# Enable C++11 and all warnings
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -std=c++11")
# Option for enabling testing. Turn on with 'cmake -Dtest=ON'.
OPTION(test "Build all tests." OFF) # Makes boolean 'test' available.
# Unit test handling
if(test)
# Compile gtest
add_subdirectory(lib/gtest-1.7.0)
# Enable testing and declare some variables used for compiling the test cases
enable_testing()
set(GTEST_INCLUDE_DIR ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
set(GTEST_LIBRARIES gtest gtest_main)
endif()
INCLUDE_DIRECTORIES(src/)
ADD_LIBRARY(ousia_core
src/model/GraphNode
src/model/domain/Structure
src/model/domain/Layer
src/model/domain/Annotation
src/model/domain/Anchor
src/model/domain/Field
src/model/types/Type
src/model/types/Value
)
ADD_EXECUTABLE(ousia
src/main
)
TARGET_LINK_LIBRARIES(ousia
ousia_core
)
QT5_USE_MODULES(ousia Widgets)
if(test)
# Include the gtest include files and the src directory
INCLUDE_DIRECTORIES(
${GTEST_INCLUDE_DIR}
src/
)
# Add all unit test files
ADD_EXECUTABLE(ousia_test
test/model/GraphNode
test/model/domain/Layer
)
TARGET_LINK_LIBRARIES(ousia_test
${GTEST_LIBRARIES}
ousia_core
)
# Register the unit test
ADD_TEST(ousia_test ousia_test)
endif()
|