Commit 69392e7b authored by Dmitry Kazakov's avatar Dmitry Kazakov

Revert "Add a CMake option for ASAN address sanitizer"

This reverts commit 05762b6e.

Instead we should use options provided by ECMEnableSanitizers

Short manual:
```
cmake -DECM_ENABLE_SANITIZERS='address' .
make -j8 install

sudo apt list 'libllvm*'

sudo apt install llvm-X.X # where X.X is a version of libllvm package

export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-X.X # where X.X is the verison of your llvm
export ASAN_OPTIONS=fast_unwind_on_malloc=1:symbolize=1:malloc_context_size=15
```
parent 540000e9
......@@ -264,7 +264,6 @@ include(GenerateExportHeader)
include(ECMMarkAsTest)
include(ECMInstallIcons)
include(CMakeDependentOption)
include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)
include(CheckFunctionExists)
......@@ -407,20 +406,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
option(KRITA_DEVS "For Krita developers. This modifies the DEBUG build type to use -O3 -g, while still enabling Q_ASSERT. This is necessary because the Qt5 cmake modules normally append QT_NO_DEBUG to any build type that is not labeled Debug")
CMAKE_DEPENDENT_OPTION(KRITA_DEVS_SANITIZER "Activate ASAN memory sanitizer for the build (available only with KRITA_DEVS)" ON
"KRITA_DEVS" OFF)
if (KRITA_DEVS)
if (NOT KRITA_DEVS_SANITIZER)
set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g " CACHE STRING "" FORCE)
else()
set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE)
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g" CACHE STRING "" FORCE)
endif()
if(UNIX)
......@@ -441,11 +428,6 @@ if(MINGW)
string(REPLACE "-Wl,--export-all-symbols" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
endif(MINGW)
if (KRITA_DEVS_SANITIZER)
string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
endif()
# enable exceptions globally
kde_enable_exceptions()
......
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