Skip to content

Commit

Permalink
Fix "ld: warning: ignoring duplicate libraries:" with XCode 15 on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Dec 20, 2023
1 parent 4ba05a7 commit 5f17d5c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/cmake/xtd_commands.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2121,17 +2121,18 @@ if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup")
endif ()

# The following linker option is used to remove : "ld: warning: ignoring duplicate libraries:" with XCode 15 on macOS
# See https://github.com/orgs/Homebrew/discussions/4794 for more information
if (APPLE AND XCODE_VERSION)
string(REPLACE "." ";" XCODE_VERSION_LIST ${XCODE_VERSION})
list(GET XCODE_VERSION_LIST 0 XCODE_VERSION_MAJOR)
list(GET XCODE_VERSION_LIST 1 XCODE_VERSION_MINOR)
list(GET XCODE_VERSION_LIST 2 XCODE_VERSION_PATCH)
#list(GET XCODE_VERSION_LIST 1 XCODE_VERSION_MINOR)
#list(GET XCODE_VERSION_LIST 2 XCODE_VERSION_BUILD)
if (XCODE_VERSION_MAJOR GREATER_EQUAL 15)
add_link_options(-Wl -ld_classic)
endif ()
endif ()


add_definitions(-D__CMAKE_INSTALL_PREFIX__="${CMAKE_INSTALL_PREFIX}")
if (NOT XTD_PROJECT_INCLUDE_FILE)
set(XTD_PROJECT_INCLUDE_FILE "xtd/xtd")
Expand Down

0 comments on commit 5f17d5c

Please sign in to comment.