-
Notifications
You must be signed in to change notification settings - Fork 74
/
CMakeLists.txt
59 lines (46 loc) · 1.9 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.19)
project(fuzztest)
option(FUZZTEST_BUILD_TESTING "Building the tests." OFF)
option(FUZZTEST_FUZZING_MODE "Building the fuzztest in fuzzing mode." OFF)
set(FUZZTEST_COMPATIBILITY_MODE "" CACHE STRING "Compatibility mode. Available options: <empty>, libfuzzer")
set(CMAKE_CXX_STANDARD 17)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (COMPILER_GCC 1)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
set (COMPILER_CLANG 1) # Safe to treat AppleClang as a regular Clang, in general.
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set (COMPILER_CLANG 1)
else ()
message (FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} is not supported")
endif ()
if (COMPILER_GCC AND (FUZZTEST_FUZZING_MODE OR (FUZZTEST_COMPATIBILITY_MODE STREQUAL "libfuzzer")))
message (FATAL_ERROR "Compilation with GCC is not yet supported for fuzztest mode. Please use Clang. CC=clang CXX=clang++")
endif ()
if (FUZZTEST_FUZZING_MODE AND NOT FUZZTEST_COMPATIBILITY_MODE STREQUAL "")
message (FATAL_ERROR "Please either use fuzzing mode or compatibility mode")
endif ()
if (NOT FUZZTEST_COMPATIBILITY_MODE STREQUAL "" AND
NOT FUZZTEST_COMPATIBILITY_MODE STREQUAL "libfuzzer")
message (FATAL_ERROR "Compatibility mode is only supported for libfuzzer")
endif ()
include(cmake/AddFuzzTest.cmake)
include(cmake/FuzzTestFlagSetup.cmake)
fuzztest_setup_fuzzing_flags()
include(cmake/BuildDependencies.cmake)
include(cmake/FuzzTestHelpers.cmake)
include_directories(${re2_SOURCE_DIR})
if (FUZZTEST_BUILD_TESTING)
enable_testing()
endif ()
if (FUZZTEST_BUILD_TESTING)
set(protobuf_PROTOC_EXE "${protobuf_BINARY_DIR}/protoc")
include(${protobuf_SOURCE_DIR}/cmake/protobuf-generate.cmake)
endif ()
add_subdirectory(grammar_codegen)
add_subdirectory(tools)
add_subdirectory(common)
add_subdirectory(fuzztest)
if (FUZZTEST_BUILD_TESTING)
add_subdirectory(domain_tests)
add_subdirectory(e2e_tests)
endif ()