[Cmake-commits] CMake branch, next, updated. v3.5.0-rc2-153-gf2c877b

Brad King brad.king at kitware.com
Tue Feb 16 10:46:50 EST 2016


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, next has been updated
       via  f2c877b6cd36bad7c36204a42d89ed39e3220be4 (commit)
       via  9beb2744d7685fca9cd5717308d4457dffdefcdc (commit)
      from  10fd48038dd5d804caf41a3f169f1dc54595874c (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=f2c877b6cd36bad7c36204a42d89ed39e3220be4
commit f2c877b6cd36bad7c36204a42d89ed39e3220be4
Merge: 10fd480 9beb274
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Feb 16 10:46:49 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Feb 16 10:46:49 2016 -0500

    Merge topic 'automoc-src-per-dir' into next
    
    9beb2744 Automoc: Fix support of files with the same name (#12873)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9beb2744d7685fca9cd5717308d4457dffdefcdc
commit 9beb2744d7685fca9cd5717308d4457dffdefcdc
Author:     Mariusz Pluciński <mplucinski at mplucinski.com>
AuthorDate: Sat Feb 13 11:30:31 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Feb 16 10:45:19 2016 -0500

    Automoc: Fix support of files with the same name (#12873)

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index b16eccd..226ab43 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1104,10 +1104,39 @@ void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders,
         std::cout << "AUTOGEN: Checking " << headerName << std::endl;
         }
 
-      const std::string basename = cmsys::SystemTools::
-                                   GetFilenameWithoutLastExtension(headerName);
+      std::string headerDirectory;
+      if (cmsys::SystemTools::IsSubDirectory(headerName,
+                                             this->ProjectSourceDir))
+        {
+        headerDirectory = this->ProjectSourceDir;
+        }
+      else if (cmsys::SystemTools::IsSubDirectory(headerName,
+                                                  this->ProjectBinaryDir))
+        {
+        headerDirectory = this->ProjectBinaryDir;
+        }
+      else
+        {
+        cmsys::SystemTools::SplitPathRootComponent(headerName,
+                                                   &headerDirectory);
+        }
+
+      std::string baseHeaderName =
+        cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName);
+
+      headerDirectory = cmsys::SystemTools::RelativePath(
+        headerDirectory, cmsys::SystemTools::GetParentDirectory(headerName));
+
+      if (!headerDirectory.empty())
+        {
+        headerDirectory += "/";
+        }
+
+      std::string mocName = headerDirectory + baseHeaderName;
+
+      cmSystemTools::ReplaceString(mocName, "/", "_");
 
-      const std::string currentMoc = "moc_" + basename + ".cpp";
+      const std::string currentMoc = "moc_" + mocName + ".cpp";
       std::string macroName;
       if (requiresMocing(contents, macroName))
         {
diff --git a/Tests/QtAutogen/Adir/CMakeLists.txt b/Tests/QtAutogen/Adir/CMakeLists.txt
index a1c36ff..0c7848d 100644
--- a/Tests/QtAutogen/Adir/CMakeLists.txt
+++ b/Tests/QtAutogen/Adir/CMakeLists.txt
@@ -3,6 +3,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_AUTOMOC ON)
 set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
 
-add_library(libA SHARED libA.cpp)
+add_library(libA SHARED libA.cpp foo.cpp bar/foo.cpp)
 target_link_libraries(libA LINK_PUBLIC ${QT_QTCORE_TARGET})
 generate_export_header(libA)
diff --git a/Tests/QtAutogen/Adir/bar/foo.cpp b/Tests/QtAutogen/Adir/bar/foo.cpp
new file mode 100644
index 0000000..3f5e0a9
--- /dev/null
+++ b/Tests/QtAutogen/Adir/bar/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+bar::foo::foo() {}
+bar::foo::~foo() {}
diff --git a/Tests/QtAutogen/Adir/bar/foo.h b/Tests/QtAutogen/Adir/bar/foo.h
new file mode 100644
index 0000000..daf2367
--- /dev/null
+++ b/Tests/QtAutogen/Adir/bar/foo.h
@@ -0,0 +1,10 @@
+#include <QObject>
+
+namespace bar {
+  class foo: public QObject {
+    Q_OBJECT
+  public:
+    foo();
+    ~foo();
+  };
+}
diff --git a/Tests/QtAutogen/Adir/foo.cpp b/Tests/QtAutogen/Adir/foo.cpp
new file mode 100644
index 0000000..86e4d8e
--- /dev/null
+++ b/Tests/QtAutogen/Adir/foo.cpp
@@ -0,0 +1,4 @@
+#include "foo.h"
+
+foo::foo() {}
+foo::~foo() {}
diff --git a/Tests/QtAutogen/Adir/foo.h b/Tests/QtAutogen/Adir/foo.h
new file mode 100644
index 0000000..a51960c
--- /dev/null
+++ b/Tests/QtAutogen/Adir/foo.h
@@ -0,0 +1,8 @@
+#include <QObject>
+
+class foo: public QObject {
+  Q_OBJECT
+public:
+  foo();
+  ~foo();
+};

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

Summary of changes:
 Source/cmQtAutoGenerators.cxx       |   35 ++++++++++++++++++++++++++++++++---
 Tests/QtAutogen/Adir/CMakeLists.txt |    2 +-
 Tests/QtAutogen/Adir/bar/foo.cpp    |    4 ++++
 Tests/QtAutogen/Adir/bar/foo.h      |   10 ++++++++++
 Tests/QtAutogen/Adir/foo.cpp        |    4 ++++
 Tests/QtAutogen/Adir/foo.h          |    8 ++++++++
 6 files changed, 59 insertions(+), 4 deletions(-)
 create mode 100644 Tests/QtAutogen/Adir/bar/foo.cpp
 create mode 100644 Tests/QtAutogen/Adir/bar/foo.h
 create mode 100644 Tests/QtAutogen/Adir/foo.cpp
 create mode 100644 Tests/QtAutogen/Adir/foo.h


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list