1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmSourceFile.h,v $
7 Date: $Date: 2008/01/30 16:21:54 $
8 Version: $Revision: 1.25 $
10 Date: $Date: 2008-04-29 18:17:42 $
11 Version: $Revision: 1.26 $
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #ifndef cmSourceFile_h
23 #define cmSourceFile_h
25 #include "cmSourceFileLocation.h"
26 #include "cmCustomCommand.h"
27 #include "cmPropertyMap.h"
31 /** \class cmSourceFile
32 * \brief Represent a class loaded from a makefile.
34 * cmSourceFile is represents a class loaded from
41 * Construct with the makefile storing the source and the initial
42 * name referencing it.
44 cmSourceFile(cmMakefile
* mf
, const char* name
);
49 * Get the list of the custom commands for this source file
51 cmCustomCommand
* GetCustomCommand();
52 cmCustomCommand
const* GetCustomCommand() const;
53 void SetCustomCommand(cmCustomCommand
*cc
);
55 ///! Set/Get a property of this source file
56 void SetProperty(const char *prop
, const char *value
);
57 void AppendProperty(const char* prop
, const char* value
);
58 const char *GetProperty(const char *prop
) const;
59 bool GetPropertyAsBool(const char *prop
) const;
61 /** Implement getting a property when called from a CMake language
62 command like get_property or get_source_file_property. */
63 const char* GetPropertyForUser(const char *prop
);
66 * The full path to the file. The non-const version of this method
67 * may attempt to locate the file on disk and finalize its location.
68 * The const version of this method may return an empty string if
69 * the non-const version has not yet been called (yes this is a
70 * horrible interface, but is necessary for backwards
73 std::string
const& GetFullPath();
74 std::string
const& GetFullPath() const;
77 * Get the information currently known about the source file
78 * location without attempting to locate the file as GetFullPath
79 * would. See cmSourceFileLocation documentation.
81 cmSourceFileLocation
const& GetLocation() const;
84 * Get the file extension of this source file.
86 std::string
const& GetExtension() const;
89 * Get the language of the compiler to use for this source file.
91 const char* GetLanguage();
92 const char* GetLanguage() const;
95 * Return the vector that holds the list of dependencies
97 const std::vector
<std::string
> &GetDepends() const {return this->Depends
;}
98 void AddDepend(const char* d
) { this->Depends
.push_back(d
); }
100 // Get the properties
101 cmPropertyMap
&GetProperties() { return this->Properties
; };
103 // Define the properties
104 static void DefineProperties(cmake
*cm
);
107 * Check whether the given source file location could refer to this
110 bool Matches(cmSourceFileLocation
const&);
113 cmSourceFileLocation Location
;
114 cmPropertyMap Properties
;
115 cmCustomCommand
* CustomCommand
;
116 std::string Extension
;
117 std::string Language
;
118 std::string FullPath
;
119 bool FindFullPathFailed
;
122 bool TryFullPath(const char* tryPath
, const char* ext
);
123 void CheckExtension();
124 void CheckLanguage(std::string
const& ext
);
126 std::vector
<std::string
> Depends
;