Commit c7108df9 by Eric Fiselier

Only compile and run the C++03 test when -std=c++03 is supported. Fixes #164

parent f434ce3f
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
find_package(Threads REQUIRED) 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) macro(compile_benchmark_test name)
add_executable(${name} "${name}.cc") add_executable(${name} "${name}.cc")
target_link_libraries(${name} benchmark ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(${name} benchmark ${CMAKE_THREAD_LIBS_INIT})
...@@ -42,10 +38,18 @@ add_test(fixture_test fixture_test --benchmark_min_time=0.01) ...@@ -42,10 +38,18 @@ add_test(fixture_test fixture_test --benchmark_min_time=0.01)
compile_benchmark_test(map_test) compile_benchmark_test(map_test)
add_test(map_test map_test --benchmark_min_time=0.01) add_test(map_test map_test --benchmark_min_time=0.01)
compile_benchmark_test(cxx03_test)
set_target_properties(cxx03_test check_cxx_compiler_flag(-std=c++03 BENCHMARK_HAS_CXX03_FLAG)
PROPERTIES COMPILE_FLAGS "${CXX03_FLAGS}") if (BENCHMARK_HAS_CXX03_FLAG)
add_test(cxx03 cxx03_test --benchmark_min_time=0.01) 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) # Add the coverage command(s)
if(CMAKE_BUILD_TYPE) if(CMAKE_BUILD_TYPE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment