1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmGetFilenameComponentCommand.h,v $
6 Date: $Date: 2002-01-21 20:30:25 $
7 Version: $Revision: 1.5 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmGetFilenameComponentCommand_h
18 #define cmGetFilenameComponentCommand_h
20 #include "cmCommand.h"
22 /** \class cmGetFilenameComponentCommand
23 * \brief Get a specific component of a filename.
25 * cmGetFilenameComponentCommand is a utility command used to get the path,
26 * name, extension or name without extension of a full filename.
28 class cmGetFilenameComponentCommand
: public cmCommand
32 * This is a virtual constructor for the command.
34 virtual cmCommand
* Clone()
36 return new cmGetFilenameComponentCommand
;
40 * This is called when the command is first encountered in
41 * the CMakeLists.txt file.
43 virtual bool InitialPass(std::vector
<std::string
> const& args
);
46 * This determines if the command gets propagated down
47 * to makefiles located in subdirectories.
49 virtual bool IsInherited() { return true; }
52 * The name of the command as specified in CMakeList.txt.
54 virtual const char* GetName() { return "GET_FILENAME_COMPONENT";}
57 * Succinct documentation.
59 virtual const char* GetTerseDocumentation()
61 return "Get a specific component of a full filename.";
67 virtual const char* GetFullDocumentation()
70 "GET_FILENAME_COMPONENT(VarName FileName PATH|NAME|EXT|NAME_WE [CACHE])\n"
71 "Set VarName to be the path (PATH), file name (NAME), file "
72 "extension (EXT) or file name without extension (NAME_WE) of FileName.\n"
73 "Note that the path is converted to Unix slashes format and has no "
74 "trailing slashes. The longest file extension is always considered.\n"
75 "Warning: as a utility command, the resulting value is not put in the "
76 "cache but in the definition list, unless you add the optional CACHE "
80 cmTypeMacro(cmGetFilenameComponentCommand
, cmCommand
);