summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-09-01 23:23:59 +0000
committerVedant Kumar <vsk@apple.com>2017-09-01 23:23:59 +0000
commit160179b335b9dd2c22b151e5eb0aff983db202db (patch)
treeb5ebe8a243ee4b79df3af6ca7758eeacd879b562 /cmake
parent665cb4327b786b6869753488a69b9993373110ef (diff)
[cmake] Work around -Wunused-driver-argument warnings
Fix the Darwin logic so that -msse3 is only used on macOS, and -fomit-frame-pointer is not used on armv7/armv7k/armv7s. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312390 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/AddCompilerRT.cmake8
-rw-r--r--cmake/Modules/CompilerRTDarwinUtils.cmake15
2 files changed, 22 insertions, 1 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index 64a8e0368..032b43723 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -125,8 +125,16 @@ function(add_compiler_rt_runtime name type)
else()
set(NO_LTO_FLAGS "")
endif()
+
if(APPLE)
foreach(os ${LIB_OS})
+ # Strip out -msse3 if this isn't macOS.
+ message(WARNING "BEFORE: ${LIB_CFLAGS}")
+ list(LENGTH LIB_CFLAGS HAS_EXTRA_CFLAGS)
+ if(HAS_EXTRA_CFLAGS AND NOT "${os}" MATCHES "^(osx)$")
+ list(REMOVE_ITEM LIB_CFLAGS "-msse3")
+ endif()
+ message(WARNING "AFTER: ${LIB_CFLAGS}")
if(type STREQUAL "STATIC")
set(libname "${name}_${os}")
else()
diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
index 7fdb111fe..a25540bf4 100644
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -200,10 +200,23 @@ macro(darwin_add_builtin_library name suffix)
if(DARWIN_${LIB_OS}_SYSROOT)
set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT})
endif()
+
+ # Make a copy of the compilation flags.
+ set(builtin_cflags ${LIB_CFLAGS})
+
+ # Strip out any inappropriate flags for the target.
+ if("${LIB_ARCH}" MATCHES "^(armv7|armv7k|armv7s)$")
+ set(builtin_cflags "")
+ foreach(cflag "${LIB_CFLAGS}")
+ string(REPLACE "-fomit-frame-pointer" "" cflag "${cflag}")
+ list(APPEND builtin_cflags ${cflag})
+ endforeach(cflag)
+ endif()
+
set_target_compile_flags(${libname}
${sysroot_flag}
${DARWIN_${LIB_OS}_BUILTIN_MIN_VER_FLAG}
- ${LIB_CFLAGS})
+ ${builtin_cflags})
set_property(TARGET ${libname} APPEND PROPERTY
COMPILE_DEFINITIONS ${LIB_DEFS})
set_target_properties(${libname} PROPERTIES