From caac6ad6766931c2e79542f36c0e514b7bd7c6fe Mon Sep 17 00:00:00 2001 From: Simon Kallweit <64953474+skallweitNV@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:42:30 +0200 Subject: [PATCH] cmake presets (#10) * add CMakePresets.json * small fix --- CMakePresets.json | 67 ++++++++++++++++++++++++++++++++++++++++ src/core/struct-holder.h | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..4f993ee2 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,67 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 20, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "description": "Default build using Ninja Multi-Config generator", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build" + }, + { + "name": "msvc-base", + "hidden": true, + "inherits": "default", + "description": "Options specific for MSVC", + "cacheVariables": { + "CMAKE_C_FLAGS_INIT": "-D_ITERATOR_DEBUG_LEVEL=0 /MP", + "CMAKE_CXX_FLAGS_INIT": "-D_ITERATOR_DEBUG_LEVEL=0 /MP" + } + }, + { + "name": "msvc", + "inherits": "msvc-base", + "description": "Ninja Multi-Config generator with MSVC", + "generator": "Ninja Multi-Config", + "cacheVariables": { + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_COMPILER": "cl.exe" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + } + } + }, + { + "name": "vs2019", + "inherits": "msvc-base", + "description": "Visual Studio 2019 project", + "generator": "Visual Studio 16 2019" + }, + { + "name": "vs2022", + "inherits": "msvc-base", + "description": "Visual Studio 2022 project", + "generator": "Visual Studio 17 2022" + } + ], + "buildPresets": [ + { + "name": "msvc-debug", + "configurePreset": "msvc", + "configuration": "Debug" + }, + { + "name": "msvc-release", + "configurePreset": "default", + "configuration": "Release" + } + ] + } diff --git a/src/core/struct-holder.h b/src/core/struct-holder.h index c9e118f1..2a0c12be 100644 --- a/src/core/struct-holder.h +++ b/src/core/struct-holder.h @@ -15,7 +15,7 @@ class StructHolder if (str) { char* newStr = (char*)allocate(std::strlen(str) + 1); - std::strcpy(newStr, str); + std::memcpy(newStr, str, std::strlen(str) + 1); str = newStr; } }