diff options
author | Ankit Meel <ankitjmeel@gmail.com> | 2020-09-26 10:35:33 +0300 |
---|---|---|
committer | Ankit Meel <ankitjmeel@gmail.com> | 2020-09-26 20:42:57 +0300 |
commit | 74bcb32c9f02a99ffa4b441aa5caa3e96f5be91f (patch) | |
tree | 27a20f2ab233a92d5d51a86514b7355cf264a7bb /CMakeLists.txt | |
parent | e7bb7836ccc9f38d467ede9229df496857463f4d (diff) |
macOS: Remove ASan debug flags from release config.
Setting `PLATFORM_LINKLIBS` is not required for clang, compiler and
linker flags are enough. Note that the change made in
{rBa4c5811e2127}) to `platform_apple.cmake` (appending to
`PLATFORM_CFLAGS`) has not been reverted. platform file shouldn't be
overwriting the flags.
`PLATFORM_LINKFLAGS` is overwritten by `platform_apple.cmake`, so no
point in setting it. Fixing that like `PLATFORM_CFLAGS` is out of the
scope of this change.
`PLATFORM_LINKFLAGS_DEBUG` has been replaced with generator expression
to include RelWithDebInfo and MinSizeRel build types also.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cf8af6a17b7..c858862df94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -859,13 +859,13 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release") if(MSVC) set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6") endif() - if(APPLE) - # COMPILER_ASAN_CFLAGS and COMPILER_ASAN_CXXFLAGS are the same as of - # now, so use either for PLATFORM_CFLAGS. - set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${COMPILER_ASAN_CFLAGS}") - set(COMPILER_ASAN_LINKER_FLAGS "-fno-omit-frame-pointer -fsanitize=address") - endif(APPLE) - if(COMPILER_ASAN_LIBRARY) + + if(APPLE AND COMPILER_ASAN_LIBRARY) + string(REPLACE " " ";" _list_COMPILER_ASAN_CFLAGS ${COMPILER_ASAN_CFLAGS}) + add_compile_options("$<$<NOT:$<CONFIG:Release>>:${_list_COMPILER_ASAN_CFLAGS}>") + add_link_options("$<$<NOT:$<CONFIG:Release>>:-fno-omit-frame-pointer;-fsanitize=address>") + unset(_list_COMPILER_ASAN_CFLAGS) + elseif(COMPILER_ASAN_LIBRARY) set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}") set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}") |