[CMake] basename macro

Eric Noulard eric.noulard at gmail.com
Mon Sep 10 12:40:45 EDT 2007


2007/9/10, Juan Sanchez <Juan.Sanchez at amd.com>:
> Is there a basename macro to remove the file extension from a name?  I
> am using 2.4.7.

Look at the

GET_FILENAME_COMPONENT

CMake builtin macro.

>>>
Get a specific component of a full filename.

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

       Set VarName to be the path (PATH), file name (NAME), file extension
       (EXT), file name without extension (NAME_WE) of FileName, or the full
       absolute (ABSOLUTE) file name without symlinks.  Note that the path is
       converted to Unix slashes format and has no trailing slashes.  The
       longest file extension is always considered.  If the optional CACHE
       argument is specified, the result variable is added to the cache.

>>>
-- 
Erk


More information about the CMake mailing list