Re: [CMake] Full paths for transitive dependencies

2015-03-18 Thread Stephen Kelly
Adam wrote:

> I happened to stumble acrosss this today.  I fixed it by adding another
> find_package to the last project but this seems to defeat the purpose of
> transitive dependencies.  What am I doing wrong?

The docs I linked to describe Config files which include() the result of 
install(EXPORT).

Thanks,

Steve.


-- 

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


Re: [CMake] Full paths for transitive dependencies

2015-03-17 Thread Adam
I happened to stumble acrosss this today.  I fixed it by adding another
find_package to the last project but this seems to defeat the purpose of
transitive dependencies.  What am I doing wrong?

Here's a more detailed example
(https://github.com/toomuchatonce/cmake_transient_issue.git)

---
app - CMakeLists.txt
cmake_minimum_required(VERSION 3.0.2)
add_executable(app main.cpp)
# uncomment to fix link error
#find_package( a NO_MODULE REQUIRED )
find_package( b NO_MODULE REQUIRED )
target_link_libraries(app b)
install(TARGETS app RUNTIME DESTINATION bin)
---
libb - CMakeLists.txt
cmake_minimum_required (VERSION 3.0.2)
project(b)
find_package(a NO_MODULE REQUIRED )
add_library(b lib.cpp)
target_link_libraries(b a)
target_include_directories(b PUBLIC "$")
install(TARGETS b EXPORT bConfig ARCHIVE DESTINATION lib/b )
install(FILES b.h DESTINATION include/b)
install(EXPORT bConfig DESTINATION lib/cmake/b )
--
liba - CMakeLists.txt
cmake_minimum_required (VERSION 3.0.2)
project(a)
add_library(a lib.cpp)
target_include_directories(a INTERFACE "$")
install(TARGETS a EXPORT aConfig ARCHIVE DESTINATION lib/a )
install(FILES a.h DESTINATION include/a)
install(EXPORT aConfig DESTINATION lib/cmake/a )
--
superbuild - CMakeLists.txt
cmake_minimum_required( VERSION 3.0.2 )
include(ExternalProject)
set(DEVROOT ${CMAKE_BINARY_DIR}/devroot)
set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEVROOT})
ExternalProject_Add(
   a
   CMAKE_ARGS ${CMAKE_ARGS}
   SOURCE_DIR ${CMAKE_SOURCE_DIR}/../liba
)
ExternalProject_Add(
   b
   DEPENDS a
   CMAKE_ARGS ${CMAKE_ARGS}
   SOURCE_DIR ${CMAKE_SOURCE_DIR}/../libb
)
ExternalProject_Add(
   app
   DEPENDS b
   CMAKE_ARGS ${CMAKE_ARGS}
   SOURCE_DIR ${CMAKE_SOURCE_DIR}/../app
)

Regards,
Adam

On Tue, Mar 17, 2015 at 4:50 AM, Stephen Kelly  wrote:

> Richard Taylor wrote:
>
> >
>
> http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
> >
>
> Prefer the official documentation instead of the wiki wherever official
> documentation exists (especially if it is well-formatted; that means it's
> probably recent and maintained).
>
>  http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
>
> > However, only the names of dependent targets are set (via
> > INTERFACE_LINK_LIBRARIES in Targets.cmake)
> >
> > I guess that's where the problem lies, I'm just not sure how to fix it..
>
> The above link documents a find_dependency macro, which you might make use
> of.
>
> Thanks,
>
> Steve.
>
>
> --
>
> 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
>
-- 

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

Re: [CMake] Full paths for transitive dependencies

2015-03-16 Thread Stephen Kelly
Richard Taylor wrote:

> 
http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
>

Prefer the official documentation instead of the wiki wherever official 
documentation exists (especially if it is well-formatted; that means it's 
probably recent and maintained).

 http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
 
> However, only the names of dependent targets are set (via
> INTERFACE_LINK_LIBRARIES in Targets.cmake)
> 
> I guess that's where the problem lies, I'm just not sure how to fix it..

The above link documents a find_dependency macro, which you might make use 
of.

Thanks,

Steve.


-- 

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


[CMake] Full paths for transitive dependencies

2015-03-16 Thread Richard Taylor
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
Targets-.cmake from B, it's own location is specified
as a full path (set via IMPORTED_LOCATION_)

However, only the names of dependent targets are set (via
INTERFACE_LINK_LIBRARIES in 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