1
0
Fork 0

Move ENABLE_ASAN check to global scope

Allows ASan with GCC.
This commit is contained in:
James Turner 2020-08-19 14:02:45 +01:00
parent 63d3dd4cbd
commit 5820619575

View file

@ -495,7 +495,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Ap
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(WARNING_FLAGS_C "-Wall")
endif()
# ASan is enabled in SimGear's configuration, in case you are
# wondering why there is no option() for it above.
if (ENABLE_ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
@ -506,8 +509,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Ap
set(CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=address")
endif()
endif()
if(WIN32)
if(MSVC)
# override CMake default RelWithDebInfo flags. This is important to ensure