-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
49 lines (44 loc) · 1.16 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.16)
project(AnTrans-RI
VERSION 0.1
DESCRIPTION "An(alyzing) Trans(pose) for LibRI."
LANGUAGES CXX
)
include_directories(${CMAKE_SOURCE_DIR}/include)
set (CMAKE_CXX_STANDARD 17)
include (CTest)
enable_testing()
find_package(GTest HINTS /usr/local/lib/ ${GTEST_DIR})
if(NOT ${GTest_FOUND})
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG "origin/main"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(googletest)
endif()
function(AddTest) # function for UT
cmake_parse_arguments(UT "DYN" "TARGET" "LIBS;DYN_LIBS;STATIC_LIBS;SOURCES;DEPENDS" ${ARGN})
add_executable(${UT_TARGET} ${UT_SOURCES})
target_link_libraries(${UT_TARGET} ${UT_LIBS}
GTest::gtest_main GTest::gmock_main)
add_test(NAME ${UT_TARGET}
COMMAND ${UT_TARGET}
WORKING_DIRECTORY $<TARGET_FILE_DIR:${UT_TARGET}>
)
endfunction(AddTest)
AddTest(
TARGET opt_test
SOURCES tests/test_opts.cpp
)
AddTest(
TARGET deduce_test
SOURCES tests/test_deduce.cpp
)
AddTest(
TARGET search_test
SOURCES tests/test_search.cpp
)