cmake: Ensure source and binary dirs are set
If only the source dir is provided, the binary dir is assumed to be the working directory. If only the binary dir is provided and it doesn't yet have a CMakeCache.txt to provide the source dir, then the source dir is assumed to be the working directory. This logic was not previously being handled correctly when -S and/or -B options were involved. Furthermore, when both were missing, no suitable error message was provided and an empty string was used for the build directory. Fixes: #18707
Loading
-
We had some build scripts that implicitly used the working directory fallback when no directory was specified.
Using a clone of https://github.com/google/flatbuffers as the working directory, on cmake 3.13.2 one could run
cmake -G "Unix Makefiles"
and the command would run correctly. cmake 3.13.3 gave an error:
"CMake Error: No source or binary directory provided"
. Changing the command to:cmake -G "Unix Makefiles" .
fixed the problem.
Just figured this may be good to know in case other people were also relying on this bug :)
Edited by Jeremy Day -
mentioned in issue #18817 (closed)
Please register or sign in to comment