# cmake does not honor --log-level in add\_jar()

**URL:** https://discourse.cmake.org/t/cmake-does-not-honor-log-level-in-add-jar/3202
**Category:** Development
**Created:** [April 23, 2021, 5:43pm UTC](https://discourse.cmake.org/t/cmake-does-not-honor-log-level-in-add-jar/3202 "2021-04-23T17:43:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rhbroberg](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rhbroberg/32/1062_2.png) [@rhbroberg](https://discourse.cmake.org/u/rhbroberg)
#### Post date: [April 23, 2021, 5:43pm UTC](https://discourse.cmake.org/t/cmake-does-not-honor-log-level-in-add-jar/3202/1 "2021-04-23T17:43:16Z")

</div>

When running cmake on a project which has add\_jar() in it, a message unconditionally appears during the jar building:

`-- Clean class files from previous build`

This message comes from this file (in my installation):

`/usr/local/share/cmake-3.19/Modules/UseJava/ClearClassFiles.cmake`

That message line looks like this:

`message(STATUS "Clean class files from previous build")`

The message appears during the build (ninja) regardless of what “–log-level” I set when running cmake. The file is called from

`Modules/UseJava.cmake` using ${CAMKE\_COMMAND} … -P … ClearClassFiles.cmake.

Setting the CMAKE\_MESSAGE\_LOG\_LEVEL variable also has no effect on that message. As far as I’m concerned, that’s not a necessary message during my build, but I cannot make it go away. Is there a way I can make the recursive cmake call honor the --log-level I’ve specified?

Thanks

---

<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: [April 23, 2021, 6:25pm UTC](https://discourse.cmake.org/t/cmake-does-not-honor-log-level-in-add-jar/3202/2 "2021-04-23T18:25:42Z")

</div>

The `--log-level` and `CMAKE_MESSAGE_LOG_LEVEL` mechanisms from the top-level CMake configure don’t affect custom commands (such as the `ClearClassFiles.cmake` script). It doesn’t appear as though there’s a way to influence the logging of that command right now. I’d file [an issue](https://gitlab.kitware.com/cmake/cmake/-/issues) to add a way to suppress that message.

---

<div class="post-metadata">

### Author: ![rhbroberg](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rhbroberg/32/1062_2.png) [@rhbroberg](https://discourse.cmake.org/u/rhbroberg)
#### Post date: [April 23, 2021, 6:36pm UTC](https://discourse.cmake.org/t/cmake-does-not-honor-log-level-in-add-jar/3202/3 "2021-04-23T18:36:12Z")

</div>

Thanks, I have done so

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [April 26, 2021, 1:19pm UTC](https://discourse.cmake.org/t/cmake-does-not-honor-log-level-in-add-jar/3202/4 "2021-04-26T13:19:13Z")

</div>

I see [CMake Issue 22107](https://gitlab.kitware.com/cmake/cmake/-/issues/22107), thanks.
