Skip to content

Commit

Permalink
Only use special ar and ranlib command when ENABLE_LTO is ON. (melonD…
Browse files Browse the repository at this point in the history
…S-emu#1018)

This allows melonDS to be built with the standard system toolchain
on NetBSD, see discussion in melonDS-emu#1016
  • Loading branch information
alarixnia authored Feb 26, 2021
1 parent 89051f6 commit f8692f8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,17 @@ if (ENABLE_LTO)
add_compile_options(-flto -fPIC)
add_link_options(-flto -fuse-linker-plugin -pie)
endif()
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
find_program(LLD NAMES ld.lld ld64.lld lld-link)
if (NOT LLD STREQUAL "LLD-NOTFOUND")
add_link_options(-fuse-ld=lld)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
find_program(LLD NAMES ld.lld ld64.lld lld-link)
if (NOT LLD STREQUAL "LLD-NOTFOUND")
add_link_options(-fuse-ld=lld)
endif()
set(CMAKE_AR "llvm-ar")
set(CMAKE_RANLIB "llvm-ranlib")
endif()
set(CMAKE_AR "llvm-ar")
set(CMAKE_RANLIB "llvm-ranlib")
endif()

option(BUILD_QT_SDL "Build Qt/SDL frontend" ON)
Expand Down

0 comments on commit f8692f8

Please sign in to comment.