[libcxx] r290802 - build: further improve flags handling for cl

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 1 12:20:40 PST 2017


Author: compnerd
Date: Sun Jan  1 14:20:40 2017
New Revision: 290802

URL: http://llvm.org/viewvc/llvm-project?rev=290802&view=rev
Log:
build: further improve flags handling for cl

This allows us to build with cl (or rather clang-cl) by using the
correct spelling for `-include` (`/FI` for cl).  clang-cl and cl default
to C++11/C++14 as they support it rather than permitting an explicit
language standard.

Modified:
    libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=290802&r1=290801&r2=290802&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Sun Jan  1 14:20:40 2017
@@ -354,8 +354,10 @@ if (LIBCXX_HAS_MUSL_LIBC)
 endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME)
-if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})
-  message(FATAL_ERROR "C++11 or greater is required but the compiler does not support ${LIBCXX_STANDARD_VER}")
+if(NOT ${SUPPORTS_DIALECT_NAME})
+  if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+    message(FATAL_ERROR "C++11 or greater is required but the compiler does not support ${LIBCXX_STANDARD_VER}")
+  endif()
 endif()
 
 # On all systems the system c++ standard library headers need to be excluded.
@@ -515,13 +517,17 @@ if (DEFINED WIN32 AND LIBCXX_ENABLE_STAT
 endif()
 
 if (LIBCXX_NEEDS_SITE_CONFIG)
-  configure_file(
-    include/__config_site.in
-    ${LIBCXX_BINARY_DIR}/__config_site
-    @ONLY)
+  configure_file("include/__config_site.in"
+                 "${LIBCXX_BINARY_DIR}/__config_site"
+                 @ONLY)
+
   # Provide the config definitions by included the generated __config_site
   # file at compile time.
-  add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
+  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+    add_compile_flags("/FI\"${LIBCXX_BINARY_DIR}/__config_site\"")
+  else()
+    add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
+  endif()
 endif()
 
 #===============================================================================




More information about the cfe-commits mailing list