Skip to content
  • Alexander Neundorf's avatar
    find_package: improve error message when no Find module is present · 7d67dcf5
    Alexander Neundorf authored and Brad King's avatar Brad King committed
    
    
    Explain exactly why CMake is looking for a package configuration file
    and who is expected to provide what:
    
     CMake Error at CMakeLists.txt:7 (find_package):
      By not providing "Find<pkg>.cmake" in CMAKE_MODULE_PATH the caller
      has asked CMake to find a package configuration file provided by
      "<pkg>", but CMake did not find one.
    
      Could not find a package configuration file provided by "<pkg>"
      with any of the names:
    
        <pkg>Config.cmake
        <pkg>-config.cmake
    
      Add the installation prefix of "<pkg>" to CMAKE_PREFIX_PATH or
      set "<pkg>_DIR" to a directory containing one of the above files.
      If "<pkg>" provides separate development package or SDK be sure
      it has been installed.
    
    The first paragraph explains how CMake is interpreting the intention of
    the caller.  This puts the blame or credit at the call site in the
    project code where it belongs both when it is a bug and when it is
    intentional.  It can be dropped in NO_MODULE mode.
    
    Suggested-by: default avatarBrad King <brad.king@kitware.com>
    7d67dcf5