cmake-gui doesn't implicilty use current working directory as source directory

See the following usage of CMake:

$ cd binary_search
$ cmake --version
cmake version 3.24.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).
$ cmake -B build
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/.../projects/playground/binary_search/build

By default if -S isn’t specified it assumes the current working directory. This is reasonable behavior that assists CLI usage.

However the same isn’t true for cmake-gui when I try cmake-gui -B build with CMake gui I get the following result:

As you can see it didn’t properly fill out the source/binary directory.

However when I try cmake-gui -S . -B build/ it works as expected:

I think cmake-gui should be fixed to work like regular cmake

Thoughts?

Specifying only a -B for a new build directory (and using CWD as source) is not a documented behavior. According to the manual -B may only be used for an existing build directory where the source dir is read from the cache file.

So I think clarifying the behavior of cmake command line is the first step. The next step would be a consistent behavior of cmake-gui.

1 Like