mirror of
https://github.com/nicbarker/clay.git
synced 2025-09-18 04:26:18 +00:00
Check flags availability for sanitization
This commit is contained in:
parent
1bc5105272
commit
75d1546476
|
@ -2,9 +2,19 @@ cmake_minimum_required(VERSION 3.27)
|
||||||
project(clay_examples_cpp_project_example CXX)
|
project(clay_examples_cpp_project_example CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
if(NOT MSVC)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g")
|
macro(add_checked_flag FLAG)
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
check_cxx_compiler_flag("${FLAG}" SUPPORTED)
|
||||||
|
if(SUPPORTED)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
|
||||||
|
else()
|
||||||
|
message(WARNING "${FLAG} not supported")
|
||||||
endif()
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
add_checked_flag("-fsanitize=address")
|
||||||
|
add_checked_flag("-fno-omit-frame-pointer")
|
||||||
|
|
||||||
add_executable(clay_examples_cpp_project_example main.cpp)
|
add_executable(clay_examples_cpp_project_example main.cpp)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue