Blame cmake/Modules/CheckCCompilerFlagSSP.cmake

Packit Service 31306d
# - Check whether the C compiler supports a given flag in the
Packit Service 31306d
# context of a stack checking compiler option.
Packit Service 31306d
Packit Service 31306d
# CHECK_C_COMPILER_FLAG_SSP(FLAG VARIABLE)
Packit Service 31306d
#
Packit Service 31306d
#  FLAG - the compiler flag
Packit Service 31306d
#  VARIABLE - variable to store the result
Packit Service 31306d
#
Packit Service 31306d
#  This actually calls check_c_source_compiles.
Packit Service 31306d
#  See help for CheckCSourceCompiles for a listing of variables
Packit Service 31306d
#  that can modify the build.
Packit Service 31306d
Packit Service 31306d
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
Packit Service 31306d
#
Packit Service 31306d
# Redistribution and use is allowed according to the terms of the BSD license.
Packit Service 31306d
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
Packit Service 31306d
Packit Service 31306d
# Requires cmake 3.10
Packit Service 31306d
#include_guard(GLOBAL)
Packit Service 31306d
include(CheckCSourceCompiles)
Packit Service 31306d
Packit Service 31306d
macro(CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
Packit Service 31306d
   set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
Packit Service 31306d
   set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
Packit Service 31306d
Packit Service 31306d
   check_c_source_compiles("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT})
Packit Service 31306d
Packit Service 31306d
   set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
Packit Service 31306d
endmacro(CHECK_C_COMPILER_FLAG_SSP)