MCPcopy Create free account
hub / github.com/Kitware/CMake / ComputePDBOutputDir

Method ComputePDBOutputDir

Source/cmGeneratorTarget.cxx:4644–4705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4642}
4643
4644bool cmGeneratorTarget::ComputePDBOutputDir(std::string const& kind,
4645 std::string const& config,
4646 std::string& out) const
4647{
4648 // Look for a target property defining the target output directory
4649 // based on the target type.
4650 std::string propertyName;
4651 if (!kind.empty()) {
4652 propertyName = cmStrCat(kind, "_OUTPUT_DIRECTORY");
4653 }
4654 std::string conf = config;
4655
4656 // Check for a per-configuration output directory target property.
4657 std::string configUpper = cmSystemTools::UpperCase(conf);
4658 std::string configProp;
4659 if (!kind.empty()) {
4660 configProp = cmStrCat(kind, "_OUTPUT_DIRECTORY_", configUpper);
4661 }
4662
4663 // Select an output directory.
4664 if (cmValue config_outdir = this->GetProperty(configProp)) {
4665 // Use the user-specified per-configuration output directory.
4666 out = cmGeneratorExpression::Evaluate(*config_outdir, this->LocalGenerator,
4667 config);
4668
4669 // Skip per-configuration subdirectory.
4670 conf.clear();
4671 } else if (cmValue outdir = this->GetProperty(propertyName)) {
4672 // Use the user-specified output directory.
4673 out =
4674 cmGeneratorExpression::Evaluate(*outdir, this->LocalGenerator, config);
4675
4676 // Skip per-configuration subdirectory if the value contained a
4677 // generator expression.
4678 if (out != *outdir) {
4679 conf.clear();
4680 }
4681 }
4682 if (out.empty()) {
4683 cmGeneratorTarget const* reuseTarget = this->GetPchReuseTarget();
4684 bool const hasReuse = reuseTarget && reuseTarget != this;
4685 // Compiler-generated PDB output always needed for REUSE_FROM.
4686 if (kind == "COMPILE_PDB"_s && (this->PchReused || hasReuse)) {
4687 out = this->GetSupportDirectory();
4688 } else {
4689 return false;
4690 }
4691 }
4692
4693 // Convert the output path to a full path in case it is
4694 // specified as a relative path. Treat a relative path as
4695 // relative to the current output directory for this makefile.
4696 out = (cmSystemTools::CollapseFullPath(
4697 out, this->LocalGenerator->GetCurrentBinaryDirectory()));
4698
4699 // The generator may add the configuration's subdirectory.
4700 if (!conf.empty()) {
4701 this->LocalGenerator->GetGlobalGenerator()->AppendDirectoryForConfig(

Callers 2

GetCompileInfoMethod · 0.95
GetOutputInfoMethod · 0.95

Calls 8

GetPropertyMethod · 0.95
GetPchReuseTargetMethod · 0.95
GetSupportDirectoryMethod · 0.95
cmStrCatFunction · 0.70
emptyMethod · 0.45
clearMethod · 0.45
GetGlobalGeneratorMethod · 0.45

Tested by

no test coverage detected