From 1c19626864d8622ac3a0f00b564ea1d7f0eb3971 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Mon, 9 Oct 2017 14:03:18 +0200 Subject: Autogen: Allow setting SKIP_AUTOUIC/GEN on .ui files not in the sources SKIP_AUTOUIC and SKIP_AUTOGEN were ignored when set on a `.ui` file that was not in the sources of the target. --- Source/cmQtAutoGeneratorInitializer.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 217865b..e7080cd 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -452,8 +452,6 @@ static void SetupAutoTargetUic(cmQtAutoGenDigest const& digest, cmGeneratorTarget const* target = digest.Target; cmMakefile* makefile = target->Target->GetMakefile(); - AddDefinitionEscaped(makefile, "_uic_skip", setup.UicSkip); - // Uic search paths { std::vector uicSearchPaths; @@ -489,21 +487,25 @@ static void SetupAutoTargetUic(cmQtAutoGenDigest const& digest, } } } - // Uic files options + // .ui files skip and options { std::vector uiFileFiles; std::vector> uiFileOptions; { std::string const uiExt = "ui"; - const std::vector& srcFiles = makefile->GetSourceFiles(); - for (cmSourceFile* sf : srcFiles) { + for (cmSourceFile* sf : makefile->GetSourceFiles()) { // sf->GetExtension() is only valid after sf->GetFullPath() ... std::string const& fPath = sf->GetFullPath(); if (sf->GetExtension() == uiExt) { + std::string const absFile = cmSystemTools::GetRealPath(fPath); + // Check if the file should be skipped + if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || + sf->GetPropertyAsBool("SKIP_AUTOGEN")) { + setup.UicSkip.insert(absFile); + } // Check if the files has uic options std::string const uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS"); if (!uicOpts.empty()) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); // Check if file isn't skipped if (setup.UicSkip.count(absFile) == 0) { uiFileFiles.push_back(absFile); @@ -519,6 +521,8 @@ static void SetupAutoTargetUic(cmQtAutoGenDigest const& digest, AddDefinitionEscaped(makefile, "_qt_uic_options_options", uiFileOptions); } + AddDefinitionEscaped(makefile, "_uic_skip", setup.UicSkip); + // Uic executable { std::string err; -- cgit v0.12