mirror of
https://github.com/google/benchmark.git
synced 2025-01-30 05:40:15 +08:00
Only compile and run the C++03 test when -std=c++03 is supported. Fixes #164
This commit is contained in:
parent
f434ce3fb6
commit
c7108df977
@ -2,10 +2,6 @@
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(CXX03_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "-std=c++11" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
|
||||
string(REPLACE "-std=c++0x" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
|
||||
|
||||
macro(compile_benchmark_test name)
|
||||
add_executable(${name} "${name}.cc")
|
||||
target_link_libraries(${name} benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
@ -42,10 +38,18 @@ add_test(fixture_test fixture_test --benchmark_min_time=0.01)
|
||||
compile_benchmark_test(map_test)
|
||||
add_test(map_test map_test --benchmark_min_time=0.01)
|
||||
|
||||
compile_benchmark_test(cxx03_test)
|
||||
set_target_properties(cxx03_test
|
||||
PROPERTIES COMPILE_FLAGS "${CXX03_FLAGS}")
|
||||
add_test(cxx03 cxx03_test --benchmark_min_time=0.01)
|
||||
|
||||
check_cxx_compiler_flag(-std=c++03 BENCHMARK_HAS_CXX03_FLAG)
|
||||
if (BENCHMARK_HAS_CXX03_FLAG)
|
||||
set(CXX03_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "-std=c++11" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
|
||||
string(REPLACE "-std=c++0x" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
|
||||
|
||||
compile_benchmark_test(cxx03_test)
|
||||
set_target_properties(cxx03_test
|
||||
PROPERTIES COMPILE_FLAGS "${CXX03_FLAGS}")
|
||||
add_test(cxx03 cxx03_test --benchmark_min_time=0.01)
|
||||
endif()
|
||||
|
||||
# Add the coverage command(s)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
|
Loading…
Reference in New Issue
Block a user