private export

Jeremy Whiting jpwhiting at kde.org
Tue Oct 14 23:20:28 UTC 2014


Meh, Albert found a decent enough way to do it. Posted to rb to look at.

On Tue, Oct 14, 2014 at 5:03 PM, Aleix Pol <aleixpol at kde.org> wrote:
> On Tue, Oct 14, 2014 at 10:37 PM, Jeremy Whiting <jpwhiting at kde.org> wrote:
>>
>> Hello,
>>
>> In KNewStuff autotests there are two disabled tests that build and
>> work if I export the Author and EntryInternal classes, but these two
>> classes are private (declared in _p.h files) so I'd rather not export
>> them, since they aren't public api. Is there a way to have them
>> exported when BUILD_TESTING is set only? I didn't see anything obvious
>> in the knewstuff_export.h generated header. I guess I could have the
>> class declarations wrapped in #ifdef BUILD_TESTING but that seems like
>> a hack. Is there a proper way to only export private classes when
>> building and running tests?
>>
>> thanks,
>> Jeremy
>
>
> You can do things like that with cmake library objects. See documentation
> for add_library(... OBJECT ...).
>
> It will make it possible for you to have objects in different targets so
> they are compiled once but in different places. I used it here as a test
> [1]. It's not magic, but it saves some compilation time and possible
> complexity.
>
> Cheers!
> Aleix
>
> [1] kde:scratch/apol/kanboardclient
>
> _______________________________________________
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
>


More information about the Kde-frameworks-devel mailing list