# Cmake log messages configuration

**URL:** https://discourse.cmake.org/t/cmake-log-messages-configuration/3875
**Category:** Usage
**Created:** [August 4, 2021, 1:20am UTC](https://discourse.cmake.org/t/cmake-log-messages-configuration/3875 "2021-08-04T01:20:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![AverageLearner](https://discourse.cmake.org/user_avatar/discourse.cmake.org/averagelearner/32/1685_2.png) [@AverageLearner](https://discourse.cmake.org/u/AverageLearner)
#### Post date: [August 4, 2021, 1:20am UTC](https://discourse.cmake.org/t/cmake-log-messages-configuration/3875/1 "2021-08-04T01:20:24Z")

</div>

Hello, I want to know how does the Cmake messages such as warning messages get displayed or logged in the the logfile. For example, if there is a find\_package(“one”) in the cmakelist.txt, and this package does not exist, a Cmake warning message would show up saying that it could not find the package configuration file.

May I know how can I get into this message logging system, where does it configure this message to display in the console. Is there an option to suppress this message or display at all times? How can I access all these settings and files? Thank you.

---

<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: [August 4, 2021, 1:22am UTC](https://discourse.cmake.org/t/cmake-log-messages-configuration/3875/2 "2021-08-04T01:22:56Z")

</div>

The messages go to the output and I don’t think there’s a way to hook into it and intercept. You might want this instead:

```cmake
find_package(one QUIET)
if (NOT one_FOUND)
  # whatever you wanted to do
endif ()
```

---

<div class="post-metadata">

### Author: ![AverageLearner](https://discourse.cmake.org/user_avatar/discourse.cmake.org/averagelearner/32/1685_2.png) [@AverageLearner](https://discourse.cmake.org/u/AverageLearner)
#### Post date: [August 4, 2021, 1:33am UTC](https://discourse.cmake.org/t/cmake-log-messages-configuration/3875/3 "2021-08-04T01:33:17Z")

</div>

Thank you for your reply. I was getting this warning when I run with Cmake

CMake Warning at src/tad-commonapi/CMakeLists.txt:17 (find\_package):  
By not providing “Findtad.cmake” in CMAKE\_MODULE\_PATH this project has  
asked CMake to find a package configuration file provided by “tad”, but  
CMake did not find one.

Could not find a package configuration file provided by “tad” with any of  
the following names:

```
tadConfig.cmake
tad-config.cmake

```

Add the installation prefix of “tad” to CMAKE\_PREFIX\_PATH or set “tad\_DIR”  
to a directory containing one of the above files. If “tad” provides a  
separate development package or SDK, be sure it has been installed

It seems like there is already a default formatted warning messages built into Cmake that gets shown (when file is not located for e.g.), is there no way to configure this part of the log system? Can I find the if-else condition for this message?

---

<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: [August 4, 2021, 1:35am UTC](https://discourse.cmake.org/t/cmake-log-messages-configuration/3875/4 "2021-08-04T01:35:39Z")

</div>

Oh, that means CMake couldn’t even find to file to determine if `tad` can be found or not. No, there’s no way to configure this particular message at least.

---

<div class="post-metadata">

### Author: ![AverageLearner](https://discourse.cmake.org/user_avatar/discourse.cmake.org/averagelearner/32/1685_2.png) [@AverageLearner](https://discourse.cmake.org/u/AverageLearner)
#### Post date: [August 4, 2021, 2:02am UTC](https://discourse.cmake.org/t/cmake-log-messages-configuration/3875/5 "2021-08-04T02:02:09Z")

</div>

Thanks for clarifying.

Also, I am new to Cmake, there are some things I am confused about. I understand that there are message() to display messages based on the condition set in the parenthesis, but we can also set CMAKE\_MESSAGE\_LOG\_LEVEL. For the latter, what does it mean by setting that variable, is there an option (e.g. debug, warning or error) to insert after “set(CMAKE\_MESSAGE\_LOG\_LEVEL XXX)”?

---

<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: [August 4, 2021, 2:21pm UTC](https://discourse.cmake.org/t/cmake-log-messages-configuration/3875/6 "2021-08-04T14:21:29Z")

</div>

Please see [the docs for the variable](https://cmake.org/cmake/help/latest/variable/CMAKE_MESSAGE_LOG_LEVEL.html).
