CMake warning when using preset without -S or -B
With this CMakeLists.txt:
cmake_minimum_required(VERSION 3.19)
project(Hello)
...and this CMakePresets.json:
{
"version": 1,
"configurePresets": [
{
"name": "linux",
"generator": "Ninja Multi-Config",
"binaryDir": "build_${presetName}"
},
{
"name": "macos",
"generator": "Xcode",
"binaryDir": "build_${presetName}"
},
{
"name": "windows",
"generator": "Visual Studio 16 2019",
"architecture": "Win32",
"binaryDir": "build_${presetName}"
}
]
}
Run one of these commands from the source directory:
cmake --preset=linux
cmake --preset=macos
cmake --preset=windows
You'll get this warning:
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
Despite the warning saying the binary directory would be assumed to be the current working directory, it still uses binaryDir
from the preset. I would expect no warning when using --preset when the preset has a binaryDir
set.
Observed in CMake 3.19.0-rc2.