1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSourceFile.h,v $
6 Date: $Date: 2008-04-29 18:17:42 $
7 Version: $Revision: 1.26 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmSourceFile_h
18 #define cmSourceFile_h
20 #include "cmSourceFileLocation.h"
21 #include "cmCustomCommand.h"
22 #include "cmPropertyMap.h"
26 /** \class cmSourceFile
27 * \brief Represent a class loaded from a makefile.
29 * cmSourceFile is represents a class loaded from
36 * Construct with the makefile storing the source and the initial
37 * name referencing it.
39 cmSourceFile(cmMakefile
* mf
, const char* name
);
44 * Get the list of the custom commands for this source file
46 cmCustomCommand
* GetCustomCommand();
47 cmCustomCommand
const* GetCustomCommand() const;
48 void SetCustomCommand(cmCustomCommand
*cc
);
50 ///! Set/Get a property of this source file
51 void SetProperty(const char *prop
, const char *value
);
52 void AppendProperty(const char* prop
, const char* value
);
53 const char *GetProperty(const char *prop
) const;
54 bool GetPropertyAsBool(const char *prop
) const;
56 /** Implement getting a property when called from a CMake language
57 command like get_property or get_source_file_property. */
58 const char* GetPropertyForUser(const char *prop
);
61 * The full path to the file. The non-const version of this method
62 * may attempt to locate the file on disk and finalize its location.
63 * The const version of this method may return an empty string if
64 * the non-const version has not yet been called (yes this is a
65 * horrible interface, but is necessary for backwards
68 std::string
const& GetFullPath();
69 std::string
const& GetFullPath() const;
72 * Get the information currently known about the source file
73 * location without attempting to locate the file as GetFullPath
74 * would. See cmSourceFileLocation documentation.
76 cmSourceFileLocation
const& GetLocation() const;
79 * Get the file extension of this source file.
81 std::string
const& GetExtension() const;
84 * Get the language of the compiler to use for this source file.
86 const char* GetLanguage();
87 const char* GetLanguage() const;
90 * Return the vector that holds the list of dependencies
92 const std::vector
<std::string
> &GetDepends() const {return this->Depends
;}
93 void AddDepend(const char* d
) { this->Depends
.push_back(d
); }
96 cmPropertyMap
&GetProperties() { return this->Properties
; };
98 // Define the properties
99 static void DefineProperties(cmake
*cm
);
102 * Check whether the given source file location could refer to this
105 bool Matches(cmSourceFileLocation
const&);
108 cmSourceFileLocation Location
;
109 cmPropertyMap Properties
;
110 cmCustomCommand
* CustomCommand
;
111 std::string Extension
;
112 std::string Language
;
113 std::string FullPath
;
114 bool FindFullPathFailed
;
117 bool TryFullPath(const char* tryPath
, const char* ext
);
118 void CheckExtension();
119 void CheckLanguage(std::string
const& ext
);
121 std::vector
<std::string
> Depends
;