[CMake] CMAKE way to get leaf of file path

Russell L. Carter rcarter at esturion.net
Mon Nov 8 15:31:37 EST 2010


On 11/08/2010 12:59 PM, Alexander Neundorf wrote:

> 
> To get the last component of a path, use
> get_filename_component(... NAME)
> To get the parent directory, use
> get_filename_component(... PATH)
> 
> 
> When you need to generate a unique name from a path, you could use the 
> STRING() command to replace all "/" with e.g. an underscore.


Thanks... there's more than one way to do it.  I've got this
integrated into my test generation macros and once again cmake
makes abstracting build structure just about effortless.

A most excellent tool.

Cheers,
Russell


> 
> Alex



More information about the CMake mailing list