mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
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:
@@ -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_STATIC AND NOT LIBCXX_ENABLE_SHARED)
|
||||
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()
|
||||
|
||||
#===============================================================================
|
||||
|
||||
Reference in New Issue
Block a user