File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -979,6 +979,18 @@ endif()
979
979
set (SWIFT_USE_LINKER ${SWIFT_USE_LINKER_default} CACHE STRING
980
980
"Build Swift with a non-default linker" )
981
981
982
+ include (CheckLinkerFlag )
983
+
984
+ # Apple's linker complains about duplicate libraries, which CMake likes to do
985
+ # to support ELF platforms. To silence that warning, we can use
986
+ # -no_warn_duplicate_libraries, but only in versions of the linker that
987
+ # support that flag.
988
+ if (NOT LLVM_USE_LINKER AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
989
+ check_linker_flag (C "-Wl,-no_warn_duplicate_libraries" SWIFT_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES )
990
+ else ()
991
+ set (SWIFT_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES OFF CACHE INTERNAL "" )
992
+ endif ()
993
+
982
994
#
983
995
# Enable additional warnings.
984
996
#
Original file line number Diff line number Diff line change @@ -441,6 +441,12 @@ function(_add_host_variant_link_flags target)
441
441
" SHELL:-Xlinker -dead_strip ")
442
442
endif()
443
443
endif()
444
+
445
+ if(SWIFT_LINKER_SUPPORTS_NO_WARN_DUPLICATE_LIBRARIES)
446
+ target_link_options(${target} PRIVATE
447
+ " SHELL:-Xlinker -no_warn_duplicate_libraries ")
448
+ endif()
449
+
444
450
endfunction()
445
451
446
452
function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
You can’t perform that action at this time.
0 commit comments