From 0f85f36f12dbb3117f94ab5cea8a34111d039dc3 Mon Sep 17 00:00:00 2001 From: oandreeva-nv Date: Mon, 18 Dec 2023 18:44:09 -0800 Subject: [PATCH 1/2] Setting min cxx standard version --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce9736c..89e9fa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,16 @@ cmake_minimum_required(VERSION 3.17) project(tritoncommon LANGUAGES C CXX) +# +# C++ standard +set(TRITON_MIN_CXX_STANDARD 17 CACHE STRING "The minimum C++ standard whose features are requested to build this target.") + +if (NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS ${TRITON_MIN_CXX_STANDARD}) + set(COMMON_CMAKE_CXX_STANDARD ${TRITON_MIN_CXX_STANDARD}) +else() + set(COMMON_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD}) +endif() + # # Options # @@ -55,7 +65,7 @@ endif() add_library(common-compile-settings INTERFACE) -target_compile_features(common-compile-settings INTERFACE cxx_std_11) +target_compile_features(common-compile-settings INTERFACE cxx_std_${COMMON_CMAKE_CXX_STANDARD}) target_compile_options(common-compile-settings INTERFACE $<$,$,$>: From 0f7218ed3b9378331cb7176256cc77a61ab52678 Mon Sep 17 00:00:00 2001 From: oandreeva-nv Date: Wed, 20 Dec 2023 10:41:13 -0800 Subject: [PATCH 2/2] Clean up --- CMakeLists.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89e9fa5..6b8546f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,14 +30,9 @@ project(tritoncommon LANGUAGES C CXX) # # C++ standard +# set(TRITON_MIN_CXX_STANDARD 17 CACHE STRING "The minimum C++ standard whose features are requested to build this target.") -if (NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS ${TRITON_MIN_CXX_STANDARD}) - set(COMMON_CMAKE_CXX_STANDARD ${TRITON_MIN_CXX_STANDARD}) -else() - set(COMMON_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD}) -endif() - # # Options # @@ -65,7 +60,7 @@ endif() add_library(common-compile-settings INTERFACE) -target_compile_features(common-compile-settings INTERFACE cxx_std_${COMMON_CMAKE_CXX_STANDARD}) +target_compile_features(common-compile-settings INTERFACE cxx_std_${TRITON_MIN_CXX_STANDARD}) target_compile_options(common-compile-settings INTERFACE $<$,$,$>: