Skip to content

Commit

Permalink
Add a minimal CMake project to check for AddressSanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed May 22, 2024
1 parent d8e3dd4 commit f061757
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmake/asan/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.6)
project(STATIC_ASAN LANGUAGES CXX)

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/main.cpp "int main() {}")
add_executable(foo main.cpp)

target_compile_options(foo PRIVATE -fno-omit-frame-pointer -fsanitize=address -static-libasan)
target_link_options(foo PRIVATE -fno-omit-frame-pointer -fsanitize=address -static-libasan)

0 comments on commit f061757

Please sign in to comment.