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)

This commit is contained in:
Oliver Stöneberg 2020-11-21 07:44:22 +01:00 committed by GitHub
parent f5eba39935
commit b7c573bc9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 28 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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_OBJECTS:simplecpp_objs_sanitized>
$<TARGET_OBJECTS:tinyxml2_objs_sanitized>
$<TARGET_OBJECTS:lib_objs_sanitized>)
$<TARGET_OBJECTS:simplecpp_objs>
$<TARGET_OBJECTS:tinyxml2_objs>
$<TARGET_OBJECTS:lib_objs>)
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