summaryrefslogtreecommitdiffstats
path: root/Source/cmTestGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-09-18 17:05:05 (GMT)
committerBrad King <brad.king@kitware.com>2013-09-20 12:18:10 (GMT)
commit6fe5c4afc0a8363927ecd48bea4cc822894f97db (patch)
treef6267faf7834d1d4df7111df0fd9d2c10833753a /Source/cmTestGenerator.cxx
parent7324eb896eb7337aaec2baf44d11d419a9d87b30 (diff)
downloadCMake-6fe5c4afc0a8363927ecd48bea4cc822894f97db.zip
CMake-6fe5c4afc0a8363927ecd48bea4cc822894f97db.tar.gz
CMake-6fe5c4afc0a8363927ecd48bea4cc822894f97db.tar.bz2
cmTestGenerator: Separate test properties for each configuration
Move property generation from GenerateScriptConfigs to separate copies in GenerateOldStyle and GenerateScriptForConfig. This causes the per-config tests generated for the add_test(NAME) signature to each get their own test properties. This will allow us to later change the property values based on the test configuration. While at it, generate lower-case CMake code (e.g. set_tests_properties). Inspired-by: Ben Boeckel <mathstuf@gmail.com>
Diffstat (limited to 'Source/cmTestGenerator.cxx')
-rw-r--r--Source/cmTestGenerator.cxx55
1 files changed, 33 insertions, 22 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 42f511e..3167362 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -39,29 +39,8 @@ cmTestGenerator
void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
Indent const& indent)
{
- // First create the tests.
+ // Create the tests.
this->cmScriptGenerator::GenerateScriptConfigs(os, indent);
-
- // Now generate the test properties.
- if(this->TestGenerated)
- {
- cmTest* test = this->Test;
- cmMakefile* mf = test->GetMakefile();
- cmLocalGenerator* lg = mf->GetLocalGenerator();
- std::ostream& fout = os;
- cmPropertyMap::const_iterator pit;
- cmPropertyMap* mpit = &test->GetProperties();
- if ( mpit->size() )
- {
- fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES ";
- for ( pit = mpit->begin(); pit != mpit->end(); ++ pit )
- {
- fout << " " << pit->first
- << " " << lg->EscapeForCMake(pit->second.GetValue());
- }
- fout << ")" << std::endl;
- }
- }
}
//----------------------------------------------------------------------------
@@ -127,6 +106,21 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Finish the test command.
os << ")\n";
+
+ // Output properties for the test.
+ cmPropertyMap& pm = this->Test->GetProperties();
+ if(!pm.empty())
+ {
+ os << indent << "set_tests_properties(" << this->Test->GetName()
+ << " PROPERTIES ";
+ for(cmPropertyMap::const_iterator i = pm.begin();
+ i != pm.end(); ++i)
+ {
+ os << " " << i->first
+ << " " << lg->EscapeForCMake(i->second.GetValue());
+ }
+ os << ")" << std::endl;
+ }
}
//----------------------------------------------------------------------------
@@ -181,4 +175,21 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
fout << "\"";
}
fout << ")" << std::endl;
+
+ // Output properties for the test.
+ cmMakefile* mf = this->Test->GetMakefile();
+ cmLocalGenerator* lg = mf->GetLocalGenerator();
+ cmPropertyMap& pm = this->Test->GetProperties();
+ if(!pm.empty())
+ {
+ fout << indent << "set_tests_properties(" << this->Test->GetName()
+ << " PROPERTIES ";
+ for(cmPropertyMap::const_iterator i = pm.begin();
+ i != pm.end(); ++i)
+ {
+ fout << " " << i->first
+ << " " << lg->EscapeForCMake(i->second.GetValue());
+ }
+ fout << ")" << std::endl;
+ }
}