[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] User-overriding IMPORTED targets (overlaying libraries, ...)
From:       Ivan Shapovalov <intelfx () intelfx ! name>
Date:       2016-08-31 11:57:34
Message-ID: 1472644654.10750.42.camel () intelfx ! name
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Hello,

Let's suppose I have a project Foo which generates a shared library
`libfoo.so`, and a project Bar which links to `foo` and builds an
executable `bar`.

Let's also suppose that as a maintainer, I wrote a library
`libfoo_overlay.so` which links to `libfoo.so` and redefines certain
symbols in that library (e. g. for hardware-specific optimizations
which cannot be upstreamed).

If the projects use the traditional find_package() module mode approach
to find `foo`, then the FindFoo.cmake module will most likely define a
CACHED variable Foo_LIBRARY, which I can then edit with ccmake,
pointing it to `libfoo_overlay.so` instead of `libfoo.so`. This way, I
do not need to patch either project's buildsystem, which is nice.

However, if the two projects use a more-modern approach with config
mode find_package() and IMPORTED targets, then I have no way to edit
the definition of `foo` imported target to alter its LOCATION, because
the target definition itself is not cached.

Of course, I can always edit the FooConfig.cmake file manually, but I'd
better avoid patching anything (installing new files or running any
cmake commands is OK).

Is there any nice way to solve this?

--=20
Ivan Shapovalov / intelfx /
["signature.asc" (application/pgp-signature)]

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic