summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionDAGChecker.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-01-05 11:40:38 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-01-06 17:46:45 (GMT)
commit646c6ec2f975238c11e2be02912fae0872843772 (patch)
treec0f1387d00ee83f841a197cc226b760e75c520cb /Source/cmGeneratorExpressionDAGChecker.cxx
parent711fb38f726fe3ef1209c81ae7b3220c5ca1512b (diff)
downloadCMake-646c6ec2f975238c11e2be02912fae0872843772.zip
CMake-646c6ec2f975238c11e2be02912fae0872843772.tar.gz
CMake-646c6ec2f975238c11e2be02912fae0872843772.tar.bz2
Genex: Use a preprocessor loop to implement transitive DAG check.
The other infrastructure for transitive property handling is already using a preprocessor loop. Implement special backward-compatibility handling of COMPILE_DEFINITIONS_<CONFIG> using a template switch for the extra check.
Diffstat (limited to 'Source/cmGeneratorExpressionDAGChecker.cxx')
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx57
1 files changed, 25 insertions, 32 deletions
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index c2c4e20..3e97163 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -179,44 +179,37 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
|| strcmp(prop, "INTERFACE_LINK_LIBRARIES") == 0;
}
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingIncludeDirectories() const
+enum TransitiveProperty {
+#define DEFINE_ENUM_ENTRY(NAME) NAME,
+ CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(DEFINE_ENUM_ENTRY)
+#undef DEFINE_ENUM_ENTRY
+ TransitivePropertyTerminal
+};
+
+template<TransitiveProperty>
+bool additionalTest(const char* const)
{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "INCLUDE_DIRECTORIES") == 0
- || strcmp(prop, "INTERFACE_INCLUDE_DIRECTORIES") == 0 );
+ return false;
}
-//----------------------------------------------------------------------------
-bool
-cmGeneratorExpressionDAGChecker::EvaluatingSystemIncludeDirectories() const
+template<>
+bool additionalTest<COMPILE_DEFINITIONS>(const char* const prop)
{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "SYSTEM_INCLUDE_DIRECTORIES") == 0
- || strcmp(prop, "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES") == 0);
+ return cmHasLiteralPrefix(prop, "COMPILE_DEFINITIONS_");
}
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingCompileDefinitions() const
-{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "COMPILE_DEFINITIONS") == 0
- || strcmp(prop, "INTERFACE_COMPILE_DEFINITIONS") == 0
- || cmHasLiteralPrefix(prop, "COMPILE_DEFINITIONS_"));
+#define DEFINE_TRANSITIVE_PROPERTY_METHOD(METHOD, PROPERTY) \
+bool cmGeneratorExpressionDAGChecker::METHOD() const \
+{ \
+ const char* const prop = this->Property.c_str(); \
+ if (strcmp(prop, #PROPERTY) == 0 \
+ || strcmp(prop, "INTERFACE_" #PROPERTY) == 0) \
+ { \
+ return true; \
+ } \
+ return additionalTest<PROPERTY>(prop); \
}
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingCompileOptions() const
-{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "COMPILE_OPTIONS") == 0
- || strcmp(prop, "INTERFACE_COMPILE_OPTIONS") == 0 );
-}
+CM_FOR_EACH_TRANSITIVE_PROPERTY(DEFINE_TRANSITIVE_PROPERTY_METHOD)
-//----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::EvaluatingAutoUicOptions() const
-{
- const char *prop = this->Property.c_str();
- return (strcmp(prop, "AUTOUIC_OPTIONS") == 0
- || strcmp(prop, "INTERFACE_AUTOUIC_OPTIONS") == 0 );
-}
+#undef DEFINE_TRANSITIVE_PROPERTY_METHOD