-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathCMakeLists.txt
62 lines (55 loc) · 2.46 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
cmake_minimum_required(VERSION 3.14)
project("foundation sources")
option(CONFIG_MATROSKA2 "Build libmatroska2 and tools" ON)
option(DEV_MODE "Developer mode with extra compilation checks" OFF)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11)
include(CheckCCompilerFlag)
include(CMakeParseArguments)
function(add_c_flag_if_supported)
foreach(flagname ${ARGN})
string(REPLACE "-" "_" TEST_RESULT ${flagname})
string(REPLACE "=" "_" TEST_RESULT ${TEST_RESULT})
check_c_compiler_flag(${flagname} HAVE_FLAG_${TEST_RESULT})
# message(STATUS "supported ${flagname}: ${HAVE_FLAG_${TEST_RESULT}}")
if (HAVE_FLAG_${TEST_RESULT})
add_compile_options(${flagname})
endif()
endforeach()
endfunction()
if(DEV_MODE)
message(STATUS "Using developer mode for ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
set(CMAKE_C_EXTENSIONS OFF)
add_c_flag_if_supported(-Wno-error=unused-command-line-argument
-Wall -Wextra -Wpedantic -Wfatal-errors -fstack-protector-strong
-Wcast-align
-Werror=missing-field-initializers
-Werror=excess-initializers
-Werror=strict-aliasing
-Werror=array-bounds
-Werror=format
-Werror=incompatible-pointer-types
-Werror=restrict
-Werror=int-conversion
-Werror=implicit-int
-Werror=return-mismatch
-Werror=declaration-missing-parameter-type
-Werror=switch
-Werror=return-type
-Werror=strict-prototypes
-Werror=implicit-function-declaration
# MSVC
-W4
-we4013 # undefined; assuming extern returning int
-we4005 # macro redefinition
-wd4100 # unreferenced formal parameter
-wd4200 # nonstandard extension used: zero-sized array in struct/union
)
endif()
add_subdirectory("corec")
add_subdirectory("libebml2")
if(CONFIG_MATROSKA2)
add_subdirectory("libmatroska2")
add_subdirectory("mkvalidator")
add_subdirectory("mkclean")
add_subdirectory("mkparts")
endif(CONFIG_MATROSKA2)