Target install path question

Andreas Pakulat apaku at gmx.de
Mon Sep 20 13:04:50 CEST 2010


On 20.09.10 12:36:28, Sebastian Trüg wrote:
> Hi,
> 
> is there a way to get the exact path of a target install path?
> If I have for example some installation rule like:
> 
> install(TARGET foobar DESTINATION lib)
> 
> I would like to use the path of the foobar lib in my FooBarConfig.cmake
> to set a variable FOOBAR_LIBRARIES.
> Is that possible without resorting to what the Akonadi version does, ie.
> construct a different path for each architecture?

I don't know what Akonadi does, but usually the config-files are installed
to <prefix>/lib<suffix>/cmake/<yourmodule> so you can easily get at the lib
or bin or share dir by using CMAKE_CURRENT_LIST_FILE variable and
extracting the path from that. Then use a static relative path from that
like "../../" (for lib<suffix>) or "../../bin|share" for bin/share.

Using some 'heuristics' like guessing architecture and using that is not
necessarily reliable as the person building the codebase can change all
details of the target path by using global cmake variables.

A quick look through the target properties list doesn't seem to indicate
there is any to extract the final install location. Generally though if you
have install(TARGET foobar DESTINATION lib) then it'll end up in
DESTDIR/<prefix>/lib. But I guess you're using some pre-defined variable(s)
which are platform-dependent?

Andreas

-- 
Are you ever going to do the dishes?  Or will you change your major to biology?


More information about the Kde-buildsystem mailing list