hyperion.ng/cmake/LDGold.cmake
Paulchen-Panther 2ccdfeb9e1
Gold linker, CCache, Stats, LGTM
- Increases linker performance under Linux builds by using Gold linker, if available
- ccache is used if available
- removed statistic class (Stats.cpp) from project due to the missing result (sorry @Brindosch)
- add LGTM bandges for code analysis overview

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
2019-06-05 21:13:37 +02:00

18 lines
712 B
CMake

option(ENABLE_LDGOLD "Use GNU gold linker" ON)
set(LDGOLD_FOUND FALSE)
if(ENABLE_LDGOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if(LD_VERSION MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(LDGOLD_FOUND TRUE)
message(STATUS "Linker: GNU gold")
else()
message(STATUS "GNU gold linker is not available, falling back to default system linker")
endif()
else()
message(STATUS "Linker: Default system linker")
endif()