diff options
author | Kuba Mracek <mracek@apple.com> | 2016-12-05 05:21:44 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2016-12-05 05:21:44 +0000 |
commit | 9a1eeb20832cf434ed9b1082fdfaed8afd49fd90 (patch) | |
tree | b85bb2771a50687481e24d73b24739c5cf361fb2 /CMakeLists.txt | |
parent | c7fb36d42d489206bfd1a2cc7dd55b02e5e3dc9a (diff) |
Use Darwin libtool's -no_warning_for_no_symbols if available to silence the "has no symbols" link warning
Building compiler-rt on Darwin produces dozens of meaningless warnings about object files having no symbols during static archive creation. This is very intentional as compiler-rt uses #ifdefs to conditionally compile platform-specific code, and we even have a .cpp source file that only contains static asserts to make sure the environment is configured right. On Linux, this situation is fine and no warning is produced. This patch adds a libtool version detection and if it's new enough, we'll use the -no_warning_for_no_symbols flag that suppresses this warning. Build logs should be much cleaner now!
Differential Revision: https://reviews.llvm.org/D27119
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 82e0c5c8573..3d99626a506 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,9 +73,22 @@ if(CMAKE_HOST_APPLE AND APPLE) if(CMAKE_LIBTOOL) set(CMAKE_LIBTOOL ${CMAKE_LIBTOOL} CACHE PATH "libtool executable") message(STATUS "Found libtool - ${CMAKE_LIBTOOL}") + + execute_process(COMMAND ${CMAKE_LIBTOOL} -V + OUTPUT_VARIABLE LIBTOOL_V_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE) + if("${LIBTOOL_V_OUTPUT}" MATCHES ".*cctools-([0-9.]+).*") + string(REGEX REPLACE ".*cctools-([0-9.]+).*" "\\1" LIBTOOL_VERSION + ${LIBTOOL_V_OUTPUT}) + if(NOT LIBTOOL_VERSION VERSION_LESS "862") + set(LIBTOOL_NO_WARNING_FLAG "-no_warning_for_no_symbols") + endif() + endif() + foreach(lang ${languages}) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY - "${CMAKE_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ") + "${CMAKE_LIBTOOL} -static ${LIBTOOL_NO_WARNING_FLAG} -o <TARGET> \ + <LINK_FLAGS> <OBJECTS> ") endforeach() endif() |