CMakeLists.txt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright(c) 2019 spdlog authors Distributed under the MIT License (http://opensource.org/licenses/MIT)
  2. cmake_minimum_required(VERSION 3.11)
  3. project(spdlog_bench CXX)
  4. if(NOT TARGET spdlog)
  5. # Stand-alone build
  6. find_package(spdlog CONFIG REQUIRED)
  7. endif()
  8. find_package(Threads REQUIRED)
  9. find_package(benchmark CONFIG)
  10. if(NOT benchmark_FOUND)
  11. message(STATUS "Using CMake Version ${CMAKE_VERSION}")
  12. # User can fetch googlebenchmark
  13. message(STATUS "Downloading GoogleBenchmark")
  14. include(FetchContent)
  15. # disable tests
  16. set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "")
  17. # Do not build and run googlebenchmark tests
  18. FetchContent_Declare(googlebenchmark GIT_REPOSITORY https://github.com/google/benchmark.git GIT_TAG v1.6.0)
  19. FetchContent_MakeAvailable(googlebenchmark)
  20. endif()
  21. add_executable(bench bench.cpp)
  22. spdlog_enable_warnings(bench)
  23. target_link_libraries(bench PRIVATE spdlog::spdlog)
  24. add_executable(async_bench async_bench.cpp)
  25. target_link_libraries(async_bench PRIVATE spdlog::spdlog)
  26. add_executable(latency latency.cpp)
  27. target_link_libraries(latency PRIVATE benchmark::benchmark spdlog::spdlog)
  28. add_executable(formatter-bench formatter-bench.cpp)
  29. target_link_libraries(formatter-bench PRIVATE benchmark::benchmark spdlog::spdlog)