🔨 Don't write to global CMAKE_CXX_STANDARD

Instead use modern target_compile_features with cxx_std_11
This commit is contained in:
Olivier Le Doeuff 2022-09-26 11:39:13 +02:00
parent bc3be12530
commit 696f5299f0

View File

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.9)
project(fast_float VERSION 3.4.0 LANGUAGES CXX) project(fast_float VERSION 3.4.0 LANGUAGES CXX)
option(FASTFLOAT_TEST "Enable tests" OFF) option(FASTFLOAT_TEST "Enable tests" OFF)
set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to be used")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(FASTFLOAT_TEST) if(FASTFLOAT_TEST)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
@ -30,6 +28,7 @@ target_include_directories(
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
target_compile_features(fast_float INTERFACE cxx_std_11)
if(FASTFLOAT_SANITIZE) if(FASTFLOAT_SANITIZE)
target_compile_options(fast_float INTERFACE -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all) target_compile_options(fast_float INTERFACE -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all)
target_link_libraries(fast_float INTERFACE -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all) target_link_libraries(fast_float INTERFACE -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all)