Skip to content

Commit 0511086

Browse files
authored
Fix CMake compilation for static libraries with IPO (#11143) (#11161)
1 parent a5f252f commit 0511086

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,4 @@ a license to everyone to use it as detailed in LICENSE.)
470470
* rssqian <[email protected]>
471471
* Shachar Langbeheim <[email protected]>
472472
* David Carlier <[email protected]>
473+
* Paul Du <[email protected]> (copyright owned by ARSKAN)

cmake/Modules/Platform/Emscripten.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ if ("${CMAKE_RANLIB}" STREQUAL "")
100100
set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib${EMCC_SUFFIX}" CACHE FILEPATH "Emscripten ranlib")
101101
endif()
102102

103+
if ("${CMAKE_C_COMPILER_AR}" STREQUAL "")
104+
set(CMAKE_C_COMPILER_AR "${CMAKE_AR}" CACHE FILEPATH "Emscripten ar")
105+
endif()
106+
if ("${CMAKE_CXX_COMPILER_AR}" STREQUAL "")
107+
set(CMAKE_CXX_COMPILER_AR "${CMAKE_AR}" CACHE FILEPATH "Emscripten ar")
108+
endif()
109+
if ("${CMAKE_C_COMPILER_RANLIB}" STREQUAL "")
110+
set(CMAKE_C_COMPILER_RANLIB "${CMAKE_RANLIB}" CACHE FILEPATH "Emscripten ranlib")
111+
endif()
112+
if ("${CMAKE_CXX_COMPILER_RANLIB}" STREQUAL "")
113+
set(CMAKE_CXX_COMPILER_RANLIB "${CMAKE_RANLIB}" CACHE FILEPATH "Emscripten ranlib")
114+
endif()
115+
103116
# Don't allow CMake to autodetect the compiler, since it does not understand
104117
# Emscripten.
105118
# Pass -DEMSCRIPTEN_FORCE_COMPILERS=OFF to disable (sensible mostly only for

0 commit comments

Comments
 (0)