Browse Source

Rename the cmQtAutomoc class to cmQtAutoGenerators.

It will be extended to process .ui and .qrc files too.
Stephen Kelly 12 years ago
parent
commit
5c058c8f12

+ 2 - 2
Source/CMakeLists.txt

@@ -250,8 +250,8 @@ set(SRCS
   cmPropertyDefinitionMap.h
   cmPropertyMap.cxx
   cmPropertyMap.h
-  cmQtAutomoc.cxx
-  cmQtAutomoc.h
+  cmQtAutoGenerators.cxx
+  cmQtAutoGenerators.h
   cmRST.cxx
   cmRST.h
   cmScriptGenerator.h

+ 7 - 7
Source/cmGlobalGenerator.cxx

@@ -18,7 +18,7 @@
 #include "cmExternalMakefileProjectGenerator.h"
 #include "cmake.h"
 #include "cmMakefile.h"
-#include "cmQtAutomoc.h"
+#include "cmQtAutoGenerators.h"
 #include "cmSourceFile.h"
 #include "cmVersion.h"
 #include "cmTargetExport.h"
@@ -1049,8 +1049,8 @@ void cmGlobalGenerator::Generate()
     }
 
   // Iterate through all targets and set up automoc for those which have
-  // the AUTOMOC property set
-  this->CreateAutomocTargets();
+  // the AUTOMOC, AUTOUIC or AUTORCC property set
+  this->CreateQtAutoGeneratorsTargets();
 
   // For each existing cmLocalGenerator
   unsigned int i;
@@ -1206,10 +1206,10 @@ bool cmGlobalGenerator::CheckTargets()
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalGenerator::CreateAutomocTargets()
+void cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
 {
 #ifdef CMAKE_BUILD_WITH_CMAKE
-  typedef std::vector<std::pair<cmQtAutomoc, cmTarget*> > Automocs;
+  typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget*> > Automocs;
   Automocs automocs;
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
@@ -1227,7 +1227,7 @@ void cmGlobalGenerator::CreateAutomocTargets()
         {
         if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported())
           {
-          cmQtAutomoc automoc;
+          cmQtAutoGenerators automoc;
           if(automoc.InitializeMocSourceFile(&target))
             {
             automocs.push_back(std::make_pair(automoc, &target));
@@ -1239,7 +1239,7 @@ void cmGlobalGenerator::CreateAutomocTargets()
   for (Automocs::iterator it = automocs.begin(); it != automocs.end();
        ++it)
     {
-    it->first.SetupAutomocTarget(it->second);
+    it->first.SetupAutoGenerateTarget(it->second);
     }
 #endif
 }

+ 1 - 1
Source/cmGlobalGenerator.h

@@ -319,7 +319,7 @@ protected:
   virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
 
   bool CheckTargets();
-  void CreateAutomocTargets();
+  void CreateQtAutoGeneratorsTargets();
 
 
   // Fill the ProjectMap, this must be called after LocalGenerators

+ 25 - 21
Source/cmQtAutomoc.cxx → Source/cmQtAutoGenerators.cxx

@@ -29,7 +29,7 @@
 #include <unistd.h>
 #endif
 
-#include "cmQtAutomoc.h"
+#include "cmQtAutoGenerators.h"
 
 
 static bool requiresMocing(const std::string& text, std::string &macroName)
@@ -113,7 +113,7 @@ static void copyTargetProperty(cmTarget* destinationTarget,
 }
 
 
-cmQtAutomoc::cmQtAutomoc()
+cmQtAutoGenerators::cmQtAutoGenerators()
 :Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
 ,ColorOutput(true)
 ,RunMocFailed(false)
@@ -135,7 +135,7 @@ cmQtAutomoc::cmQtAutomoc()
     }
 }
 
-bool cmQtAutomoc::InitializeMocSourceFile(cmTarget* target)
+bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target)
 {
   cmMakefile* makefile = target->GetMakefile();
   // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
@@ -201,7 +201,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
     }
 }
 
-void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
+void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
 {
   cmMakefile* makefile = target->GetMakefile();
   const char* targetName = target->GetName();
@@ -466,7 +466,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
 }
 
 
-bool cmQtAutomoc::Run(const char* targetDirectory, const char *config)
+bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config)
 {
   bool success = true;
   cmake cm;
@@ -492,7 +492,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory, const char *config)
 }
 
 
-cmGlobalGenerator* cmQtAutomoc::CreateGlobalGenerator(cmake* cm,
+cmGlobalGenerator* cmQtAutoGenerators::CreateGlobalGenerator(cmake* cm,
                                                   const char* targetDirectory)
 {
   cmGlobalGenerator* gg = new cmGlobalGenerator();
@@ -509,7 +509,7 @@ cmGlobalGenerator* cmQtAutomoc::CreateGlobalGenerator(cmake* cm,
 }
 
 
-bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
+bool cmQtAutoGenerators::ReadAutomocInfoFile(cmMakefile* makefile,
                                       const char* targetDirectory,
                                       const char *config)
 {
@@ -569,7 +569,7 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
 }
 
 
-std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile)
+std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile)
 {
   std::string s;
   s += makefile->GetSafeDefinition("AM_MOC_COMPILE_DEFINITIONS");
@@ -586,7 +586,7 @@ std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile)
 }
 
 
-bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile,
+bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile,
                                             const char* targetDirectory)
 {
   std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
@@ -602,7 +602,8 @@ bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile,
 }
 
 
-void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory)
+void
+cmQtAutoGenerators::WriteOldMocDefinitionsFile(const char* targetDirectory)
 {
   std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
   cmSystemTools::ConvertToUnixSlashes(filename);
@@ -619,7 +620,7 @@ void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory)
 }
 
 
-void cmQtAutomoc::Init()
+void cmQtAutoGenerators::Init()
 {
   this->OutMocCppFilename = this->Builddir;
   this->OutMocCppFilename += this->TargetName;
@@ -706,7 +707,7 @@ void cmQtAutomoc::Init()
 }
 
 
-bool cmQtAutomoc::RunAutomoc(cmMakefile* makefile)
+bool cmQtAutoGenerators::RunAutomoc(cmMakefile* makefile)
 {
   if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
     || (this->OldCompileSettingsStr != this->CurrentCompileSettingsStr))
@@ -830,7 +831,7 @@ bool cmQtAutomoc::RunAutomoc(cmMakefile* makefile)
 }
 
 
-void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
+void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
                               const std::vector<std::string>& headerExtensions,
                               std::map<std::string, std::string>& includedMocs)
 {
@@ -1011,7 +1012,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
 }
 
 
-void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename,
+void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename,
                               const std::vector<std::string>& headerExtensions,
                               std::map<std::string, std::string>& includedMocs)
 {
@@ -1124,7 +1125,8 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename,
 }
 
 
-void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename,
+void
+cmQtAutoGenerators::SearchHeadersForCppFile(const std::string& absFilename,
                               const std::vector<std::string>& headerExtensions,
                               std::set<std::string>& absHeaders)
 {
@@ -1160,7 +1162,7 @@ void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename,
 }
 
 
-void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
+void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders,
                         const std::map<std::string, std::string>& includedMocs,
                         std::map<std::string, std::string>& notIncludedMocs)
 {
@@ -1194,7 +1196,7 @@ void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
 }
 
 
-bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile,
+bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
                               const std::string& mocFileName)
 {
   const std::string mocFilePath = this->Builddir + mocFileName;
@@ -1271,7 +1273,7 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile,
 }
 
 
-std::string cmQtAutomoc::Join(const std::vector<std::string>& lst,
+std::string cmQtAutoGenerators::Join(const std::vector<std::string>& lst,
                               char separator)
 {
     if (lst.empty())
@@ -1291,13 +1293,15 @@ std::string cmQtAutomoc::Join(const std::vector<std::string>& lst,
 }
 
 
-bool cmQtAutomoc::StartsWith(const std::string& str, const std::string& with)
+bool cmQtAutoGenerators::StartsWith(const std::string& str,
+                                    const std::string& with)
 {
   return (str.substr(0, with.length()) == with);
 }
 
 
-bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with)
+bool cmQtAutoGenerators::EndsWith(const std::string& str,
+                                  const std::string& with)
 {
   if (with.length() > (str.length()))
     {
@@ -1307,7 +1311,7 @@ bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with)
 }
 
 
-std::string cmQtAutomoc::ReadAll(const std::string& filename)
+std::string cmQtAutoGenerators::ReadAll(const std::string& filename)
 {
   std::ifstream file(filename.c_str());
   cmsys_ios::stringstream stream;

+ 5 - 5
Source/cmQtAutomoc.h → Source/cmQtAutoGenerators.h

@@ -11,20 +11,20 @@
   See the License for more information.
 ============================================================================*/
 
-#ifndef cmQtAutomoc_h
-#define cmQtAutomoc_h
+#ifndef cmQtAutoGenerators_h
+#define cmQtAutoGenerators_h
 
 class cmGlobalGenerator;
 class cmMakefile;
 
-class cmQtAutomoc
+class cmQtAutoGenerators
 {
 public:
-  cmQtAutomoc();
+  cmQtAutoGenerators();
   bool Run(const char* targetDirectory, const char *config);
 
   bool InitializeMocSourceFile(cmTarget* target);
-  void SetupAutomocTarget(cmTarget* target);
+  void SetupAutoGenerateTarget(cmTarget* target);
 
 private:
   cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,

+ 2 - 2
Source/cmcmd.cxx

@@ -13,7 +13,7 @@
 #include "cmMakefile.h"
 #include "cmLocalGenerator.h"
 #include "cmGlobalGenerator.h"
-#include "cmQtAutomoc.h"
+#include "cmQtAutoGenerators.h"
 #include "cmVersion.h"
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -634,7 +634,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       }
     else if (args[1] == "cmake_automoc")
       {
-        cmQtAutomoc automoc;
+        cmQtAutoGenerators automoc;
         const char *config = args[3].empty() ? 0 : args[3].c_str();
         bool automocSuccess = automoc.Run(args[2].c_str(), config);
         return automocSuccess ? 0 : 1;