[PATCH] D19992: [libcxx] Prefer C++14 over C++11 when building libc++experimental.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue May 10 09:23:55 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL269070: [libcxx] Prefer C++14 over C++11 when building libc++experimental. (authored by EricWF).

Changed prior to commit:
  http://reviews.llvm.org/D19992?vs=56333&id=56732#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19992

Files:
  libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake
  libcxx/trunk/lib/CMakeLists.txt

Index: libcxx/trunk/lib/CMakeLists.txt
===================================================================
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -142,9 +142,15 @@
   file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
   add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES})
   target_link_libraries(cxx_experimental cxx)
+
+  set(experimental_flags "${LIBCXX_COMPILE_FLAGS}")
+  check_flag_supported(-std=c++14)
+  if (NOT MSVC AND LIBCXX_SUPPORTS_STD_EQ_CXX14_FLAG)
+    string(REPLACE "-std=c++11" "-std=c++14" experimental_flags "${LIBCXX_COMPILE_FLAGS}")
+  endif()
   set_target_properties(cxx_experimental
     PROPERTIES
-      COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
+      COMPILE_FLAGS "${experimental_flags}"
       OUTPUT_NAME   "c++experimental"
   )
 endif()
Index: libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake
===================================================================
--- libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibcxxFlags.cmake
@@ -35,6 +35,11 @@
   endforeach()
 endmacro(remove_flags)
 
+macro(check_flag_supported flag)
+    mangle_name("${flag}" flagname)
+    check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
+endmacro()
+
 # Add a macro definition if condition is true.
 macro(define_if condition def)
   if (${condition})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19992.56732.patch
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160510/0afd4f58/attachment.bin>


More information about the cfe-commits mailing list