summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFile.h
diff options
context:
space:
mode:
authorDeniz Bahadir <dbahadir@benocs.com>2020-11-09 00:06:51 (GMT)
committerDeniz Bahadir <dbahadir@benocs.com>2020-11-24 17:16:51 (GMT)
commit6624b65b3f478574512a23a7220abff4ed590011 (patch)
tree41a239c43b3a223ea8f27beac5b12d299d39c62c /Source/cmSourceFile.h
parentb14fe704f8fad5785f10f0d56c5b49a8e0e0e94c (diff)
downloadCMake-6624b65b3f478574512a23a7220abff4ed590011.zip
CMake-6624b65b3f478574512a23a7220abff4ed590011.tar.gz
CMake-6624b65b3f478574512a23a7220abff4ed590011.tar.bz2
GENERATED prop: Add implementation for policy CMP0118 being set to NEW
* Adding implementation for policy CMP0118 being set to `NEW`. * Adding new tests for policy CMP0118 being set to `NEW`. * Checking the `GENERATED` property with `get_source_file_property` or `get_property` now always returns exactly `1` or `0`. No other values will be returned. Note, that this is a backwards-incompatible change, even when policy CMP0118 is unset or set to `OLD`. * Additionally, as `get_source_file_property` and `get_property` now always check if a source-file was marked globally visible, even when CMP0118 is unset or set to `OLD`, they possibly return `1` where they might have returned `0` before the changes introduced by this commit. Note, that this is a backwards-incompatible change, even when policy CMP0118 is unset or set to `OLD`. * As a consequence, the tests for policy CMP0118 being unset or set to `OLD` got slightly adjusted, too, to reflect these changes in behavior.
Diffstat (limited to 'Source/cmSourceFile.h')
-rw-r--r--Source/cmSourceFile.h36
1 files changed, 28 insertions, 8 deletions
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 3ad2664..94b5cc8 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -20,18 +20,18 @@ class cmMakefile;
/** \class cmSourceFile
* \brief Represent a class loaded from a makefile.
*
- * cmSourceFile is represents a class loaded from
- * a makefile.
+ * cmSourceFile represents a class loaded from a makefile.
*/
class cmSourceFile
{
public:
/**
- * Construct with the makefile storing the source and the initial
- * name referencing it.
+ * Construct with the makefile storing the source and the initial name
+ * referencing it. If it shall be marked as generated, this source file's
+ * kind is assumed to be known, regardless of the given value.
*/
cmSourceFile(
- cmMakefile* mf, const std::string& name,
+ cmMakefile* mf, const std::string& name, bool generated,
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
/**
@@ -54,9 +54,29 @@ public:
command like get_property or get_source_file_property. */
cmProp GetPropertyForUser(const std::string& prop);
- //! Checks is the GENERATED property is set and true
- /// @return Equivalent to GetPropertyAsBool("GENERATED")
- bool GetIsGenerated() const { return this->IsGenerated; }
+ /// Marks this file as generated
+ /**
+ * This stores this file's path in the global table for all generated source
+ * files.
+ */
+ void MarkAsGenerated();
+ enum class CheckScope
+ {
+ Global,
+ GlobalAndLocal
+ };
+ /// Determines if this source file is marked as generated.
+ /**
+ * This will check if this file's path is stored in the global table of all
+ * generated source files. If that is not the case and checkScope is set to
+ * GlobalAndLocal the value of the possibly existing local GENERATED property
+ * is returned instead.
+ * @param checkScope Determines if alternatively for backwards-compatibility
+ * a local GENERATED property should be considered, too.
+ * @return true if this source file is marked as generated, otherwise false.
+ */
+ bool GetIsGenerated(
+ CheckScope checkScope = CheckScope::GlobalAndLocal) const;
const std::vector<BT<std::string>>& GetCompileOptions() const
{