diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2014-07-24 20:18:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-07-31 13:17:53 (GMT) |
commit | f86850ef60b7dc008a144722bd0c803289a8ab76 (patch) | |
tree | d9fc952fe7e6dff216bf6bd24626bb3b5bf422fb /Source/cmGeneratorExpressionEvaluator.cxx | |
parent | 028ad31878d25dad055ed9588d81568b284a272e (diff) | |
download | CMake-f86850ef60b7dc008a144722bd0c803289a8ab76.zip CMake-f86850ef60b7dc008a144722bd0c803289a8ab76.tar.gz CMake-f86850ef60b7dc008a144722bd0c803289a8ab76.tar.bz2 |
Genex: Implement generator expressions for target PDB files.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6f940a6..3547e66 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1512,6 +1512,7 @@ static const struct InstallPrefixNode : public cmGeneratorExpressionNode class ArtifactNameTag; class ArtifactLinkerTag; class ArtifactSonameTag; +class ArtifactPdbTag; class ArtifactPathTag; class ArtifactDirTag; @@ -1558,6 +1559,44 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag> //---------------------------------------------------------------------------- template<> +struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag> +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + std::string language = target->GetLinkerLanguage(context->Config); + + std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB"; + + if(!context->Makefile->IsOn(pdbSupportVar)) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is not supported by the target linker."); + return std::string(); + } + + cmTarget::TargetType targetType = target->GetType(); + + if(targetType != cmTarget::SHARED_LIBRARY && + targetType != cmTarget::MODULE_LIBRARY && + targetType != cmTarget::EXECUTABLE) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_PDB_FILE is allowed only for " + "targets with linker created artifacts."); + return std::string(); + } + + std::string result = target->GetPDBDirectory(context->Config); + result += "/"; + result += target->GetPDBName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag> { static std::string Create(cmTarget* target, @@ -1706,6 +1745,9 @@ TargetFilesystemArtifactNodeGroup<ArtifactLinkerTag> targetLinkerNodeGroup; static const TargetFilesystemArtifactNodeGroup<ArtifactSonameTag> targetSoNameNodeGroup; +static const +TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> targetPdbNodeGroup; + //---------------------------------------------------------------------------- static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) @@ -1733,12 +1775,15 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) nodeMap["TARGET_FILE"] = &targetNodeGroup.File; nodeMap["TARGET_LINKER_FILE"] = &targetLinkerNodeGroup.File; nodeMap["TARGET_SONAME_FILE"] = &targetSoNameNodeGroup.File; + nodeMap["TARGET_PDB_FILE"] = &targetPdbNodeGroup.File; nodeMap["TARGET_FILE_NAME"] = &targetNodeGroup.FileName; nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerNodeGroup.FileName; nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameNodeGroup.FileName; + nodeMap["TARGET_PDB_FILE_NAME"] = &targetPdbNodeGroup.FileName; nodeMap["TARGET_FILE_DIR"] = &targetNodeGroup.FileDir; nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; + nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; |