[F] Fixed ubsan build with clang
This commit is contained in:
parent
f9db2c8402
commit
6ae5cb0107
@ -183,12 +183,17 @@ if("${FORT_COMPILER}" STREQUAL "GNU" OR "${FORT_COMPILER}" STREQUAL "Clang")
|
||||
#ubsan case
|
||||
if(FORT_BUILD_TYPE STREQUAL "ubsan")
|
||||
# -fno-sanitize-recover option is used to force faild
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
||||
if("${FORT_COMPILER}" STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover")
|
||||
target_link_libraries(${PROJECT_NAME}_example ubsan)
|
||||
target_link_libraries(${PROJECT_NAME}_example_cpp ubsan)
|
||||
target_link_libraries(${PROJECT_NAME}_test ubsan)
|
||||
elseif("${FORT_COMPILER}" STREQUAL "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover=all")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=all")
|
||||
endif("${FORT_COMPILER}" STREQUAL "GNU")
|
||||
endif(FORT_BUILD_TYPE STREQUAL "ubsan")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user