summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-24 13:42:15 (GMT)
committerBrad King <brad.king@kitware.com>2021-02-25 18:24:45 (GMT)
commita133a583d484028f8b03bd791ebea8ba0cf96b84 (patch)
tree0674b75f633c0785f8b095b3606f84a6e87ba103 /Source/cmLocalGenerator.h
parentc99db7153337865861ccb79c8f855d4d9f3539fc (diff)
downloadCMake-a133a583d484028f8b03bd791ebea8ba0cf96b84.zip
CMake-a133a583d484028f8b03bd791ebea8ba0cf96b84.tar.gz
CMake-a133a583d484028f8b03bd791ebea8ba0cf96b84.tar.bz2
cmLocalGenerator: Clarify GetIncludeFlags signature
Make the `config` argument non-optional so all callers must be explicit. Convert the path style argument to an enumeration to make its role clear at call sites. The path style argument is implemented by `ConvertToIncludeReference`, which was introduced with the Ninja generator by commit 5b114c9bee (Introduce a cmLocalGenerator::ConvertToIncludeReference function, 2011-09-07, v2.8.7~187^2~4). Its only purpose is to allow the Ninja generator to use relative paths in `-I` flags. Add a comment explaining this role.
Diffstat (limited to 'Source/cmLocalGenerator.h')
-rw-r--r--Source/cmLocalGenerator.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index e48849a..f597120 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -171,13 +171,19 @@ public:
cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
+
+ enum class IncludePathStyle
+ {
+ Default,
+ Absolute,
+ };
+
//! Get the include flags for the current makefile and language
- std::string GetIncludeFlags(const std::vector<std::string>& includes,
- cmGeneratorTarget* target,
- const std::string& lang,
- bool forceFullPaths = false,
- bool forResponseFile = false,
- const std::string& config = "");
+ std::string GetIncludeFlags(
+ std::vector<std::string> const& includes, cmGeneratorTarget* target,
+ std::string const& lang, std::string const& config,
+ bool forResponseFile = false,
+ IncludePathStyle pathStyle = IncludePathStyle::Default);
using GeneratorTargetVector =
std::vector<std::unique_ptr<cmGeneratorTarget>>;
@@ -256,11 +262,6 @@ public:
bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
- virtual std::string ConvertToIncludeReference(
- std::string const& path,
- cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
- bool forceFullPaths = false);
-
/** Called from command-line hook to clear dependencies. */
virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {}
@@ -557,6 +558,13 @@ public:
cmProp GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop);
protected:
+ // The default implementation ignores the IncludePathStyle and always
+ // uses absolute paths. A generator may override this to use relative
+ // paths in some cases.
+ virtual std::string ConvertToIncludeReference(
+ std::string const& path, IncludePathStyle pathStyle,
+ cmOutputConverter::OutputFormat format);
+
//! put all the libraries for a target on into the given stream
void OutputLinkLibraries(cmComputeLinkInformation* pcli,
cmLinkLineComputer* linkLineComputer,