Leave the -shared-libasan from global compiler/linker options

This commit is contained in:
Sameer Rahmani 2022-07-12 00:21:54 +01:00
parent 4d3624505e
commit fa6273f0bf
4 changed files with 24 additions and 4 deletions

View File

@ -114,14 +114,12 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
$<$<CONFIG:RELEASE>:-O3>
$<$<CONFIG:RELEASE>:-fmerge-all-constants>
$<$<CONFIG:DEBUG>:-shared-libsan>
)
add_link_options(
# We enforce the lld linker
-fuse-ld=lld
-Wl,-gc-sections
$<$<CONFIG:DEBUG>:-shared-libsan>
$<$<CONFIG:RELEASE>:-fsanitize-address-globals-dead-stripping>
$<$<CONFIG:DEBUG>:-fsanitize=address>
$<$<CONFIG:RELEASE>:-s>

View File

@ -23,7 +23,7 @@ if(NOT APPLE)
endif()
set(SOURCES core.cpp)
add_library(core OBJECT
add_library(core STATIC
${SOURCES})
#add_custom_target(serene.core)
@ -44,6 +44,12 @@ set_target_properties(core PROPERTIES
# LTO support
INTERPROCEDURAL_OPTIMIZATION FALSE)
target_compile_options(core PUBLIC -fsanitize=address -static-libsan --static)
target_link_options(core PUBLIC -fsanitize=address -static-libsan --static)
get_target_property(MFLAGS core COMPILE_OPTIONS)
message(STATUS "------ ${MFLAGS}")
if(SERENE_ENABLE_TIDY)
set_target_properties(core PROPERTIES CXX_CLANG_TIDY ${CLANG_TIDY_PATH})
endif()
@ -63,5 +69,4 @@ include(GenerateExportHeader)
generate_export_header(core EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/serene/core/export.h)
target_link_libraries(core PRIVATE)

View File

@ -46,6 +46,15 @@ set_target_properties(serene PROPERTIES
# LTO support
INTERPROCEDURAL_OPTIMIZATION TRUE)
target_compile_options(serene
PRIVATE
$<$<CONFIG:DEBUG>:-static-libsan>)
target_link_options(serene
PRIVATE
$<$<CONFIG:DEBUG>:-shared-libsan>)
if(SERENE_ENABLE_TIDY)
set_target_properties(serene PROPERTIES CXX_CLANG_TIDY ${CLANG_TIDY_PATH})
endif()

View File

@ -25,6 +25,14 @@ set_target_properties(serenec PROPERTIES
# LTO support
INTERPROCEDURAL_OPTIMIZATION TRUE)
target_compile_options(serenec
PRIVATE
$<$<CONFIG:DEBUG>:-static-libsan>)
target_link_options(serenec
PRIVATE
$<$<CONFIG:DEBUG>:-shared-libsan>)
add_dependencies(serenec Serene::core)
if(SERENE_ENABLE_TIDY)