-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
74 lines (61 loc) · 1.33 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
cmake_minimum_required(VERSION 3.0)
project(gtpu)
enable_language(CXX)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++17" COMPILER_SUPPORTS_CXX17)
if (COMPILER_SUPPORTS_CXX17)
add_definitions(-std=c++17)
else ()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
endif ()
find_package(GTest REQUIRED)
find_package(Threads REQUIRED)
include_directories(
${GTEST_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/med
${PROJECT_SOURCE_DIR}/med/med
)
# Library path
set(CMAKE_LDFLAGS
"${CMAKE_LDFLAGS} -L\".\" "
)
# Define the CXX sources
set ( CXX_SRCS
gtpu.hpp
ut/gtpu.cpp
)
add_compile_options(
-Werror
-Wall
-Wextra
-Waddress
-Warray-bounds
-Winit-self
-Wunreachable-code
-pedantic
-pedantic-errors
)
#set_source_files_properties(
# ${CXX_SRCS} PROPERTIES COMPILE_FLAGS
# " -g -O3 -std=c++14 -Wall -Werror"
#)
add_executable(gtest_gtpu
${CXX_SRCS}
)
target_link_libraries(gtest_gtpu
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
if(DEFINED ENV{BUILD_FLAGS})
set(BUILD_FLAGS "$ENV{BUILD_FLAGS}")
else ()
set(BUILD_FLAGS "-O3")
endif ()
set_target_properties(gtest_gtpu PROPERTIES COMPILE_FLAGS
${BUILD_FLAGS}
)
enable_testing()
add_test(UT gtest_gtpu)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
DEPENDS gtest_gtpu)