diff options
author | Danny Holman <dholman@gymli.org> | 2024-11-07 00:34:30 -0600 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-11-07 00:34:30 -0600 |
commit | 57e837822bd5dc5a1bc491968b3ab483c9c04535 (patch) | |
tree | e6d28f0dbe9c16b87bce239decb8d4006c8dfb32 /CMakeLists.txt | |
parent | a97d152c8495ccf4272c733b63747a78b0371afa (diff) |
core: add stack smashing protection and Win32 bt
Add basic stack smashing protections and enable it for all engine
functions. Add proper backtrace support to the Windows build.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 91f8a98..5bf751b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,13 +57,21 @@ list(APPEND LINK_LIBS if (WIN32) find_package(dlfcn-win32 REQUIRED) + find_package(DBGHELP REQUIRED) set(GLFW_LIBRARIES glfw3dll) set(DX12_LIBRARIES d3d12.lib dxgi.lib dxguid.lib) set(DL_LIBRARIES dlfcn-win32::dl) - list(APPEND LINK_LIBS ${DX12_LIBRARIES} ${DL_LIBRARIES}) -else() + list(APPEND LINK_LIBS ${DX12_LIBRARIES} ${DL_LIBRARIES} ${DBGHELP_LIBRARY}) +else () set(GLFW_LIBRARIES glfw) -endif() +endif () + +include(EnableCFLAG) +if (MSVC) + enable_c_compiler_flag_if_supported("/GS") +else () + enable_c_compiler_flag_if_supported("-fstack-protector-all") +endif () list(APPEND LINK_LIBS ${GLFW_LIBRARIES}) |