[CMake] Getting a list of all targets?

David Cole david.cole at kitware.com
Mon Sep 6 09:21:22 EDT 2010


On Mon, Sep 6, 2010 at 3:21 AM, Chris Hillery <chillery-cmake at lambda.nu>wrote:

> On Sun, Sep 5, 2010 at 10:06 PM, Clifford Yapp <cliffyapp at gmail.com>wrote:
>
>> I was hoping I wouldn't need to do a custom wrapper for every target,
>> particularly since I'm building some sub-projects using foreign
>> CMakeLists.txt files and I'd really rather not change them from their
>> default state - that's an extra maintainance burden and one of the
>> advantages I'm most hoping for with CMake is to be able to use
>> external build logic without altering it.
>>
>
> Well, if Michael's correct about the original form being available with an
> _ prefix, then at least you wouldn't have to modify any sub-project build
> files. Just
>
> function (add_library name ....)
>   # do stuff to remember this target
>   _add_library (name ....)
> endfunction (add_library)
>
> Not 100% ideal, but a relatively small amount of work should get you what
> you asked for initially, I think.
>
> Ceej
> aka Chris Hillery
>
> _______________________________________________
> 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
>


This is the "right approach" for now. There is currently no way to iterate
over targets in the CMakeLists files...

HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100906/5abde7d5/attachment-0001.htm>


More information about the CMake mailing list