Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions examples/cpp-project-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@ cmake_minimum_required(VERSION 3.27)
project(clay_examples_cpp_project_example CXX)

set(CMAKE_CXX_STANDARD 20)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g")
endif()

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()
endmacro()

add_checked_flag("-fsanitize=address")
add_checked_flag("-fno-omit-frame-pointer")

add_executable(clay_examples_cpp_project_example main.cpp)

Expand Down