diff options
author | Brad King <brad.king@kitware.com> | 2009-08-10 13:07:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-08-10 13:07:59 (GMT) |
commit | 821247ef4d8dc95bf0bc8cb1ba25331593fb404c (patch) | |
tree | ebfe6d1836f29eadc320e278c632079688ec7158 /Source | |
parent | cf6634fe2ae4e74383323b6ed6ff808cd7ba1f9e (diff) | |
download | CMake-821247ef4d8dc95bf0bc8cb1ba25331593fb404c.zip CMake-821247ef4d8dc95bf0bc8cb1ba25331593fb404c.tar.gz CMake-821247ef4d8dc95bf0bc8cb1ba25331593fb404c.tar.bz2 |
Cleanup test property script code generation
We teach cmTestGenerator::GenerateScriptConfigs to use the general
cmLocalGenerator::EscapeForCMake method to write escaped test property
values into test scripts. This eliminates the previous hand-coded
escaping implementation.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmTestGenerator.cxx | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 7f4c2d1..2c98910 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -50,6 +50,8 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, 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(); @@ -58,36 +60,8 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES "; for ( pit = mpit->begin(); pit != mpit->end(); ++ pit ) { - fout << " " << pit->first.c_str() << " \""; - const char* value = pit->second.GetValue(); - for ( ; *value; ++ value ) - { - switch ( *value ) - { - case '\\': - case '"': - case ' ': - case '#': - case '(': - case ')': - case '$': - case '^': - fout << "\\" << *value; - break; - case '\t': - fout << "\\t"; - break; - case '\n': - fout << "\\n"; - break; - case '\r': - fout << "\\r"; - break; - default: - fout << *value; - } - } - fout << "\""; + fout << " " << pit->first + << " " << lg->EscapeForCMake(pit->second.GetValue()); } fout << ")" << std::endl; } |