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 af5b8256b4d3ca1b65f5f97424918e241e360213 (commit) via 20f56fe4d4c1227a9bd1601311aaf7c07b28bbd4 (commit) via 6e576baa2a639ed4401a35c640e20002828dac9b (commit) from 0bb1daddaf0f450b8d040015c9135ad85fee9378 (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 ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af5b8256b4d3ca1b65f5f97424918e241e360213 commit af5b8256b4d3ca1b65f5f97424918e241e360213 Merge: 0bb1dad 20f56fe Author: Clinton Stimpson <clin...@elemtech.com> AuthorDate: Mon Aug 4 10:17:58 2014 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Mon Aug 4 10:17:58 2014 -0400 Merge topic 'qt-automoc' into next 20f56fe4 Qt: Enable running automoc test with Qt4 or Qt5. 6e576baa Qt: Fix automoc when .h and .cpp are in different directories. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20f56fe4d4c1227a9bd1601311aaf7c07b28bbd4 commit 20f56fe4d4c1227a9bd1601311aaf7c07b28bbd4 Author: Clinton Stimpson <clin...@elemtech.com> AuthorDate: Mon Aug 4 08:14:52 2014 -0600 Commit: Clinton Stimpson <clin...@elemtech.com> CommitDate: Mon Aug 4 08:14:52 2014 -0600 Qt: Enable running automoc test with Qt4 or Qt5. Previously, the automoc tests required both Qt4 and Qt5. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ca7fcdc..1402c95 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1201,7 +1201,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets") - if(Qt5Widgets_FOUND AND NOT Qt5Widgets_VERSION VERSION_LESS 5.1.0) + endif() + + if((QT4_WORKS AND QT_QTGUI_FOUND) OR + (Qt5Widgets_FOUND AND NOT Qt5Widgets_VERSION VERSION_LESS 5.1.0) ) add_test(Qt4And5Automoc ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc" @@ -1226,7 +1229,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5AutomocReverse") - endif() endif() find_package(GTK2 QUIET) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e576baa2a639ed4401a35c640e20002828dac9b commit 6e576baa2a639ed4401a35c640e20002828dac9b Author: Clinton Stimpson <clin...@elemtech.com> AuthorDate: Mon Aug 4 08:11:31 2014 -0600 Commit: Clinton Stimpson <clin...@elemtech.com> CommitDate: Mon Aug 4 08:11:31 2014 -0600 Qt: Fix automoc when .h and .cpp are in different directories. Thanks Pau Garcia i Quiles for the patch. diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d4d565c..76edad5 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1830,30 +1830,57 @@ cmQtAutoGenerators::SearchHeadersForCppFile(const std::string& absFilename, const std::string basename = cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename); const std::string absPath = cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; + cmsys::SystemTools::GetRealPath(absFilename.c_str())); - for(std::vector<std::string>::const_iterator ext = headerExtensions.begin(); - ext != headerExtensions.end(); - ++ext) + std::vector<std::string> incPaths; + incPaths.push_back(absPath); + cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths); + + for(std::vector<std::string>::const_iterator path = incPaths.begin(); + path != incPaths.end(); + ++path) + { + bool found = false; + for(std::vector<std::string>::const_iterator ext = + headerExtensions.begin(); + ext != headerExtensions.end(); + ++ext) { - const std::string headerName = absPath + basename + "." + (*ext); - if (cmsys::SystemTools::FileExists(headerName.c_str())) + const std::string headerName = (*path) + "/" + basename + "." + (*ext); + + if (cmsys::SystemTools::FileExists(headerName.c_str())) { - absHeaders.insert(headerName); - break; + absHeaders.insert(headerName); + found = true; + break; } } - for(std::vector<std::string>::const_iterator ext = headerExtensions.begin(); - ext != headerExtensions.end(); - ++ext) + if (found) + break; + } + for(std::vector<std::string>::const_iterator path = incPaths.begin(); + path != incPaths.end(); + ++path) + { + bool found = false; + for(std::vector<std::string>::const_iterator ext = + headerExtensions.begin(); + ext != headerExtensions.end(); + ++ext) { - const std::string privateHeaderName = absPath+basename+"_p."+(*ext); - if (cmsys::SystemTools::FileExists(privateHeaderName.c_str())) + const std::string privateHeaderName = (*path) + "/" + + basename + "_p." + (*ext); + + if (cmsys::SystemTools::FileExists(privateHeaderName.c_str())) { - absHeaders.insert(privateHeaderName); - break; + absHeaders.insert(privateHeaderName); + found = true; + break; } } + if (found) + break; + } } diff --git a/Tests/Qt4And5Automoc/AnObject.cpp b/Tests/Qt4And5Automoc/AnObject.cpp new file mode 100644 index 0000000..c1c93f1 --- /dev/null +++ b/Tests/Qt4And5Automoc/AnObject.cpp @@ -0,0 +1,4 @@ +#include "AnObject.h" + +void AnObject::activated() { +} diff --git a/Tests/Qt4And5Automoc/AnObject.h b/Tests/Qt4And5Automoc/AnObject.h new file mode 100644 index 0000000..b7c5409 --- /dev/null +++ b/Tests/Qt4And5Automoc/AnObject.h @@ -0,0 +1,9 @@ +#include <QObject> + +class AnObject : public QObject { + Q_OBJECT +public: + AnObject() {} +private slots: + void activated(); +}; diff --git a/Tests/Qt4And5Automoc/CMakeLists.txt b/Tests/Qt4And5Automoc/CMakeLists.txt index ad74961..7f3e81e 100644 --- a/Tests/Qt4And5Automoc/CMakeLists.txt +++ b/Tests/Qt4And5Automoc/CMakeLists.txt @@ -1,13 +1,13 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.0.1) project(Qt4And5Automoc) if (QT_REVERSE_FIND_ORDER) - find_package(Qt5Core REQUIRED) - find_package(Qt4 REQUIRED) + find_package(Qt5Core) + find_package(Qt4) else() - find_package(Qt4 REQUIRED) - find_package(Qt5Core REQUIRED) + find_package(Qt4) + find_package(Qt5Core) endif() set(CMAKE_AUTOMOC ON) @@ -20,10 +20,16 @@ macro(generate_main_file VERSION) ) endmacro() -generate_main_file(4) -generate_main_file(5) +include_directories(include) -add_executable(qt4_exe "${CMAKE_CURRENT_BINARY_DIR}/main_qt4.cpp") +if (${QT4_FOUND}) +generate_main_file(4) +add_executable(qt4_exe "${CMAKE_CURRENT_BINARY_DIR}/main_qt4.cpp" AnObject.cpp src/OtherObject.cpp) target_link_libraries(qt4_exe Qt4::QtCore) -add_executable(qt5_exe "${CMAKE_CURRENT_BINARY_DIR}/main_qt5.cpp") +endif() + +if (${QT5_FOUND}) +generate_main_file(5) +add_executable(qt5_exe "${CMAKE_CURRENT_BINARY_DIR}/main_qt5.cpp" AnObject.cpp src/OtherObject.cpp) target_link_libraries(qt5_exe Qt5::Core) +endif() diff --git a/Tests/Qt4And5Automoc/include/OtherObject.h b/Tests/Qt4And5Automoc/include/OtherObject.h new file mode 100644 index 0000000..6d51cc1 --- /dev/null +++ b/Tests/Qt4And5Automoc/include/OtherObject.h @@ -0,0 +1,9 @@ +#include <QObject> + +class OtherObject : public QObject { + Q_OBJECT +public: + OtherObject() {} +private slots: + void activated(); +}; diff --git a/Tests/Qt4And5Automoc/main.cpp.in b/Tests/Qt4And5Automoc/main.cpp.in index 00fd641..7852cd6 100644 --- a/Tests/Qt4And5Automoc/main.cpp.in +++ b/Tests/Qt4And5Automoc/main.cpp.in @@ -1,5 +1,7 @@ #include <QObject> +#include "AnObject.h" +#include "OtherObject.h" class SomeObject : public QObject { @@ -14,5 +16,7 @@ public: int main(int argc, char **argv) { + AnObject a; + OtherObject o; return 0; } diff --git a/Tests/Qt4And5Automoc/src/OtherObject.cpp b/Tests/Qt4And5Automoc/src/OtherObject.cpp new file mode 100644 index 0000000..d4e724a --- /dev/null +++ b/Tests/Qt4And5Automoc/src/OtherObject.cpp @@ -0,0 +1,4 @@ +#include "OtherObject.h" + +void OtherObject::activated() { +} ----------------------------------------------------------------------- Summary of changes: Source/cmQtAutoGenerators.cxx | 57 ++++++++++++++++++++-------- Tests/CMakeLists.txt | 6 ++- Tests/Qt4And5Automoc/AnObject.cpp | 4 ++ Tests/Qt4And5Automoc/AnObject.h | 9 +++++ Tests/Qt4And5Automoc/CMakeLists.txt | 24 +++++++----- Tests/Qt4And5Automoc/include/OtherObject.h | 9 +++++ Tests/Qt4And5Automoc/main.cpp.in | 4 ++ Tests/Qt4And5Automoc/src/OtherObject.cpp | 4 ++ 8 files changed, 91 insertions(+), 26 deletions(-) create mode 100644 Tests/Qt4And5Automoc/AnObject.cpp create mode 100644 Tests/Qt4And5Automoc/AnObject.h create mode 100644 Tests/Qt4And5Automoc/include/OtherObject.h create mode 100644 Tests/Qt4And5Automoc/src/OtherObject.cpp hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits