summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorglx22 <glx22@users.noreply.github.com>2020-06-28 01:18:28 +0200
committerGitHub <noreply@github.com>2020-06-28 01:18:28 +0200
commit63d20c029bd283e03a93d3ab93e1565ac427cdce (patch)
treeeb7eff816d8377d4369ee6a9e2f954a2d0a828bc /cmake
parent218db00c4c75d0452dd76996a1925775ebdc4e70 (diff)
downloadopenttd-63d20c029bd283e03a93d3ab93e1565ac427cdce.tar.xz
Fix 887b912af: MinGW requires an extra link flag with _FORTIFY_SOURCE (#8246)
see #7860
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CompileFlags.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake
index 9287ca249..e7d470c7d 100644
--- a/cmake/CompileFlags.cmake
+++ b/cmake/CompileFlags.cmake
@@ -33,6 +33,11 @@ macro(compile_flags)
"$<$<CONFIG:Debug>:-D_DEBUG>"
"$<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>" # FORTIFY_SOURCE should only be used in non-debug builds (requires -O1+)
)
+ if (MINGW)
+ add_link_options(
+ "$<$<NOT:$<CONFIG:Debug>>:-fstack-protector>" # Prevent undefined references when _FORTIFY_SOURCE > 0
+ )
+ endif (MINGW)
# Prepare a generator that checks if we are not a debug, and don't have asserts
# on. We need this later on to set some compile options for stable releases.