From 3351912a5311ab2c497c1479f900e6c0c04bfcdd Mon Sep 17 00:00:00 2001 From: Asher Glick Date: Tue, 31 Oct 2023 01:37:03 -0500 Subject: [PATCH] Enable CPP17 Build This was maybe enabled before, but due to some edgecases around default versions it seems to have broken at some point. Doing this seems to have fixed it so that `-std=gnu++17` is present in the compile_commands.json file now. --- xml_converter/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xml_converter/CMakeLists.txt b/xml_converter/CMakeLists.txt index db9747f3..5824ed49 100644 --- a/xml_converter/CMakeLists.txt +++ b/xml_converter/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required (VERSION 3.16) project (XMLConverter) +# Set CPP standard library to cpp17 +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -23,8 +27,6 @@ add_library(${CORE_LIB} STATIC ${SOURCES} ${PROTO_SRC}) # Include protobuf libraies. target_link_libraries(${CORE_LIB} PUBLIC ${Protobuf_LIBRARIES}) -# Require C++ 17 or newer. -target_compile_features(${CORE_LIB} PUBLIC cxx_std_17) if(MSVC) target_compile_options(${CORE_LIB} PUBLIC /W4 /WX) else()