1# Copyright 2017 Google Inc. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15add_executable(libfuzzer_example_test 16 libfuzzer_example_test.cc) 17target_link_libraries(libfuzzer_example_test 18 ${GTEST_BOTH_LIBRARIES} 19 ${CMAKE_THREAD_LIBS_INIT}) 20add_test(test.libfuzzer_example_test libfuzzer_example_test --gtest_color=yes AUTO) 21if(LIB_PROTO_MUTATOR_TESTING) 22 add_dependencies(check libfuzzer_example_test) 23endif() 24 25protobuf_generate_cpp(LIB_FUZZER_EXAMPLE_PROTO_SRCS 26 LIB_FUZZER_EXAMPLE_PROTO_HDRS 27 libfuzzer_example.proto) 28 29add_library(fuzzer-example-proto 30 ${LIB_FUZZER_EXAMPLE_PROTO_SRCS}) 31set_property(TARGET fuzzer-example-proto 32 PROPERTY COMPILE_FLAGS ${NO_FUZZING_FLAGS}) 33 34foreach(fuzzer libfuzzer_example libfuzzer_bin_example) 35 add_executable(${fuzzer} ${fuzzer}.cc) 36 target_link_libraries(${fuzzer} 37 fuzzer-example-proto 38 protobuf-mutator-libfuzzer 39 ${LIB_PROTO_MUTATOR_FUZZER_LIBRARIES}) 40 set_property(TARGET ${fuzzer} 41 PROPERTY COMPILE_FLAGS ${FUZZING_FLAGS}) 42 set_property(TARGET ${fuzzer} 43 PROPERTY LINK_FLAGS ${FUZZING_FLAGS_BINARY}) 44 if(LIB_PROTO_MUTATOR_TESTING) 45 add_dependencies(libfuzzer_example_test ${fuzzer}) 46 endif() 47endforeach(fuzzer) 48