Merge pull request #1441 from iwanders/support-cmake-older-than-3-8-with-if
Use C++11 features supported by CMake 3.1.
This commit is contained in:
commit
8eb7db7277
3 changed files with 11 additions and 3 deletions
|
@ -46,7 +46,11 @@ endif()
|
||||||
##
|
##
|
||||||
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
|
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
|
||||||
add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME})
|
add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME})
|
||||||
|
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||||
|
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_range_for)
|
||||||
|
else()
|
||||||
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
|
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${NLOHMANN_JSON_TARGET_NAME}
|
${NLOHMANN_JSON_TARGET_NAME}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.8)
|
||||||
project(JSON_Benchmarks LANGUAGES CXX)
|
project(JSON_Benchmarks LANGUAGES CXX)
|
||||||
|
|
||||||
# set compiler flags
|
# set compiler flags
|
||||||
|
|
|
@ -64,7 +64,11 @@ set_target_properties(catch_main PROPERTIES
|
||||||
COMPILE_DEFINITIONS "$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
|
COMPILE_DEFINITIONS "$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
|
||||||
COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
|
COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
|
||||||
)
|
)
|
||||||
|
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||||
|
target_compile_features(catch_main PUBLIC cxx_range_for)
|
||||||
|
else()
|
||||||
target_compile_features(catch_main PUBLIC cxx_std_11)
|
target_compile_features(catch_main PUBLIC cxx_std_11)
|
||||||
|
endif()
|
||||||
target_include_directories(catch_main PRIVATE "thirdparty/catch")
|
target_include_directories(catch_main PRIVATE "thirdparty/catch")
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
|
# https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
|
||||||
|
|
Loading…
Reference in a new issue