-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
42 lines (30 loc) · 1.16 KB
/
CMakeLists.txt
File metadata and controls
42 lines (30 loc) · 1.16 KB
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
cmake_minimum_required(VERSION 3.13)
# root includes
set(ROOT_INCLUDES ${PROJECT_SOURCE_DIR}/include)
set(PROJECT_NAME wordnet_test)
project(${PROJECT_NAME})
# Inlcude directories
include_directories(${ROOT_INCLUDES})
# Source files
file(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/src/*.cpp)
# Include the gtest library
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
# Unit tests
add_executable(runUnitTests ${SRC_FILES})
target_compile_options(runUnitTests PRIVATE ${COMPILE_OPTS} -O3 -Wno-gnu-zero-variadic-macro-arguments)
target_link_options(runUnitTests PRIVATE ${LINK_OPTS})
# Standard linking to gtest stuff
target_link_libraries(runUnitTests gtest gtest_main)
# Extra linking for the project
target_link_libraries(runUnitTests wordnet_lib)
# Data files
file(GLOB ETC_FILES RELATIVE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/etc/*)
# Copy data files for tests
add_custom_command(
OUTPUT ${ETC_FILES}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/etc ${CMAKE_CURRENT_BINARY_DIR}/etc
DEPENDS ${ETC_FILES}
COMMENT "Copying test data")
add_custom_target(
etc DEPENDS ${ETC_FILES})
add_dependencies(runUnitTests etc)