[CMake] Question about find package in Module mode

Andreas Pakulat apaku at gmx.de
Tue Oct 9 10:12:59 EDT 2012


Hi,

On Tue, Oct 9, 2012 at 3:46 PM, Fabio Fracassi
<fabio.fracassi at charite.de> wrote:
> Hello,
>
> I am using find_package in Module mode for a Library that is also build
> using cmake.
> The Library is build in a way that it can be used both from the build dir,
> and from the installed location.
>
> When using find_package it always seems to prefer the build dir version,
> which is somewhat surprising since I expect the default to be the
> (supposably more stable) installed version and that the build dir version
> (that could be broken at any time) needs some explicit interaction.
>
> Is the current state the way it is supposed to be? Can I force CMake to do
> what I want?

Unless you happen to build in /usr or /usr/local CMake won't
automatically find packages in module mode, so you must already be
doing something to have cmake find the module from the builddir first.
The documentation of the find_package function (cmake --help-command
find_package) has quite extensive documentation about the paths that
are being searched and their order.

Whats your find_package call? Check which of the variables mentioned
in the find_package docs are set before the find_package call.

Andreas


More information about the CMake mailing list