[CMake] normalize paths

James Bigler jamesbigler at gmail.com
Tue Jul 7 16:54:39 EDT 2009


Ugh, I forgot about get_filename_component:

            get_filename_component(VarName FileName
                                   PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH
                                   [CACHE])

ABSOLUTE seems to normalize the file paths.

James

On Tue, Jul 7, 2009 at 2:48 PM, James Bigler <jamesbigler at gmail.com> wrote:

> Is there a way to normalize or flatten a path to a file?
>
> I have two paths that I need to compare:
>
> C:\path\to\file and C:\path\to\other\..\file
>
> I need a way to collapse the second paths into something that looks like
> the first, so that I could use a string comparison on the filenames to see
> if they point to the same thing.
>
> Thanks,
> James
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090707/31c4b182/attachment.htm>


More information about the CMake mailing list