summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-02-04 18:34:54 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-02-04 18:34:54 (GMT)
commitf748b59e2057d73a25448378442d70b420ed7698 (patch)
tree0035234f8941db728f48c6485da9e5575aa34fbc /Source
parent01a41bc98ca8f2451e69fde4ac513b57276809ff (diff)
parent6053ce22f69f58c9dc4db66dbfe62cdd8fbe2774 (diff)
downloadCMake-f748b59e2057d73a25448378442d70b420ed7698.zip
CMake-f748b59e2057d73a25448378442d70b420ed7698.tar.gz
CMake-f748b59e2057d73a25448378442d70b420ed7698.tar.bz2
Merge topic 'fix-Qt-autogen'
6053ce22 QtAutogen: Make uic work even when the source is in a subdir. 1fc9ecfa FindQt4: Make AUTOMOC work regardless which order Qt 4/5 is found.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenerators.cxx34
-rw-r--r--Source/cmQtAutoGenerators.h12
2 files changed, 26 insertions, 20 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index cab59fe..7e44c26 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1279,8 +1279,8 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
const std::vector<std::string>& headerExtensions =
makefile->GetHeaderExtensions();
- std::vector<std::string> includedUis;
- std::vector<std::string> skippedUis;
+ std::map<std::string, std::string> includedUis;
+ std::map<std::string, std::string> skippedUis;
std::vector<std::string> uicSkipped;
cmSystemTools::ExpandListArgument(this->SkipUic, uicSkipped);
@@ -1290,7 +1290,8 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
{
const bool skipUic = std::find(uicSkipped.begin(), uicSkipped.end(), *it)
!= uicSkipped.end();
- std::vector<std::string>& uiFiles = skipUic ? skippedUis : includedUis;
+ std::map<std::string, std::string>& uiFiles
+ = skipUic ? skippedUis : includedUis;
const std::string &absFilename = *it;
if (this->Verbose)
{
@@ -1350,11 +1351,12 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
{
this->GenerateMoc(it->first, it->second);
}
- for(std::vector<std::string>::const_iterator it = includedUis.begin();
+ for(std::map<std::string, std::string>::const_iterator
+ it = includedUis.begin();
it != includedUis.end();
++it)
{
- this->GenerateUi(*it);
+ this->GenerateUi(it->first, it->second);
}
if(!this->RccExecutable.empty())
@@ -1431,7 +1433,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs,
- std::vector<std::string> &includedUis)
+ std::map<std::string, std::string> &includedUis)
{
cmsys::RegularExpression mocIncludeRegExp(
"[\n][ \t]*#[ \t]*include[ \t]+"
@@ -1619,7 +1621,7 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs,
- std::vector<std::string>& includedUis)
+ std::map<std::string, std::string>& includedUis)
{
cmsys::RegularExpression mocIncludeRegExp(
"[\n][ \t]*#[ \t]*include[ \t]+"
@@ -1737,7 +1739,7 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename,
void cmQtAutoGenerators::ParseForUic(const std::string& absFilename,
- std::vector<std::string>& includedUis)
+ std::map<std::string, std::string>& includedUis)
{
if (this->UicExecutable.empty())
{
@@ -1754,9 +1756,9 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename,
}
-void cmQtAutoGenerators::ParseForUic(const std::string&,
+void cmQtAutoGenerators::ParseForUic(const std::string& absFilename,
const std::string& contentsString,
- std::vector<std::string>& includedUis)
+ std::map<std::string, std::string>& includedUis)
{
if (this->UicExecutable.empty())
{
@@ -1768,6 +1770,9 @@ void cmQtAutoGenerators::ParseForUic(const std::string&,
std::string::size_type matchOffset = 0;
+ const std::string absPath = cmsys::SystemTools::GetFilenamePath(
+ cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+
matchOffset = 0;
if ((strstr(contentsString.c_str(), "ui_") != NULL)
&& (uiIncludeRegExp.find(contentsString)))
@@ -1783,7 +1788,7 @@ void cmQtAutoGenerators::ParseForUic(const std::string&,
// finding the correct header, so we need to remove the ui_ part
basename = basename.substr(3);
- includedUis.push_back(basename);
+ includedUis[absPath] = basename;
matchOffset += uiIncludeRegExp.end();
} while(uiIncludeRegExp.find(contentsString.c_str() + matchOffset));
@@ -1831,7 +1836,7 @@ cmQtAutoGenerators::SearchHeadersForCppFile(const std::string& absFilename,
void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders,
const std::map<std::string, std::string>& includedMocs,
std::map<std::string, std::string>& notIncludedMocs,
- std::vector<std::string>& includedUis)
+ std::map<std::string, std::string>& includedUis)
{
for(std::set<std::string>::const_iterator hIt=absHeaders.begin();
hIt!=absHeaders.end();
@@ -1939,7 +1944,8 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
return false;
}
-bool cmQtAutoGenerators::GenerateUi(const std::string& uiFileName)
+bool cmQtAutoGenerators::GenerateUi(const std::string& path,
+ const std::string& uiFileName)
{
if (!cmsys::SystemTools::FileExists(this->Builddir.c_str(), false))
{
@@ -1947,7 +1953,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& uiFileName)
}
std::string ui_output_file = "ui_" + uiFileName + ".h";
- std::string ui_input_file = this->Srcdir + uiFileName + ".ui";
+ std::string ui_input_file = path + uiFileName + ".ui";
int sourceNewerThanUi = 0;
bool success = cmsys::SystemTools::FileTimeCompare(ui_input_file.c_str(),
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index f66d02b..2840fbf 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -48,16 +48,16 @@ private:
bool RunAutogen(cmMakefile* makefile);
bool GenerateMoc(const std::string& sourceFile,
const std::string& mocFileName);
- bool GenerateUi(const std::string& uiFileName);
+ bool GenerateUi(const std::string& path, const std::string& uiFileName);
bool GenerateQrc();
void ParseCppFile(const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs,
- std::vector<std::string>& includedUis);
+ std::map<std::string, std::string>& includedUis);
void StrictParseCppFile(const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs,
- std::vector<std::string>& includedUis);
+ std::map<std::string, std::string>& includedUis);
void SearchHeadersForCppFile(const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::set<std::string>& absHeaders);
@@ -65,14 +65,14 @@ private:
void ParseHeaders(const std::set<std::string>& absHeaders,
const std::map<std::string, std::string>& includedMocs,
std::map<std::string, std::string>& notIncludedMocs,
- std::vector<std::string>& includedUis);
+ std::map<std::string, std::string>& includedUis);
void ParseForUic(const std::string& fileName,
const std::string& contentsString,
- std::vector<std::string>& includedUis);
+ std::map<std::string, std::string>& includedUis);
void ParseForUic(const std::string& fileName,
- std::vector<std::string>& includedUis);
+ std::map<std::string, std::string>& includedUis);
void Init();