cmake: use add_compile_options for ssp-buffer-size

In 82c8a1e3 I made "--param ssp-buffer-size=4" one argument instead of
two because when added to CMAKE_REQUIRED_LIBRARIES the ssp-buffer-size=4
part was being recognized as a library, breaking the compile tests.

This broke the build on mac, which I fixed in 915e2d1e by using ssp
flags for gcc only and not clang.

Now apparently it is breaking mxe, so instead of adding this particular
parameter to the MY_C_FLAGS variable which is then added to
CMAKE_REQUIRED_* variables for compile tests, add it directly via
ADD_COMPILE_OPTIONS().

This should hopefully resolve any remaining issues with this compiler
flag.
This commit is contained in:
Rafael Kitover 2017-03-14 10:33:24 -07:00
parent 915e2d1ec2
commit 2e8bee117d
1 changed files with 3 additions and 1 deletions

View File

@ -347,7 +347,9 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
CHECK_CXX_COMPILER_FLAG("--param ssp-buffer-size=4" SSP_BUFFER_SIZE_FLAG)
IF(SSP_BUFFER_SIZE_FLAG)
SET(MY_C_FLAGS ${MY_C_FLAGS} "--param ssp-buffer-size=4")
# we do not add it to MY_C_FLAGS because this breaks things like CMAKE_REQUIRED_LIBRARIES
# which misinterpret compiler flags without leading dashes
ADD_COMPILE_OPTIONS(--param ssp-buffer-size=4)
ENDIF()
ENDIF()
ENDIF()