blob: dc39177be8bddd957154c85c2a3ebd5f9734f5d7 [file] [log] [blame]
Vitaly Buka5b1a0032017-02-17 00:06:06 -08001# 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 Buka5b1a0032017-02-17 00:06:06 -080015add_executable(libfuzzer_example_test
16 libfuzzer_example_test.cc)
Vitaly Buka5b1a0032017-02-17 00:06:06 -080017target_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)
Vitaly Buka5b1a0032017-02-17 00:06:06 -080021add_dependencies(check libfuzzer_example_test)
Vitaly Buka73c1c6a2017-02-27 14:21:33 -080022
23protobuf_generate_cpp(LIB_FUZZER_EXAMPLE_PROTO_SRCS
24 LIB_FUZZER_EXAMPLE_PROTO_HDRS
25 libfuzzer_example.proto)
26
27add_library(fuzzer-example-proto
28 ${LIB_FUZZER_EXAMPLE_PROTO_SRCS})
29set_property(TARGET fuzzer-example-proto
30 PROPERTY COMPILE_FLAGS ${NO_FUZZING_FLAGS})
31
32foreach(fuzzer libfuzzer_example libfuzzer_bin_example)
33 add_executable(${fuzzer} ${fuzzer}.cc)
34 target_link_libraries(${fuzzer}
35 fuzzer-example-proto
Vitaly Buka53dccbe2017-10-16 18:27:21 -070036 protobuf-mutator-libfuzzer
37 ${LIB_PROTO_MUTATOR_FUZZER_LIBRARIES})
Vitaly Buka73c1c6a2017-02-27 14:21:33 -080038 set_property(TARGET ${fuzzer}
39 PROPERTY COMPILE_FLAGS ${FUZZING_FLAGS})
40 set_property(TARGET ${fuzzer}
Vitaly Buka7218a152017-10-16 16:36:40 -070041 PROPERTY LINK_FLAGS ${FUZZING_FLAGS_BINARY})
Vitaly Buka73c1c6a2017-02-27 14:21:33 -080042 add_dependencies(libfuzzer_example_test ${fuzzer})
43endforeach(fuzzer)