[CMake] Get the list of all TARGETS?

Michael Wild themiwi at gmail.com
Tue Jan 18 05:10:19 EST 2011


On 01/18/2011 10:55 AM, Eric Noulard wrote:
> Hi All,
> 
> Is it possible to get the list of all targets defined in a project (or
> CMakeLists.txt or directory ...)
> from within  a CMakeLists.txt ?
> 
> Is there some properties for this?
> I did search but didn't find anything, but may be I didn't looked in
> the right place?
> 

Unfortunately, no. That's why I usually wrap add_executable, add_library
etc. in corresponding foo_add_executable, foo_add_library, ... functions
which append the target names to global properties.

Michael


More information about the CMake mailing list