diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..243c58c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "files.associations": { + "*.rst": "restructuredtext", + "*.make": "makefile", + "opam": "ocaml.opam", + "schema.capnp.h": "c", + "stdbool.h": "c" + }, + "cmake.configureOnOpen": false +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index ecd2f5d..59ec1f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/tests/example-test.cpp b/tests/example-test.cpp index 80e3922..9510685 100644 --- a/tests/example-test.cpp +++ b/tests/example-test.cpp @@ -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,