summaryrefslogtreecommitdiff
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-08-24 14:24:35 -0400
committerCMake Topic Stage <kwrobot@kitware.com>2012-08-24 14:24:35 -0400
commited01420c2337bd641a62d6ae5e7d81eb81d41cac (patch)
treeceaba17b164d0d7dd13e6f81843d1c326247a264 /Source/cmNinjaTargetGenerator.cxx
parent05784dadc59ee3c87ab6140d684ff4c602de9ec1 (diff)
parent709fa59562569b6c6a8244f5ba53b60ebf840a30 (diff)
downloadcmake-ed01420c2337bd641a62d6ae5e7d81eb81d41cac.tar.gz
Merge topic 'ninja-target-pdb-cleanup'
709fa59 Ninja: remove GetTargetPDB because it is used only once 4bb4787 Ninja:split out setting of msvc TARGET_PDB 59cbc28 Ninja: prepare msvc pdb cleanup
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx46
1 files changed, 24 insertions, 22 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 641516e19d..918f5827e7 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -292,23 +292,33 @@ std::string cmNinjaTargetGenerator::GetTargetName() const
return this->Target->GetName();
}
-std::string cmNinjaTargetGenerator::GetTargetPDB() const
+
+bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
{
- std::string targetFullPathPDB;
- if(this->Target->GetType() == cmTarget::EXECUTABLE ||
- this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
- this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
- this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+ cmMakefile* mf = this->GetMakefile();
+ if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
+ mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID"))
{
- targetFullPathPDB = this->Target->GetDirectory(this->GetConfigName());
- targetFullPathPDB += "/";
- targetFullPathPDB += this->Target->GetPDBName(this->GetConfigName());
+ std::string pdbPath;
+ if(this->Target->GetType() == cmTarget::EXECUTABLE ||
+ this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
+ this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->Target->GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ pdbPath = this->Target->GetDirectory(this->GetConfigName());
+ pdbPath += "/";
+ pdbPath += this->Target->GetPDBName(this->GetConfigName());
}
- return targetFullPathPDB.c_str();
+ vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ ConvertToNinjaPath(pdbPath.c_str()).c_str(),
+ cmLocalGenerator::SHELL);
+ EnsureParentDirectoryExists(pdbPath);
+ return true;
+ }
+ return false;
}
-
void
cmNinjaTargetGenerator
::WriteLanguageRules(const std::string& language)
@@ -534,15 +544,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"))
- {
- vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- ConvertToNinjaPath(GetTargetPDB().c_str()).c_str(),
- cmLocalGenerator::SHELL);
- }
+ this->SetMsvcTargetPdbVariable(vars);
if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
{
@@ -638,14 +640,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()));
}