[PATCH] [libcxx] Update the way the -std= flag is chosen by CMake and LibcxxTestFormat
danalbert at google.com
Fri Aug 15 08:10:54 PDT 2014
Comment at: CMakeLists.txt:197
@@ -196,3 +196,3 @@
- if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
- list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
+ if (LIBCXX_ENABLE_CXX1Y AND LIBCXX_HAS_STDCXX1Y_FLAG)
+ set(LIBCXX_STD_VERSION c++1y)
Eric Fiselier wrote:
> Dan Albert wrote:
> > I think the case of LIBCXX_ENABLE_CXX1Y && !LIBCXX_HAS_STDCXX1Y_FLAG should raise an error, not fall back to C++11.
> If that were to be the case then we should turn LIBCXX_ENABLE_CXX1Y off by default. There is no need for CMake to fail because it can't find a c++1y flag since libc++ builds as c++11.
> Selfishly I want the c++1y to be enabled by default because I'm doing a lot of work on the LFTS that requires c++1y and I don't want to specify it to run the tests.
We'll have to make that not the default for the time being then. Having cmake lie isn't an option. We might know about this non-intuitive behavior, but most people aren't going to read the cmake files and would just assume it worked. We shouldn't do a warning or other message either. There usually isn't a reason to look at the cmake output unless it fails.
Comment at: test/lit.cfg:300
@@ +299,3 @@
+ std = 'c++11'
+ lit_config.note('using default std: \'-std=c++11\'')
Yeah, this is fine. C++11 is probably a safe default these days.
More information about the cfe-commits