Skip to content

WIP: find_package: Allow the implicit NOT_FOUND warning message to be suppressed

Allow the warning message from a package not found to be suppressed when find_package is operating in implicit mode. The default behaviour is unchanged but this introduces a CMAKE_FIND_PACKAGE_IMPLICIT_NOT_FOUND_QUIET variable that behaves as follows with find_package(Foo):

Unset or off (current behavior):

CMake Warning at CMakeLists.txt:5 (find_package):
  By not providing "FindFoo.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Foo", but
  CMake did not find one.

  Could not find a package configuration file provided by "Foo" with any of
  the following names:

    FooConfig.cmake
    foo-config.cmake

  Add the installation prefix of "Foo" to CMAKE_PREFIX_PATH or set "Foo_DIR"
  to a directory containing one of the above files.  If "Foo" provides a
  separate development package or SDK, be sure it has been installed.

Set to ON:

-- Could NOT find Foo (missing: FindFoo.cmake FooConfig.cmake foo-config.cmake)

Merge request reports