summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-01-24 13:00:34 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-01-28 20:04:11 (GMT)
commitc48d877d3116ea4aed581fda42591c3d86d8df40 (patch)
tree18043e54999c7e3a20ae7f40c9062e8e734f0c65
parent394e86df2a0adeecbdab96b3f28e575150153e11 (diff)
downloadCMake-c48d877d3116ea4aed581fda42591c3d86d8df40.zip
CMake-c48d877d3116ea4aed581fda42591c3d86d8df40.tar.gz
CMake-c48d877d3116ea4aed581fda42591c3d86d8df40.tar.bz2
QtAutogen: Make some methods appropriately file-static.
-rw-r--r--Source/cmQtAutoGenerators.cxx65
-rw-r--r--Source/cmQtAutoGenerators.h4
2 files changed, 31 insertions, 38 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 23a3998..166bbe0 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -115,6 +115,15 @@ static void copyTargetProperty(cmTarget* destinationTarget,
}
+static std::string ReadAll(const std::string& filename)
+{
+ cmsys::ifstream file(filename.c_str());
+ cmsys_ios::stringstream stream;
+ stream << file.rdbuf();
+ file.close();
+ return stream.str();
+}
+
cmQtAutoGenerators::cmQtAutoGenerators()
:Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
,ColorOutput(true)
@@ -960,11 +969,27 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
}
}
+static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
+ const char* targetDirectory)
+{
+ cmGlobalGenerator* gg = new cmGlobalGenerator();
+ gg->SetCMakeInstance(cm);
+
+ cmLocalGenerator* lg = gg->CreateLocalGenerator();
+ lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartOutputDirectory(targetDirectory);
+ lg->GetMakefile()->SetHomeDirectory(targetDirectory);
+ lg->GetMakefile()->SetStartDirectory(targetDirectory);
+ gg->SetCurrentLocalGenerator(lg);
+
+ return gg;
+}
+
bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config)
{
bool success = true;
cmake cm;
- cmGlobalGenerator* gg = this->CreateGlobalGenerator(&cm, targetDirectory);
+ cmGlobalGenerator* gg = CreateGlobalGenerator(&cm, targetDirectory);
cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
this->ReadAutogenInfoFile(makefile, targetDirectory, config);
@@ -985,24 +1010,6 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config)
return success;
}
-
-cmGlobalGenerator* cmQtAutoGenerators::CreateGlobalGenerator(cmake* cm,
- const char* targetDirectory)
-{
- cmGlobalGenerator* gg = new cmGlobalGenerator();
- gg->SetCMakeInstance(cm);
-
- cmLocalGenerator* lg = gg->CreateLocalGenerator();
- lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory);
- lg->GetMakefile()->SetStartOutputDirectory(targetDirectory);
- lg->GetMakefile()->SetHomeDirectory(targetDirectory);
- lg->GetMakefile()->SetStartDirectory(targetDirectory);
- gg->SetCurrentLocalGenerator(lg);
-
- return gg;
-}
-
-
bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory,
const char *config)
@@ -1424,7 +1431,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
if (!automocCppChanged)
{
// compare contents of the _automoc.cpp file
- const std::string oldContents = this->ReadAll(this->OutMocCppFilename);
+ const std::string oldContents = ReadAll(this->OutMocCppFilename);
if (oldContents == automocSource)
{
// nothing changed: don't touch the _automoc.cpp file
@@ -1452,7 +1459,7 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
"[\n][ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
- const std::string contentsString = this->ReadAll(absFilename);
+ const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty())
{
std::cerr << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
@@ -1635,7 +1642,7 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename,
"[\n][ \t]*#[ \t]*include[ \t]+"
"[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]");
- const std::string contentsString = this->ReadAll(absFilename);
+ const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty())
{
std::cerr << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
@@ -1748,7 +1755,7 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename,
{
return;
}
- const std::string contentsString = this->ReadAll(absFilename);
+ const std::string contentsString = ReadAll(absFilename);
if (contentsString.empty())
{
std::cerr << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
@@ -1843,7 +1850,7 @@ void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders,
++hIt)
{
const std::string& headerName = *hIt;
- const std::string contents = this->ReadAll(headerName);
+ const std::string contents = ReadAll(headerName);
if (includedMocs.find(headerName) == includedMocs.end())
{
@@ -2122,13 +2129,3 @@ bool cmQtAutoGenerators::EndsWith(const std::string& str,
}
return (str.substr(str.length() - with.length(), with.length()) == with);
}
-
-
-std::string cmQtAutoGenerators::ReadAll(const std::string& filename)
-{
- cmsys::ifstream file(filename.c_str());
- cmsys_ios::stringstream stream;
- stream << file.rdbuf();
- file.close();
- return stream.str();
-}
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 80123d8..ac0fd9e 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -36,9 +36,6 @@ private:
void InitializeAutoRccTarget(cmTarget* target);
void SetupAutoRccTarget(cmTarget const* target);
- cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
- const char* targetDirectory);
-
bool ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory,
const char *config);
@@ -82,7 +79,6 @@ private:
std::string Join(const std::vector<std::string>& lst, char separator);
bool EndsWith(const std::string& str, const std::string& with);
bool StartsWith(const std::string& str, const std::string& with);
- std::string ReadAll(const std::string& filename);
void MergeUicOptions(std::vector<std::string> &opts,
const std::vector<std::string> &fileOpts, bool isQt5);