mirror of
https://github.com/nlohmann/json.git
synced 2024-08-24 22:07:02 +02:00
Commit 73cc5089
(Using target_compile_features to specify C++ 11
standard) bumped the required cmake version, from 3.0 to 3.8, so
as to get the definition of target_compile_features().
However, target_compile_features() was introduced in cmake-3.1:
https://cmake.org/cmake/help/v3.1/command/target_compile_features.html
And using cmake-3.1 is indeed sufficient to properly build.
As such, relax the minimum required version down to cmake-3.1,
so we can build on oldish, entreprise-grade distributions that
only have cmake-3.1 (or at least, don't have up to cmake-3.8).
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
28 lines
1,022 B
CMake
28 lines
1,022 B
CMake
cmake_minimum_required(VERSION 3.1)
|
|
project(JSON_Benchmarks LANGUAGES CXX)
|
|
|
|
# set compiler flags
|
|
if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -DNDEBUG -O3")
|
|
endif()
|
|
|
|
# configure Google Benchmarks
|
|
set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "" FORCE)
|
|
add_subdirectory(thirdparty/benchmark)
|
|
|
|
# header directories
|
|
include_directories(thirdparty)
|
|
include_directories(${CMAKE_SOURCE_DIR}/../single_include)
|
|
|
|
# copy test files to build folder
|
|
file(COPY ${CMAKE_SOURCE_DIR}/data DESTINATION .)
|
|
file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
|
|
${CMAKE_SOURCE_DIR}/../test/data/regression/unsigned_ints.json
|
|
${CMAKE_SOURCE_DIR}/../test/data/regression/signed_ints.json
|
|
DESTINATION data/numbers)
|
|
|
|
# benchmark binary
|
|
add_executable(json_benchmarks src/benchmarks.cpp)
|
|
target_compile_features(json_benchmarks PRIVATE cxx_std_11)
|
|
target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT})
|