From bf5eb4a3f394051d9245a7f0c3a18b4a1d2c948a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 5 Aug 2015 19:01:23 +0200 Subject: cmGeneratorTarget: Move ComputePDBOutputDir from cmTarget. --- Source/cmGeneratorTarget.cxx | 66 ++++++++++++++++++++++++++++++++++++++++++-- Source/cmGeneratorTarget.h | 3 ++ Source/cmTarget.cxx | 61 ---------------------------------------- Source/cmTarget.h | 3 -- 4 files changed, 66 insertions(+), 67 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3651da6..3a67d2c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1780,8 +1780,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo( if(i == this->CompileInfoMap.end()) { CompileInfo info; - this->Target - ->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir); + this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir); CompileInfoMapType::value_type entry(config_upper, info); i = this->CompileInfoMap.insert(entry).first; } @@ -4519,7 +4518,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo( // Compute output directories. this->ComputeOutputDir(config, false, info.OutDir); this->ComputeOutputDir(config, true, info.ImpDir); - if(!this->Target->ComputePDBOutputDir("PDB", config, info.PdbDir)) + if(!this->ComputePDBOutputDir("PDB", config, info.PdbDir)) { info.PdbDir = info.OutDir; } @@ -4635,6 +4634,67 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, } //---------------------------------------------------------------------------- +bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind, + const std::string& config, + std::string& out) const +{ + // Look for a target property defining the target output directory + // based on the target type. + const char* propertyName = 0; + std::string propertyNameStr = kind; + if(!propertyNameStr.empty()) + { + propertyNameStr += "_OUTPUT_DIRECTORY"; + propertyName = propertyNameStr.c_str(); + } + std::string conf = config; + + // Check for a per-configuration output directory target property. + std::string configUpper = cmSystemTools::UpperCase(conf); + const char* configProp = 0; + std::string configPropStr = kind; + if(!configPropStr.empty()) + { + configPropStr += "_OUTPUT_DIRECTORY_"; + configPropStr += configUpper; + configProp = configPropStr.c_str(); + } + + // Select an output directory. + if(const char* config_outdir = this->GetProperty(configProp)) + { + // Use the user-specified per-configuration output directory. + out = config_outdir; + + // Skip per-configuration subdirectory. + conf = ""; + } + else if(const char* outdir = this->GetProperty(propertyName)) + { + // Use the user-specified output directory. + out = outdir; + } + if(out.empty()) + { + return false; + } + + // Convert the output path to a full path in case it is + // specified as a relative path. Treat a relative path as + // relative to the current output directory for this makefile. + out = (cmSystemTools::CollapseFullPath + (out, this->Makefile->GetCurrentBinaryDirectory())); + + // The generator may add the configuration's subdirectory. + if(!conf.empty()) + { + this->LocalGenerator->GetGlobalGenerator()-> + AppendDirectoryForConfig("/", conf, "", out); + } + return true; +} + +//---------------------------------------------------------------------------- void cmGeneratorTarget::ComputeLinkInterfaceLibraries( const std::string& config, diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index f0f6d41..4ca0447 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -528,6 +528,9 @@ private: mutable bool DebugSourcesDone; mutable bool LinkImplementationLanguageIsContextDependent; + bool ComputePDBOutputDir(const std::string& kind, const std::string& config, + std::string& out) const; + public: std::vector const& GetLinkImplementationClosure(const std::string& config) const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index af7fe2e..40f93a3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2448,67 +2448,6 @@ const char* cmTarget::GetOutputTargetType(bool implib) const } //---------------------------------------------------------------------------- -bool cmTarget::ComputePDBOutputDir(const std::string& kind, - const std::string& config, - std::string& out) const -{ - // Look for a target property defining the target output directory - // based on the target type. - const char* propertyName = 0; - std::string propertyNameStr = kind; - if(!propertyNameStr.empty()) - { - propertyNameStr += "_OUTPUT_DIRECTORY"; - propertyName = propertyNameStr.c_str(); - } - std::string conf = config; - - // Check for a per-configuration output directory target property. - std::string configUpper = cmSystemTools::UpperCase(conf); - const char* configProp = 0; - std::string configPropStr = kind; - if(!configPropStr.empty()) - { - configPropStr += "_OUTPUT_DIRECTORY_"; - configPropStr += configUpper; - configProp = configPropStr.c_str(); - } - - // Select an output directory. - if(const char* config_outdir = this->GetProperty(configProp)) - { - // Use the user-specified per-configuration output directory. - out = config_outdir; - - // Skip per-configuration subdirectory. - conf = ""; - } - else if(const char* outdir = this->GetProperty(propertyName)) - { - // Use the user-specified output directory. - out = outdir; - } - if(out.empty()) - { - return false; - } - - // Convert the output path to a full path in case it is - // specified as a relative path. Treat a relative path as - // relative to the current output directory for this makefile. - out = (cmSystemTools::CollapseFullPath - (out, this->Makefile->GetCurrentBinaryDirectory())); - - // The generator may add the configuration's subdirectory. - if(!conf.empty()) - { - this->Makefile->GetGlobalGenerator()-> - AppendDirectoryForConfig("/", conf, "", out); - } - return true; -} - -//---------------------------------------------------------------------------- std::string cmTarget::GetFrameworkVersion() const { assert(this->GetType() != INTERFACE_LIBRARY); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a3a8063..d37f934 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -467,9 +467,6 @@ private: bool LinkLibrariesForVS6Analyzed; #endif - bool ComputePDBOutputDir(const std::string& kind, const std::string& config, - std::string& out) const; - // Cache import information from properties for each configuration. struct ImportInfo { -- cgit v0.12