From 08d3294fcd07c93432594bc70c664309da331758 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Tue, 9 Nov 2021 23:22:49 -0500 Subject: [PATCH] vs: add presets and flags to take advantage of VS 2022 stuff (#957) --- CMakeLists.txt | 6 ++++++ CMakePresets.json | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 CMakePresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index cecfe85e70..3e2151a726 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,12 @@ if(UNIX) -Wsign-promo \ -fdiagnostics-color=always") else() + if(CMAKE_BUILD_TYPE MATCHES "Debug") + message("Setting Flags to Enable Edit and Continue") + set(CMAKE_CXX_FLAGS_DEBUG "/ZI") + set(CMAKE_SHARED_LINKER_FLAGS "/SAFESEH:NO") + set(CMAKE_EXE_LINKER_FLAGS "/SAFESEH:NO") + endif() set(CMAKE_CXX_FLAGS "/EHsc") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:16000000,16384") endif(UNIX) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..11089b59a9 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,54 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "linux-default", + "displayName": "Linux Debug", + "description": "Target the Windows Subsystem for Linux (WSL) or a remote Linux system.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Linux" ] }, + "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" } + } + }, + { + "name": "windows-debug", + "displayName": "Windows x64 Debug", + "description": "Target Windows with the Visual Studio development environment.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "INSTALL_GTEST": "True" + }, + "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } } + }, + { + "name": "windows-release", + "displayName": "Windows x64 Release", + "description": "Target Windows with the Visual Studio development environment.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "INSTALL_GTEST": "True" + }, + "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } } + } + ] +}