Skip to content

Commit 441a134

Browse files
committed
Add CMakePresets.json to fix VS built-in CMake build directory
When Visual Studio opens CMakeLists.txt directly (Open Folder / CMake mode), it defaults to out/build/<config>/ as the binary directory. This breaks the OdbcFb.vcxproj include path (../../build/_deps/...) which expects 'build/'. CMakePresets.json standardizes the binary directory to 'build/' across all environments (command-line, Visual Studio, CLion, VS Code), so the .vcxproj include path works without manual adjustments. Also adds CMakeUserPresets.json to .gitignore for user-local overrides.
1 parent 206cfd2 commit 441a134

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ tests/Testing/
4040
# IDE
4141
.idea/
4242
.vscode/
43+
CMakeUserPresets.json

CMakePresets.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 15,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "default",
11+
"displayName": "Default (build/)",
12+
"description": "Default preset — uses 'build/' as the binary directory so that all tools (command-line, Visual Studio, CLion, VS Code) share the same layout.",
13+
"binaryDir": "${sourceDir}/build",
14+
"cacheVariables": {
15+
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install"
16+
}
17+
},
18+
{
19+
"name": "release",
20+
"displayName": "Release",
21+
"inherits": "default",
22+
"cacheVariables": {
23+
"CMAKE_BUILD_TYPE": "Release"
24+
}
25+
},
26+
{
27+
"name": "debug",
28+
"displayName": "Debug",
29+
"inherits": "default",
30+
"cacheVariables": {
31+
"CMAKE_BUILD_TYPE": "Debug"
32+
}
33+
}
34+
],
35+
"buildPresets": [
36+
{
37+
"name": "release",
38+
"configurePreset": "default",
39+
"configuration": "Release"
40+
},
41+
{
42+
"name": "debug",
43+
"configurePreset": "default",
44+
"configuration": "Debug"
45+
}
46+
],
47+
"testPresets": [
48+
{
49+
"name": "default",
50+
"configurePreset": "default",
51+
"output": {
52+
"outputOnFailure": true
53+
}
54+
}
55+
]
56+
}

0 commit comments

Comments
 (0)