mirror of https://github.com/AxioDL/metaforce.git
Add GNU gold option (default for Linux Release builds)
This commit is contained in:
parent
de3ccfadd0
commit
731bf406a1
|
@ -15,6 +15,25 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|||
include_directories(/usr/local/include)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL "Release" AND ${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
||||
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" ON)
|
||||
else()
|
||||
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" OFF)
|
||||
endif()
|
||||
if(USE_LD_GOLD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
|
||||
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 -Wl,--disable-new-dtags")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
|
||||
message(STATUS "GNU gold linker enabled.")
|
||||
else()
|
||||
message(WARNING "GNU gold linker isn't available, using the default system linker.")
|
||||
set(USE_LD_GOLD OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/libBoo/include)
|
||||
set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hecl/blender)
|
||||
|
|
Loading…
Reference in New Issue