# Supporting CMake in kondo

**URL:** https://discourse.cmake.org/t/supporting-cmake-in-kondo/10776
**Category:** Usage
**Created:** [May 2, 2024, 3:59am UTC](https://discourse.cmake.org/t/supporting-cmake-in-kondo/10776 "2024-05-02T03:59:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tbillington](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tbillington/32/4547_2.png) [@tbillington](https://discourse.cmake.org/u/tbillington)
#### Post date: [May 2, 2024, 3:59am UTC](https://discourse.cmake.org/t/supporting-cmake-in-kondo/10776/1 "2024-05-02T03:59:47Z")

</div>

Hey! I maintain an open source polyglot project cleaning tool called [kondo](https://github.com/tbillington/kondo). Picture attached for clarity

 ![image](https://discourse.cmake.org/uploads/default/original/2X/1/1da13d68256132607222034e470691c4b53c1271.jpeg)

kondo has had _very_ basic support for cmake projects for a while, however with v2 of the project underway I’m looking to expand support to as many different ways of using cmake as possible. It would be great to get feedback from actual cmake users if possible 😀

A user helpfully described numerous ways of using cmake in this [issue thread](https://github.com/tbillington/kondo/issues/120). I want to know which of these is the most common or standard use of cmake. I’ve inlined the relevant section below.

```sh
# All of these are valid ways to configure the project, even simultaneously.
(mkdir build && cd build && cmake ..) # 1. Currently supported.
(mkdir _ && cd _ && cmake ..) # 2. Unsupported.
(mkdir build/config1 && cd build/config1 && cmake ../..) # 3. Unsupported.
(mkdir /tmp/build && cd /tmp/build && cmake /project/) # 4. Unsupported, assumes project tree in `/project/`.
cmake . # 5. Unsupported.

```

Secondly, how prevalent is the use of the `clean` target? I ran through the cmake tutorial and saw one was generated for me.

Is `clean` something I could expect the majority of cmake projects to have? kondo currently performs all clean logic itself, though I am investigating shelling out to tools like cmake to invoke their logic if the user desires. Would that behaviour be expected or preferred from your perspective?

Thank you for your time, Trent 🙂

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 1, 2025, 9:28pm UTC](https://discourse.cmake.org/t/supporting-cmake-in-kondo/10776/2 "2025-01-01T21:28:47Z")

</div>

For configuring I suggest just using `cmake -Ssourcedir -Bbuilddir` from tooling. There’s no need to faff about with `mkdir`, `mkdir -p`, `cd`, or subshells. You might also be interested in the [`--fresh`](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-fresh) flag (CMake 3.24+).

> [@tbillington](#):
>
> Secondly, how prevalent is the use of the `clean` target? I ran through the cmake tutorial and saw one was generated for me.

The `clean` target is definitely fine for `Makefiles` and `Ninja` generators. I _think_ the IDE generators have something like it, but it might be named something else. For `Ninja` generators, you might want to also consider `ninja -t cleandead` which removes files that the `.ninja_log` knows about but the `build.ninja` file doesn’t have rules for anymore (e.g., you disable Python support after performing a build with Python enabled).
