diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-01 07:37:24 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-07 16:03:13 (GMT) |
commit | 0f9080e235907d54e72041805dd2faf7ee43ce4d (patch) | |
tree | f887623beab522fd15921d32ccdcfafcf486d845 /Source/cmQtAutoGeneratorInitializer.cxx | |
parent | d561c1fffc4ec68a4e9043e0dc0499832f84fdec (diff) | |
download | CMake-0f9080e235907d54e72041805dd2faf7ee43ce4d.zip CMake-0f9080e235907d54e72041805dd2faf7ee43ce4d.tar.gz CMake-0f9080e235907d54e72041805dd2faf7ee43ce4d.tar.bz2 |
Autogen: More use of scoped lambdas
Diffstat (limited to 'Source/cmQtAutoGeneratorInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index ed01a3c..bfb2945 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -1063,23 +1063,18 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( // Open and write file cmsys::ofstream ofs(infoFile.c_str(), std::ios::app); if (ofs) { + auto OfsWriteMap = [&ofs]( + const char* key, const std::map<std::string, std::string>& map) { + for (const auto& item : map) { + ofs << "set(" << key << "_" << item.first << " " + << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; + } + }; ofs << "# Configuration specific options\n"; - for (const auto& item : configSuffix) { - ofs << "set(AM_CONFIG_SUFFIX_" << item.first << " " - << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; - } - for (const auto& item : setup.ConfigMocDefines) { - ofs << "set(AM_MOC_DEFINITIONS_" << item.first << " " - << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; - } - for (const auto& item : setup.ConfigMocIncludes) { - ofs << "set(AM_MOC_INCLUDES_" << item.first << " " - << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; - } - for (const auto& item : setup.ConfigUicOptions) { - ofs << "set(AM_UIC_TARGET_OPTIONS_" << item.first << " " - << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; - } + OfsWriteMap("AM_CONFIG_SUFFIX", configSuffix); + OfsWriteMap("AM_MOC_DEFINITIONS", setup.ConfigMocDefines); + OfsWriteMap("AM_MOC_INCLUDES", setup.ConfigMocIncludes); + OfsWriteMap("AM_UIC_TARGET_OPTIONS", setup.ConfigUicOptions); } else { // File open error std::string error = "Internal CMake error when trying to open file: "; |