[CMake] find_package implemented with exported targets

Adolfo Rodríguez dofo79 at gmail.com
Thu Mar 26 05:16:42 EDT 2009


Hi,

I have a CMake project that when installed provides a FindFoo.cmake module
whose internals rely on find_path, find_library, etc.. I am considering
switching the module implementation to a foo-config.cmake script and target
exporting/importing. In the process I have run into a couple of hurdles and
I'd like to know if they are easy to overcome:

- In the current FindFoo module,  the list of libraries associated to the
package are contained in a Foo_LIBRARIES variable, and I would like to
preserve the existing interface, e.g., continue to do
target_link_libraries(bar ${Foo_LIBRARIES}). Is there an automated way to
obtain such a variable, I mean, one that contains all the targets (and
preferrable only the libraries) exported by Foo?

- I am storing Foo's header files in Foo_INCLUDE_DIRS. However, I'm also
interested in including Foo's external dependency paths (say, bring Boost's
headers into scope when I use Foo). Must I do this manually in my
foo-config.cmake script?.

I haven't found anything in the docs that points that this might be
possible. Maybe it's something too specific of my use-case.

Cheers,

-- 
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090326/f9d79e08/attachment.htm>


More information about the CMake mailing list