summaryrefslogtreecommitdiff
path: root/Source/cmSourceFile.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSourceFile.h')
-rw-r--r--Source/cmSourceFile.h67
1 files changed, 44 insertions, 23 deletions
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index edad4c7b5..82a3625b8 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -5,14 +5,16 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "cmCustomCommand.h"
+#include "cmListFileCache.h"
#include "cmPropertyMap.h"
#include "cmSourceFileLocation.h"
#include "cmSourceFileLocationKind.h"
-#include <string>
-#include <vector>
-
-class cmCustomCommand;
class cmMakefile;
/** \class cmSourceFile
@@ -32,17 +34,11 @@ public:
cmMakefile* mf, const std::string& name,
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
- ~cmSourceFile();
-
- cmSourceFile(const cmSourceFile&) = delete;
- cmSourceFile& operator=(const cmSourceFile&) = delete;
-
/**
- * Get the list of the custom commands for this source file
+ * Get the custom command for this source file
*/
- cmCustomCommand* GetCustomCommand();
- cmCustomCommand const* GetCustomCommand() const;
- void SetCustomCommand(cmCustomCommand* cc);
+ cmCustomCommand* GetCustomCommand() const;
+ void SetCustomCommand(std::unique_ptr<cmCustomCommand> cc);
//! Set/Get a property of this source file
void SetProperty(const std::string& prop, const char* value);
@@ -62,15 +58,31 @@ public:
/// @return Equivalent to GetPropertyAsBool("GENERATED")
bool GetIsGenerated() const { return this->IsGenerated; }
+ const std::vector<BT<std::string>>& GetCompileOptions() const
+ {
+ return this->CompileOptions;
+ }
+
+ const std::vector<BT<std::string>>& GetCompileDefinitions() const
+ {
+ return this->CompileDefinitions;
+ }
+
+ const std::vector<BT<std::string>>& GetIncludeDirectories() const
+ {
+ return this->IncludeDirectories;
+ }
+
/**
- * The full path to the file. The non-const version of this method
- * may attempt to locate the file on disk and finalize its location.
- * The const version of this method may return an empty string if
- * the non-const version has not yet been called (yes this is a
- * horrible interface, but is necessary for backwards
- * compatibility).
+ * Resolves the full path to the file. Attempts to locate the file on disk
+ * and finalizes its location.
+ */
+ std::string const& ResolveFullPath(std::string* error = nullptr);
+
+ /**
+ * The resolved full path to the file. The returned file name might be empty
+ * if the path has not yet been resolved.
*/
- std::string const& GetFullPath(std::string* error = nullptr);
std::string const& GetFullPath() const;
/**
@@ -88,7 +100,7 @@ public:
/**
* Get the language of the compiler to use for this source file.
*/
- std::string GetLanguage();
+ std::string const& GetOrDetermineLanguage();
std::string GetLanguage() const;
/**
@@ -98,8 +110,9 @@ public:
void AddDepend(const std::string& d) { this->Depends.push_back(d); }
// Get the properties
- cmPropertyMap& GetProperties() { return this->Properties; }
const cmPropertyMap& GetProperties() const { return this->Properties; }
+ // Set the properties
+ void SetProperties(cmPropertyMap properties);
/**
* Check whether the given source file location could refer to this
@@ -113,12 +126,15 @@ public:
private:
cmSourceFileLocation Location;
cmPropertyMap Properties;
- cmCustomCommand* CustomCommand = nullptr;
+ std::unique_ptr<cmCustomCommand> CustomCommand;
std::string Extension;
std::string Language;
std::string FullPath;
std::string ObjectLibrary;
std::vector<std::string> Depends;
+ std::vector<BT<std::string>> CompileOptions;
+ std::vector<BT<std::string>> CompileDefinitions;
+ std::vector<BT<std::string>> IncludeDirectories;
bool FindFullPathFailed = false;
bool IsGenerated = false;
@@ -129,6 +145,9 @@ private:
static const std::string propLANGUAGE;
static const std::string propLOCATION;
static const std::string propGENERATED;
+ static const std::string propCOMPILE_DEFINITIONS;
+ static const std::string propCOMPILE_OPTIONS;
+ static const std::string propINCLUDE_DIRECTORIES;
};
// TODO: Factor out into platform information modules.
@@ -139,6 +158,8 @@ private:
"hpj" \
"|bat)$"
+#define CM_PCH_REGEX "cmake_pch\\.(h|hxx)$"
+
#define CM_RESOURCE_REGEX "\\.(pdf|plist|png|jpeg|jpg|storyboard|xcassets)$"
#endif