diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDocumentGeneratorExpressions.h | 1 | ||||
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 9 | ||||
-rw-r--r-- | Source/cmGeneratorExpression.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h index 5d6553d..74c673a 100644 --- a/Source/cmDocumentGeneratorExpressions.h +++ b/Source/cmDocumentGeneratorExpressions.h @@ -18,6 +18,7 @@ "Valid expressions are:\n" \ " $<0:...> = empty string (ignores \"...\")\n" \ " $<1:...> = content of \"...\"\n" \ + " $<CONFIG:cfg> = '1' if config is \"cfg\", else '0'\n" \ " $<CONFIGURATION> = configuration name\n" \ " $<TARGET_FILE:tgt> = main file (.exe, .so.1.2, .a)\n" \ " $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n" \ diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index ed33c7e..92bbf1d 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -14,6 +14,8 @@ #include "cmMakefile.h" #include "cmTarget.h" +#include <cmsys/String.h> + //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( cmMakefile* mf, const char* config, @@ -25,6 +27,7 @@ cmGeneratorExpression::cmGeneratorExpression( "_FILE(|_NAME|_DIR):" // Filename component. "([A-Za-z0-9_.-]+)" // Target name. ">$"); + this->TestConfig.compile("^\\$<CONFIG:([A-Za-z0-9_]*)>$"); } //---------------------------------------------------------------------------- @@ -162,6 +165,12 @@ bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result) { return cmGeneratorExpressionBool(expr+5, result, "OR", "0", "1"); } + else if(this->TestConfig.find(expr)) + { + result = cmsysString_strcasecmp(this->TestConfig.match(1).c_str(), + this->Config? this->Config:"") == 0 + ? "1":"0"; + } else { result = "Expression syntax not recognized."; diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 1a9d4c6..a023eb0 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -51,6 +51,7 @@ private: std::vector<char> Data; std::stack<size_t> Barriers; cmsys::RegularExpression TargetInfo; + cmsys::RegularExpression TestConfig; std::set<cmTarget*> Targets; bool Evaluate(); bool Evaluate(const char* expr, std::string& result); |