[compiler-rt] r174699 - [CMake] set -mmacosx-version-min to 10.7 if compiler-rt is built with -stdlib=libc++

Alexey Samsonov samsonov at google.com
Thu Feb 7 23:39:25 PST 2013


Author: samsonov
Date: Fri Feb  8 01:39:25 2013
New Revision: 174699

URL: http://llvm.org/viewvc/llvm-project?rev=174699&view=rev
Log:
[CMake] set -mmacosx-version-min to 10.7 if compiler-rt is built with -stdlib=libc++

Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=174699&r1=174698&r2=174699&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Fri Feb  8 01:39:25 2013
@@ -101,6 +101,10 @@ else()
   set(COMPILER_RT_CAN_EXECUTE_TESTS FALSE)
 endif()
     
+# Check if compiler-rt is built with libc++.
+find_flag_in_string("${CMAKE_CXX_FLAGS}" "-stdlib=libc++"
+                    COMPILER_RT_USES_LIBCXX)
+
 function(filter_available_targets out_var)
   set(archs)
   foreach(arch ${ARGN})
@@ -140,8 +144,16 @@ check_cxx_compiler_flag(-Wno-c99-extensi
 if(SUPPORTS_NO_C99_EXTENSIONS_FLAG)
   list(APPEND SANITIZER_COMMON_CFLAGS -Wno-c99-extensions)
 endif()
+
+# Setup min Mac OS X version.
 if(APPLE)
-  list(APPEND SANITIZER_COMMON_CFLAGS -mmacosx-version-min=10.5)
+  if(COMPILER_RT_USES_LIBCXX)
+    set(SANITIZER_MIN_OSX_VERSION 10.7)
+  else()
+    set(SANITIZER_MIN_OSX_VERSION 10.5)
+  endif()
+  list(APPEND SANITIZER_COMMON_CFLAGS
+    -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
 endif()
 
 # Architectures supported by Sanitizer runtimes. Specific sanitizers may

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake?rev=174699&r1=174698&r2=174699&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake Fri Feb  8 01:39:25 2013
@@ -15,3 +15,14 @@ function(set_target_link_flags target)
   set_property(TARGET ${target} PROPERTY LINK_FLAGS "${argstring}")
 endfunction()
 
+# Check if a given flag is present in a space-separated flag_string.
+# Store the result in out_var.
+function(find_flag_in_string flag_string flag out_var)
+  string(REPLACE " " ";" flag_list ${flag_string})
+  list(FIND flag_list ${flag} flag_pos)
+  if(NOT flag_pos EQUAL -1)
+    set(${out_var} TRUE PARENT_SCOPE)
+  else()
+    set(${out_var} FALSE PARENT_SCOPE)
+  endif()
+endfunction()





More information about the llvm-commits mailing list