1
1
set (OPENSSL_USE_STATIC_LIBS TRUE )
2
2
find_package (OpenSSL REQUIRED )
3
- #include(libprotobuf-mutator)
4
3
add_compile_options (-O0 )
5
4
6
5
add_library (explore_me_advanced
@@ -17,6 +16,36 @@ target_link_libraries(explore_me_advanced
17
16
-lz
18
17
)
19
18
19
+
20
+ #
21
+ # Block defining the location of the fuzzer_no_main library that is needed to compile this example
22
+ #
23
+
24
+ # Uncomment and change to your own path if you want to specify a specific fuzzer_no_main library
25
+ #set(FUZZER_NO_MAIN_PATH /usr/lib/clang/${CMAKE_C_COMPILER_VERSION}/lib/linux/libclang_rt.fuzzer_no_main-${CMAKE_SYSTEM_PROCESSOR}.a)
26
+
27
+
28
+ # If location is not manually defined, we search for it.
29
+ if (NOT DEFINED FUZZER_NO_MAIN_PATH )
30
+ execute_process (COMMAND clang --print-file-name libclang_rt.fuzzer_no_main-${CMAKE_SYSTEM_PROCESSOR}.a
31
+ OUTPUT_VARIABLE FUZZER_NO_MAIN_PATH
32
+ OUTPUT_STRIP_TRAILING_WHITESPACE
33
+ )
34
+
35
+ # If the first search was not successful, we check if the dependency is there, but does not contain the architecture information
36
+ # in its name, as it is common if you compile the sources yourself.
37
+ if (NOT ${FUZZER_NO_MAIN_PATH} MATCHES "\/ " )
38
+ execute_process (COMMAND clang --print-file-name libclang_rt.fuzzer_no_main.a
39
+ OUTPUT_VARIABLE FUZZER_NO_MAIN_PATH
40
+ OUTPUT_STRIP_TRAILING_WHITESPACE
41
+ )
42
+ endif ()
43
+ endif ()
44
+
45
+ #
46
+ # End of fuzzer_no_main definition
47
+ #
48
+
20
49
foreach (TestType IN ITEMS
21
50
structured_input_checks
22
51
custom_mutator_example_checks
@@ -31,7 +60,7 @@ foreach(TestType IN ITEMS
31
60
)
32
61
33
62
target_link_libraries (${TestType} _test
34
- /usr/lib/clang/${CMAKE_C_COMPILER_VERSION}/lib/linux/libclang_rt.fuzzer_no_main-${CMAKE_SYSTEM_PROCESSOR}.a
63
+ ${FUZZER_NO_MAIN_PATH}
35
64
explore_me_advanced
36
65
GTest::gtest_main
37
66
)
@@ -43,7 +72,7 @@ foreach(TestType IN ITEMS
43
72
)
44
73
45
74
target_link_libraries (${TestType} _fuzz_test
46
- /usr/lib/clang/${CMAKE_C_COMPILER_VERSION}/lib/linux/libclang_rt.fuzzer_no_main-${CMAKE_SYSTEM_PROCESSOR}.a
75
+ ${FUZZER_NO_MAIN_PATH}
47
76
explore_me_advanced
48
77
GTest::gtest
49
78
)
0 commit comments