summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-09-23 13:35:06 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-09-24 07:27:58 +0000
commit2cc3720a573e982c20a0f01f8db4dd8efe4f31c0 (patch)
tree70f91f754ffb36ec2afd54b10426d793e3bfc337 /cmake
parent8049ef3d4d1e6c458211a3c86ea35e9fe9b29ff5 (diff)
macOS: Prevent warnings about object files without any symbols
Change-Id: I0860b95cd75f536ff20defde97c3df7dc78a1e18 Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake12
1 files changed, 12 insertions, 0 deletions
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 "<CMAKE_AR> qcS <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> qS <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols <TARGET>")
+ endforeach()
+endif()
+
# Functions and macros:
# qt_remove_args can remove arguments from an existing list of function