diff options
author | Brad King <brad.king@kitware.com> | 2020-11-30 17:38:03 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-11-30 17:38:17 (GMT) |
commit | 0173cdcc012945901190e883283adfbbba61f491 (patch) | |
tree | f7c17e87cee8969a68b19fad20575be03276d99e /Source/cmSourceFile.h | |
parent | cf93438ae2e92bbbc35a64543c08e06706a2942c (diff) | |
parent | 573d51201acb5d922e96e496b25d00092953ffd5 (diff) | |
download | CMake-0173cdcc012945901190e883283adfbbba61f491.zip CMake-0173cdcc012945901190e883283adfbbba61f491.tar.gz CMake-0173cdcc012945901190e883283adfbbba61f491.tar.bz2 |
Merge topic 'make-GENERATED-visible-from-any-scope'
573d51201a GENERATED prop: Set CMP0118 to NEW for some (unrelated) tests
6624b65b3f GENERATED prop: Add implementation for policy CMP0118 being set to NEW
b14fe704f8 GENERATED prop: Simplify determining the language of a source file
ca4ce458a3 GENERATED prop: Check CMP0118 policy and warn in certain situations
0eb30f175e GENERATED prop: Introducing policy CMP0118 and its documentation
78c8d95605 GENERATED prop: Add some tests before introducing changes with CMP0118
e01527619f Simplify code by calling a function directly instead of duplicating it
75cb8615e9 Fix typo in function name
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5308
Diffstat (limited to 'Source/cmSourceFile.h')
-rw-r--r-- | Source/cmSourceFile.h | 36 |
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 { |