Commit 2e9e80d1 authored by GILLES Sebastien's avatar GILLES Sebastien

#1288 Slight improvement in CMake.

parent f255e6ae
...@@ -11,6 +11,15 @@ macro(add_cxx_compiler_flag _flag) ...@@ -11,6 +11,15 @@ macro(add_cxx_compiler_flag _flag)
endif() endif()
endmacro() endmacro()
macro(add_cxx_compiler_debug_flag _flag)
string(REPLACE "-" "_" _flag_var ${_flag})
check_cxx_compiler_flag("${_flag}" CXX_COMPILER_${_flag_var}_OK)
if(CXX_COMPILER_${_flag_var}_OK)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${_flag}")
endif()
endmacro()
macro(add_c_compiler_flag _flag) macro(add_c_compiler_flag _flag)
string(REPLACE "-" "_" _flag_var ${_flag}) string(REPLACE "-" "_" _flag_var ${_flag})
......
...@@ -119,7 +119,8 @@ endif() ...@@ -119,7 +119,8 @@ endif()
if(MOREFEM_ASAN) if(MOREFEM_ASAN)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") add_cxx_compiler_debug_flag("-fno-omit-frame-pointer")
add_cxx_compiler_debug_flag("-fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
endif() endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment