[CMake] Import/export issue with shared library
Hauke Heibel
hauke.heibel at googlemail.com
Sun Jan 8 12:25:50 EST 2012
Hi Eric,
On Sun, Jan 8, 2012 at 5:20 PM, Eric Noulard <eric.noulard at gmail.com> wrote:
> I'm not sure how you compile your example.
> Should they be built in-source?
> Do you create out-of-source build tree for each A,B,SomeProject?
I usually build out-of-source. What is built out-of-source is up to
the user. Typically, we build A once and leave it untouched and then
work on an isolated out-of-source build of B. SomeProject is usually
used only when everything is bundled into a single installer.
> However from your last message it seems like you
>
> export(TARGETS B A ...
>
> statements depends on the fact that A (resp B.) is an imported target or not.
Exactly.
> So may be you could add
>
> get_target_property(IA IMPORTED A)
>
> if (NOT IA)
> set(EXPORTEDA "A")
> else()
> set(EXPORTEDA "")
> endif()
>
> export(TARGETS B ${EXPORTEDA} ...
>
> Would this work for you use case?
This is interesting; I did not know about the IMPORTED property. I
could integrate this query into my hand-crafted export macro and I am
quite sure that it would help.
Thanks,
Hauke
More information about the CMake
mailing list