-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
28 lines (20 loc) · 904 Bytes
/
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
cmake_minimum_required(VERSION 2.8)
project(clang_travis_cmake_gtest_coveralls_example)
include(gtest.cmake)
SET(COVERAGE OFF CACHE BOOL "Coverage")
add_executable(tests unit_tests.cpp)
find_package (Threads)
target_link_libraries(tests gtest ${CMAKE_THREAD_LIBS_INIT})
if (MSVC)
target_compile_options(tests PRIVATE /std:c++17 /W4 /WX)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od")
# VS 2017 removed tr1
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
else()
target_compile_options(tests PRIVATE -std=c++14 -g -Wall -Werror -Wextra -Wpedantic -Wconversion -Wswitch-default -Wswitch-enum -Wunreachable-code -Wwrite-strings -Wcast-align -Wshadow -Wundef)
if (COVERAGE)
target_compile_options(tests PRIVATE --coverage)
target_link_libraries(tests PRIVATE --coverage)
endif()
endif()