[cmake-developers] Should a module attempt to find its own dependencies?

David Cole david.cole at kitware.com
Sun Jan 8 21:07:53 EST 2012


On Sunday, January 8, 2012, Alexander Neundorf <neundorf at kde.org> wrote:
> On Sunday 08 January 2012, Stephen Kelly wrote:
>> Alexander Neundorf wrote:
>> > On Sunday 08 January 2012, Stephen Kelly wrote:
>> >> Hi,
>> >>
>> >> I don't think I've ever seen a direct answer to this question.
>> >
>> > AFAIK, yes, they should.
>> > FindKDE4Internal.cmake finds Qt, FindPNG.cmake finds zlib.
>> >
>> >> Is it something to be decided on a case by case basis? If so, then why
>> >> is there no general case?
>> >>
>> >> I can see a possible reason that it is not solvable in the general
case
>> >> because sometimes the behaviour of find_package can be changed by
>> >> setting variables (eg, one might use QT_USE_QTXMLPATTERNS before
>> >> finding Qt4).
>> >>
>> >> Specifically this comes up for me because I need to know whether Qt5
>> >> modules should find their own dependencies. That is, should
>> >>
>> >> find_package(Qt5Gui)
>> >>
>> >> cause
>> >>
>> >> find_package(Qt5Core REQUIRED)
>> >>
>> >> to be called or not?
>> >
>> > I'd say yes.
>> > Otherwise the imported targets in Qt5Gui will depend on not yet defined
>> > targets from Qt5Core.
>> >
>> > The same way cmake takes care of adding the required additional
libraries
>> > to the link line (like adding zlib when linking libpng), it should also
>> > take care of this, IMO.
>> >
>> > You should just have to state
>> > find_package(Foo)
>> > and this will get you Foo.
>>
>> That implies that
>>
>> * Qt5Gui_INCLUDE_DIRS should also contain Qt5Core_INCLUDE_DIRS
>>
>> * Qt5Gui_DEFINITIONS should contain Qt5Core_DEFINITIONS
>>
>> * Qt5Gui_COMPILE_DEFINITIONS should contain Qt5Core_COMPILE_DEFINITIONS
>>
>> Right?
>
>
> Yes, I'd say so.
> But let's wait also for some opinions from others.
>
> Alex
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>

I'd say so too. Waiting for a dissenting opinion... ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20120108/8150776c/attachment-0001.htm>


More information about the cmake-developers mailing list