# FindXXX semantic: \_FIND\_REQUIRED and \_FIND\_QUIETLY

**URL:** <https://discourse.cmake.org/t/findxxx-semantic-find-required-and-find-quietly/285>\
**Category:** Code\
**Created:** [November 29, 2019, 6:38pm UTC](https://discourse.cmake.org/t/findxxx-semantic-find-required-and-find-quietly/285 "2019-11-29T18:38:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![serghei](https://discourse.cmake.org/user_avatar/discourse.cmake.org/serghei/32/6246_2.png) [@serghei](https://discourse.cmake.org/u/serghei)\
**Post date:** [November 29, 2019, 6:38pm UTC](https://discourse.cmake.org/t/findxxx-semantic-find-required-and-find-quietly/285/1 "2019-11-29T18:38:29Z")

</div>

.

Sometimes I face the following semantics in the `findXXX` modules. And to be honestly not quite understand what happens here:

```
include(FindPackageHandleStandardArgs)

set(_pkg ${CMAKE_FIND_PACKAGE_NAME)

if(${_pkg}_FIND_REQUIRED AND NOT ${_pkg}_FIND_QUIETLY)

  find_package_handle_standard_args(
    ${CMAKE_FIND_PACKAGE_NAME}
    REQUIRED_VARS
      SPDLOG_INCLUDE_DIR
      SPDLOG_LIBRARY)

else()

  find_package_handle_standard_args(
    ${CMAKE_FIND_PACKAGE_NAME} 
    DEFAULT_MSG
    SPDLOG_INCLUDE_DIR
    SPDLOG_LIBRARY)

endif()

```

When the `${CMAKE_FIND_PACKAGE_NAME)_FIND_QUIETLY ` variable will be set to `TRUE `? Should I use such approach in my own modules? The two branches look pretty similar, isn’t. Is this a generally valid example? When and in what situations is this approach justified?

I have not seen mention of such a tricks (` if(XXX_FIND_REQUIRED AND NOT XXX_FIND_QUIETLY)`) in the documentation. That’s why it became interesting to me what kind of use cases needs such checks.

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:** [December 2, 2019, 12:54pm UTC](https://discourse.cmake.org/t/findxxx-semantic-find-required-and-find-quietly/285/2 "2019-12-02T12:54:31Z")

</div>

This seems like a very odd pattern. I think I’ve always just seen a straight call to FPHSA (which handles `QUIETLY` properly already).
