[CMake] source code introspection

Michael Wild themiwi at gmail.com
Tue Aug 30 10:54:39 EDT 2011


On Tue 30 Aug 2011 04:46:54 PM CEST, Joshua Auerbach wrote:
> Hi,
> 
> I am fairly new to cmake and am trying to determine if something is
> possible to do.  I was not having success with my web searches so will
> try asking here.
> 
> In my project I have an interface (class with pure virtual functions)
> that other classes extend/implement.  Is it somehow possible with cmake
> to determine all the classes in a directory that implement this interface?
> 
> Thanks,
> Josh

You can give it a try with file(READ...) and if(... MATCHES ...) 
constructs. But usually it is safer to just maintain a list of those 
classes in a string list. Everything else is very fragile in my 
experience.

Michael



More information about the CMake mailing list