diff options
author | Brad King <brad.king@kitware.com> | 2012-08-13 14:00:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-08-15 15:44:49 (GMT) |
commit | 9d9f616792ee07a460af9f0a6dc036d81b852e66 (patch) | |
tree | 5057d83f7d6a4cdc52472f1b144ac6aad473789a /Source/cmGeneratorExpression.cxx | |
parent | ebf05abda15967f8f50dcf132f7bf84472ca6337 (diff) | |
download | CMake-9d9f616792ee07a460af9f0a6dc036d81b852e66.zip CMake-9d9f616792ee07a460af9f0a6dc036d81b852e66.tar.gz CMake-9d9f616792ee07a460af9f0a6dc036d81b852e66.tar.bz2 |
Add $<CONFIG:...> boolean query generator expression
This expression evaluates to '1' or '0' to indicate whether the build
configuration for which the expression is evaluated matches tha named
configuration. In combination with the "$<0:...>" and "$<1:...>"
expressions this allows per-configuration content to be generated.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
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."; |