[cmake-developers] find_package error wording
Brad King
brad.king at kitware.com
Fri Feb 17 09:13:19 EST 2012
On 2/17/2012 4:29 AM, Alexander Neundorf wrote:
> I collected the various error messages which can be produced in the different
> cases:
> * package not found
> * package found, but version doesn't match
>
> * REQUIRED
> * without REQUIRED
>
> * find_package() with no Find-module present
> * find_package(NO_MODULE)
> * find_package() with a wrapper Find-module which does:
> find_package(ecm QUIET NO_MODULE)
> fphsa(ecm CONFIG_MODE)
Nice. Can you code this into a test in the Tests/CMakeOnly directory?
That way we will have a single place to reference to see all the current
error messages and we will know if things change accidentally.
On 2/17/2012 5:48 AM, Alexander Neundorf wrote:
> These three points and a small bug fix (error message was not printed at all
> for an invalid CONFIGS name) are now in the FindPackage_ImprovedErrorMessages
> branch and merged into next.
From your commit message:
> CMake Error at CMakeLists.txt:7 (find_package):
> Could not find module Findecm.cmake or a configuration file
> for package ecm with one of the following names:
>
> ecmConfig.cmake
> ecm-config.cmake
>
> Adjust CMAKE_MODULE_PATH to find Findecm.cmake. To find
> the configuration file, set CMAKE_PREFIX_PATH to the installation prefix of
> ecm, or set ecm_DIR to the directory
> containing a CMake configuration file for ecm.
Perhaps we can make the distinction between user and developer right
in the message. When there is no Find module the proper message that
a user sees should talk about ecm_DIR and CMAKE_PREFIX_PATH only.
This should be the focus. We can then add an extra note to help
developers use Find modules. Consider:
CMake Error at CMakeLists.txt:7 (find_package):
No package configuration file for "ecm" found by names:
ecmConfig.cmake
ecm-config.cmake
Add the installation prefix of "ecm" to CMAKE_PREFIX_PATH or
set "ecm_DIR" to a directory containing one of the above files.
(If you are a developer expecting this find_package to load a
Findecm.cmake module then ensure it lies in CMAKE_MODULE_PATH.)
-Brad
More information about the cmake-developers
mailing list