Commit Graph

5 Commits

Author SHA1 Message Date
David Korth
a08cb02e0c [cmake] Remove excess quoting from some CMake macros for various checks. 2021-08-06 19:37:48 -04:00
David Korth
39ad7c32dc [cmake] CheckStackProtectorCompilerFlag.cmake: Make this a function and eliminate redundant checks. 2020-02-22 11:24:52 -05:00
David Korth
8ede4e897f [cmake] CheckStackProtectorCompilerFlag.cmake: Fix flag checks on MinGW-w64.
MinGW-w64 only links in libssp if a function needs stack protection.
Since my toolchain doesn't have libssp enabled, this results in the
previous check passing (-fstack-protector-strong with a nearly empty
test program does nothing), but other tests end up failing because
libssp isn't available.

Use a test program with varargs, based on the C99 vsnprintf() wrapper
for older versions of MSVC.
2017-03-14 22:33:04 -04:00
David Korth
aa41cbe210 [cmake] CheckStackProtectorCompilerFlag.cmake: Fix the ENDMACRO() argument. 2016-09-13 21:09:30 -04:00
David Korth
c87a1b2c23 [cmake] Added a check for stack smashing protection CFLAGS.
MSVC 2002 introduced the /GS flag, and it's enabled by default as of
MSVC 2005. Added a check for 2002/2003, even though those versions
definitely aren't supported.

gcc added -fstack-protector and -fstack-protector-all in gcc-4.1,
and -fstack-protector-strong in gcc-4.9. Prefer strong if it's available,
then fall back to -fstack-protector-all then -fstack-protector if
strong isn't available.
2016-09-12 22:18:11 -04:00