From fe11677945a0637ae51a24323fa41ffeb7a503d1 Mon Sep 17 00:00:00 2001 From: Giacomo Rombaut <145848-giacogiac@users.noreply.gitlab.kitware.com> Date: Tue, 4 Mar 2025 15:50:21 +0100 Subject: [PATCH] GenEx: Fix TARGET_PDB_FILE_BASE_NAME with PDB_NAME and DEBUG_POSTFIX When `PDB_NAME` is explicitly set, the `_POSTFIX` is not added to the `.pdb` names. Fixes: #26733 --- Source/cmGeneratorExpressionNode.cxx | 3 +-- Source/cmGeneratorTarget.cxx | 3 ++- Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index db55274854..ed61993efe 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -4182,8 +4182,7 @@ struct TargetOutputNameArtifactResultGetter return std::string(); } - return target->GetPDBOutputName(context->Config) + - target->GetFilePostfix(context->Config); + return target->GetPDBOutputName(context->Config); } }; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 99ee0ec16c..43ab2d3a36 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3772,7 +3772,8 @@ std::string cmGeneratorTarget::GetPDBOutputName( std::string const& config) const { std::string base = - this->GetOutputName(config, cmStateEnums::RuntimeBinaryArtifact); + this->GetOutputName(config, cmStateEnums::RuntimeBinaryArtifact) + + this->GetFilePostfix(config); std::vector props; std::string configUpper = cmSystemTools::UpperCase(config); diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake index d550431e1e..a401745d1f 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake @@ -122,8 +122,8 @@ check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfi ]]) if (CMAKE_C_LINKER_SUPPORTS_PDB) string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties + postfix" "$" "exec4_pdb_postfix") -check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties + postfix" "$" "shared4_pdb_postfix") +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties + postfix" "$" "exec4_pdb") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties + postfix" "$" "shared4_pdb") ]]) endif()