1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-25 19:44:55 +00:00

Fix duplicate warning from Xcode

This commit is contained in:
Carles Fernandez
2024-04-12 18:15:33 +02:00
parent 7e79945529
commit 6fc04b34f2
7 changed files with 87 additions and 0 deletions

View File

@@ -77,6 +77,9 @@ if(UNIX)
)
endif()
include(XcodeDeleteDuplicates)
xcode_delete_duplicates(volk_gnsssdr_profile)
if(ENABLE_STRIP)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr_profile
@@ -106,6 +109,8 @@ if(UNIX)
)
endif()
xcode_delete_duplicates(volk_gnsssdr-config-info)
if(ENABLE_STRIP)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
set_target_properties(volk_gnsssdr-config-info

View File

@@ -0,0 +1,23 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(DEFINED __INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE)
return()
endif()
set(__INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE TRUE)
function(xcode_delete_duplicates target)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0")
# A bug in Xcode 15 adds duplicate flags to the linker. In addition, the
# `-warn_duplicate_libraries` is now enabled by default which may result
# in several 'duplicate libraries warning'.
# - https://gitlab.kitware.com/cmake/cmake/-/issues/25297 and
# - https://indiestack.com/2023/10/xcode-15-duplicate-library-linker-warnings/
target_link_options(${target} PUBLIC "LINKER:-no_warn_duplicate_libraries")
endif()
endif()
endfunction()

View File

@@ -4,6 +4,7 @@
# SPDX-FileCopyrightText: 2010-2021 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
include(XcodeDeleteDuplicates)
########################################################################
# header file detection
@@ -595,6 +596,9 @@ if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode)))
else()
target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries})
endif()
xcode_delete_duplicates(volk_gnsssdr)
target_include_directories(volk_gnsssdr
PUBLIC $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
@@ -676,6 +680,8 @@ if(ENABLE_STATIC_LIBS)
)
set_target_properties(volk_gnsssdr_static PROPERTIES OUTPUT_NAME volk_gnsssdr)
xcode_delete_duplicates(volk_gnsssdr_static)
install(TARGETS volk_gnsssdr_static
EXPORT VOLK_GNSSSDR-export
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel"
@@ -702,6 +708,9 @@ if(ENABLE_TESTING)
TARGET_DEPS volk_gnsssdr
)
endif()
xcode_delete_duplicates(volk_gnsssdr_test_all)
foreach(kernel ${h_files})
get_filename_component(kernel ${kernel} NAME)
string(REPLACE ".h" "" kernel ${kernel})