Vitaly Buka | 5b1a003 | 2017-02-17 00:06:06 -0800 | [diff] [blame] | 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 | |
Vitaly Buka | 5b1a003 | 2017-02-17 00:06:06 -0800 | [diff] [blame] | 15 | add_executable(libfuzzer_example_test |
| 16 | libfuzzer_example_test.cc) |
Vitaly Buka | 5b1a003 | 2017-02-17 00:06:06 -0800 | [diff] [blame] | 17 | target_link_libraries(libfuzzer_example_test |
| 18 | ${GTEST_BOTH_LIBRARIES} |
| 19 | ${CMAKE_THREAD_LIBS_INIT}) |
| 20 | add_test(test.libfuzzer_example_test libfuzzer_example_test --gtest_color=yes AUTO) |
Vitaly Buka | 5b1a003 | 2017-02-17 00:06:06 -0800 | [diff] [blame] | 21 | add_dependencies(check libfuzzer_example_test) |
Vitaly Buka | 73c1c6a | 2017-02-27 14:21:33 -0800 | [diff] [blame] | 22 | |
| 23 | protobuf_generate_cpp(LIB_FUZZER_EXAMPLE_PROTO_SRCS |
| 24 | LIB_FUZZER_EXAMPLE_PROTO_HDRS |
| 25 | libfuzzer_example.proto) |
| 26 | |
| 27 | add_library(fuzzer-example-proto |
| 28 | ${LIB_FUZZER_EXAMPLE_PROTO_SRCS}) |
| 29 | set_property(TARGET fuzzer-example-proto |
| 30 | PROPERTY COMPILE_FLAGS ${NO_FUZZING_FLAGS}) |
| 31 | |
| 32 | foreach(fuzzer libfuzzer_example libfuzzer_bin_example) |
| 33 | add_executable(${fuzzer} ${fuzzer}.cc) |
| 34 | target_link_libraries(${fuzzer} |
| 35 | fuzzer-example-proto |
Vitaly Buka | 53dccbe | 2017-10-16 18:27:21 -0700 | [diff] [blame] | 36 | protobuf-mutator-libfuzzer |
| 37 | ${LIB_PROTO_MUTATOR_FUZZER_LIBRARIES}) |
Vitaly Buka | 73c1c6a | 2017-02-27 14:21:33 -0800 | [diff] [blame] | 38 | set_property(TARGET ${fuzzer} |
| 39 | PROPERTY COMPILE_FLAGS ${FUZZING_FLAGS}) |
| 40 | set_property(TARGET ${fuzzer} |
Vitaly Buka | 7218a15 | 2017-10-16 16:36:40 -0700 | [diff] [blame] | 41 | PROPERTY LINK_FLAGS ${FUZZING_FLAGS_BINARY}) |
Vitaly Buka | 73c1c6a | 2017-02-27 14:21:33 -0800 | [diff] [blame] | 42 | add_dependencies(libfuzzer_example_test ${fuzzer}) |
| 43 | endforeach(fuzzer) |