1cmake_minimum_required(VERSION 3.8) 2project(JSON_Benchmarks LANGUAGES CXX) 3 4# set compiler flags 5if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang)) 6 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -DNDEBUG -O3") 7endif() 8 9# configure Google Benchmarks 10set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "" FORCE) 11add_subdirectory(thirdparty/benchmark) 12 13# header directories 14include_directories(thirdparty) 15include_directories(${CMAKE_SOURCE_DIR}/../single_include) 16 17# download test data 18include(${CMAKE_SOURCE_DIR}/../cmake/download_test_data.cmake) 19 20# benchmark binary 21add_executable(json_benchmarks src/benchmarks.cpp) 22target_compile_features(json_benchmarks PRIVATE cxx_std_11) 23target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT}) 24add_dependencies(json_benchmarks download_test_data) 25target_include_directories(json_benchmarks PRIVATE ${CMAKE_BINARY_DIR}/include) 26