Skip to content
Snippets Groups Projects
Verified Commit 77737e6b authored by Lars Bilke's avatar Lars Bilke
Browse files

[cmake] Pass only one sanitizer to TFEL, prefer ASAN.

Multiple flags required to be passed whitespace-separated and this
messes up CMake's external project builds. Could not get it to work.
parent 45299cde
No related branches found
No related tags found
No related merge requests found
......@@ -81,17 +81,19 @@ if(OGS_USE_MFRONT)
)
endif()
# Only one flag supported, prefer ASAN
if(ENABLE_ASAN)
list(APPEND _sanitize_flags -fsanitize=address)
set(_sanitize_flag -fsanitize=address)
endif()
if(ENABLE_UBSAN)
list(APPEND _sanitize_flags -fsanitize=undefined)
if(ENABLE_UBSAN AND NOT DEFINED _sanitize_flag)
set(_sanitize_flag -fsanitize=undefined)
elseif(ENABLE_UBSAN AND DEFINED _sanitize_flag)
message(STATUS "MFront: ASAN enabled only! UBSAN is off.")
endif()
if(DEFINED _sanitize_flags)
list(JOIN _sanitize_flags " " _sanitize_flags_string)
if(DEFINED _sanitize_flag)
foreach(var CXX EXE_LINKER SHARED_LINKER MODULE_LINKER)
list(APPEND _tfel_cmake_args
"-DCMAKE_${var}_FLAGS_INIT=${_sanitize_flags_string}"
"-DCMAKE_${var}_FLAGS_INIT=${_sanitize_flag}"
)
endforeach()
endif()
......@@ -103,7 +105,7 @@ if(OGS_USE_MFRONT)
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"-Denable-testing=OFF"
${_defaultCMakeArgs}
${_tfel_cmake_args}
"${_tfel_cmake_args}"
)
message(
STATUS
......
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