diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-05 17:01:23 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-08 23:04:38 (GMT) |
commit | bf5eb4a3f394051d9245a7f0c3a18b4a1d2c948a (patch) | |
tree | 9ed9eda7183349df187679b430224a23f3898ab4 /Source/cmGeneratorTarget.cxx | |
parent | 49017cddab23702d8228a195f64934e61ab7667e (diff) | |
download | CMake-bf5eb4a3f394051d9245a7f0c3a18b4a1d2c948a.zip CMake-bf5eb4a3f394051d9245a7f0c3a18b4a1d2c948a.tar.gz CMake-bf5eb4a3f394051d9245a7f0c3a18b4a1d2c948a.tar.bz2 |
cmGeneratorTarget: Move ComputePDBOutputDir from cmTarget.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 66 |
1 files changed, 63 insertions, 3 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, |