Am 19.04.2016 um 19:28 schrieb Brad King:
On 04/19/2016 11:09 AM, Sebastian Holtermann wrote:
https://cmake.org/Bug/view.php?id=12873
https://cmake.org/Bug/view.php?id=16068
They introduce
- same name collision checks during moc/qrc/ui generation
- moc/qrc generation in subdirectories to support
sources with the name in different subdirectories
- A test for equally named sources in different subdirectories
Please review.
Thanks! I've applied them locally and merged the cleanup/refactoring
commits to 'next' for testing first. Once those test cleanly I'll move
on to the rest.
It is good too see the patches made it into the next branch.
Thanks and sorry for the wrong indentation btw..
Now there is another issue I have a partially fix for.
As of now all included mocs and uis get generated in
CMAKE_CURRENT_BINARY_DIR/
because they must be within INCLUDE_DIRECTORIES.
I think a more robust approach would be to generate them in
CMAKE_CURRENT_BINARY_DIR/TARGET_automoc.dir/
and to add the _automoc.dir to INCLUDE_DIRECTORIES.
I've attached a patch that does does so
- it is relative to current "next" branch.
It is incomplete though because I didn't manage to get
CMAKE_CURRENT_BINARY_DIR/TARGET_automoc.dir/
into INCLUDE_DIRECTORIES in Source/cmQtAutoGeneratorInitializer.cxx.
(GetAutogenTargetBuildDir() in Source/cmQtAutoGeneratorInitializer.cxx)
If someone could do that or give me pointers on how to do it
then this could be another improvement.
-Sebastian
>From aa246261ba1f98ca245f8c5a93b6c93c7fbe8ec5 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann <sebh...@xwmw.org>
Date: Thu, 21 Apr 2016 08:44:11 +0200
Subject: [PATCH] Autogen: Generate included moc and ui files in
TARGET_automoc.dir/
---
Source/cmQtAutoGenerators.cxx | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index c6ee751..29e2e47 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -564,6 +564,13 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
this->SearchHeadersForCppFile(absFilename, headerExtensions, headerFiles);
}
+ // Prepend included mocs with build subdirectory
+ for(std::map<std::string, std::string>::iterator
+ it = includedMocs.begin(); it != includedMocs.end(); ++it)
+ {
+ it->second = this->TargetBuildSubDir + it->second;
+ }
+
{
std::vector<std::string> mocSkipped;
cmSystemTools::ExpandListArgument(this->SkipMoc, mocSkipped);
@@ -1261,7 +1268,8 @@ bool cmQtAutoGenerators::GenerateUiFiles(
{
const std::string & uiFileName = *sit;
const std::string uiInputFile = sourcePath + uiFileName + ".ui";
- const std::string uiOutputFile = "ui_" + uiFileName + ".h";
+ const std::string uiOutputFile = this->TargetBuildSubDir
+ + "ui_" + uiFileName + ".h";
sourceMap[uiInputFile] = uiOutputFile;
testMap[uiInputFile] = uiOutputFile;
}
@@ -1321,6 +1329,13 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
&sourceNewerThanUi);
if (this->GenerateAll || !success || sourceNewerThanUi >= 0)
{
+ // make sure the directory for the resulting ui file exists
+ std::string uiDir = uiBuildFile.substr(0, uiBuildFile.rfind('/'));
+ if (!cmsys::SystemTools::FileExists(uiDir.c_str(), false))
+ {
+ cmsys::SystemTools::MakeDirectory(uiDir.c_str());
+ }
+
std::string msg = "Generating ";
msg += uiOutputFile;
cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue
--
2.8.0.rc3
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers