Finding dependencies in config files
Stephen Kelly
steveire at gmail.com
Sun Feb 17 19:22:25 UTC 2013
Alexander Neundorf wrote:
> On Saturday 16 February 2013, Alexander Neundorf wrote:
>> On Saturday 16 February 2013, Stephen Kelly wrote:
>> > commit 6bf0ad9fc7807f341ca924235d2f1e54b8038881
>> > Author: Alex Neundorf <neundorf at kde.org>
>> > Date: Sat Feb 9 18:50:06 2013 +0100
>> >
>> > kguiaddons: check that kconfig has been found in the Config.cmake
>> > file
>> >
>> > Alex
>> >
>> > diff --git a/staging/kguiaddons/kguiaddonsConfig.cmake.in
>> > b/staging/kguiaddons/kguiaddonsConfig.cmake.in
>> > index 8f1278f..325ef2c 100644
>> > --- a/staging/kguiaddons/kguiaddonsConfig.cmake.in
>> > +++ b/staging/kguiaddons/kguiaddonsConfig.cmake.in
>> > @@ -2,6 +2,12 @@
>> >
>> > # Any changes in this file will be overwritten by CMake.
>> >
>> > +if(NOT TARGET KF5::kconfigcore)
>> > + set(kconfig_NOT_FOUND_MESSAGE "kguiaddons depends on the package
>> > kconfig, which is missing. Use find_package() to find it before
>> > kguiaddons.")
>> > + set(kconfig_FOUND FALSE)
>> > + return()
>> > +endif()
>> >
>> >
>> > Still, the correct approach is to find_package the dependencies in the
>> > config file. Do you have some objection to doing so?
>>
>> No, not at all :-)
>> As I said, this is just the quick fix.
>
> Well, one thing I wondered about is whether it might be also a good idea
> to have just those checks inside the individual Config.cmake files, and
> care about finding the dependencies only in FindKF5.cmake.
I don't think that's a good idea. For third parties, using many frameworks
should be as simple as this:
find_package(karchive REQUIRED)
target_link_libraries(foo KF5::karchive)
Config files need to find their own dependencies. There's no need to attempt
to maintain (and version) that externally in ecm. There's no need for a
config file to depend on ecm.
Thanks,
Steve.
More information about the Kde-frameworks-devel
mailing list