IAP GITLAB

Skip to content
Snippets Groups Projects
Commit dd5aea94 authored by Hans Dembinski's avatar Hans Dembinski
Browse files

simpler

parent 0adacc0b
No related branches found
No related tags found
1 merge request!106Adding sanitizers revealed bugs
......@@ -102,11 +102,12 @@ function (CORSIKA_ADD_TEST name)
target_include_directories (${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_outputs/)
add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -r junit)
if(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
target_compile_options(${name} PRIVATE -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=all)
set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=address,undefined")
else()
target_compile_options(${name} PRIVATE -fno-omit-frame-pointer -fsanitize=address,leak,undefined -fno-sanitize-recover=all)
set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=address,leak,undefined")
set(sanitize "address,implicit-integer-truncation,implicit-conversion,integer,alignment,bool,builtin,bounds,enum,float-cast-overflow,function,pointer-overflow,return,shift,shift-base,shift-exponent,unreachable,vla-bound,vptr")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
# Apple has some security measures which interfere with the leak sanitizer, so we can't use it on OSX
set(sanitize "leak,${sanitize}")
endif()
target_compile_options(${name} PRIVATE -fno-omit-frame-pointer -fsanitize=${sanitize} -fno-sanitize-recover=all)
set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=${sanitize}")
endfunction (CORSIKA_ADD_TEST)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment