Automatic inclusion of import targets found by find_package()?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Automatic inclusion of import targets found by find_package()?

Robert Dailey-2
Let's say I have my own upstream library and I export a target for it.
This subsequent cmake file (containing my IMPORT target definition) is
included with my tarball.

When a consuming project wants to find and use my import targets, they
currently have to do (consider this pseudocode since i just typed it
up for example purposes):

find_package(mylibrary REQUIRED CONFIG)
include(${mylibrary_DIR}/lib/cmake/mylibrary-0.1.2/mylibrary.cmake)
add_executable(fubar mylibrary)

It would be nice if the include part happened automatically. Mostly
because since the version number is intertwined with the path, it
makes explicitly specifying it cumbersome and high maintenance.

Is there more automation here that I'm not seeing? Thanks in advance.
--

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 | Threaded
Open this post in threaded view
|

Re: Automatic inclusion of import targets found by find_package()?

Stephen Kelly-2
Robert Dailey wrote:

> Is there more automation here that I'm not seeing? Thanks in advance.

Yes, the documentation tells you to include what you need in the config
file:

 https://cmake.org/cmake/help/v3.6/manual/cmake-packages.7.html#creating-a-package-configuration-file

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
Reply | Threaded
Open this post in threaded view
|

Re: Automatic inclusion of import targets found by find_package()?

Robert Dailey-2
On Sun, Jul 10, 2016 at 5:11 PM, Stephen Kelly <[hidden email]> wrote:
> Robert Dailey wrote:
>
>> Is there more automation here that I'm not seeing? Thanks in advance.
>
> Yes, the documentation tells you to include what you need in the config
> file:
>
>  https://cmake.org/cmake/help/v3.6/manual/cmake-packages.7.html#creating-a-package-configuration-file

Thanks, I realized this a bit too late. The title of the section was a
little misleading, I thought that section would go over the normal
find module scenario, not the config package one. In other words, the
section above it already gave instructions on creating the config
package file.
--

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