Hello, I'm a CMake newbie trying to build a chain of libraries on windows,
let's call them A, B and C

A is a standalone shared library
B is a shared library that depends on A in its headers & implementation
C is a shared library that depends on B (and so implicitly depends on A)

All three export themselves as cmake packages - config generation is
essentially a copy & paste job from
http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file

Each is built and installed in turn.

B uses find_package(A) - The installed location of A's .cmake files is
provided during configuration by setting the A_DIR var.
C is built similarly via find_package(B) and providing the location of the
installed .cmake files for B.

B builds fine and finds & links to it's dependency A using the full
installed path of A.
C finds B, and knows it is dependent on A, but the linker is only passed
the name of A rather than the full path. No additional library paths get
added to the generated project, so the build fails at link time.

Is it normal behaviour that you need to manually specify the location of
all public transitive dependencies somehow, or am I doing something wrong
when exporting targets?

I figured that as B was installed using a known location of A, C should be
able to find A from B's installed configs. Looking at the installed
<targetname>Targets-<config>.cmake from B, it's own location is specified
as a full path (set via IMPORTED_LOCATION_<CONFIG>)

However, only the names of dependent targets are set (via
INTERFACE_LINK_LIBRARIES in <targetname>Targets.cmake)

I guess that's where the problem lies, I'm just not sure how to fix it..

Rich
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to