2016-05-16 04:43:42 +08:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
|
|
|
|
project(memgraph_tests)
|
|
|
|
|
|
|
|
# setup dependencies
|
|
|
|
|
|
|
|
# Catch (C++ Automated Test Cases in Headers) dependency
|
|
|
|
ExternalProject_Add(
|
|
|
|
Catch
|
|
|
|
GIT_REPOSITORY "https://github.com/philsquared/Catch.git"
|
|
|
|
GIT_TAG "master"
|
|
|
|
SOURCE_DIR "${CMAKE_SOURCE_DIR}/libs/Catch"
|
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_COMMAND ""
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
TEST_COMMAND ""
|
|
|
|
)
|
|
|
|
ExternalProject_Get_Property(Catch source_dir)
|
|
|
|
set(catch_source_dir ${source_dir})
|
2016-05-25 06:37:14 +08:00
|
|
|
|
2016-05-16 04:43:42 +08:00
|
|
|
include_directories(${catch_source_dir}/include)
|
|
|
|
|
|
|
|
# find tests
|
|
|
|
file(GLOB_RECURSE test_files ${CMAKE_HOME_DIRECTORY}/tests/*.cpp)
|
|
|
|
set(tests "")
|
|
|
|
foreach(test_file ${test_files})
|
|
|
|
get_filename_component(test_name ${test_file} NAME_WE)
|
|
|
|
list(APPEND tests ${test_name})
|
|
|
|
endforeach()
|
|
|
|
MESSAGE(STATUS "Available tests are: ${tests}")
|
|
|
|
|
2016-05-23 13:51:36 +08:00
|
|
|
# copy test data
|
|
|
|
file(COPY ${CMAKE_SOURCE_DIR}/tests/data DESTINATION ${CMAKE_BINARY_DIR}/tests)
|
|
|
|
|
2016-05-16 04:43:42 +08:00
|
|
|
# build tests
|
|
|
|
foreach(test ${tests})
|
|
|
|
add_executable(${test} ${test}.cpp)
|
2016-05-23 13:51:36 +08:00
|
|
|
target_link_libraries(${test} stdc++fs)
|
2016-05-25 06:37:14 +08:00
|
|
|
target_link_libraries(${test} cypher_lib)
|
2016-05-16 04:43:42 +08:00
|
|
|
add_test(NAME ${test} COMMAND ${test})
|
|
|
|
set_property(TARGET ${test} PROPERTY CXX_STANDARD 14)
|
|
|
|
endforeach()
|