summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-10-22 11:44:24 +0200
committerMarc Chevrier <marc.chevrier@gmail.com>2020-11-28 16:02:58 +0100
commita97c41bf8b7748037b08d881b620285b64b1881f (patch)
treeeea487b02d5563757fad9cdae70239f724dc3464 /Source
parentbcf19af5c71c7618aaf8fa6982e52c5e86d31eb1 (diff)
downloadcmake-a97c41bf8b7748037b08d881b620285b64b1881f.tar.gz
Refactoring: Makefiles Generators: Add support for various depends scanners
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.h7
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx10
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h29
-rw-r--r--Source/cmMakefileTargetGenerator.cxx1
4 files changed, 28 insertions, 19 deletions
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 30371c58d5..09e820a51b 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -43,6 +43,13 @@ enum class cmSourceOutputKind
OutputOrByproduct
};
+/** What scanner to use for dependencies lookup. */
+enum class cmDependencyScannerKind
+{
+ CMake,
+ Compiler
+};
+
/** Target and source file which have a specific output. */
struct cmSourcesWithOutput
{
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index dd270848f8..e06dfaca4d 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2049,16 +2049,18 @@ std::string cmLocalUnixMakefileGenerator3::GetTargetDirectory(
}
cmLocalUnixMakefileGenerator3::ImplicitDependLanguageMap const&
-cmLocalUnixMakefileGenerator3::GetImplicitDepends(const cmGeneratorTarget* tgt)
+cmLocalUnixMakefileGenerator3::GetImplicitDepends(
+ const cmGeneratorTarget* tgt, cmDependencyScannerKind scanner)
{
- return this->ImplicitDepends[tgt->GetName()];
+ return this->ImplicitDepends[tgt->GetName()][scanner];
}
void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
const cmGeneratorTarget* tgt, const std::string& lang,
- const std::string& obj, const std::string& src)
+ const std::string& obj, const std::string& src,
+ cmDependencyScannerKind scanner)
{
- this->ImplicitDepends[tgt->GetName()][lang][obj].push_back(src);
+ this->ImplicitDepends[tgt->GetName()][scanner][lang][obj].push_back(src);
}
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 5edca2add3..14dd0baf45 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -13,6 +13,7 @@
#include "cmDepends.h"
#include "cmLocalCommonGenerator.h"
+#include "cmLocalGenerator.h"
class cmCustomCommand;
class cmCustomCommandGenerator;
@@ -152,23 +153,21 @@ public:
// File pairs for implicit dependency scanning. The key of the map
// is the depender and the value is the explicit dependee.
- struct ImplicitDependFileMap : public cmDepends::DependencyMap
- {
- };
- struct ImplicitDependLanguageMap
- : public std::map<std::string, ImplicitDependFileMap>
- {
- };
- struct ImplicitDependTargetMap
- : public std::map<std::string, ImplicitDependLanguageMap>
- {
- };
+ using ImplicitDependFileMap = cmDepends::DependencyMap;
+ using ImplicitDependLanguageMap =
+ std::map<std::string, ImplicitDependFileMap>;
+ using ImplicitDependScannerMap =
+ std::map<cmDependencyScannerKind, ImplicitDependLanguageMap>;
+ using ImplicitDependTargetMap =
+ std::map<std::string, ImplicitDependScannerMap>;
ImplicitDependLanguageMap const& GetImplicitDepends(
- cmGeneratorTarget const* tgt);
+ cmGeneratorTarget const* tgt,
+ cmDependencyScannerKind scanner = cmDependencyScannerKind::CMake);
- void AddImplicitDepends(cmGeneratorTarget const* tgt,
- const std::string& lang, const std::string& obj,
- const std::string& src);
+ void AddImplicitDepends(
+ cmGeneratorTarget const* tgt, const std::string& lang,
+ const std::string& obj, const std::string& src,
+ cmDependencyScannerKind scanner = cmDependencyScannerKind::CMake);
// write the target rules for the local Makefile into the stream
void WriteLocalAllRules(std::ostream& ruleFileStream);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 71660a091e..d6566691dc 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -23,6 +23,7 @@
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLinkLineComputer.h" // IWYU pragma: keep
#include "cmLocalCommonGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmMakefileExecutableTargetGenerator.h"