[CMake] CMAKE way to get leaf of file path

Russell L. Carter rcarter at esturion.net
Sat Nov 6 21:07:53 EDT 2010


Hi there,
Happy cmake user here.  I want to retrieve the leaf name of
the directory property "PARENT_DIRECTORY".  This is really
a more general cmake question:  how do I most efficiently
manipulate path components of the absolute pathnames that
cmake uses and returns for many variables?

In the current case, suppose I have

"/home/me/project/src/module/help"

how do I, in the best CMAKE WAY, extract the leaf, "help"?

string(REGEXP) or something like that?

I would love to be able to run a bash script on the full
path and return just the leaf...  can I do that?

Thanks,
Russell



More information about the CMake mailing list