[cmake-developers] Bad error message when a package could not be found - make find_package() not search config files by default
Rolf Eike Beer
eike at sf-mail.de
Fri Feb 17 04:56:47 EST 2012
> On Thursday 16 February 2012, Alexander Neundorf wrote:
>> Hi,
>>
>> when I use a Find-module to search for a package, I get a nice error
>> message if the package could not be found.
>
> 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)
>
>
> Here we go:
>
> package not found, REQUIRED:
>
> --------------------------------------------------------
> 1.) find_package() with no Find-module present:
>
> CMake Error at CMakeLists.txt:4 (find_package):
> Could not find module Findecm.cmake or a configuration file
> for package ecm.
>
> Adjust CMAKE_MODULE_PATH to find Findecm.cmake or set
> ecm_DIR to the directory containing a CMake configuration
> file for ecm. The file will have one of the following
> names:
>
> ecmConfig.cmake
> ecm-config.cmake
> ***** processing continues, but with error
>
>
> --------------------------------------------------------
> 2.) find_package(NO_MODULE):
>
> CMake Error at CMakeLists.txt:4 (find_package):
> Could not find a configuration file for package ecm.
>
> Set ecm_DIR to the directory containing a CMake
> configuration file for ecm. The file will have one of the
> following names:
>
> ecmConfig.cmake
> ecm-config.cmake
> ***** processing continues, but with error
> --------------------------------------------------------
> 4.) find_package() with no Find-module present, same with NO_MODULE:
>
> CMake Error at CMakeLists.txt:4 (find_package):
> Could not find a configuration file for package "ecm" that
> is compatible with requested version "0.0.4".
>
> The following configuration files were considered but not accepted:
>
> /opt/ecm/share/ecm-0.0.2/cmake/ecm-config.cmake, version: 0.0.2
> /opt/ecm/share/ecm-0.0.3/cmake/ecm-config.cmake, version: 0.0.3
> ***** processing continues, but with error
> What should be improved:
> 1.), 2.), 4.) processing should stop if REQUIRED was used
I disagree. Say I want to build $random package. Throw the source
somewhere, run cmake. Now I see the errors and install the packages that
are missing. If processing immediately stops on an unmet dependency I
would have to repeat that as long as there are unmet dependencies. If
processing continues but gives and error I can install all things at once.
Eike
More information about the cmake-developers
mailing list