Suppress linker warnings in Mac debug builds

fish wants to build with -mmacosx-version-min=10.9. This is important
because it ensures that we do not use functions or linker features which
which are not available on 10.9. However this collides with the fact
that fish also prefers to use a pcre2 package installed on the system,
which is typically built for that system.

Mac ld will (rightly) complain when it sees a 10.9-targeted binary
linking a 10.15-targeted dylib. This is an annoying warning that gets
emitted on every build.

We could fix this either having Mac builds prefer the vendored PCRE2
by default, or by having debug builds target the system version. But
we want to continue to default to system PCRE2 and we don't want to risk
losing compatibility with older Mac versions. So we will just suppress
all linker warnings in Mac debug builds.
This commit is contained in:
ridiculousfish 2020-09-27 11:35:16 -07:00
parent e8859b4ce2
commit 1390112b46

View File

@ -9,6 +9,13 @@ set(MAC_CODESIGN_ID "" CACHE STRING "Mac code-signing identity")
# on the Mac.
set(MAC_INJECT_GET_TASK_ALLOW ON CACHE BOOL "Inject get-task-allow on Mac")
# When building a Mac build, it is common for fish to link against a
# pcre2 built for the host platform (e.g. macOS 10.15) while fish wants
# to link for macOS 10.9. This warning would be of interest for releases,
# but is just noise for daily development. Unfortunately it has no flag
# of its own, so suppress all linker warnings in debug builds.
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -w")
function(CODESIGN_ON_MAC target)
if((APPLE) AND (MAC_CODESIGN_ID))
execute_process(COMMAND sw_vers "-productVersion" OUTPUT_VARIABLE OSX_VERSION)