From 7f61736f4a3cf7f50707ff66617e31318124df17 Mon Sep 17 00:00:00 2001 From: Gudmundur Adalsteinsson Date: Fri, 20 Dec 2024 11:26:46 +0000 Subject: [PATCH] Only set C++ standard if not defined This allows us use `add_subdirectory(avcpp)` without overwriting the set standard (C++23 e.g.) --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51665045..9ee3bf6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,10 @@ set(AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)") set(AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)") set(AV_BUILD_EXAMPLES On CACHE BOOL "Build example applications (On)") -# Compiler-specific C++11 activation. -set(CMAKE_CXX_STANDARD 17) +# Compiler-specific C++17 activation. +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +endif() set(CMAKE_CXX_STANDARD_REQUIRED yes) # Warnings