mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-03 04:03:23 +03:00
cmLocalGenerator: add an override for CMakeFiles-using paths
Visual Studio doesn't use a `CMakeFiles` subdirectory for its support directories. However, some codepaths expect to use paths which are always under `CMakeFiles`. Add a mechanism to keep the path for such files.
This commit is contained in:
1 parent
35d32b8741
commit
c95a8348ce
8 files changed
+31
-6
No files matched your search
@@ -2851,7 +2851,7 @@ std::string cmGeneratorTarget::GetPchHeader(std::string const& config,
|
|||||||
{ "OBJCXX", ".objcxx.hxx" }
|
{ "OBJCXX", ".objcxx.hxx" }
|
||||||
};
|
};
|
||||||
|
|
||||||
filename = generatorTarget->GetSupportDirectory();
|
filename = generatorTarget->GetCMFSupportDirectory();
|
||||||
|
|
||||||
if (this->GetGlobalGenerator()->IsMultiConfig()) {
|
if (this->GetGlobalGenerator()->IsMultiConfig()) {
|
||||||
filename = cmStrCat(filename, '/', config);
|
filename = cmStrCat(filename, '/', config);
|
||||||
@@ -2944,7 +2944,8 @@ std::string cmGeneratorTarget::GetPchSource(std::string const& config,
|
|||||||
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
|
this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = cmStrCat(generatorTarget->GetSupportDirectory(), "/cmake_pch");
|
filename =
|
||||||
|
cmStrCat(generatorTarget->GetCMFSupportDirectory(), "/cmake_pch");
|
||||||
|
|
||||||
// For GCC the source extension will be transformed into .h[xx].gch
|
// For GCC the source extension will be transformed into .h[xx].gch
|
||||||
if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) {
|
if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) {
|
||||||
@@ -5222,6 +5223,17 @@ std::string cmGeneratorTarget::GetSupportDirectory() const
|
|||||||
lg->GetTargetDirectory(this));
|
lg->GetTargetDirectory(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmGeneratorTarget::GetCMFSupportDirectory() const
|
||||||
|
{
|
||||||
|
cmLocalGenerator* lg = this->GetLocalGenerator();
|
||||||
|
if (!lg->AlwaysUsesCMFPaths()) {
|
||||||
|
return cmStrCat(lg->GetCurrentBinaryDirectory(), "/CMakeFiles/",
|
||||||
|
lg->GetTargetDirectory(this));
|
||||||
|
}
|
||||||
|
return cmStrCat(lg->GetObjectOutputRoot(), '/',
|
||||||
|
lg->GetTargetDirectory(this));
|
||||||
|
}
|
||||||
|
|
||||||
bool cmGeneratorTarget::IsLinkable() const
|
bool cmGeneratorTarget::IsLinkable() const
|
||||||
{
|
{
|
||||||
return (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
|
return (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
|
||||||
|
|||||||
@@ -935,6 +935,7 @@ public:
|
|||||||
|
|
||||||
/** Get a build-tree directory in which to place target support files. */
|
/** Get a build-tree directory in which to place target support files. */
|
||||||
std::string GetSupportDirectory() const;
|
std::string GetSupportDirectory() const;
|
||||||
|
std::string GetCMFSupportDirectory() const;
|
||||||
|
|
||||||
/** Return whether this target may be used to link another target. */
|
/** Return whether this target may be used to link another target. */
|
||||||
bool IsLinkable() const;
|
bool IsLinkable() const;
|
||||||
|
|||||||
@@ -3636,7 +3636,7 @@ void cmGlobalGenerator::WriteSummary()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this->WriteSummary(tgt.get());
|
this->WriteSummary(tgt.get());
|
||||||
fout << tgt->GetSupportDirectory() << '\n';
|
fout << tgt->GetCMFSupportDirectory() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3644,7 +3644,7 @@ void cmGlobalGenerator::WriteSummary()
|
|||||||
void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
|
void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
|
||||||
{
|
{
|
||||||
// Place the labels file in a per-target support directory.
|
// Place the labels file in a per-target support directory.
|
||||||
std::string dir = target->GetSupportDirectory();
|
std::string dir = target->GetCMFSupportDirectory();
|
||||||
std::string file = cmStrCat(dir, "/Labels.txt");
|
std::string file = cmStrCat(dir, "/Labels.txt");
|
||||||
std::string json_file = cmStrCat(dir, "/Labels.json");
|
std::string json_file = cmStrCat(dir, "/Labels.json");
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ std::string cmInstallCxxModuleBmiGenerator::GetScriptLocation(
|
|||||||
if (config.empty()) {
|
if (config.empty()) {
|
||||||
config_name = "noconfig";
|
config_name = "noconfig";
|
||||||
}
|
}
|
||||||
return cmStrCat(this->Target->GetSupportDirectory(),
|
return cmStrCat(this->Target->GetCMFSupportDirectory(),
|
||||||
"/install-cxx-module-bmi-", config_name, ".cmake");
|
"/install-cxx-module-bmi-", config_name, ".cmake");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3323,7 +3323,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string filename_base =
|
std::string filename_base =
|
||||||
cmStrCat(target->GetSupportDirectory(), "/Unity/");
|
cmStrCat(target->GetCMFSupportDirectory(), "/Unity/");
|
||||||
|
|
||||||
cmValue batchSizeString = target->GetProperty("UNITY_BUILD_BATCH_SIZE");
|
cmValue batchSizeString = target->GetProperty("UNITY_BUILD_BATCH_SIZE");
|
||||||
size_t const unityBatchSize = batchSizeString
|
size_t const unityBatchSize = batchSizeString
|
||||||
@@ -4291,6 +4291,11 @@ std::string cmLocalGenerator::GetObjectOutputRoot() const
|
|||||||
return cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles");
|
return cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmLocalGenerator::AlwaysUsesCMFPaths() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::string cmLocalGenerator::GetSourceFileLanguage(cmSourceFile const& source)
|
std::string cmLocalGenerator::GetSourceFileLanguage(cmSourceFile const& source)
|
||||||
{
|
{
|
||||||
return source.GetLanguage();
|
return source.GetLanguage();
|
||||||
|
|||||||
@@ -439,6 +439,7 @@ public:
|
|||||||
std::string const& GetCurrentSourceDirectory() const;
|
std::string const& GetCurrentSourceDirectory() const;
|
||||||
|
|
||||||
virtual std::string GetObjectOutputRoot() const;
|
virtual std::string GetObjectOutputRoot() const;
|
||||||
|
virtual bool AlwaysUsesCMFPaths() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a macOS application bundle Info.plist file.
|
* Generate a macOS application bundle Info.plist file.
|
||||||
|
|||||||
@@ -89,6 +89,11 @@ std::string cmLocalVisualStudioGenerator::GetObjectOutputRoot() const
|
|||||||
return this->GetCurrentBinaryDirectory();
|
return this->GetCurrentBinaryDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmLocalVisualStudioGenerator::AlwaysUsesCMFPaths() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<cmCustomCommand>
|
std::unique_ptr<cmCustomCommand>
|
||||||
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
|
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
|
||||||
std::string const& config,
|
std::string const& config,
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
cmGeneratorTarget const* = nullptr) override;
|
cmGeneratorTarget const* = nullptr) override;
|
||||||
|
|
||||||
std::string GetObjectOutputRoot() const override;
|
std::string GetObjectOutputRoot() const override;
|
||||||
|
bool AlwaysUsesCMFPaths() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual char const* ReportErrorLabel() const;
|
virtual char const* ReportErrorLabel() const;
|
||||||
|
|||||||
Reference in new issue
Block a user