From 76b6a982037dd9487a628d7163cf85b86e204c18 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sat, 6 Sep 2025 12:22:16 +0200 Subject: [PATCH] CMake: Fix required C++ standard cxx_std_14 is only available since CMake 3.8 The CXX_STANDARD_REQUIRED property is a boolean, i.e. ON or OFF not a numeric value. The feature is enough to require the standard already In the test the specification is not required as the library sets it --- CMakeLists.txt | 8 ++------ test/CMakeLists.txt | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65058c4..1d46e40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,10 @@ # Generated by `boostdep --cmake lockfree` # Copyright 2020 Peter Dimov +# Copyright 2025 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.8...3.16) project(boost_lockfree VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) @@ -11,10 +12,6 @@ option(BOOST_LOCKFREE_BUILD_TESTS "Build boost::lockfree tests" OFF) option(BOOST_LOCKFREE_TESTS_STRESSTEST "Build boost::lockfree with more excessive stress tests" OFF) option(BOOST_LOCKFREE_USE_FILE_SET "Use FILE_SET for boost::lockfree" OFF) -if (NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -endif() - add_library(boost_lockfree INTERFACE) add_library(Boost::lockfree ALIAS boost_lockfree) @@ -43,7 +40,6 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.23 AND BOOST_LOCKFREE_USE_FILE_SET) endif() target_compile_features(boost_lockfree INTERFACE cxx_std_14) -set_target_properties( boost_lockfree PROPERTIES CXX_STANDARD_REQUIRED 14) target_link_libraries(boost_lockfree INTERFACE diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 51dda6a..c7dd5be 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -59,7 +59,6 @@ foreach(Test ${Tests}) LINK_LIBRARIES ${Libs} COMPILE_DEFINITIONS BOOST_TEST_NO_OLD_TOOLS ) - set_target_properties( boost_lockfree-${Test} PROPERTIES CXX_STANDARD_REQUIRED 14) if (BOOST_LOCKFREE_TESTS_STRESSTEST) target_compile_definitions(boost_lockfree-${Test} PRIVATE BOOST_LOCKFREE_STRESS_TEST)