Add C++ standard to CMake for MSVC

This commit is contained in:
Jonah Beckford 2023-08-07 20:55:27 -07:00
parent f07596dbb5
commit d8b55078ba
3 changed files with 18 additions and 1 deletions

10
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,10 @@
{
"files.associations": {
"*.rst": "restructuredtext",
"*.make": "makefile",
"opam": "ocaml.opam",
"schema.capnp.h": "c",
"stdbool.h": "c"
},
"cmake.configureOnOpen": false
}

View file

@ -9,6 +9,13 @@ project(c-capnproto LANGUAGES ${languages})
include(CTest)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS NO)
if(BUILD_TESTING)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS NO)
endif()
# Stop noise if CXX compiler is set.
set(ignoreAndAvoidCMakeUnusedWarning "${CMAKE_CXX_COMPILER}")

View file

@ -18,7 +18,7 @@
#include "addressbook.capnp.h"
static capn_text chars_to_text(const char *chars) {
return (capn_text) {
return {
.len = (int) strlen(chars),
.str = chars,
.seg = NULL,