Skip to content

Commit 8de389f

Browse files
committed
cmake: introduce option OSS_FUZZ
OSS Fuzz build environment has some specific, for example, libFuzzer files are named in other way that in LLVM package.
1 parent 872ef18 commit 8de389f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ project(luzer
77

88
option(ENABLE_LUAJIT "Use LuaJIT library" OFF)
99
option(LUAJIT_FRIENDLY_MODE "Use LuaJIT-friendly mode" OFF)
10+
option(OSS_FUZZ "Enable OSS Fuzz support" OFF)
11+
12+
if(DEFINED ENV{OSS_FUZZ})
13+
set(OSS_FUZZ ON)
14+
endif()
1015

1116
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1217
include(SetClangRTLib)

luzer/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SetHwArchString(ARCH)
22
# LibFuzzer library in the OSS Fuzz environment has another name.
3-
if (DEFINED ENV{OSS_FUZZ})
3+
if(OSS_FUZZ)
44
set(LIBFUZZER_NO_MAIN_LIB_NAME "libclang_rt.fuzzer_no_main.a")
55
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
66
set(LIBFUZZER_NO_MAIN_LIB_NAME "libclang_rt.fuzzer_no_main-${ARCH}.a")
@@ -14,7 +14,7 @@ set(LIBCLANG_ASAN_NAME "libclang_rt.asan-${ARCH}.a")
1414
set(LIBCLANG_UBSAN_NAME "libclang_rt.ubsan_standalone-${ARCH}.a")
1515
# Sanitizers libraries in the OSS Fuzz environment have different
1616
# names.
17-
if (DEFINED ENV{OSS_FUZZ})
17+
if(OSS_FUZZ)
1818
set(LIBCLANG_ASAN_NAME "libclang_rt.asan.a")
1919
set(LIBCLANG_UBSAN_NAME "libclang_rt.ubsan_standalone.a")
2020
endif()

0 commit comments

Comments
 (0)