diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-09-22 22:54:08 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-10-23 18:35:25 (GMT) |
commit | 506151af519aa50594000d22c66c0620f026878f (patch) | |
tree | 50ac2bb4de4e197fc6f067dfc1e9ed53faf65483 /Source/cmQtAutoGenerators.cxx | |
parent | b2a7f60a4660ced5892e47eb1e7dd560313c340c (diff) | |
download | CMake-506151af519aa50594000d22c66c0620f026878f.zip CMake-506151af519aa50594000d22c66c0620f026878f.tar.gz CMake-506151af519aa50594000d22c66c0620f026878f.tar.bz2 |
QtAutogen: Extract a GetRccExecutable method.
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 7e4be89..f709932 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -935,6 +935,29 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) makefile->AddDefinition("_qt_rcc_options_options", cmLocalGenerator::EscapeForCMake(rccFileOptions).c_str()); + makefile->AddDefinition("_qt_rcc_executable", + this->GetRccExecutable(target).c_str()); +} + +std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* 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 = + target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", + "")) + { + qtVersion = targetQtVersion; + } + } + std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) { @@ -943,9 +966,9 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { cmSystemTools::Error("Qt5::rcc target not found ", targetName.c_str()); - return; + return std::string(); } - makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation("")); + return qt5Rcc->GetLocation(""); } else if (strcmp(qtVersion, "4") == 0) { @@ -954,15 +977,14 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { cmSystemTools::Error("Qt4::rcc target not found ", targetName.c_str()); - return; + return std::string(); } - makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation("")); - } - else - { - cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " - "Qt 5 ", targetName.c_str()); + return qt4Rcc->GetLocation(""); } + + cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " + "Qt 5 ", targetName.c_str()); + return std::string(); } static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, |