Only use special ar and ranlib command when ENABLE_LTO is ON. (#1018)

This allows melonDS to be built with the standard system toolchain
on NetBSD, see discussion in #1016
This commit is contained in:
nia 2021-02-26 17:54:36 +01:00 committed by GitHub
parent 89051f63d4
commit f8692f85a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -102,18 +102,17 @@ if (ENABLE_LTO)
add_compile_options(-flto -fPIC) add_compile_options(-flto -fPIC)
add_link_options(-flto -fuse-linker-plugin -pie) add_link_options(-flto -fuse-linker-plugin -pie)
endif() endif()
endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_AR "gcc-ar")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CMAKE_RANLIB "gcc-ranlib")
set(CMAKE_AR "gcc-ar") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_RANLIB "gcc-ranlib") find_program(LLD NAMES ld.lld ld64.lld lld-link)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if (NOT LLD STREQUAL "LLD-NOTFOUND")
find_program(LLD NAMES ld.lld ld64.lld lld-link) add_link_options(-fuse-ld=lld)
if (NOT LLD STREQUAL "LLD-NOTFOUND") endif()
add_link_options(-fuse-ld=lld) set(CMAKE_AR "llvm-ar")
set(CMAKE_RANLIB "llvm-ranlib")
endif() endif()
set(CMAKE_AR "llvm-ar")
set(CMAKE_RANLIB "llvm-ranlib")
endif() endif()
option(BUILD_QT_SDL "Build Qt/SDL frontend" ON) option(BUILD_QT_SDL "Build Qt/SDL frontend" ON)