mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Cmake build: Unify use of sanitizer
The configuration variable is LYX_DEBUG_SANITIZE which can have following values: "NONE" "ADDRESS" Use address sanitizer (previously used with the variable LYX_ASAN) "UNSPECIFIED" Use unspecified sanitizer
This commit is contained in:
parent
ffa1b1dcc7
commit
4f46c22d03
@ -217,7 +217,7 @@ else()
|
|||||||
unset(LYX_ENABLE_VALGRIND_TESTS CACHE)
|
unset(LYX_ENABLE_VALGRIND_TESTS CACHE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
LYX_OPTION(ASAN "Use address sanitizer" OFF ALL)
|
LYX_COMBO(DEBUG_SANITIZE "Use sanitize check" NONE ADDRESS UNSPECIFIED)
|
||||||
#LYX_COMBO(USE_FILEDIALOG "Use native or QT file dialog" QT NATIVE)
|
#LYX_COMBO(USE_FILEDIALOG "Use native or QT file dialog" QT NATIVE)
|
||||||
LYX_COMBO(USE_QT "Use Qt version as frontend" AUTO QT4 QT5 QT6)
|
LYX_COMBO(USE_QT "Use Qt version as frontend" AUTO QT4 QT5 QT6)
|
||||||
LYX_COMBO(USE_IPO "Interprocedural optimization" OFF AUTO ON)
|
LYX_COMBO(USE_IPO "Interprocedural optimization" OFF AUTO ON)
|
||||||
@ -674,6 +674,19 @@ else()
|
|||||||
set(LYX_CXX_FLAGS "")
|
set(LYX_CXX_FLAGS "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (LYX_DEBUG_SANITIZE MATCHES "ADDRESS")
|
||||||
|
set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||||
|
message(STATUS)
|
||||||
|
message(STATUS "Address sanitizer enabled. Usage:")
|
||||||
|
message(STATUS " wget https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py")
|
||||||
|
message(STATUS " chmod +x ./asan_symbolize.py")
|
||||||
|
message(STATUS " ./bin/${_lyx} 2>&1 | ./asan_symbolize.py | c++filt ")
|
||||||
|
message(STATUS)
|
||||||
|
elseif (LYX_DEBUG_SANITIZE MATCHES "UNSPECIFIED")
|
||||||
|
set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
if (CXX11_FLAG MATCHES "\\+\\+([0-9]+)")
|
if (CXX11_FLAG MATCHES "\\+\\+([0-9]+)")
|
||||||
set(CMAKE_CXX_STANDARD ${CMAKE_MATCH_1})
|
set(CMAKE_CXX_STANDARD ${CMAKE_MATCH_1})
|
||||||
@ -726,16 +739,6 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LYX_ASAN)
|
|
||||||
set(CMAKE_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -g ${CMAKE_CXX_FLAGS}")
|
|
||||||
message(STATUS)
|
|
||||||
message(STATUS "Address sanitizer enabled. Usage:")
|
|
||||||
message(STATUS " wget https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py")
|
|
||||||
message(STATUS " chmod +x ./asan_symbolize.py")
|
|
||||||
message(STATUS " ./bin/${_lyx} 2>&1 | ./asan_symbolize.py | c++filt ")
|
|
||||||
message(STATUS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(LYX_CXX_FLAGS_EXTRA "" CACHE STRING "Desired semicolon separated list of extra cxx compile flags, like '-Werror'")
|
set(LYX_CXX_FLAGS_EXTRA "" CACHE STRING "Desired semicolon separated list of extra cxx compile flags, like '-Werror'")
|
||||||
mark_as_advanced(LYX_CXX_FLAGS_EXTRA)
|
mark_as_advanced(LYX_CXX_FLAGS_EXTRA)
|
||||||
if(LYX_CXX_FLAGS_EXTRA)
|
if(LYX_CXX_FLAGS_EXTRA)
|
||||||
|
Loading…
Reference in New Issue
Block a user