diff options
author | Duncan Barber <7744-dunquan@users.noreply.gitlab.kitware.com> | 2021-04-10 14:04:22 (GMT) |
---|---|---|
committer | Duncan Barber <7744-dunquan@users.noreply.gitlab.kitware.com> | 2021-04-10 17:33:24 (GMT) |
commit | 1876f2d03fe3ccc4ea02c27fe345657b3366b48e (patch) | |
tree | 965c9d2645be15805817dc9ebbf76c0895ee39a1 /Source/cmQtAutoGenInitializer.cxx | |
parent | 087b717aefd5439fc5bc6ae25b9795cbb5563e02 (diff) | |
download | CMake-1876f2d03fe3ccc4ea02c27fe345657b3366b48e.zip CMake-1876f2d03fe3ccc4ea02c27fe345657b3366b48e.tar.gz CMake-1876f2d03fe3ccc4ea02c27fe345657b3366b48e.tar.bz2 |
Autogen: Move duplicated filename generation code into a function
Diffstat (limited to 'Source/cmQtAutoGenInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index a1602bd..816d7e5 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -430,12 +430,8 @@ bool cmQtAutoGenInitializer::InitCustomTargets() cmSystemTools::ConvertToUnixSlashes(this->Dir.Work); // Include directory - this->ConfigFileNames(this->Dir.Include, - cmStrCat(this->Dir.Build, "/include"), ""); - this->Dir.IncludeGenExp = this->Dir.Include.Default; - if (this->MultiConfig) { - this->Dir.IncludeGenExp += "_$<CONFIG>"; - } + this->ConfigFileNamesAndGenex(this->Dir.Include, this->Dir.IncludeGenExp, + cmStrCat(this->Dir.Build, "/include"), ""); } // Moc, Uic and _autogen target settings @@ -586,15 +582,9 @@ bool cmQtAutoGenInitializer::InitMoc() cmStrCat(this->Dir.Build, "/mocs_compilation.cpp"); this->Moc.CompilationFileGenex = this->Moc.CompilationFile.Default; } else { - this->ConfigFileNames(this->Moc.CompilationFile, - cmStrCat(this->Dir.Build, "/mocs_compilation"), - ".cpp"); - if (this->MultiConfig) { - this->Moc.CompilationFileGenex = - cmStrCat(this->Dir.Build, "/mocs_compilation_$<CONFIG>.cpp"_s); - } else { - this->Moc.CompilationFileGenex = this->Moc.CompilationFile.Default; - } + this->ConfigFileNamesAndGenex( + this->Moc.CompilationFile, this->Moc.CompilationFileGenex, + cmStrCat(this->Dir.Build, "/mocs_compilation"_s), ".cpp"_s); } // Moc predefs @@ -966,17 +956,10 @@ bool cmQtAutoGenInitializer::InitScanFiles() cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s); ConfigString uiHeader; - uiHeader.Default = - cmStrCat(this->Dir.Build, "/include"_s, uiHeaderFilePath); - auto uiHeaderGenex = uiHeader.Default; - if (this->MultiConfig) { - uiHeaderGenex = cmStrCat(this->Dir.Build, "/include_$<CONFIG>"_s, - uiHeaderFilePath); - for (std::string const& cfg : this->ConfigsList) { - uiHeader.Config[cfg] = cmStrCat(this->Dir.Build, "/include_"_s, - cfg, uiHeaderFilePath); - } - } + std::string uiHeaderGenex; + this->ConfigFileNamesAndGenex( + uiHeader, uiHeaderGenex, cmStrCat(this->Dir.Build, "/include"_s), + uiHeaderFilePath); this->Uic.UiHeaders.emplace_back( std::make_pair(uiHeader, uiHeaderGenex)); @@ -1790,6 +1773,18 @@ void cmQtAutoGenInitializer::ConfigFileNames(ConfigString& configString, } } +void cmQtAutoGenInitializer::ConfigFileNamesAndGenex( + ConfigString& configString, std::string& genex, cm::string_view const prefix, + cm::string_view const suffix) +{ + this->ConfigFileNames(configString, prefix, suffix); + if (this->MultiConfig) { + genex = cmStrCat(prefix, "_$<CONFIG>"_s, suffix); + } else { + genex = configString.Default; + } +} + void cmQtAutoGenInitializer::ConfigFileClean(ConfigString& configString) { this->AddCleanFile(configString.Default); |