mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-10-08 16:27:53 -04:00
31 lines
1.0 KiB
CMake
31 lines
1.0 KiB
CMake
|
include_guard(GLOBAL)
|
||
|
|
||
|
include(DetectCompiler)
|
||
|
include(DetectArchitecture)
|
||
|
|
||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||
|
if (C_CLANG OR C_GCC)
|
||
|
add_compile_options(-Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize)
|
||
|
elseif (C_MSVC)
|
||
|
add_compile_options(/MP)
|
||
|
endif()
|
||
|
|
||
|
if (SANITIZE_ADDRESS)
|
||
|
message(STATUS "Activate address sanitization")
|
||
|
if(MSVC)
|
||
|
set(ASAN_LIB_ARCH ${MSVC_CXX_ARCHITECTURE_ID})
|
||
|
string(TOLOWER ${ASAN_LIB_ARCH} ASAN_LIB_ARCH)
|
||
|
if(ASAN_LIB_ARCH STREQUAL "x86")
|
||
|
set(ASAN_LIB_ARCH "i386")
|
||
|
elseif(ASAN_LIB_ARCH STREQUAL "x64")
|
||
|
set(ASAN_LIB_ARCH "x86_64")
|
||
|
endif()
|
||
|
add_compile_options(/fsanitize=address)
|
||
|
link_libraries(clang_rt.asan_dynamic-${ASAN_LIB_ARCH} clang_rt.asan_dynamic_runtime_thunk-${ASAN_LIB_ARCH})
|
||
|
add_link_options(/wholearchive:clang_rt.asan_dynamic_runtime_thunk-${ASAN_LIB_ARCH}.lib)
|
||
|
else()
|
||
|
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -g)
|
||
|
add_link_options(-fsanitize=address)
|
||
|
endif()
|
||
|
endif()
|