summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/CMakeLists.txt20
-rw-r--r--libcxx/cmake/config-ix.cmake3
-rw-r--r--libcxx/test/CMakeLists.txt1
-rw-r--r--libcxx/test/lit.cfg26
-rw-r--r--libcxx/test/lit.site.cfg.in2
5 files changed, 32 insertions, 20 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index c3b375e9c08..6f51e4e0a03 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -40,7 +40,7 @@ option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
-option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
+option(LIBCXX_ENABLE_CXX1Y "Enable -std=c++1y and use of c++1y language features if the compiler supports it." OFF)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
@@ -194,9 +194,23 @@ else()
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
- if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
- list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
+ # If c++1y has been enabled then attempt to use it. Fail if it is no supported
+ # by the compiler. Otherwise choose c++11 and ensure the compiler supports it.
+ if (LIBCXX_ENABLE_CXX1Y)
+ if (LIBCXX_HAS_STDCXX1Y_FLAG)
+ set(LIBCXX_STD_VERSION c++1y)
+ else()
+ message(FATAL_ERROR "c++1y was enabled but the compiler does not support it.")
+ endif()
+ else()
+ if (LIBCXX_HAS_STDCXX11_FLAG)
+ set(LIBCXX_STD_VERSION c++11)
+ else()
+ message(FATAL_ERROR "c++11 is required by libc++ but is not supported by the compiler")
+ endif()
endif()
+ # LIBCXX_STD_VERSION should always be set at this point.
+ list(APPEND LIBCXX_CXX_REQUIRED_FLAGS "-std=${LIBCXX_STD_VERSION}")
endif()
macro(append_if list condition var)
diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake
index e8adafd6587..6aa4fa2da75 100644
--- a/libcxx/cmake/config-ix.cmake
+++ b/libcxx/cmake/config-ix.cmake
@@ -2,7 +2,8 @@ include(CheckLibraryExists)
include(CheckCXXCompilerFlag)
# Check compiler flags
-check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
+check_cxx_compiler_flag(-std=c++11 LIBCXX_HAS_STDCXX11_FLAG)
+check_cxx_compiler_flag(-std=c++1y LIBCXX_HAS_STDCXX1Y_FLAG)
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 4810b2c5748..b04bb97264d 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -28,7 +28,6 @@ if(PYTHONINTERP_FOUND)
set(LIBCXX_BINARY_DIR ${CMAKE_BINARY_DIR})
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
pythonize_bool(LIBCXX_ENABLE_SHARED)
- pythonize_bool(LIBCXX_HAS_STDCXX0X_FLAG)
set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
diff --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg
index 8a6ff4154d4..edb0ab0d3cc 100644
--- a/libcxx/test/lit.cfg
+++ b/libcxx/test/lit.cfg
@@ -247,18 +247,6 @@ if libcxx_obj_root is None:
if libcxx_obj_root is None:
libcxx_obj_root = libcxx_src_root
-cxx_has_stdcxx0x_flag_str = lit_config.params.get('cxx_has_stdcxx0x_flag', None)
-if cxx_has_stdcxx0x_flag_str is not None:
- if cxx_has_stdcxx0x_flag_str.lower() in ('1', 'true'):
- cxx_has_stdcxx0x_flag = True
- elif cxx_has_stdcxx0x_flag_str.lower() in ('', '0', 'false'):
- cxx_has_stdcxx0x_flag = False
- else:
- lit_config.fatal(
- 'user parameter cxx_has_stdcxx0x_flag_str should be 0 or 1')
-else:
- cxx_has_stdcxx0x_flag = getattr(config, 'cxx_has_stdcxx0x_flag', True)
-
# This test suite supports testing against either the system library or the
# locally built one; the former mode is useful for testing ABI compatibility
# between the current headers and a shipping dynamic library.
@@ -313,8 +301,18 @@ include_paths = ['-I' + libcxx_src_root + '/include',
'-I' + libcxx_src_root + '/test/support']
library_paths = ['-L' + libcxx_obj_root + '/lib']
compile_flags = []
-if cxx_has_stdcxx0x_flag:
- compile_flags += ['-std=c++0x']
+
+# Try and get the std version from the command line. Fall back to default given
+# in lit.site.cfg is not present. If default is not present then force c++11.
+std = lit_config.params.get('std', None)
+if std is None:
+ std = getattr(config, 'std', None)
+ if std is None:
+ std = 'c++11'
+ lit_config.note('using default std: \'-std=c++11\'')
+else:
+ lit_config.note('using user specified std: \'-std={}\''.format(std))
+compile_flags += ['-std={}'.format(std)]
# Configure extra linker parameters.
exec_env = {}
diff --git a/libcxx/test/lit.site.cfg.in b/libcxx/test/lit.site.cfg.in
index 1a73dff25cd..9ef332ca695 100644
--- a/libcxx/test/lit.site.cfg.in
+++ b/libcxx/test/lit.site.cfg.in
@@ -1,6 +1,6 @@
@AUTO_GEN_COMMENT@
config.cxx_under_test = "@LIBCXX_COMPILER@"
-config.cxx_has_stdcxx0x_flag = @LIBCXX_HAS_STDCXX0X_FLAG@
+config.std = "@LIBCXX_STD_VERSION@"
config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@"
config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
config.python_executable = "@PYTHON_EXECUTABLE@"
OpenPOWER on IntegriCloud