diff options
author | Eric Fiselier <eric@efcs.ca> | 2018-11-13 07:03:16 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2018-11-13 07:03:16 +0000 |
commit | 4de1c753ff50a2c8aad8ddd56c449b29f85b16d5 (patch) | |
tree | 221458caccf3826e5e05bf0fa97ff7206f3b7cdf /libcxx/benchmarks | |
parent | 32869c6997aa2c880acbad5e8a39e16ab06c6507 (diff) | |
download | bcm5719-llvm-4de1c753ff50a2c8aad8ddd56c449b29f85b16d5.tar.gz bcm5719-llvm-4de1c753ff50a2c8aad8ddd56c449b29f85b16d5.zip |
Attempt to make benchmarks fall back to -std=c++1z when C++17 isn't supported.
The benchmarks currently require C++17, however Clang 3.9 doesn't
support -std=c++17 while still supporting all the C++17 features needed
to compile the benchmarks.
This patch makes the benchmark build attempt to fall back to -std=c++1z
when -std=c++17 isn't supported.
See llvm.org/PR39629
llvm-svn: 346744
Diffstat (limited to 'libcxx/benchmarks')
-rw-r--r-- | libcxx/benchmarks/CMakeLists.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/benchmarks/CMakeLists.txt index 40489cabc2e..5989dafdcad 100644 --- a/libcxx/benchmarks/CMakeLists.txt +++ b/libcxx/benchmarks/CMakeLists.txt @@ -67,8 +67,19 @@ add_custom_target(cxx-benchmarks) set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx) set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native) + +check_flag_supported("-std=c++17") +mangle_name("LIBCXX_SUPPORTS_STD_EQ_c++17_FLAG" BENCHMARK_SUPPORTS_STD_CXX17_FLAG) +if (${BENCHMARK_SUPPORTS_STD_CXX17_FLAG}) + set(BENCHMARK_DIALECT_FLAG "-std=c++17") +else() + # If the compiler doesn't support -std=c++17, attempt to fall back to -std=c++1z while still + # requiring C++17 language features. + set(BENCHMARK_DIALECT_FLAG "-std=c++1z") +endif() + set(BENCHMARK_TEST_COMPILE_FLAGS - -std=c++17 -O2 + ${BENCHMARK_DIALECT_FLAG} -O2 -I${BENCHMARK_LIBCXX_INSTALL}/include -I${LIBCXX_SOURCE_DIR}/test/support ) |