From 2cc3720a573e982c20a0f01f8db4dd8efe4f31c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 23 Sep 2019 13:35:06 +0200 Subject: [PATCH] macOS: Prevent warnings about object files without any symbols Change-Id: I0860b95cd75f536ff20defde97c3df7dc78a1e18 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 4ddbcff3ab..8f249a15fe 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -231,6 +231,18 @@ set(QT_BUILD_INTERNALS_EXTRA_CMAKE_CODE "") # This will be /path/to/qtbase/tests when building standalone tests. set(QT_TOP_LEVEL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +# Prevent warnings about object files without any symbols. This is a common +# thing in Qt as we tend to build files unconditionally, and then use ifdefs +# to compile out parts that are not relevant. +if(CMAKE_HOST_APPLE AND APPLE) + foreach(lang ASM C CXX) + # We have to tell 'ar' to not run ranlib by itself, by passing the 'S' option + set(CMAKE_${lang}_ARCHIVE_CREATE " qcS ") + set(CMAKE_${lang}_ARCHIVE_APPEND " qS ") + set(CMAKE_${lang}_ARCHIVE_FINISH " -no_warning_for_no_symbols ") + endforeach() +endif() + # Functions and macros: # qt_remove_args can remove arguments from an existing list of function