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
15set(LIBXML2_CFLAGS "${CMAKE_C_FLAGS} ${FUZZING_FLAGS} -w")
16set(LIBXML2_CXXFLAGS "${CMAKE_CXX_FLAGS} ${FUZZING_FLAGS} -w")
17include(libxml2)
18add_executable(libxml2_example
19               libxml2_example.cc)
20target_link_libraries(libxml2_example
21                      protobuf-mutator-xml
22                      ${LIB_PROTO_MUTATOR_FUZZER_LIBRARIES}
23                      ${LIBXML2_LIBRARIES}
24                      ${ZLIB_LIBRARIES}
25                      ${LIBLZMA_LIBRARIES})
26set_property(TARGET libxml2_example
27             PROPERTY COMPILE_FLAGS ${FUZZING_FLAGS})
28set_property(TARGET libxml2_example
29             PROPERTY LINK_FLAGS ${FUZZING_FLAGS_BINARY})
30
31add_executable(libxml2_example_test
32               libxml2_example_test.cc)
33add_dependencies(libxml2_example_test libxml2_example)
34target_link_libraries(libxml2_example_test
35                      ${GTEST_BOTH_LIBRARIES}
36                      ${CMAKE_THREAD_LIBS_INIT})
37add_test(test.libxml2_example_test libxml2_example_test --gtest_color=yes AUTO)
38if (LIB_PROTO_MUTATOR_TESTING)
39  add_dependencies(check libxml2_example_test)
40endif()
41