From 3802859b599db7c9a1529202c59309e3ef7bd154 Mon Sep 17 00:00:00 2001 From: Paul Du Date: Thu, 14 May 2020 10:25:35 +0200 Subject: [PATCH] Fix CMake compilation for static libraries with IPO (#11143) --- AUTHORS | 1 + cmake/Modules/Platform/Emscripten.cmake | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/AUTHORS b/AUTHORS index 8f75808e6e747..e547f5442e7d6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -470,3 +470,4 @@ a license to everyone to use it as detailed in LICENSE.) * rssqian * Shachar Langbeheim * David Carlier +* Paul Du (copyright owned by ARSKAN) diff --git a/cmake/Modules/Platform/Emscripten.cmake b/cmake/Modules/Platform/Emscripten.cmake index 8cb3df5f68370..485d9149557ae 100644 --- a/cmake/Modules/Platform/Emscripten.cmake +++ b/cmake/Modules/Platform/Emscripten.cmake @@ -100,6 +100,19 @@ if ("${CMAKE_RANLIB}" STREQUAL "") set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib${EMCC_SUFFIX}" CACHE FILEPATH "Emscripten ranlib") endif() +if ("${CMAKE_C_COMPILER_AR}" STREQUAL "") + set(CMAKE_C_COMPILER_AR "${CMAKE_AR}") +endif() +if ("${CMAKE_CXX_COMPILER_AR}" STREQUAL "") + set(CMAKE_CXX_COMPILER_AR "${CMAKE_AR}") +endif() +if ("${CMAKE_C_COMPILER_RANLIB}" STREQUAL "") + set(CMAKE_C_COMPILER_RANLIB "${CMAKE_RANLIB}") +endif() +if ("${CMAKE_CXX_COMPILER_RANLIB}" STREQUAL "") + set(CMAKE_CXX_COMPILER_RANLIB "${CMAKE_RANLIB}") +endif() + # Don't allow CMake to autodetect the compiler, since it does not understand # Emscripten. # Pass -DEMSCRIPTEN_FORCE_COMPILERS=OFF to disable (sensible mostly only for