aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-07-01 13:45:53 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-07-01 17:03:11 -0700
commite2a65a70779a66471d98a98a1cc611fcb9bb0d5b (patch)
treeca0b0499eb12f3a64bbe967aa6f5bc15eec49b83
parent671d3c1c80b7d6fbe8910a2070b156c25962b2c9 (diff)
downloadPrismLauncher-e2a65a70779a66471d98a98a1cc611fcb9bb0d5b.tar.gz
PrismLauncher-e2a65a70779a66471d98a98a1cc611fcb9bb0d5b.tar.bz2
PrismLauncher-e2a65a70779a66471d98a98a1cc611fcb9bb0d5b.zip
feat: ensure MSVC using stack unwind semantics
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r--CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70a55319..b1e63585 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,13 @@ if(MSVC)
# Use /W4 as /Wall includes unnesserey warnings such as added padding to structs
set(CMAKE_CXX_FLAGS "/GS /permissive- /W4 ${CMAKE_CXX_FLAGS}")
+ # /EHs Enables stack unwind semantics for standard C++ exceptions to ensure stackframes are unwound
+ # and object deconstructors are called when an exception is caught.
+ # without it memory leaks and a warning is printed
+ # /EHc tells the compiler to assume that functions declared as extern "C" never throw a C++ exception
+ # This appears to not always be a defualt compiler option in CMAKE
+ set(CMAKE_CXX_FLAGS "/EHsc ${CMAKE_CXX_FLAGS}")
+
# LINK accepts /SUBSYSTEM whics sets if we are a WINDOWS (gui) or a CONSOLE programs
# This implicitly selects an entrypoint specific to the subsystem selected
# qtmain/QtEntryPointLib provides the correct entrypoint (wWinMain) for gui programs