cmake_modules/compilerchecks.cmake
changeset 9167 ecf19179b37e
parent 9165 7b0d5388abc4
child 9169 ef53201e95ec
equal deleted inserted replaced
9165:7b0d5388abc4 9167:ecf19179b37e
     8 # CMAKE_SHARED_LIBRARY_<lang>_FLAGS same but for shared libraries
     8 # CMAKE_SHARED_LIBRARY_<lang>_FLAGS same but for shared libraries
     9 
     9 
    10 #TODO: should there be two different checks for C and CXX?
    10 #TODO: should there be two different checks for C and CXX?
    11 
    11 
    12 #stack protection, when found it needs to go in the linker flags too (-lssp is added)
    12 #stack protection, when found it needs to go in the linker flags too (-lssp is added)
    13 check_c_compiler_flag("-fstack-protector" HAVE_STACKPROTECTOR)
    13 check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
    14 if(HAVE_STACKPROTECTOR)
    14 if(HAVE_STACKPROTECTOR)
    15     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
    15     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all -fstack-protector")
    16     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
    16     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all -fstack-protector")
    17     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector")
    17     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector-all -fstack-protector")
    18     set(CMAKE_SHARED_LIBRARY_C_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector")
    18     set(CMAKE_SHARED_LIBRARY_C_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector-all -fstack-protector")
    19     set(CMAKE_SHARED_LIBRARY_CXX_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector")
    19     set(CMAKE_SHARED_LIBRARY_CXX_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector-all -fstack-protector")
    20 endif()
    20 endif()
    21 
    21 
    22 #symbol visibility
    22 #symbol visibility
    23 check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITYH)
    23 check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITYH)
    24 if(HAVE_VISIBILITYH)
    24 if(HAVE_VISIBILITYH)