forked from Matroska-Org/foundation-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (47 loc) · 1.97 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
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})
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}")
set(CMAKE_CXX_EXTENSIONS OFF)
add_c_flag_if_supported(-Wno-error=unused-command-line-argument
-Wall -Wextra -Wpedantic -Wfatal-errors -fstack-protector-strong
-Wno-self-assign
-Wno-unused-parameter
-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
-W4)
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)