[CMake] How to make cmake-2.6 tell why it fails

Brad King brad.king at kitware.com
Mon Aug 25 14:44:25 EDT 2008


Martin Costabel wrote:
> Martin Costabel wrote:
> []
>> Now I only have to find out why another user gets the error
>>
>> "find_package cannot find package FREETYPE because FREETYPE_DIR is
>> set to "/sw/lib/freetype219" which is not a directory containing a
>> package configuration file (or it is not for the requested version)."
>>
>> although everyone else with the same configuration does not get this
>> error. Maybe another framework interfering...
> 
> Not a framework this time. Turns out it was a case-sensitivity problem:
> 
> The scribus CMakeLists.txt had
> 
> FIND_PACKAGE(FREETYPE REQUIRED)
> 
> but the module in cmake-2.6/Modules/ is called FindFreetype.cmake.
> This is no problem for people running a case-insensitive file system,
> which is the majority on MacOSX. There cmake simply loads a file named
> FindFREETYPE.cmake, or so it thinks. But MacOSX also offers case
> sensitive file systems, and there it fails. It works with
> 
> FIND_PACKAGE(Freetype REQUIRED)
> 
> Three remarks:
> 
> 1. It would have been nice if cmake had given a comprehensible error
> message, like not finding a fitting Module.

The message you report that the other user got looks like what CMake 2.4
produces.  CMake 2.6 provides this error:

CMake Error at CMakeLists.txt:4 (find_package):
  find_package could not find module FindFREETYPE.cmake or a
  configuration file for package FREETYPE.

  Adjust CMAKE_MODULE_PATH to find FindFREETYPE.cmake or set
  FREETYPE_DIR to the directory containing a CMake configuration file
  for FREETYPE.  ...

> 2. Why are the names of the Find*.cmake Modules such a colorful mixture
> of upper- and lowercase? How should a cmake user remember that it is
> Curl and CUPS (or the other way round?), Freetype and EXPAT?

It's historical.  The contributor of each module chose a capitalization
that was preferred for the package to be found (or by the contributor).

One may run

  cmake --help-module-list

to see the modules available with proper capitalization.

-Brad



More information about the CMake mailing list