Editing IMPORTED targets

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Editing IMPORTED targets

Ivan Shapovalov
Hello!

Using find modules to detect dependencies has a nice feature: it is
then possible to edit the resulting cache entries to link to different
libraries (or add other libraries along the found ones, for whatever
purposes), or change directories, or flags, or whatever.

Using find configs and IMPORTED targets, however, prevents doing this,
because IMPORTED targets are not stored in CMake cache. This can be a
significant disadvantage at times.

So: is there any workaround/hidden feature to edit IMPORTED targets?
Or is such a feature planned?

Thanks,
--
Ivan Shapovalov / intelfx /
--

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

signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Editing IMPORTED targets

Stephen Kelly-2
Ivan Shapovalov wrote:

> Hello!
>
> Using find modules to detect dependencies has a nice feature: it is
> then possible to edit the resulting cache entries to link to different
> libraries (or add other libraries along the found ones, for whatever
> purposes), or change directories, or flags, or whatever.
>
> Using find configs and IMPORTED targets, however, prevents doing this,
> because IMPORTED targets are not stored in CMake cache. This can be a
> significant disadvantage at times.

Can you be more specific?

Why can the user provide better information than the supplier of the
IMPORTED target?

Thanks,

Steve.


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Editing IMPORTED targets

Ivan Shapovalov
On 2016-10-03 at 14:43 +0200, Stephen Kelly wrote:

> Ivan Shapovalov wrote:
>
> > Hello!
> >
> > Using find modules to detect dependencies has a nice feature: it is
> > then possible to edit the resulting cache entries to link to
> > different
> > libraries (or add other libraries along the found ones, for
> > whatever
> > purposes), or change directories, or flags, or whatever.
> >
> > Using find configs and IMPORTED targets, however, prevents doing
> > this,
> > because IMPORTED targets are not stored in CMake cache. This can be
> > a
> > significant disadvantage at times.
>
> Can you be more specific?
>
> Why can the user provide better information than the supplier of the 
> IMPORTED target?
>
> Thanks,
>
> Steve.
>
>
Well, sometimes you need to do certain "maintainer-specific" overrides:
include custom headers before everything, link to custom libraries
before everything and so on. Think LD_PRELOAD, but at link time.

--
Ivan Shapovalov / intelfx /
--

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

signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Editing IMPORTED targets

Stephen Kelly-2
Ivan Shapovalov wrote:

> On 2016-10-03 at 14:43 +0200, Stephen Kelly wrote:
>> Ivan Shapovalov wrote:
>>
>> > Hello!
>> >
>> > Using find modules to detect dependencies has a nice feature: it is
>> > then possible to edit the resulting cache entries to link to
>> > different
>> > libraries (or add other libraries along the found ones, for
>> > whatever
>> > purposes), or change directories, or flags, or whatever.
>> >
>> > Using find configs and IMPORTED targets, however, prevents doing
>> > this,
>> > because IMPORTED targets are not stored in CMake cache. This can be
>> > a
>> > significant disadvantage at times.
>>
>> Can you be more specific?
>>
>> Why can the user provide better information than the supplier of the
>> IMPORTED target?
>>
>> Thanks,
>>
>> Steve.
>>
>>
>
> Well, sometimes you need to do certain "maintainer-specific" overrides:
> include custom headers before everything, link to custom libraries
> before everything and so on. Think LD_PRELOAD, but at link time.

What is a 'maintainer' in that sentence? A 'maintainer' can change the
buildsystem CMake files. I suspect that's not an actor you mean. If you can
be more specific maybe I will understand.

Would 'wrapping' be a good solution?

 add_library(foo_wrapper INTERFACE)
 target_include_directories(foo_wrapper INTERFACE
   ${custom_includes}
   $<TARGET_PROPERTY:Foo::foo,INTERFACE_INCLUDE_DIRECTORIES>
 )
 target_link_libraries(foo_wrapper INTERFACE
   ${custom_libraries}
   Foo::foo
 )


Thanks,

Steve.


--

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