diff options
author | Adolfo E. García <adolfo.garcia.cr@gmail.com> | 2017-10-15 15:54:27 +0300 |
---|---|---|
committer | Adolfo E. García <adolfo.garcia.cr@gmail.com> | 2017-10-21 19:12:28 +0300 |
commit | de065c728fb7600ec368e895ba4faab656c0dc0a (patch) | |
tree | 7cd07f1a7f20021802dffa740295c64d3d48a5d9 /CMakeLists.txt | |
parent | 2fa3f5072d2010c402d44c394b208cd32f108aea (diff) |
Enable option WITH_ASAN for macOS builds
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bfefcadd1..f9aec839c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,9 +36,9 @@ include(CheckCXXSourceCompiles) option(WITH_TESTS "Enable building of unit tests" ON) option(WITH_GUI_TESTS "Enable building of GUI tests" OFF) option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated methods." OFF) -option(WITH_ASAN "Enable address sanitizer checks (Linux only)" OFF) +option(WITH_ASAN "Enable address sanitizer checks (Linux and macOS only)" OFF) option(WITH_COVERAGE "Use to build with coverage tests (GCC only)." OFF) -option(WITH_APP_BUNDLE "Enable Application Bundle for OS X" ON) +option(WITH_APP_BUNDLE "Enable Application Bundle for macOS" ON) option(WITH_XC_AUTOTYPE "Include Auto-Type." ON) option(WITH_XC_HTTP "Include KeePassHTTP and Custom Icon Downloads." OFF) @@ -110,16 +110,20 @@ endif() add_gcc_compiler_cxxflags("-fno-exceptions -fno-rtti") add_gcc_compiler_cxxflags("-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual") add_gcc_compiler_cflags("-Wchar-subscripts -Wwrite-strings") + if(WITH_ASAN) - if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") - message(FATAL_ERROR "WITH_ASAN is only supported on Linux at the moment.") + if(NOT (LINUX OR APPLE)) + message(FATAL_ERROR "WITH_ASAN is only supported on Linux and macOS at the moment.") endif() add_gcc_compiler_flags("-fsanitize=address -DWITH_ASAN") - if(NOT (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)) - add_gcc_compiler_flags("-fsanitize=leak -DWITH_LSAN") + if(LINUX) + if(NOT (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)) + add_gcc_compiler_flags("-fsanitize=leak -DWITH_LSAN") + endif() endif() + endif() string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER) |