-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
59 lines (48 loc) · 1.32 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
cmake_minimum_required(VERSION 3.8)
project(baron VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 17)
if(${BUILD_BARON_DEBUG})
set(CMAKE_BUILD_TYPE Debug)
set(compiler_flags "\
-g\
-fstandalone-debug\
-O0\
-fno-inline\
-fno-omit-frame-pointer\
-DBARON_DEBUG\
")
else()
set(CMAKE_BUILD_TYPE Release)
set(compiler_flags "-O3")
endif()
if(${BUILD_BARON_ASAN})
string(APPEND compiler_flags " -fsanitize=address")
endif()
if(${BUILD_BARON_UBSAN})
string(APPEND compiler_flags " -fsanitize=undefined")
endif()
set(BUILD_FAKE_JNI_DEBUG OFF CACHE BOOL "")
set(BUILD_FAKE_JNI_TESTS OFF CACHE BOOL "")
set(BUILD_FAKE_JNI_EXAMPLES OFF CACHE BOOL "")
string(APPEND CMAKE_CXX_FLAGS " ${compiler_flags}")
string(APPEND CMAKE_C_FLAGS " ${compiler_flags}")
add_subdirectory(fake-jni)
file(GLOB_RECURSE BARON_SRC "src/**.cpp")
add_library(baron SHARED ${BARON_SRC})
target_link_libraries(baron fake-jni)
target_include_directories(baron PUBLIC include)
target_compile_options(baron PUBLIC
-Wall
-Wextra
# -Werror
-pedantic
-Wno-unused-parameter
-Wno-unused-function
-Wno-nested-anon-types
-Wno-vla-extension
-Wno-zero-length-array
)
set(BUILD_BARON_EXAMPLES ON CACHE BOOL "Enables baron example")
if(${BUILD_BARON_EXAMPLES})
add_subdirectory(example)
endif()