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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool
2017-01-01 20:20:40 +00:00
parent cfe109bf3d
commit 1ca3c45316

View File

@@ -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})
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_STATIC AND NOT LIBCXX_ENABLE_SHARED)
endif()
if (LIBCXX_NEEDS_SITE_CONFIG)
configure_file(
include/__config_site.in
${LIBCXX_BINARY_DIR}/__config_site
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.
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()
#===============================================================================