Hi,

I have the following problem and any help would be appreciated.

I have a shared library B which links to another shared library A
(with the new LINK_PRIVATE flag specified and the linking is carried
out against A's target). In B's CMake file, there is an export
statement for the shared library B which is causing problems.

Scenario 1:
When A is an imported target defined in a "ALibraryDepends.cmake"
loaded by find_package(A), I can simply export B with

export(TARGETS B
  FILE "${PROJECT_BINARY_DIR}/CMake/BLibraryDepends.cmake"
)

Here, export(TARGETS B A ...) fails since A is just imported but not
build by the project.

Scenario 2:
When A and B are both part of the same project, the find script of A
does not load "${PROJECT_BINARY_DIR}/CMake/ALibraryDepends.cmake"
since the target already exists in this project. But the export
statement from scenario 1) fails and I have to write

export(TARGETS B A
  FILE "${PROJECT_BINARY_DIR}/CMake/BLibraryDepends.cmake"
)

Here, export export(TARGETS B ...) fails because CMake needs to export
even the private shared library information. If I remember correctly,
there is something rpath specific behind this requirement.

Now I am wondering if there is any way to write my scripts such that
scenario 1) and scenario 2) are both working at the same time?

Any suggestions are appreciated.

Regards,
Hauke
--

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://www.cmake.org/mailman/listinfo/cmake

Reply via email to