1cmake_minimum_required(VERSION 3.18) 2 3project(libder) 4 5if(CMAKE_BUILD_TYPE STREQUAL "Debug") 6 if(NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") 7 add_compile_options(-fsanitize=address,undefined -fstrict-aliasing) 8 add_link_options(-fsanitize=address,undefined -fstrict-aliasing) 9 endif() 10 11 add_compile_options(-Werror) 12endif() 13 14# AppleClang is excluded for the time being; the version used in GitHub Action 15# runners doesn't seem to have that part of libclang_rt installed, though the 16# -fsanitize=fuzzer-no-link instrumentation seems to be fine. Maybe re-evaluate 17# this for MATCHES as a possibility later. 18if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") 19 set(BUILD_FUZZERS TRUE 20 CACHE BOOL "Build the libFuzzer fuzzers (needs llvm)") 21else() 22 set(BUILD_FUZZERS FALSE 23 CACHE BOOL "Build the libFuzzer fuzzers (needs llvm)") 24endif() 25 26add_subdirectory(libder) 27add_subdirectory(derdump) 28add_subdirectory(tests) 29