2 execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
3 if(LD_VERSION MATCHES "GNU gold")
4 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
5 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
6 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
8 message(STATUS "Linker: GNU gold")
10 message(WARNING "GNU gold linker is not available, falling back to default system linker")
13 message(STATUS "Linker: Default system linker")
16 set(DEFAULT_ENABLE_DEBUGFISSION FALSE)
17 if(CMAKE_BUILD_TYPE STREQUAL Debug OR
18 CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo AND
20 set(DEFAULT_ENABLE_DEBUGFISSION TRUE)
23 include(CMakeDependentOption)
24 cmake_dependent_option(ENABLE_DEBUGFISSION "Enable Debug Fission support" ON
25 "DEFAULT_ENABLE_DEBUGFISSION" OFF)
27 set(DEBUGFISSION_FOUND FALSE)
28 if(ENABLE_DEBUGFISSION)
29 include(TestCXXAcceptsFlag)
30 check_cxx_accepts_flag(-gsplit-dwarf CXX_ACCEPTS_GSPLIT_DWARF)
31 if(CXX_ACCEPTS_GSPLIT_DWARF)
32 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gsplit-dwarf")
33 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf")
34 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
35 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
36 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
37 set(DEBUGFISSION_FOUND TRUE)
38 message(STATUS "Debug Fission enabled")
40 message(WARNING "Debug Fission is not available")