find_package()

Alexander Neundorf neundorf at kde.org
Thu Jun 29 22:35:43 CEST 2006


On Thursday 29 June 2006 21:55, Allen Winter wrote:
> What's the best cmake command to find an installed cmake module?
> find_package() is used often in our CMakeLists.txt files, but I wonder
> if there isn't something better.
>
> For example:
> The kdepimlibs package installs KDEPIMLib.cmake into
> $top/share/apps/cmake/modules
>
> Near the top of kdepim/CMakeLists.txt I have the line
> "find_package(KDEPIMLib REQUIRED)". If that file is not found, cmake prints
> the following and exits:
>   CMake Error: KDEPIMLib_DIR is not set.  It must be set to the directory
> containing\ KDEPIMLibConfig.cmake in order to use KDEPIMLib.
>
> What I'd rather have is a cmake command that looks in a path for a file,
> and if that file is not found a nice error message is printed (maybe
> something I can specify) and then, based on the REQUIRED option, aborts
> cmake.
>
> Does something like this already exist?

This is an issue which is not yet solved perfectly in cmake, the developers 
are currently disussing a good solution.

For kdepimlib:

There should also be a
find_package(KDE4)

Once this succeeded, the CMAKE_MODULE_PATH (where cmake searches for modules) 
should be set so that $top/share/apps/cmake/modules/ is part of it.
Then KDEPIMlib should be found automatically.
I'll have a closer look at it in the next days.

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list