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

**URL:** https://discourse.cmake.org/t/cmake-gui-doesnt-implicilty-use-current-working-directory-as-source-directory/6407
**Category:** Usage
**Created:** [September 4, 2022, 5:42pm UTC](https://discourse.cmake.org/t/cmake-gui-doesnt-implicilty-use-current-working-directory-as-source-directory/6407 "2022-09-04T17:42:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![buildSystemPerson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/buildsystemperson/32/2851_2.png) [@buildSystemPerson](https://discourse.cmake.org/u/buildSystemPerson)
#### Post date: [September 4, 2022, 5:42pm UTC](https://discourse.cmake.org/t/cmake-gui-doesnt-implicilty-use-current-working-directory-as-source-directory/6407/1 "2022-09-04T17:42:45Z")

</div>

See the following usage of CMake:

```auto
$ 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:

 ![image](https://discourse.cmake.org/uploads/default/original/2X/1/1143d542de046b55e2a1b6cc085cff998e68ea95.png)

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:

 ![image](https://discourse.cmake.org/uploads/default/original/2X/1/171cb118cd05aded5d6f81469f5a6400bc9ce862.png)

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

Thoughts?

---

<div class="post-metadata">

### Author: ![jtxa](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jtxa/32/1535_2.png) [@jtxa](https://discourse.cmake.org/u/jtxa)
#### Post date: [September 4, 2022, 11:02pm UTC](https://discourse.cmake.org/t/cmake-gui-doesnt-implicilty-use-current-working-directory-as-source-directory/6407/2 "2022-09-04T23:02:56Z")

</div>

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`.
