This repository has been archived by the owner on Jun 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
72 lines (61 loc) · 2.02 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
cmake_minimum_required(VERSION 3.0)
project(ifj2017)
# codecov integration
include(utils/DownloadProject.cmake)
download_project(
PROJ codecov
GIT_REPOSITORY https://github.com/RWTH-HPC/CMake-codecov.git
GIT_TAG master
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
set(CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/codecov-src/cmake" ${CMAKE_MODULE_PATH})
#init
IF (CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -pedantic -std=c99 -Wno-unused-parameter -Wno-variadic-macros")
ELSEIF (MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_CRT_SECURE_NO_WARNINGS /wd4200")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS /wd4200")
ENDIF ()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 99)
# Visual Studio debug visualizers
IF (MSVC)
file(
GLOB_RECURSE VS_debug_visualizers
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"dev/debug/vs/*.natvis"
)
ELSE ()
set(VS_visualizers "")
ENDIF ()
# ifj2017
file(
GLOB_RECURSE ifj2017_SRC
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"src/*.c" "src/*.h"
)
add_executable(ifj2017 ${ifj2017_SRC} ${VS_debug_visualizers})
IF (NOT MSVC)
target_link_libraries(ifj2017 m)
ENDIF ()
find_package(codecov)
add_coverage(ifj2017) # to coverage by integration tests
set(ifj2017_SRC_no_main ${ifj2017_SRC})
list(REMOVE_ITEM ifj2017_SRC_no_main "src/ifj2017.c")
# ifj2017_test
include(test/CMakeLists.txt)
# ifj2017_benchmark
include(benchmark/CMakeLists.txt)
# automatic source groups by folder structure
set(_all_sources ${ifj2017_test_SRC} ${ifj2017_benchmark_SRC} ${ifj2017_SRC} ${VS_debug_visualizers})
foreach (_source IN ITEMS ${_all_sources})
get_filename_component(_source_path "${_source}" PATH)
IF (MSVC)
string(REPLACE "/" "\\" _source_path_msvc "${_source_path}")
set(_source_path ${_source_path_msvc})
ENDIF ()
source_group("${_source_path}" FILES "${_source}")
endforeach ()
coverage_evaluate()