macOS: Silence noisy linker warning about duplicate libraries
The warning was introduced with XCode 15 and conflicted with some assumptions in the CMake. Even without actual cyclic dependency between targets CMake might decide to pass library multiple times to the linker, to ensure all its users find symbols from it. This behavior is expected to be tweaked in the upcoming CMake version, but until it is released and became widely used by all Blender macOS developers silence the warning. Pull Request: https://projects.blender.org/blender/blender/pulls/116718
This commit is contained in:
parent
cbcb6abfee
commit
b66dec58ed
|
@ -429,10 +429,21 @@ string(APPEND PLATFORM_LINKFLAGS
|
|||
" -Wl,-unexported_symbols_list,'${PLATFORM_SYMBOLS_MAP}'"
|
||||
)
|
||||
|
||||
# Use old, slower linker for now to avoid many linker warnings.
|
||||
if(${XCODE_VERSION} VERSION_GREATER_EQUAL 15.0)
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||
# Silence "no platform load command found in <static library>, assuming: macOS".
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Wl,-ld_classic")
|
||||
else()
|
||||
# Silence "ld: warning: ignoring duplicate libraries".
|
||||
#
|
||||
# The warning is introduced with Xcode 15 and is triggered when the same library
|
||||
# is passed to the linker ultiple times. This situation could happen with either
|
||||
# cyclic libraries, or some transitive dependencies where CMake might decide to
|
||||
# pass library to the linker multiple times to force it re-scan symbols. It is
|
||||
# not neeed for Xcode linker to ensure all symbols from library are used and it
|
||||
# is corrected in CMake 3.29:
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/25297
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Xlinker -no_warn_duplicate_libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue