summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx11
-rw-r--r--Source/cmNinjaTargetGenerator.cxx31
-rw-r--r--Source/cmNinjaTargetGenerator.h7
3 files changed, 24 insertions, 25 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 59db295..9dc860e 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -468,16 +468,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
cmMakefile* mf = this->GetMakefile();
- if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
- mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
- {
- const std::string pdbPath = this->GetTargetPDB();
- vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(pdbPath.c_str()).c_str(),
- cmLocalGenerator::SHELL);
- EnsureParentDirectoryExists(pdbPath);
- }
- else
+ if (!this->SetMsvcTargetPdbVariable(vars))
{
// It is common to place debug symbols at a specific place,
// so we need a plain target name in the rule available.
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 328ca2d..b89602e 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -311,6 +311,21 @@ std::string cmNinjaTargetGenerator::GetTargetPDB() const
return targetFullPathPDB.c_str();
}
+bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
+{
+ cmMakefile* mf = this->GetMakefile();
+ if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
+ mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
+ {
+ const std::string pdbPath = this->GetTargetPDB();
+ vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ ConvertToNinjaPath(pdbPath.c_str()).c_str(),
+ cmLocalGenerator::SHELL);
+ EnsureParentDirectoryExists(pdbPath);
+ return true;
+ }
+ return false;
+}
void
cmNinjaTargetGenerator
@@ -537,17 +552,7 @@ cmNinjaTargetGenerator
vars["DEP_FILE"] = objectFileName + ".d";;
EnsureParentDirectoryExists(objectFileName);
- // TODO move to GetTargetPDB
- cmMakefile* mf = this->GetMakefile();
- if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
- mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
- {
- const std::string pdbPath = this->GetTargetPDB();
- vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(pdbPath.c_str()).c_str(),
- cmLocalGenerator::SHELL);
- EnsureParentDirectoryExists(pdbPath);
- }
+ this->SetMsvcTargetPdbVariable(vars);
if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
{
@@ -643,14 +648,14 @@ cmNinjaTargetGenerator
void
cmNinjaTargetGenerator
-::EnsureDirectoryExists(const std::string& dir)
+::EnsureDirectoryExists(const std::string& dir) const
{
cmSystemTools::MakeDirectory(dir.c_str());
}
void
cmNinjaTargetGenerator
-::EnsureParentDirectoryExists(const std::string& path)
+::EnsureParentDirectoryExists(const std::string& path) const
{
EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str()));
}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 84573ce..0c52fc4 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -44,6 +44,9 @@ public:
std::string GetTargetName() const;
protected:
+
+ bool SetMsvcTargetPdbVariable(cmNinjaVars&) const;
+
cmGeneratedFileStream& GetBuildFileStream() const;
cmGeneratedFileStream& GetRulesFileStream() const;
@@ -112,8 +115,8 @@ protected:
// Helper to add flag for windows .def file.
void AddModuleDefinitionFlag(std::string& flags);
- void EnsureDirectoryExists(const std::string& dir);
- void EnsureParentDirectoryExists(const std::string& path);
+ void EnsureDirectoryExists(const std::string& dir) const;
+ void EnsureParentDirectoryExists(const std::string& path) const;
// write rules for Mac OS X Application Bundle content.
struct MacOSXContentGeneratorType :