[Cmake-commits] CMake branch, master, updated. v3.12.0-rc3-220-g102f51d

Kitware Robot kwrobot at kitware.com
Fri Jul 13 09:05:03 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  102f51d0aad6826864d6c6da6c2c2f9c6682b28d (commit)
       via  f691dbc4858710708ec764a942c8f25425324a7f (commit)
       via  969ad5b33e365d447642d2bf114ca6bd5667e257 (commit)
       via  e109dc0b2a68999dec742689955b7b2701025d6f (commit)
       via  384c3f9e9e743b1edb1e7b441d113b6e5e68085d (commit)
       via  f2134169f61e12354c79cd818758d34257116b1c (commit)
       via  86b332c25d22f7050ed60c1604c2a188c5885619 (commit)
       via  189f723509a5077d044510e90b01775e2997302a (commit)
       via  c6a8002827e0d23d27906ea5760a67981660f453 (commit)
      from  0d72c50d29e81789396cab9c515e90ba1e014150 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=102f51d0aad6826864d6c6da6c2c2f9c6682b28d
commit 102f51d0aad6826864d6c6da6c2c2f9c6682b28d
Merge: f691dbc 86b332c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 13 12:57:28 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Jul 13 08:57:36 2018 -0400

    Merge topic 'autogen_forward_errors'
    
    86b332c25d Return std::string from cmGeneratorTarget::ImportedGetLocation
    189f723509 Autogen: Wrap moc/uic/rcc related variables in structs
    c6a8002827 Autogen: Improve error detection during configuration
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2207


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f691dbc4858710708ec764a942c8f25425324a7f
commit f691dbc4858710708ec764a942c8f25425324a7f
Merge: 969ad5b f213416
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 13 12:57:02 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Jul 13 08:57:09 2018 -0400

    Merge topic 'cpack-wix-extra-sources'
    
    f2134169f6 WiX: Add the build directory to IncludeSearchPaths for candle.exe
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2194


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=969ad5b33e365d447642d2bf114ca6bd5667e257
commit 969ad5b33e365d447642d2bf114ca6bd5667e257
Merge: 0d72c50 e109dc0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jul 13 08:55:33 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jul 13 08:55:33 2018 -0400

    Merge branch 'release-3.12'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2134169f61e12354c79cd818758d34257116b1c
commit f2134169f61e12354c79cd818758d34257116b1c
Author:     Lars Schmertmann <Lars.Schmertmann at governikus.de>
AuthorDate: Fri Jul 6 12:52:04 2018 +0200
Commit:     Lars Schmertmann <Lars.Schmertmann at governikus.de>
CommitDate: Thu Jul 12 08:48:33 2018 +0200

    WiX: Add the build directory to IncludeSearchPaths for candle.exe
    
    CPack creates cpack_variables.wxi in the build directory. In the WiX
    template it can be used by <?include "cpack_variables.wxi"?> because
    the template is configured into main.wxs in the build directory.
    Because the extra source files are in the source directory it was necessary to use
    <?include "$(sys.CURRENTDIR)_CPack_Packages\win32\WIX\cpack_variables.wxi"?>.
    This requires knowledge about the build directory structure and
    is avoided by this change by adding the build directory to the IncludeSearchPaths.

diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 382b189..398ebd3 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -100,6 +100,10 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile,
     command << " -ext " << QuotePath(ext);
   }
 
+  if (sourceFile.rfind(this->CPackTopLevel, 0) != 0) {
+    command << " " << QuotePath("-I" + this->CPackTopLevel);
+  }
+
   AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command);
 
   command << " " << QuotePath(sourceFile);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86b332c25d22f7050ed60c1604c2a188c5885619
commit 86b332c25d22f7050ed60c1604c2a188c5885619
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Jul 11 16:58:48 2018 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Wed Jul 11 16:58:48 2018 +0200

    Return std::string from cmGeneratorTarget::ImportedGetLocation

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3989ebe..098c13a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3358,14 +3358,12 @@ std::string cmGeneratorTarget::GetFullNameInternal(
   return prefix + base + suffix;
 }
 
