cmake_modules/compilerchecks.cmake
changeset 9339 14f5f3a1e2f7
parent 9315 15487f7fed42
child 10783 8e742c9ffdf8
equal deleted inserted replaced
9337:c9d4daae1dee 9339:14f5f3a1e2f7
    18     #(see 822312 654424 on bugzilla.redhat.com)
    18     #(see 822312 654424 on bugzilla.redhat.com)
    19     check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
    19     check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
    20     if(HAVE_STACKPROTECTOR)
    20     if(HAVE_STACKPROTECTOR)
    21         add_flag_append(CMAKE_C_FLAGS "-fstack-protector-all -fstack-protector")
    21         add_flag_append(CMAKE_C_FLAGS "-fstack-protector-all -fstack-protector")
    22         add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-all -fstack-protector")
    22         add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-all -fstack-protector")
    23         add_flag_append(CMAKE_EXE_LINKER_FLAGS "-fstack-protector-all -fstack-protector")
       
    24         add_flag_append(CMAKE_SHARED_LIBRARY_C_FLAGS "-fstack-protector-all -fstack-protector")
       
    25         add_flag_append(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fstack-protector-all -fstack-protector")
       
    26     endif()
    23     endif()
    27 endif()
    24 endif()
    28 
    25 
    29 
    26 
    30 
    27 
    39     #check for noexecstack on ELF, Gentoo security
    36     #check for noexecstack on ELF, Gentoo security
    40     set(CMAKE_REQUIRED_FLAGS "-Wl,-znoexecstack")
    37     set(CMAKE_REQUIRED_FLAGS "-Wl,-znoexecstack")
    41     check_c_compiler_flag("" HAVE_NOEXECSTACK)
    38     check_c_compiler_flag("" HAVE_NOEXECSTACK)
    42     if(HAVE_NOEXECSTACK)
    39     if(HAVE_NOEXECSTACK)
    43         add_linker_flag("-znoexecstack")
    40         add_linker_flag("-znoexecstack")
       
    41     endif()
       
    42 
       
    43     #check for origin on ELF, BSD $ORIGIN support
       
    44     set(CMAKE_REQUIRED_FLAGS "-Wl,-zorigin")
       
    45     check_c_compiler_flag("" HAVE_ORIGIN)
       
    46     if(HAVE_ORIGIN)
       
    47         add_linker_flag("-zorigin")
    44     endif()
    48     endif()
    45 
    49 
    46     #check for full relro on ELF, Debian security
    50     #check for full relro on ELF, Debian security
    47     set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow")
    51     set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow")
    48     check_c_compiler_flag("" HAVE_RELROFULL)
    52     check_c_compiler_flag("" HAVE_RELROFULL)