cmake: Handling of argument ""
In cmake 3.23.0-rc1, .cmake path-to-source-directory
(without -S) fails
Originally reported in https://bugs.gentoo.org/833100 where cmake invocation and output was (with later correction):
cmake -C /var/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1_build/gentoo_common_config.cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_USE_SYSTEM_LIBRARIES=ON -DCMAKE_DOC_DIR=/share/doc/cmake-3.23.0_rc1 -DCMAKE_MAN_DIR=/share/man -DCMAKE_DATA_DIR=/share/cmake -DSPHINX_MAN=no -DSPHINX_HTML=no -DBUILD_CursesDialog=yes -DBUILD_TESTING=no -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1_build/gentoo_toolchain.cmake "" /var/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1
CMake Warning:
Ignoring extra path from command line:
/var/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1
loading initial cache file /var/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1_build/gentoo_common_config.cmake
CMake Error: The source directory "/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1_build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Argument /var/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1
was incorrectly not recognized as path to source directory (and was treated as "extra path" in "Ignoring extra path from command line" warning), and then current working directory (/tmp/portage/dev-util/cmake-3.23.0_rc1/work/cmake-3.23.0-rc1_build
) was used as source directory.
I guess that this regression change was introduced in one of these commits:
As found later, effectively cmake "" path-to-source-directory
was actually run, and ""
tricked some logic in CMake.
Edited by Arfrever