Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ include(DispatchCompilerWarnings)
include(DTrace)
include(SwiftSupport)

include(EnableFramePointers)

# NOTE(abdulras) this is the CMake supported way to control whether we generate
# shared or static libraries. This impacts the behaviour of `add_library` in
# what type of library it generates.
Expand Down
13 changes: 13 additions & 0 deletions cmake/modules/EnableFramePointers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Including this file enables frame pointers, if we know how.
#

include(CheckCompilerFlag)

# Check if the compiler supports -fno-omit-frame-pointer
check_compiler_flag(C -fno-omit-frame-pointer SUPPORTS_NO_OMIT_FP)

# If it does, use it
if (SUPPORTS_NO_OMIT_FP)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>)
endif()