From b7c573bc9ba658043476ba691b86b88859438f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sat, 21 Nov 2020 07:44:22 +0100 Subject: [PATCH] removed the *_sanitized targets used by fuzz-client from CMake - if you need this to be sanitized use CMAKE_CXX_FLAGS / fixed linking of fuzz-client (#2914) --- externals/simplecpp/CMakeLists.txt | 7 ------- externals/tinyxml2/CMakeLists.txt | 8 -------- lib/CMakeLists.txt | 7 ------- oss-fuzz/CMakeLists.txt | 18 ++++++++++++------ 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/externals/simplecpp/CMakeLists.txt b/externals/simplecpp/CMakeLists.txt index 7297aa87c..8c7df7497 100644 --- a/externals/simplecpp/CMakeLists.txt +++ b/externals/simplecpp/CMakeLists.txt @@ -2,10 +2,3 @@ file(GLOB hdrs "*.h") file(GLOB srcs "*.cpp") add_library(simplecpp_objs OBJECT ${srcs} ${hdrs}) -# TODO: conflicts with ANALYZE_* options -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_library(simplecpp_objs_sanitized OBJECT EXCLUDE_FROM_ALL ${srcs} ${hdrs}) - target_compile_options(simplecpp_objs_sanitized PRIVATE -fsanitize=address) -endif() - - diff --git a/externals/tinyxml2/CMakeLists.txt b/externals/tinyxml2/CMakeLists.txt index 9609f1ba1..12b699b83 100644 --- a/externals/tinyxml2/CMakeLists.txt +++ b/externals/tinyxml2/CMakeLists.txt @@ -13,11 +13,3 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() endif() -# TODO: conflicts with ANALYZE_* options -if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_library(tinyxml2_objs_sanitized OBJECT EXCLUDE_FROM_ALL ${srcs} ${hdrs}) - target_compile_options(tinyxml2_objs_sanitized PRIVATE -fsanitize=address) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0") - target_compile_options(tinyxml2_objs_sanitized PRIVATE -Wno-extra-semi-stmt) - endif() -endif() diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 0e22ae51a..a1df79d7d 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -41,10 +41,3 @@ add_library(lib_objs OBJECT ${srcs_lib} ${hdrs}) if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS) target_precompile_headers(lib_objs PRIVATE precompiled.h) endif() -if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_library(lib_objs_sanitized OBJECT EXCLUDE_FROM_ALL ${srcs_lib} ${hdrs}) - target_compile_options(lib_objs_sanitized PRIVATE -fsanitize=address) - if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS) - target_precompile_headers(lib_objs_sanitized PRIVATE precompiled.h) - endif() -endif() diff --git a/oss-fuzz/CMakeLists.txt b/oss-fuzz/CMakeLists.txt index ed2973839..c0fbd4d1c 100644 --- a/oss-fuzz/CMakeLists.txt +++ b/oss-fuzz/CMakeLists.txt @@ -2,14 +2,20 @@ if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_executable(fuzz-client EXCLUDE_FROM_ALL main.cpp type2.cpp - $ - $ - $) + $ + $ + $) target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals/tinyxml2 ${CMAKE_SOURCE_DIR}/externals) target_compile_options(fuzz-client PRIVATE -fsanitize=fuzzer) - # requires CMake >= 3.13 - #target_link_options(fuzz-client PRIVATE -fsanitize=address -fsanitize=fuzzer) - target_link_libraries(fuzz-client PRIVATE -fsanitize=address -fsanitize=fuzzer) + # TODO: target_link_options() requires CMake >= 3.13 + #target_link_options(fuzz-client PRIVATE -fsanitize=fuzzer) + target_link_libraries(fuzz-client PRIVATE -fsanitize=fuzzer) + if (HAVE_RULES) + target_link_libraries(fuzz-client PRIVATE ${PCRE_LIBRARY}) + endif() + if (USE_Z3) + target_link_libraries(fuzz-client PRIVATE ${Z3_LIBRARIES}) + endif() add_executable(translate EXCLUDE_FROM_ALL translate.cpp