Merge pull request #1026 from ktonon/develop
Added public target_compile_features for auto and constexpr
This commit is contained in:
commit
495436a5d5
4 changed files with 10 additions and 8 deletions
|
@ -277,6 +277,7 @@ script:
|
||||||
if [[ (-x $(which brew)) ]]; then
|
if [[ (-x $(which brew)) ]]; then
|
||||||
brew update
|
brew update
|
||||||
brew install cmake ninja
|
brew install cmake ninja
|
||||||
|
brew upgrade cmake
|
||||||
cmake --version
|
cmake --version
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.0.0)
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
|
||||||
##
|
##
|
||||||
## PROJECT
|
## PROJECT
|
||||||
|
@ -44,6 +44,8 @@ endif()
|
||||||
##
|
##
|
||||||
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
|
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
|
||||||
|
|
||||||
|
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${NLOHMANN_JSON_TARGET_NAME}
|
${NLOHMANN_JSON_TARGET_NAME}
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.8)
|
||||||
project(JSON_Benchmarks LANGUAGES CXX)
|
project(JSON_Benchmarks LANGUAGES CXX)
|
||||||
|
|
||||||
# set compiler flags
|
# set compiler flags
|
||||||
if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
|
if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -flto -DNDEBUG -O3")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -DNDEBUG -O3")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# configure Google Benchmarks
|
# configure Google Benchmarks
|
||||||
|
@ -23,4 +23,5 @@ file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
|
||||||
|
|
||||||
# benchmark binary
|
# benchmark binary
|
||||||
add_executable(json_benchmarks src/benchmarks.cpp)
|
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})
|
target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
|
@ -6,7 +6,7 @@ option(JSON_Coverage "Build test suite with coverage information" OFF)
|
||||||
if(JSON_Sanitizer)
|
if(JSON_Sanitizer)
|
||||||
message(STATUS "Building test suite with Clang sanitizer")
|
message(STATUS "Building test suite with Clang sanitizer")
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "-std=c++11 -g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer")
|
set(CMAKE_CXX_FLAGS "-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -61,11 +61,10 @@ add_library(catch_main OBJECT
|
||||||
"src/unit.cpp"
|
"src/unit.cpp"
|
||||||
)
|
)
|
||||||
set_target_properties(catch_main PROPERTIES
|
set_target_properties(catch_main PROPERTIES
|
||||||
CXX_STANDARD 11
|
|
||||||
CXX_STANDARD_REQUIRED ON
|
|
||||||
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>>"
|
||||||
)
|
)
|
||||||
|
target_compile_features(catch_main PUBLIC cxx_std_11)
|
||||||
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
|
||||||
|
@ -95,13 +94,12 @@ foreach(file ${files})
|
||||||
|
|
||||||
add_executable(${testcase} $<TARGET_OBJECTS:catch_main> ${file})
|
add_executable(${testcase} $<TARGET_OBJECTS:catch_main> ${file})
|
||||||
set_target_properties(${testcase} PROPERTIES
|
set_target_properties(${testcase} PROPERTIES
|
||||||
CXX_STANDARD 11
|
|
||||||
CXX_STANDARD_REQUIRED ON
|
|
||||||
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>>"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(${testcase} PRIVATE CATCH_CONFIG_FAST_COMPILE)
|
target_compile_definitions(${testcase} PRIVATE CATCH_CONFIG_FAST_COMPILE)
|
||||||
|
target_compile_features(${testcase} PRIVATE cxx_std_11)
|
||||||
target_include_directories(${testcase} PRIVATE "thirdparty/catch")
|
target_include_directories(${testcase} PRIVATE "thirdparty/catch")
|
||||||
target_include_directories(${testcase} PRIVATE "thirdparty/fifo_map")
|
target_include_directories(${testcase} PRIVATE "thirdparty/fifo_map")
|
||||||
target_include_directories(${testcase} PRIVATE ${NLOHMANN_JSON_INCLUDE_BUILD_DIR})
|
target_include_directories(${testcase} PRIVATE ${NLOHMANN_JSON_INCLUDE_BUILD_DIR})
|
||||||
|
|
Loading…
Reference in a new issue