CMakeLists.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Enable the tests
  2. find_package(Threads REQUIRED)
  3. set(CXX03_FLAGS "${CMAKE_CXX_FLAGS}")
  4. string(REPLACE "-std=c++11" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
  5. string(REPLACE "-std=c++0x" "-std=c++03" CXX03_FLAGS "${CXX03_FLAGS}")
  6. macro(compile_benchmark_test name)
  7. add_executable(${name} "${name}.cc")
  8. target_link_libraries(${name} benchmark ${CMAKE_THREAD_LIBS_INIT})
  9. endmacro(compile_benchmark_test)
  10. # Demonstration executable
  11. compile_benchmark_test(benchmark_test)
  12. add_test(benchmark benchmark_test --benchmark_min_time=0.01)
  13. compile_benchmark_test(filter_test)
  14. macro(add_filter_test name filter expect)
  15. add_test(${name} filter_test --benchmark_min_time=0.01 --benchmark_filter=${filter} ${expect})
  16. endmacro(add_filter_test)
  17. add_filter_test(filter_simple "Foo" 3)
  18. add_filter_test(filter_suffix "BM_.*" 4)
  19. add_filter_test(filter_regex_all ".*" 5)
  20. add_filter_test(filter_regex_blank "" 5)
  21. add_filter_test(filter_regex_none "monkey" 0)
  22. add_filter_test(filter_regex_wildcard ".*Foo.*" 3)
  23. add_filter_test(filter_regex_begin "^BM_.*" 4)
  24. add_filter_test(filter_regex_begin2 "^N" 1)
  25. add_filter_test(filter_regex_end ".*Ba$" 1)
  26. compile_benchmark_test(options_test)
  27. add_test(options_benchmarks options_test --benchmark_min_time=0.01)
  28. compile_benchmark_test(basic_test)
  29. add_test(basic_benchmark basic_test --benchmark_min_time=0.01)
  30. compile_benchmark_test(cxx03_test)
  31. set_target_properties(cxx03_test
  32. PROPERTIES COMPILE_FLAGS "${CXX03_FLAGS}")
  33. add_test(cxx03 cxx03_test --benchmark_min_time=0.01)