From 59b91107d16c2f2ba68791ae67c53bdcc0d32e05 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 5 Oct 2015 18:50:00 +0200 Subject: QtAutogen: Move GetRccExecutable method. --- Source/cmQtAutoGeneratorInitializer.cxx | 102 ++++++++++++++++---------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'Source/cmQtAutoGeneratorInitializer.cxx') diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index d998ae0996..5cb22e9531 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -340,6 +340,57 @@ void cmQtAutoGeneratorInitializer::SetupAutoUicTarget(cmTarget const* target, } } +std::string cmQtAutoGeneratorInitializer::GetRccExecutable( + cmTarget const* target) +{ + cmGeneratorTarget *gtgt = target->GetMakefile() + ->GetGlobalGenerator() + ->GetGeneratorTarget(target); + cmMakefile *makefile = target->GetMakefile(); + const char *qtVersion = makefile->GetDefinition("_target_qt_version"); + if (!qtVersion) + { + qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR"); + if (!qtVersion) + { + qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); + } + if (const char *targetQtVersion = + gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) + { + qtVersion = targetQtVersion; + } + } + + std::string targetName = target->GetName(); + if (strcmp(qtVersion, "5") == 0) + { + cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc"); + if (!qt5Rcc) + { + cmSystemTools::Error("Qt5::rcc target not found ", + targetName.c_str()); + return std::string(); + } + return qt5Rcc->ImportedGetLocation(""); + } + else if (strcmp(qtVersion, "4") == 0) + { + cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc"); + if (!qt4Rcc) + { + cmSystemTools::Error("Qt4::rcc target not found ", + targetName.c_str()); + return std::string(); + } + return qt4Rcc->ImportedGetLocation(""); + } + + cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " + "Qt 5 ", targetName.c_str()); + return std::string(); +} + std::string cmQtAutoGeneratorInitializer::GetAutogenTargetName( cmTarget const* target) { @@ -1021,54 +1072,3 @@ void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target) makefile->AddDefinition("_qt_rcc_executable", cmQtAutoGeneratorInitializer::GetRccExecutable(target).c_str()); } - -std::string cmQtAutoGeneratorInitializer::GetRccExecutable( - cmTarget const* target) -{ - cmGeneratorTarget *gtgt = target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); - cmMakefile *makefile = target->GetMakefile(); - const char *qtVersion = makefile->GetDefinition("_target_qt_version"); - if (!qtVersion) - { - qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR"); - if (!qtVersion) - { - qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); - } - if (const char *targetQtVersion = - gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) - { - qtVersion = targetQtVersion; - } - } - - std::string targetName = target->GetName(); - if (strcmp(qtVersion, "5") == 0) - { - cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc"); - if (!qt5Rcc) - { - cmSystemTools::Error("Qt5::rcc target not found ", - targetName.c_str()); - return std::string(); - } - return qt5Rcc->ImportedGetLocation(""); - } - else if (strcmp(qtVersion, "4") == 0) - { - cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc"); - if (!qt4Rcc) - { - cmSystemTools::Error("Qt4::rcc target not found ", - targetName.c_str()); - return std::string(); - } - return qt4Rcc->ImportedGetLocation(""); - } - - cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " - "Qt 5 ", targetName.c_str()); - return std::string(); -} -- cgit v1.2.1