-const char* cmGeneratorTarget::ImportedGetLocation(
+std::string cmGeneratorTarget::ImportedGetLocation(
   const std::string& config) const
 {
-  static std::string location;
   assert(this->IsImported());
-  location = this->Target->ImportedGetFullPath(
+  return this->Target->ImportedGetFullPath(
     config, cmStateEnums::RuntimeBinaryArtifact);
-  return location.c_str();
 }
 
 std::string cmGeneratorTarget::GetFullNameImported(
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6a36116..6c1f931 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -658,7 +658,7 @@ public:
       no soname at all.  */
   bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
 
-  const char* ImportedGetLocation(const std::string& config) const;
+  std::string ImportedGetLocation(const std::string& config) const;
 
   /** Get the target major and minor version numbers interpreted from
       the VERSION property.  Version 0 is returned if the property is
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index a0fd1b1..fd9829f 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -37,11 +37,6 @@
 #include <utility>
 #include <vector>
 
-inline static const char* SafeString(const char* value)
-{
-  return (value != nullptr) ? value : "";
-}
-
 static std::size_t GetParallelCPUCount()
 {
   static std::size_t count = 0;
@@ -1268,7 +1263,7 @@ bool cmQtAutoGenInitializer::GetMocExecutable()
       cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
       cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
       if (tgt != nullptr) {
-        this->Moc.Executable = SafeString(tgt->ImportedGetLocation(""));
+        this->Moc.Executable = tgt->ImportedGetLocation("");
       } else {
         err = "Could not find target " + targetName;
       }
@@ -1329,7 +1324,7 @@ bool cmQtAutoGenInitializer::GetUicExecutable()
       cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
       cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
       if (tgt != nullptr) {
-        this->Uic.Executable = SafeString(tgt->ImportedGetLocation(""));
+        this->Uic.Executable = tgt->ImportedGetLocation("");
       } else {
         if (this->QtVersionMajor == "5") {
           // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
@@ -1394,7 +1389,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable()
       cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
       cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
       if (tgt != nullptr) {
-        this->Rcc.Executable = SafeString(tgt->ImportedGetLocation(""));
+        this->Rcc.Executable = tgt->ImportedGetLocation("");
       } else {
         err = "Could not find target " + targetName;
       }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=189f723509a5077d044510e90b01775e2997302a
commit 189f723509a5077d044510e90b01775e2997302a
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Jul 11 13:54:46 2018 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Wed Jul 11 13:54:46 2018 +0200

    Autogen: Wrap moc/uic/rcc related variables in structs

diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 11ffe71..a0fd1b1 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -182,12 +182,13 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer(
   cmGeneratorTarget* target, bool mocEnabled, bool uicEnabled, bool rccEnabled,
   std::string const& qtVersionMajor)
   : Target(target)
-  , MocEnabled(mocEnabled)
-  , UicEnabled(uicEnabled)
-  , RccEnabled(rccEnabled)
   , MultiConfig(false)
   , QtVersionMajor(qtVersionMajor)
 {
+  Moc.Enabled = mocEnabled;
+  Uic.Enabled = uicEnabled;
+  Rcc.Enabled = rccEnabled;
+
   this->QtVersionMinor =
     cmQtAutoGenInitializer::GetQtMinorVersion(target, this->QtVersionMajor);
 }
@@ -300,15 +301,15 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
   }
 
   // Add moc compilation to generated files list
-  if (this->MocEnabled) {
+  if (this->Moc.Enabled) {
     std::string mocsComp = this->DirBuild + "/mocs_compilation.cpp";
     this->AddGeneratedSource(mocsComp, GeneratorT::MOC);
     autogenProvides.push_back(std::move(mocsComp));
   }
 
   // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES
-  if (this->MocEnabled || this->UicEnabled ||
-      (this->RccEnabled && this->MultiConfig)) {
+  if (this->Moc.Enabled || this->Uic.Enabled ||
+      (this->Rcc.Enabled && this->MultiConfig)) {
     std::string includeDir = this->DirBuild;
     includeDir += "/include";
     if (this->MultiConfig) {
@@ -318,7 +319,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
   }
 
   // Acquire rcc executable and features
-  if (this->RccEnabled) {
+  if (this->Rcc.Enabled) {
     if (!GetRccExecutable()) {
       return false;
     }
@@ -339,14 +340,14 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
       std::string const& fPath = sf->GetFullPath();
       std::string const& ext = sf->GetExtension();
       // Register generated files that will be scanned by moc or uic
-      if (this->MocEnabled || this->UicEnabled) {
+      if (this->Moc.Enabled || this->Uic.Enabled) {
         cmSystemTools::FileFormat const fileType =
           cmSystemTools::GetFileFormat(ext.c_str());
         if ((fileType == cmSystemTools::CXX_FILE_FORMAT) ||
             (fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
           std::string const absPath = cmSystemTools::GetRealPath(fPath);
-          if ((this->MocEnabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) ||
-              (this->UicEnabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) {
+          if ((this->Moc.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) ||
+              (this->Uic.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) {
             // Register source
             const bool generated = sf->GetPropertyAsBool("GENERATED");
             if (fileType == cmSystemTools::HEADER_FILE_FORMAT) {
@@ -366,7 +367,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
         }
       }
       // Register rcc enabled files
-      if (this->RccEnabled && (ext == qrcExt) &&
+      if (this->Rcc.Enabled && (ext == qrcExt) &&
           !sf->GetPropertyAsBool("SKIP_AUTORCC")) {
         // Register qrc file
         {
@@ -382,7 +383,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
               cmSystemTools::ExpandListArgument(opts, qrc.Options);
             }
           }
-          this->Qrcs.push_back(std::move(qrc));
+          this->Rcc.Qrcs.push_back(std::move(qrc));
         }
       }
     }
@@ -393,7 +394,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     this->Target->ClearSourcesCache();
   }
   // Read skip files from makefile sources
-  if (this->MocEnabled || this->UicEnabled) {
+  if (this->Moc.Enabled || this->Uic.Enabled) {
     std::string pathError;
     for (cmSourceFile* sf : makefile->GetSourceFiles()) {
       // sf->GetExtension() is only valid after sf->GetFullPath() ...
@@ -411,17 +412,17 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
         continue;
       }
       const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN");
-      const bool mocSkip =
-        this->MocEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC"));
-      const bool uicSkip =
-        this->UicEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC"));
+      const bool mocSkip = this->Moc.Enabled &&
+        (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC"));
+      const bool uicSkip = this->Uic.Enabled &&
+        (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC"));
       if (mocSkip || uicSkip) {
         std::string const absFile = cmSystemTools::GetRealPath(fPath);
         if (mocSkip) {
-          this->MocSkip.insert(absFile);
+          this->Moc.Skip.insert(absFile);
         }
         if (uicSkip) {
-          this->UicSkip.insert(absFile);
+          this->Uic.Skip.insert(absFile);
         }
       }
     }
@@ -466,13 +467,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
         msg += "\n";
         std::string tools;
         std::string property;
-        if (this->MocEnabled && this->UicEnabled) {
+        if (this->Moc.Enabled && this->Uic.Enabled) {
           tools = "AUTOMOC and AUTOUIC";
           property = "SKIP_AUTOGEN";
-        } else if (this->MocEnabled) {
+        } else if (this->Moc.Enabled) {
           tools = "AUTOMOC";
           property = "SKIP_AUTOMOC";
-        } else if (this->UicEnabled) {
+        } else if (this->Uic.Enabled) {
           tools = "AUTOUIC";
           property = "SKIP_AUTOUIC";
         }
@@ -502,13 +503,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     generatedHeaders.clear();
   }
   // Sort headers and sources
-  if (this->MocEnabled || this->UicEnabled) {
+  if (this->Moc.Enabled || this->Uic.Enabled) {
     std::sort(this->Headers.begin(), this->Headers.end());
     std::sort(this->Sources.begin(), this->Sources.end());
   }
 
   // Process qrc files
-  if (!this->Qrcs.empty()) {
+  if (!this->Rcc.Qrcs.empty()) {
     const bool QtV5 = (this->QtVersionMajor == "5");
     // Target rcc options
     std::vector<std::string> optionsTarget;
@@ -516,9 +517,9 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
       this->Target->GetSafeProperty("AUTORCC_OPTIONS"), optionsTarget);
 
     // Check if file name is unique
-    for (Qrc& qrc : this->Qrcs) {
+    for (Qrc& qrc : this->Rcc.Qrcs) {
       qrc.Unique = true;
-      for (Qrc const& qrc2 : this->Qrcs) {
+      for (Qrc const& qrc2 : this->Rcc.Qrcs) {
         if ((&qrc != &qrc2) && (qrc.QrcName == qrc2.QrcName)) {
           qrc.Unique = false;
           break;
@@ -528,7 +529,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     // Path checksum and file names
     {
       cmFilePathChecksum const fpathCheckSum(makefile);
-      for (Qrc& qrc : this->Qrcs) {
+      for (Qrc& qrc : this->Rcc.Qrcs) {
         qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile);
         // RCC output file name
         {
@@ -559,7 +560,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
       }
     }
     // RCC options
-    for (Qrc& qrc : this->Qrcs) {
+    for (Qrc& qrc : this->Rcc.Qrcs) {
       // Target options
       std::vector<std::string> opts = optionsTarget;
       // Merge computed "-name XYZ" option
@@ -580,7 +581,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
       RccMergeOptions(opts, qrc.Options, QtV5);
       qrc.Options = std::move(opts);
     }
-    for (Qrc& qrc : this->Qrcs) {
+    for (Qrc& qrc : this->Rcc.Qrcs) {
       // Register file at target
       this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC);
 
@@ -676,7 +677,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
   }
 
   // Create _autogen target
-  if (this->MocEnabled || this->UicEnabled) {
+  if (this->Moc.Enabled || this->Uic.Enabled) {
     // Add user defined autogen target dependencies
     {
       std::string const deps =
@@ -700,10 +701,10 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
     std::string autogenComment;
     {
       std::string tools;
-      if (this->MocEnabled) {
+      if (this->Moc.Enabled) {
         tools += "MOC";
       }
-      if (this->UicEnabled) {
+      if (this->Uic.Enabled) {
         if (!tools.empty()) {
           tools += " and ";
         }
@@ -847,11 +848,11 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
   }
 
   // Generate autogen target info file
-  if (this->MocEnabled || this->UicEnabled) {
-    if (this->MocEnabled) {
+  if (this->Moc.Enabled || this->Uic.Enabled) {
+    if (this->Moc.Enabled) {
       this->SetupCustomTargetsMoc();
     }
-    if (this->UicEnabled) {
+    if (this->Uic.Enabled) {
       this->SetupCustomTargetsUic();
     }
 
@@ -938,16 +939,16 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
 
       ofs << "# Qt\n";
       CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor);
-      CWrite("AM_QT_MOC_EXECUTABLE", this->MocExecutable);
-      CWrite("AM_QT_UIC_EXECUTABLE", this->UicExecutable);
+      CWrite("AM_QT_MOC_EXECUTABLE", this->Moc.Executable);
+      CWrite("AM_QT_UIC_EXECUTABLE", this->Uic.Executable);
 
-      if (this->MocEnabled) {
+      if (this->Moc.Enabled) {
         ofs << "# MOC settings\n";
-        CWriteSet("AM_MOC_SKIP", this->MocSkip);
-        CWrite("AM_MOC_DEFINITIONS", this->MocDefines);
-        CWriteMap("AM_MOC_DEFINITIONS", this->MocDefinesConfig);
-        CWrite("AM_MOC_INCLUDES", this->MocIncludes);
-        CWriteMap("AM_MOC_INCLUDES", this->MocIncludesConfig);
+        CWriteSet("AM_MOC_SKIP", this->Moc.Skip);
+        CWrite("AM_MOC_DEFINITIONS", this->Moc.Defines);
+        CWriteMap("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines);
+        CWrite("AM_MOC_INCLUDES", this->Moc.Includes);
+        CWriteMap("AM_MOC_INCLUDES", this->Moc.ConfigIncludes);
         CWrite("AM_MOC_OPTIONS",
                this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS"));
         CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE"));
@@ -955,17 +956,17 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
                this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES"));
         CWrite("AM_MOC_DEPEND_FILTERS",
                this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS"));
-        CWrite("AM_MOC_PREDEFS_CMD", this->MocPredefsCmd);
+        CWrite("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd);
       }
 
-      if (this->UicEnabled) {
+      if (this->Uic.Enabled) {
         ofs << "# UIC settings\n";
-        CWriteSet("AM_UIC_SKIP", this->UicSkip);
-        CWrite("AM_UIC_TARGET_OPTIONS", this->UicOptions);
-        CWriteMap("AM_UIC_TARGET_OPTIONS", this->UicOptionsConfig);
-        CWriteList("AM_UIC_OPTIONS_FILES", this->UicFileFiles);
-        CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->UicFileOptions);
-        CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths);
+        CWriteSet("AM_UIC_SKIP", this->Uic.Skip);
+        CWrite("AM_UIC_TARGET_OPTIONS", this->Uic.Options);
+        CWriteMap("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions);
+        CWriteList("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles);
+        CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->Uic.FileOptions);
+        CWriteList("AM_UIC_SEARCH_PATHS", this->Uic.SearchPaths);
       }
     } else {
       std::string err = "AutoGen: Could not write file ";
@@ -976,8 +977,8 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
   }
 
   // Generate auto RCC info files
-  if (this->RccEnabled) {
-    for (Qrc const& qrc : this->Qrcs) {
+  if (this->Rcc.Enabled) {
+    for (Qrc const& qrc : this->Rcc.Qrcs) {
       // Register rcc info file as generated
       makefile->AddCMakeOutputFile(qrc.InfoFile);
 
@@ -1024,8 +1025,8 @@ bool cmQtAutoGenInitializer::SetupCustomTargets()
         }
 
         ofs << "# Rcc executable\n";
-        CWrite("ARCC_RCC_EXECUTABLE", this->RccExecutable);
-        CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->RccListOptions, ";"));
+        CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable);
+        CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->Rcc.ListOptions, ";"));
 
         ofs << "# Rcc job\n";
         CWrite("ARCC_LOCK_FILE", qrc.LockFile);
@@ -1055,7 +1056,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsMoc()
   // Moc predefs command
   if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") &&
       this->QtVersionGreaterOrEqual(5, 8)) {
-    this->MocPredefsCmd =
+    this->Moc.PredefsCmd =
       makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND");
   }
 
@@ -1079,20 +1080,20 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsMoc()
     };
 
     // Default configuration settings
-    this->MocIncludes = GetIncludeDirs(this->ConfigDefault);
-    this->MocDefines = GetCompileDefinitions(this->ConfigDefault);
+    this->Moc.Includes = GetIncludeDirs(this->ConfigDefault);
+    this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault);
     // Other configuration settings
     for (std::string const& cfg : this->ConfigsList) {
       {
         std::string const configIncludeDirs = GetIncludeDirs(cfg);
-        if (configIncludeDirs != this->MocIncludes) {
-          this->MocIncludesConfig[cfg] = configIncludeDirs;
+        if (configIncludeDirs != this->Moc.Includes) {
+          this->Moc.ConfigIncludes[cfg] = configIncludeDirs;
         }
       }
       {
         std::string const configCompileDefs = GetCompileDefinitions(cfg);
-        if (configCompileDefs != this->MocDefines) {
-          this->MocDefinesConfig[cfg] = configCompileDefs;
+        if (configCompileDefs != this->Moc.Defines) {
+          this->Moc.ConfigDefines[cfg] = configCompileDefs;
         }
       }
     }
@@ -1114,9 +1115,9 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsUic()
     std::string const usp =
       this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
     if (!usp.empty()) {
-      cmSystemTools::ExpandListArgument(usp, this->UicSearchPaths);
+      cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths);
       std::string const srcDir = makefile->GetCurrentSourceDirectory();
-      for (std::string& path : this->UicSearchPaths) {
+      for (std::string& path : this->Uic.SearchPaths) {
         path = cmSystemTools::CollapseFullPath(path, srcDir);
       }
     }
@@ -1130,13 +1131,13 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsUic()
     };
 
     // Default settings
-    this->UicOptions = UicGetOpts(this->ConfigDefault);
+    this->Uic.Options = UicGetOpts(this->ConfigDefault);
 
     // Configuration specific settings
     for (std::string const& cfg : this->ConfigsList) {
       std::string const configUicOpts = UicGetOpts(cfg);
-      if (configUicOpts != this->UicOptions) {
-        this->UicOptionsConfig[cfg] = configUicOpts;
+      if (configUicOpts != this->Uic.Options) {
+        this->Uic.ConfigOptions[cfg] = configUicOpts;
       }
     }
   }
@@ -1158,17 +1159,17 @@ bool cmQtAutoGenInitializer::SetupCustomTargetsUic()
         // Check if the .ui file should be skipped
         if (sf->GetPropertyAsBool("SKIP_AUTOUIC") ||
             sf->GetPropertyAsBool("SKIP_AUTOGEN")) {
-          this->UicSkip.insert(absFile);
+          this->Uic.Skip.insert(absFile);
         }
         // Check if the .ui file has uic options
         std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS");
         if (!uicOpts.empty()) {
           // Check if file isn't skipped
-          if (this->UicSkip.count(absFile) == 0) {
-            this->UicFileFiles.push_back(absFile);
+          if (this->Uic.Skip.count(absFile) == 0) {
+            this->Uic.FileFiles.push_back(absFile);
             std::vector<std::string> optsVec;
             cmSystemTools::ExpandListArgument(uicOpts, optsVec);
-            this->UicFileOptions.push_back(std::move(optsVec));
+            this->Uic.FileOptions.push_back(std::move(optsVec));
           }
         }
       }
@@ -1267,7 +1268,7 @@ bool cmQtAutoGenInitializer::GetMocExecutable()
       cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
       cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
       if (tgt != nullptr) {
-        this->MocExecutable = SafeString(tgt->ImportedGetLocation(""));
+        this->Moc.Executable = SafeString(tgt->ImportedGetLocation(""));
       } else {
         err = "Could not find target " + targetName;
       }
@@ -1276,9 +1277,9 @@ bool cmQtAutoGenInitializer::GetMocExecutable()
 
   // Test moc command
   if (err.empty()) {
-    if (cmSystemTools::FileExists(this->MocExecutable, true)) {
+    if (cmSystemTools::FileExists(this->Moc.Executable, true)) {
       std::vector<std::string> command;
-      command.push_back(this->MocExecutable);
+      command.push_back(this->Moc.Executable);
       command.push_back("-h");
       std::string stdOut;
       std::string stdErr;
@@ -1292,7 +1293,7 @@ bool cmQtAutoGenInitializer::GetMocExecutable()
       }
     } else {
       err = "The moc executable ";
-      err += Quoted(this->MocExecutable);
+      err += Quoted(this->Moc.Executable);
       err += " does not exist";
     }
   }
@@ -1328,7 +1329,7 @@ bool cmQtAutoGenInitializer::GetUicExecutable()
       cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
       cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
       if (tgt != nullptr) {
-        this->UicExecutable = SafeString(tgt->ImportedGetLocation(""));
+        this->Uic.Executable = SafeString(tgt->ImportedGetLocation(""));
       } else {
         if (this->QtVersionMajor == "5") {
           // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
@@ -1341,9 +1342,9 @@ bool cmQtAutoGenInitializer::GetUicExecutable()
 
   // Test uic command
   if (err.empty()) {
-    if (cmSystemTools::FileExists(this->UicExecutable, true)) {
+    if (cmSystemTools::FileExists(this->Uic.Executable, true)) {
       std::vector<std::string> command;
-      command.push_back(this->UicExecutable);
+      command.push_back(this->Uic.Executable);
       command.push_back("-h");
       std::string stdOut;
       std::string stdErr;
@@ -1357,7 +1358,7 @@ bool cmQtAutoGenInitializer::GetUicExecutable()
       }
     } else {
       err = "The uic executable ";
-      err += Quoted(this->UicExecutable);
+      err += Quoted(this->Uic.Executable);
       err += " does not exist";
     }
   }
@@ -1393,7 +1394,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable()
       cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
       cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
       if (tgt != nullptr) {
-        this->RccExecutable = SafeString(tgt->ImportedGetLocation(""));
+        this->Rcc.Executable = SafeString(tgt->ImportedGetLocation(""));
       } else {
         err = "Could not find target " + targetName;
       }
@@ -1402,9 +1403,9 @@ bool cmQtAutoGenInitializer::GetRccExecutable()
 
   // Test rcc command
   if (err.empty()) {
-    if (cmSystemTools::FileExists(this->RccExecutable, true)) {
+    if (cmSystemTools::FileExists(this->Rcc.Executable, true)) {
       std::vector<std::string> command;
-      command.push_back(this->RccExecutable);
+      command.push_back(this->Rcc.Executable);
       command.push_back("-h");
       std::string stdOut;
       std::string stdErr;
@@ -1416,9 +1417,9 @@ bool cmQtAutoGenInitializer::GetRccExecutable()
         // Detect if rcc supports (-)-list
         if (this->QtVersionMajor == "5") {
           if (stdOut.find("--list") != std::string::npos) {
-            this->RccListOptions.push_back("--list");
+            this->Rcc.ListOptions.push_back("--list");
           } else {
-            this->RccListOptions.push_back("-list");
+            this->Rcc.ListOptions.push_back("-list");
           }
         }
       } else {
@@ -1427,7 +1428,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable()
       }
     } else {
       err = "The rcc executable ";
-      err += Quoted(this->RccExecutable);
+      err += Quoted(this->Rcc.Executable);
       err += " does not exist";
     }
   }
@@ -1458,9 +1459,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
     error += "\n";
     return false;
   }
-  if (!RccListOptions.empty()) {
+  if (!this->Rcc.ListOptions.empty()) {
     // Use rcc for file listing
-    if (RccExecutable.empty()) {
+    if (this->Rcc.Executable.empty()) {
       error = "rcc executable not available";
       return false;
     }
@@ -1479,8 +1480,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
     std::string rccStdErr;
     {
       std::vector<std::string> cmd;
-      cmd.push_back(RccExecutable);
-      cmd.insert(cmd.end(), RccListOptions.begin(), RccListOptions.end());
+      cmd.push_back(this->Rcc.Executable);
+      cmd.insert(cmd.end(), this->Rcc.ListOptions.begin(),
+                 this->Rcc.ListOptions.end());
       cmd.push_back(fileNameName);
       result = cmSystemTools::RunSingleCommand(
         cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index bc78a03..0999e0f 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -72,17 +72,10 @@ private:
 
 private:
   cmGeneratorTarget* Target;
-  bool MocEnabled;
-  bool UicEnabled;
-  bool RccEnabled;
   bool MultiConfig;
   // Qt
   std::string QtVersionMajor;
   std::string QtVersionMinor;
-  std::string MocExecutable;
-  std::string UicExecutable;
-  std::string RccExecutable;
-  std::vector<std::string> RccListOptions;
   // Configurations
   std::string ConfigDefault;
   std::vector<std::string> ConfigsList;
@@ -101,21 +94,37 @@ private:
   std::vector<std::string> Headers;
   std::vector<std::string> Sources;
   // Moc
-  std::string MocPredefsCmd;
-  std::set<std::string> MocSkip;
-  std::string MocIncludes;
-  std::map<std::string, std::string> MocIncludesConfig;
-  std::string MocDefines;
-  std::map<std::string, std::string> MocDefinesConfig;
+  struct
+  {
+    bool Enabled;
+    std::string Executable;
+    std::string PredefsCmd;
+    std::set<std::string> Skip;
+    std::string Includes;
+    std::map<std::string, std::string> ConfigIncludes;
+    std::string Defines;
+    std::map<std::string, std::string> ConfigDefines;
+  } Moc;
   // Uic
-  std::set<std::string> UicSkip;
-  std::vector<std::string> UicSearchPaths;
-  std::string UicOptions;
-  std::map<std::string, std::string> UicOptionsConfig;
-  std::vector<std::string> UicFileFiles;
-  std::vector<std::vector<std::string>> UicFileOptions;
+  struct
+  {
+    bool Enabled;
+    std::string Executable;
+    std::set<std::string> Skip;
+    std::vector<std::string> SearchPaths;
+    std::string Options;
+    std::map<std::string, std::string> ConfigOptions;
+    std::vector<std::string> FileFiles;
+    std::vector<std::vector<std::string>> FileOptions;
+  } Uic;
   // Rcc
-  std::vector<Qrc> Qrcs;
+  struct
+  {
+    bool Enabled;
+    std::string Executable;
+    std::vector<std::string> ListOptions;
+    std::vector<Qrc> Qrcs;
+  } Rcc;
 };
 
 #endif

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c6a8002827e0d23d27906ea5760a67981660f453
commit c6a8002827e0d23d27906ea5760a67981660f453
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Jul 11 13:29:49 2018 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Wed Jul 11 13:29:49 2018 +0200

    Autogen: Improve error detection during configuration
    
    cmQtAutoGenInitializer::InitCustomTargets and
    cmQtAutoGenInitializer::SetupCustomTargets
    now return their success value which gets evaluated
    and passed on by the caller (cmGlobalGenerator).
    
    Checks for the existance of the moc/uic/rcc
    binaries have been introduces in cmQtAutoGenInitializer.
    Additionally they get called once with a "-h"
    argument to determine if they're functional.
    This way any binary-not-found problem is caught
    during the configuration phase.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2872831..c401844 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1318,7 +1318,9 @@ bool cmGlobalGenerator::Compute()
   // the AUTOMOC, AUTOUIC or AUTORCC property set
   auto autogenInits = this->CreateQtAutoGenInitializers();
   for (auto& autoGen : autogenInits) {
-    autoGen->InitCustomTargets();
+    if (!autoGen->InitCustomTargets()) {
+      return false;
+    }
   }
 #endif
 
@@ -1341,7 +1343,9 @@ bool cmGlobalGenerator::Compute()
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
   for (auto& autoGen : autogenInits) {
-    autoGen->SetupCustomTargets();
+    if (!autoGen->SetupCustomTargets()) {
+      return false;
+    }
     autoGen.reset(nullptr);
   }
   autogenInits.clear();
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 8ede960..11ffe71 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -192,7 +192,7 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer(
     cmQtAutoGenInitializer::GetQtMinorVersion(target, this->QtVersionMajor);
 }
 
-void cmQtAutoGenInitializer::InitCustomTargets()
+bool cmQtAutoGenInitializer::InitCustomTargets()
 {
   cmMakefile* makefile = this->Target->Target->GetMakefile();
   cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
@@ -319,51 +319,8 @@ void cmQtAutoGenInitializer::InitCustomTargets()
 
   // Acquire rcc executable and features
   if (this->RccEnabled) {
-    {
-      std::string err;
-      if (this->QtVersionMajor == "5") {
-        cmGeneratorTarget* tgt =
-          localGen->FindGeneratorTargetToUse("Qt5::rcc");
-        if (tgt != nullptr) {
-          this->RccExecutable = SafeString(tgt->ImportedGetLocation(""));
-        } else {
-          err = "AUTORCC: Qt5::rcc target not found";
-        }
-      } else if (QtVersionMajor == "4") {
-        cmGeneratorTarget* tgt =
-          localGen->FindGeneratorTargetToUse("Qt4::rcc");
-        if (tgt != nullptr) {
-          this->RccExecutable = SafeString(tgt->ImportedGetLocation(""));
-        } else {
-          err = "AUTORCC: Qt4::rcc target not found";
-        }
-      } else {
-        err = "The AUTORCC feature supports only Qt 4 and Qt 5";
-      }
-      if (!err.empty()) {
-        err += " (";
-        err += this->Target->GetName();
-        err += ")";
-        cmSystemTools::Error(err.c_str());
-      }
-    }
-    // Detect if rcc supports (-)-list
-    if (!this->RccExecutable.empty() && (this->QtVersionMajor == "5")) {
-      std::vector<std::string> command;
-      command.push_back(this->RccExecutable);
-      command.push_back("--help");
-      std::string rccStdOut;
-      std::string rccStdErr;
-      int retVal = 0;
-      bool result = cmSystemTools::RunSingleCommand(
-        command, &rccStdOut, &rccStdErr, &retVal, nullptr,
-        cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
-      if (result && retVal == 0 &&
-          rccStdOut.find("--list") != std::string::npos) {
-        this->RccListOptions.push_back("--list");
-      } else {
-        this->RccListOptions.push_back("-list");
-      }
+    if (!GetRccExecutable()) {
+      return false;
     }
   }
 
@@ -704,6 +661,7 @@ void cmQtAutoGenInitializer::InitCustomTargets()
               }
             } else {
               cmSystemTools::Error(error.c_str());
+              return false;
             }
           }
           makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends,
@@ -863,17 +821,20 @@ void cmQtAutoGenInitializer::InitCustomTargets()
       this->Target->Target->AddUtility(this->AutogenTargetName, makefile);
     }
   }
+
+  return true;
 }
 
-void cmQtAutoGenInitializer::SetupCustomTargets()
+bool cmQtAutoGenInitializer::SetupCustomTargets()
 {
   cmMakefile* makefile = this->Target->Target->GetMakefile();
 
   // Create info directory on demand
   if (!cmSystemTools::MakeDirectory(this->DirInfo)) {
-    std::string emsg = ("Could not create directory: ");
+    std::string emsg = ("AutoGen: Could not create directory: ");
     emsg += Quoted(this->DirInfo);
     cmSystemTools::Error(emsg.c_str());
+    return false;
   }
 
   // Configuration include directories
@@ -1007,7 +968,10 @@ void cmQtAutoGenInitializer::SetupCustomTargets()
         CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths);
       }
     } else {
-      return;
+      std::string err = "AutoGen: Could not write file ";
+      err += this->AutogenInfoFile;
+      cmSystemTools::Error(err.c_str());
+      return false;
     }
   }
 
@@ -1072,13 +1036,18 @@ void cmQtAutoGenInitializer::SetupCustomTargets()
         CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";"));
         CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";"));
       } else {
-        return;
+        std::string err = "AutoRcc: Could not write file ";
+        err += qrc.InfoFile;
+        cmSystemTools::Error(err.c_str());
+        return false;
       }
     }
   }
+
+  return true;
 }
 
-void cmQtAutoGenInitializer::SetupCustomTargetsMoc()
+bool cmQtAutoGenInitializer::SetupCustomTargetsMoc()
 {
   cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
   cmMakefile* makefile = this->Target->Target->GetMakefile();
@@ -1129,41 +1098,14 @@ void cmQtAutoGenInitializer::SetupCustomTargetsMoc()
     }
   }
 
-  // Moc executable
-  {
-    std::string mocExec;
-    std::string err;
-
-    if (this->QtVersionMajor == "5") {
-      cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::moc");
-      if (tgt != nullptr) {
-        mocExec = SafeString(tgt->ImportedGetLocation(""));
-      } else {
-        err = "AUTOMOC: Qt5::moc target not found";
-      }
-    } else if (this->QtVersionMajor == "4") {
-      cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::moc");
-      if (tgt != nullptr) {
-        mocExec = SafeString(tgt->ImportedGetLocation(""));
-      } else {
-        err = "AUTOMOC: Qt4::moc target not found";
-      }
-    } else {
-      err = "The AUTOMOC feature supports only Qt 4 and Qt 5";
-    }
-
-    if (err.empty()) {
-      this->MocExecutable = mocExec;
-    } else {
-      err += " (";
-      err += this->Target->GetName();
-      err += ")";
-      cmSystemTools::Error(err.c_str());
-    }
+  if (!GetMocExecutable()) {
+    return false;
   }
+
+  return true;
 }
 
-void cmQtAutoGenInitializer::SetupCustomTargetsUic()
+bool cmQtAutoGenInitializer::SetupCustomTargetsUic()
 {
   cmMakefile* makefile = this->Target->Target->GetMakefile();
 
@@ -1233,39 +1175,11 @@ void cmQtAutoGenInitializer::SetupCustomTargetsUic()
     }
   }
 
-  // Uic executable
-  {
-    std::string err;
-    std::string uicExec;
-
-    cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
-    if (this->QtVersionMajor == "5") {
-      cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::uic");
-      if (tgt != nullptr) {
-        uicExec = SafeString(tgt->ImportedGetLocation(""));
-      } else {
-        // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
-      }
-    } else if (this->QtVersionMajor == "4") {
-      cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::uic");
-      if (tgt != nullptr) {
-        uicExec = SafeString(tgt->ImportedGetLocation(""));
-      } else {
-        err = "AUTOUIC: Qt4::uic target not found";
-      }
-    } else {
-      err = "The AUTOUIC feature supports only Qt 4 and Qt 5";
-    }
-
-    if (err.empty()) {
-      this->UicExecutable = uicExec;
-    } else {
-      err += " (";
-      err += this->Target->GetName();
-      err += ")";
-      cmSystemTools::Error(err.c_str());
-    }
+  if (!GetUicExecutable()) {
+    return false;
   }
+
+  return true;
 }
 
 void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
@@ -1335,6 +1249,202 @@ bool cmQtAutoGenInitializer::QtVersionGreaterOrEqual(
   return false;
 }
 
+bool cmQtAutoGenInitializer::GetMocExecutable()
+{
+  std::string err;
+
+  // Find moc executable
+  {
+    std::string targetName;
+    if (this->QtVersionMajor == "5") {
+      targetName = "Qt5::moc";
+    } else if (QtVersionMajor == "4") {
+      targetName = "Qt4::moc";
+    } else {
+      err = "The AUTOMOC feature supports only Qt 4 and Qt 5";
+    }
+    if (!targetName.empty()) {
+      cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+      cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
+      if (tgt != nullptr) {
+        this->MocExecutable = SafeString(tgt->ImportedGetLocation(""));
+      } else {
+        err = "Could not find target " + targetName;
+      }
+    }
+  }
+
+  // Test moc command
+  if (err.empty()) {
+    if (cmSystemTools::FileExists(this->MocExecutable, true)) {
+      std::vector<std::string> command;
+      command.push_back(this->MocExecutable);
+      command.push_back("-h");
+      std::string stdOut;
+      std::string stdErr;
+      int retVal = 0;
+      bool result = cmSystemTools::RunSingleCommand(
+        command, &stdOut, &stdErr, &retVal, nullptr,
+        cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+      if (!result) {
+        err = "The moc test command failed: ";
+        err += QuotedCommand(command);
+      }
+    } else {
+      err = "The moc executable ";
+      err += Quoted(this->MocExecutable);
+      err += " does not exist";
+    }
+  }
+
+  // Print error
+  if (!err.empty()) {
+    std::string msg = "AutoMoc (";
+    msg += this->Target->GetName();
+    msg += "): ";
+    msg += err;
+    cmSystemTools::Error(msg.c_str());
+    return false;
+  }
+
+  return true;
+}
+
+bool cmQtAutoGenInitializer::GetUicExecutable()
+{
+  std::string err;
+
+  // Find uic executable
+  {
+    std::string targetName;
+    if (this->QtVersionMajor == "5") {
+      targetName = "Qt5::uic";
+    } else if (QtVersionMajor == "4") {
+      targetName = "Qt4::uic";
+    } else {
+      err = "The AUTOUIC feature supports only Qt 4 and Qt 5";
+    }
+    if (!targetName.empty()) {
+      cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+      cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
+      if (tgt != nullptr) {
+        this->UicExecutable = SafeString(tgt->ImportedGetLocation(""));
+      } else {
+        if (this->QtVersionMajor == "5") {
+          // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
+        } else {
+          err = "Could not find target " + targetName;
+        }
+      }
+    }
+  }
+
+  // Test uic command
+  if (err.empty()) {
+    if (cmSystemTools::FileExists(this->UicExecutable, true)) {
+      std::vector<std::string> command;
+      command.push_back(this->UicExecutable);
+      command.push_back("-h");
+      std::string stdOut;
+      std::string stdErr;
+      int retVal = 0;
+      bool result = cmSystemTools::RunSingleCommand(
+        command, &stdOut, &stdErr, &retVal, nullptr,
+        cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+      if (!result) {
+        err = "The uic test command failed: ";
+        err += QuotedCommand(command);
+      }
+    } else {
+      err = "The uic executable ";
+      err += Quoted(this->UicExecutable);
+      err += " does not exist";
+    }
+  }
+
+  // Print error
+  if (!err.empty()) {
+    std::string msg = "AutoUic (";
+    msg += this->Target->GetName();
+    msg += "): ";
+    msg += err;
+    cmSystemTools::Error(msg.c_str());
+    return false;
+  }
+
+  return true;
+}
+
+bool cmQtAutoGenInitializer::GetRccExecutable()
+{
+  std::string err;
+
+  // Find rcc executable
+  {
+    std::string targetName;
+    if (this->QtVersionMajor == "5") {
+      targetName = "Qt5::rcc";
+    } else if (QtVersionMajor == "4") {
+      targetName = "Qt4::rcc";
+    } else {
+      err = "The AUTORCC feature supports only Qt 4 and Qt 5";
+    }
+    if (!targetName.empty()) {
+      cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
+      cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
+      if (tgt != nullptr) {
+        this->RccExecutable = SafeString(tgt->ImportedGetLocation(""));
+      } else {
+        err = "Could not find target " + targetName;
+      }
+    }
+  }
+
+  // Test rcc command
+  if (err.empty()) {
+    if (cmSystemTools::FileExists(this->RccExecutable, true)) {
+      std::vector<std::string> command;
+      command.push_back(this->RccExecutable);
+      command.push_back("-h");
+      std::string stdOut;
+      std::string stdErr;
+      int retVal = 0;
+      bool result = cmSystemTools::RunSingleCommand(
+        command, &stdOut, &stdErr, &retVal, nullptr,
+        cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
+      if (result) {
+        // Detect if rcc supports (-)-list
+        if (this->QtVersionMajor == "5") {
+          if (stdOut.find("--list") != std::string::npos) {
+            this->RccListOptions.push_back("--list");
+          } else {
+            this->RccListOptions.push_back("-list");
+          }
+        }
+      } else {
+        err = "The rcc test command failed: ";
+        err += QuotedCommand(command);
+      }
+    } else {
+      err = "The rcc executable ";
+      err += Quoted(this->RccExecutable);
+      err += " does not exist";
+    }
+  }
+
+  // Print error
+  if (!err.empty()) {
+    std::string msg = "AutoRcc (";
+    msg += this->Target->GetName();
+    msg += "): ";
+    msg += err;
+    cmSystemTools::Error(msg.c_str());
+    return false;
+  }
+
+  return true;
+}
+
 /// @brief Reads the resource files list from from a .qrc file
 /// @arg fileName Must be the absolute path of the .qrc file
 /// @return True if the rcc file was successfully read
diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h
index 813c680..bc78a03 100644
--- a/Source/cmQtAutoGenInitializer.h
+++ b/Source/cmQtAutoGenInitializer.h
@@ -50,18 +50,22 @@ public:
                          bool uicEnabled, bool rccEnabled,
                          std::string const& qtVersionMajor);
 
-  void InitCustomTargets();
-  void SetupCustomTargets();
+  bool InitCustomTargets();
+  bool SetupCustomTargets();
 
 private:
-  void SetupCustomTargetsMoc();
-  void SetupCustomTargetsUic();
+  bool SetupCustomTargetsMoc();
+  bool SetupCustomTargetsUic();
 
   void AddGeneratedSource(std::string const& filename, GeneratorT genType);
 
   bool QtVersionGreaterOrEqual(unsigned long requestMajor,
                                unsigned long requestMinor) const;
 
+  bool GetMocExecutable();
+  bool GetUicExecutable();
+  bool GetRccExecutable();
+
   bool RccListInputs(std::string const& fileName,
                      std::vector<std::string>& files,
                      std::string& errorMessage);

-----------------------------------------------------------------------

Summary of changes:
 Source/CPack/WiX/cmCPackWIXGenerator.cxx |   4 +
 Source/cmGeneratorTarget.cxx             |   6 +-
 Source/cmGeneratorTarget.h               |   2 +-
 Source/cmGlobalGenerator.cxx             |   8 +-
 Source/cmQtAutoGenInitializer.cxx        | 497 +++++++++++++++++++------------
 Source/cmQtAutoGenInitializer.h          |  61 ++--
 6 files changed, 352 insertions(+), 226 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list