Support binary serialization of protos.
diff --git a/examples/libfuzzer/CMakeLists.txt b/examples/libfuzzer/CMakeLists.txt
index 173363c..f6f2dbf 100644
--- a/examples/libfuzzer/CMakeLists.txt
+++ b/examples/libfuzzer/CMakeLists.txt
@@ -12,26 +12,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-protobuf_generate_cpp(LIB_FUZZER_EXAMPLE_PROTO_SRCS
- LIB_FUZZER_EXAMPLE_PROTO_HDRS
- libfuzzer_example.proto)
-add_executable(libfuzzer_example
- libfuzzer_example.cc
- ${LIB_FUZZER_EXAMPLE_PROTO_SRCS})
-target_link_libraries(libfuzzer_example
- protobuf-mutator
- ${LIB_PROTO_MUTATOR_FUZZER_LIBRARIES})
-set_property(TARGET libfuzzer_example
- PROPERTY COMPILE_FLAGS ${FUZZING_FLAGS})
-set_property(TARGET libfuzzer_example
- PROPERTY LINK_FLAGS ${FUZZING_FLAGS})
-
add_executable(libfuzzer_example_test
libfuzzer_example_test.cc)
-add_dependencies(libfuzzer_example_test libfuzzer_example)
target_link_libraries(libfuzzer_example_test
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
add_test(test.libfuzzer_example_test libfuzzer_example_test --gtest_color=yes AUTO)
-
add_dependencies(check libfuzzer_example_test)
+
+protobuf_generate_cpp(LIB_FUZZER_EXAMPLE_PROTO_SRCS
+ LIB_FUZZER_EXAMPLE_PROTO_HDRS
+ libfuzzer_example.proto)
+
+add_library(fuzzer-example-proto
+ ${LIB_FUZZER_EXAMPLE_PROTO_SRCS})
+set_property(TARGET fuzzer-example-proto
+ PROPERTY COMPILE_FLAGS ${NO_FUZZING_FLAGS})
+
+foreach(fuzzer libfuzzer_example libfuzzer_bin_example)
+ add_executable(${fuzzer} ${fuzzer}.cc)
+ target_link_libraries(${fuzzer}
+ fuzzer-example-proto
+ protobuf-mutator
+ ${LIB_PROTO_MUTATOR_FUZZER_LIBRARIES})
+ set_property(TARGET ${fuzzer}
+ PROPERTY COMPILE_FLAGS ${FUZZING_FLAGS})
+ set_property(TARGET ${fuzzer}
+ PROPERTY LINK_FLAGS ${FUZZING_FLAGS})
+ add_dependencies(libfuzzer_example_test ${fuzzer})
+endforeach(fuzzer)