From b5e895b5d41dc688bf0acdec352cbccc178a7236 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 24 Oct 2018 11:22:50 +0200 Subject: Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS support This adds - the variable ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` which initializes - the target property ``AUTOGEN_ORIGIN_DEPENDS`` which controls whether or not the origin target dependencies should be forwarded to the corresponding ``_autogen`` target. The default value of ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` is ``ON`` which corresponds to the behavior that is in place since CMake 3.9. Closes: #18493 --- Modules/CMakeGenericSystem.cmake | 2 ++ Source/cmQtAutoGenInitializer.cxx | 11 ++++++++--- Source/cmQtAutoGenInitializer.h | 1 + Source/cmTarget.cxx | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 02cb464..ddfc7bd 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -23,6 +23,8 @@ set(CMAKE_DL_LIBS "dl") set(CMAKE_FIND_LIBRARY_PREFIXES "lib") set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") + +set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON) set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON) set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE") diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 7700767..a213c84 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -322,6 +322,9 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Autogen target: Compute user defined dependencies { + this->AutogenTarget.DependOrigin = + this->Target->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS"); + std::string const deps = this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); if (!deps.empty()) { @@ -904,7 +907,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() // Add link library target dependencies to the autogen target // dependencies - { + if (this->AutogenTarget.DependOrigin) { // add_dependencies/addUtility do not support generator expressions. // We depend only on the libraries found in all configs therefore. std::map commonTargets; @@ -941,8 +944,10 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() new cmGeneratorTarget(autogenTarget, localGen)); // Forward origin utilities to autogen target - for (BT const& depName : this->Target->GetUtilities()) { - autogenTarget->AddUtility(depName.Value, makefile); + if (this->AutogenTarget.DependOrigin) { + for (BT const& depName : this->Target->GetUtilities()) { + autogenTarget->AddUtility(depName.Value, makefile); + } } // Add additional autogen target dependencies to autogen target for (cmTarget* depTarget : this->AutogenTarget.DependTargets) { diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index ce00e00..1d3947b 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -107,6 +107,7 @@ private: std::string SettingsFile; std::map ConfigSettingsFile; // Dependencies + bool DependOrigin = false; std::set DependFiles; std::set DependTargets; // Sources to process diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 987bdb3..5d76a02 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -239,6 +239,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("AUTOMOC", nullptr); this->SetPropertyDefault("AUTOUIC", nullptr); this->SetPropertyDefault("AUTORCC", nullptr); + this->SetPropertyDefault("AUTOGEN_ORIGIN_DEPENDS", nullptr); this->SetPropertyDefault("AUTOGEN_PARALLEL", nullptr); this->SetPropertyDefault("AUTOMOC_COMPILER_PREDEFINES", nullptr); this->SetPropertyDefault("AUTOMOC_DEPEND_FILTERS", nullptr); -- cgit v0.12 From 0669de5d36b853fa7ff81081de719a0a48e2b654 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 24 Oct 2018 11:03:51 +0200 Subject: Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS documentation --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/AUTOGEN_ORIGIN_DEPENDS.rst | 26 ++++++++++++++++++++++++++ Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst | 12 +++++++++--- Help/variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS.rst | 11 +++++++++++ 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 Help/prop_tgt/AUTOGEN_ORIGIN_DEPENDS.rst create mode 100644 Help/variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 1651114..047859d 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -124,6 +124,7 @@ Properties on Targets /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG /prop_tgt/ARCHIVE_OUTPUT_NAME /prop_tgt/AUTOGEN_BUILD_DIR + /prop_tgt/AUTOGEN_ORIGIN_DEPENDS /prop_tgt/AUTOGEN_PARALLEL /prop_tgt/AUTOGEN_TARGET_DEPENDS /prop_tgt/AUTOMOC_COMPILER_PREDEFINES diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index b88c661..9b12fc5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -309,6 +309,7 @@ Variables that Control the Build /variable/CMAKE_ANDROID_STL_TYPE /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG + /variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS /variable/CMAKE_AUTOGEN_PARALLEL /variable/CMAKE_AUTOGEN_VERBOSE /variable/CMAKE_AUTOMOC diff --git a/Help/prop_tgt/AUTOGEN_ORIGIN_DEPENDS.rst b/Help/prop_tgt/AUTOGEN_ORIGIN_DEPENDS.rst new file mode 100644 index 0000000..f61089a --- /dev/null +++ b/Help/prop_tgt/AUTOGEN_ORIGIN_DEPENDS.rst @@ -0,0 +1,26 @@ +AUTOGEN_ORIGIN_DEPENDS +---------------------- + +Switch for forwarding origin target dependencies to the corresponding +``_autogen`` target. + +Targets which have their :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` property +``ON`` have a corresponding ``_autogen`` target which is used to auto generate +``moc`` and ``uic`` files. As this ``_autogen`` target is created at +generate-time, it is not possible to define dependencies of it, +such as to create inputs for the ``moc`` or ``uic`` executable. + +The dependencies of the ``_autogen`` target are composed from + +- the origin target dependencies + (by default enabled via :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS`) +- user defined dependencies from :prop_tgt:`AUTOGEN_TARGET_DEPENDS` + +:prop_tgt:`AUTOGEN_ORIGIN_DEPENDS` decides whether the origin target +dependencies should be forwarded to the ``_autogen`` target or not. + +By default :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS` is initialized from +:variable:`CMAKE_AUTOGEN_ORIGIN_DEPENDS` which is ``ON`` by default. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst index 7d3dfd1..84c2bfe 100644 --- a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst +++ b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst @@ -9,9 +9,15 @@ Targets which have their :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` property generate-time, it is not possible to define dependencies of it, such as to create inputs for the ``moc`` or ``uic`` executable. -The :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property can be set instead to a -list of dependencies of the ``_autogen`` target. Dependencies can be target -names or file names. +The dependencies of the ``_autogen`` target are composed from + +- the origin target dependencies + (by default enabled via :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS`) +- user defined dependencies from :prop_tgt:`AUTOGEN_TARGET_DEPENDS` + +The :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property can be set to a +list of additional dependencies for the ``_autogen`` target. Dependencies +can be target names or file names. See the :manual:`cmake-qt(7)` manual for more information on using CMake with Qt. diff --git a/Help/variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS.rst b/Help/variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS.rst new file mode 100644 index 0000000..1398e78 --- /dev/null +++ b/Help/variable/CMAKE_AUTOGEN_ORIGIN_DEPENDS.rst @@ -0,0 +1,11 @@ +CMAKE_AUTOGEN_ORIGIN_DEPENDS +---------------------------- + +Switch for forwarding origin target dependencies to the corresponding +``_autogen`` targets. + +This variable is used to initialize the :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS` +property on all the targets. See that target property for additional +information. + +By default :variable:`CMAKE_AUTOGEN_ORIGIN_DEPENDS` is ``ON``. -- cgit v0.12 From f74c406501e5ffb5b6a3c8b76c831ca87e8f0168 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 24 Oct 2018 11:42:58 +0200 Subject: Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS release notes --- Help/release/dev/autogen-origin-depends.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/autogen-origin-depends.rst diff --git a/Help/release/dev/autogen-origin-depends.rst b/Help/release/dev/autogen-origin-depends.rst new file mode 100644 index 0000000..7310487 --- /dev/null +++ b/Help/release/dev/autogen-origin-depends.rst @@ -0,0 +1,7 @@ +autogen-origin-depends +---------------------- + +* A new :variable:`CMAKE_AUTOGEN_ORIGIN_DEPENDS` variable and + :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS` target property may be set to enable or + disable forwarding of the origin target dependencies to the corresponding + ``_autogen`` target. -- cgit v0.12 From b71a9598a408a134bd7d003b6586b345f2b961fe Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 30 Oct 2018 11:21:12 +0100 Subject: Autogen: Add test for AUTOGEN_ORIGIN_DEPENDS=OFF --- .../AutogenOriginDependsOff/CMakeLists.txt | 71 ++++++++++++++++++++++ .../QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in | 9 +++ Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp | 28 +++++++++ Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp | 25 ++++++++ .../QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in | 9 +++ Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp | 9 +++ Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp | 28 +++++++++ Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp | 25 ++++++++ .../AutogenOriginDependsOff/config.hpp.in | 8 +++ .../configure_content.cmake | 10 +++ Tests/QtAutogen/AutogenOriginDependsOff/main.cpp | 15 +++++ Tests/QtAutogen/CommonTests.cmake | 1 + 12 files changed, 238 insertions(+) create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/main.cpp diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt new file mode 100644 index 0000000..1c2271a --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt @@ -0,0 +1,71 @@ +cmake_minimum_required(VERSION 3.11) +project(AutogenOriginDependsOff) +include("../AutogenTest.cmake") + +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CSD}) +include_directories(${CBD}) + +# A GENERATED file ensures there will be an _autogen target in VS +add_custom_command ( + OUTPUT "${CBD}/config.hpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CSD}/config.hpp.in" "${CBD}/config.hpp" + ) + + +# Library "a_mc" provides a header that holds a string with the content of +# mocs_compilation.cpp from a_qt. It therefore must depend on a_qt_autogen. +add_custom_target ( a_mc + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} + "-DMCF=${CBD}/a_qt_autogen/mocs_compilation.cpp" + "-DCF_IN=${CSD}/a_mc.hpp.in" + "-DCF_OUT=${CBD}/a_mc.hpp" + -P ${CSD}/configure_content.cmake + ) +add_dependencies ( a_mc a_qt_autogen ) + +# Library "a_qt" +# - depends on a GENERATED file +# - AUTOMOC enabled +# - depends on a target (a_mc) that depends on a_qt_qutogen +add_library ( a_qt a_qt.cpp "${CBD}/config.hpp" ) +add_dependencies ( a_qt a_mc ) +target_link_libraries ( a_qt ${QT_QTCORE_TARGET}) +set_target_properties ( a_qt PROPERTIES AUTOMOC TRUE) +# Disable AUTOGEN_ORIGIN_DEPENDS to avoid loop dependencies +set_target_properties ( a_qt PROPERTIES AUTOGEN_ORIGIN_DEPENDS OFF) + + +# Library "b_mc" provides a header that holds a string function that returns +# the content of mocs_compilation.cpp from b_qt. +# It therefore must depend on b_qt_autogen. +add_custom_command ( + OUTPUT ${CBD}/b_mc.cpp + DEPENDS b_qt_autogen + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} + "-DMCF=${CBD}/b_qt_autogen/mocs_compilation.cpp" + "-DCF_IN=${CSD}/b_mc.cpp.in" + "-DCF_OUT=${CBD}/b_mc.cpp" + -P ${CSD}/configure_content.cmake + ) +add_library ( b_mc ${CSD}/b_mc.hpp ${CBD}/b_mc.cpp ) + +# Library "b_qt" +# - depends on a GENERATED file +# - AUTOMOC enabled +# - depends on a library (b_mc) that depends on b_qt_qutogen +add_library ( b_qt b_qt.cpp "${CBD}/config.hpp" ) +target_link_libraries ( b_qt b_mc ) +target_link_libraries ( b_qt ${QT_QTCORE_TARGET}) +set_target_properties ( b_qt PROPERTIES AUTOMOC TRUE) +# Disable AUTOGEN_ORIGIN_DEPENDS to avoid loop dependencies +set_target_properties ( b_qt PROPERTIES AUTOGEN_ORIGIN_DEPENDS OFF) + + +# The main target depends on both libraries which depend on the _autogen +# target of the main target. +add_executable ( autogenOriginDependsOff main.cpp ) +target_link_libraries ( autogenOriginDependsOff a_qt b_qt ) diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in new file mode 100644 index 0000000..fe71f67 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in @@ -0,0 +1,9 @@ +#ifndef A_MC_HPP +#define A_MC_HPP + +namespace a_mc { + +char const* mocs_compilation = "@MOCS_COMPILATION@"; +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp new file mode 100644 index 0000000..e498969 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp @@ -0,0 +1,28 @@ + +#include "a_qt.hpp" +#include + +namespace a_qt { + +/// @brief A source local QObject based class +class Source_QObject : public QObject +{ + Q_OBJECT +public: + Source_QObject() {} + ~Source_QObject() {} + + std::string str; +}; + +std::string mocs_compilation() +{ + // Create and destroy QObject based classes + Header_QObject header_obj; + Source_QObject source_obj; + + return std::string(a_mc::mocs_compilation); +} +} + +#include "a_qt.moc" diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp new file mode 100644 index 0000000..e2387ee --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp @@ -0,0 +1,25 @@ +#ifndef A_QT_HPP +#define A_QT_HPP + +#include +#include +#include + +namespace a_qt { + +/// @brief A header local QObject based class +class Header_QObject : public QObject +{ + Q_OBJECT +public: + Header_QObject() {} + ~Header_QObject() {} + + std::string str; +}; + +/// @brief Function that returns the content of mocs_compilation.cpp +extern std::string mocs_compilation(); +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in new file mode 100644 index 0000000..0f5ec30 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in @@ -0,0 +1,9 @@ +#include + +namespace b_mc { + +char const* mocs_compilation() +{ + return "@MOCS_COMPILATION@"; +} +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp new file mode 100644 index 0000000..0437273 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp @@ -0,0 +1,9 @@ +#ifndef B_MC_HPP +#define B_MC_HPP + +namespace b_mc { + +extern char const* mocs_compilation(); +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp new file mode 100644 index 0000000..f72f6ca --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp @@ -0,0 +1,28 @@ + +#include "b_qt.hpp" +#include + +namespace b_qt { + +/// @brief A source local QObject based class +class Source_QObject : public QObject +{ + Q_OBJECT +public: + Source_QObject() {} + ~Source_QObject() {} + + std::string str; +}; + +std::string mocs_compilation() +{ + // Create and destroy QObject based classes + Header_QObject header_obj; + Source_QObject source_obj; + + return std::string(b_mc::mocs_compilation()); +} +} + +#include "b_qt.moc" diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp new file mode 100644 index 0000000..d7f0311 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp @@ -0,0 +1,25 @@ +#ifndef B_QT_HPP +#define B_QT_HPP + +#include +#include +#include + +namespace b_qt { + +/// @brief A header local QObject based class +class Header_QObject : public QObject +{ + Q_OBJECT +public: + Header_QObject() {} + ~Header_QObject() {} + + std::string str; +}; + +/// @brief Function that returns the content of mocs_compilation.cpp +extern std::string mocs_compilation(); +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in new file mode 100644 index 0000000..e415d08 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in @@ -0,0 +1,8 @@ +#ifndef CONFIG_HPP +#define CONFIG_HPP + +// Application configuration + +enum dummy { NO_OP }; + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake b/Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake new file mode 100644 index 0000000..0fc6e63 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) + +# Read mocs_compilation.cpp file into variable +file(READ "${MCF}" MOCS_COMPILATION) +string(REPLACE "\\" "\\\\" MOCS_COMPILATION "${MOCS_COMPILATION}" ) +string(REPLACE "\"" "\\\"" MOCS_COMPILATION "${MOCS_COMPILATION}" ) +string(REPLACE "\n" "\"\n\"" MOCS_COMPILATION "${MOCS_COMPILATION}" ) + +# Configure file +configure_file ( "${CF_IN}" "${CF_OUT}" @ONLY ) diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/main.cpp b/Tests/QtAutogen/AutogenOriginDependsOff/main.cpp new file mode 100644 index 0000000..a3425f1 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/main.cpp @@ -0,0 +1,15 @@ + +#include +#include +#include + +int main() +{ + if (a_qt::mocs_compilation().empty()) { + return -1; + } + if (b_qt::mocs_compilation().empty()) { + return -1; + } + return 0; +} diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 01ed7e9..46d56cb 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -15,6 +15,7 @@ ADD_AUTOGEN_TEST(RccSkipSource) if(QT_TEST_VERSION GREATER 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) endif() +ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff) ADD_AUTOGEN_TEST(MocDepends) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) -- cgit v0.12 From 846043dd35cbceec4ec114492ad04805b6ee625a Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 30 Oct 2018 11:27:49 +0100 Subject: Autogen: Rename MocDepends test to AutogenOriginDependsOn --- .../AutogenOriginDependsOn/CMakeLists.txt | 139 +++++++++++++++++++++ .../AutogenOriginDependsOn/object_invalid.hpp.in | 1 + .../AutogenOriginDependsOn/object_valid.hpp.in | 14 +++ .../AutogenOriginDependsOn/simpleLib.cpp.in | 9 ++ .../AutogenOriginDependsOn/simpleLib.hpp.in | 14 +++ .../AutogenOriginDependsOn/testATDFile.cpp | 9 ++ .../AutogenOriginDependsOn/testATDTarget.cpp | 9 ++ .../AutogenOriginDependsOn/testGenFile.cpp | 8 ++ .../AutogenOriginDependsOn/testGenLib.cpp | 12 ++ .../AutogenOriginDependsOn/testGenLib.hpp | 16 +++ .../AutogenOriginDependsOn/testGenTarget.cpp | 9 ++ Tests/QtAutogen/CommonTests.cmake | 2 +- Tests/QtAutogen/MocDepends/CMakeLists.txt | 139 --------------------- Tests/QtAutogen/MocDepends/object_invalid.hpp.in | 1 - Tests/QtAutogen/MocDepends/object_valid.hpp.in | 14 --- Tests/QtAutogen/MocDepends/simpleLib.cpp.in | 9 -- Tests/QtAutogen/MocDepends/simpleLib.hpp.in | 14 --- Tests/QtAutogen/MocDepends/testATDFile.cpp | 9 -- Tests/QtAutogen/MocDepends/testATDTarget.cpp | 9 -- Tests/QtAutogen/MocDepends/testGenFile.cpp | 8 -- Tests/QtAutogen/MocDepends/testGenLib.cpp | 12 -- Tests/QtAutogen/MocDepends/testGenLib.hpp | 16 --- Tests/QtAutogen/MocDepends/testGenTarget.cpp | 9 -- 23 files changed, 241 insertions(+), 241 deletions(-) create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/object_valid.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.cpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenFile.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenTarget.cpp delete mode 100644 Tests/QtAutogen/MocDepends/CMakeLists.txt delete mode 100644 Tests/QtAutogen/MocDepends/object_invalid.hpp.in delete mode 100644 Tests/QtAutogen/MocDepends/object_valid.hpp.in delete mode 100644 Tests/QtAutogen/MocDepends/simpleLib.cpp.in delete mode 100644 Tests/QtAutogen/MocDepends/simpleLib.hpp.in delete mode 100644 Tests/QtAutogen/MocDepends/testATDFile.cpp delete mode 100644 Tests/QtAutogen/MocDepends/testATDTarget.cpp delete mode 100644 Tests/QtAutogen/MocDepends/testGenFile.cpp delete mode 100644 Tests/QtAutogen/MocDepends/testGenLib.cpp delete mode 100644 Tests/QtAutogen/MocDepends/testGenLib.hpp delete mode 100644 Tests/QtAutogen/MocDepends/testGenTarget.cpp diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt new file mode 100644 index 0000000..f70d9ce --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt @@ -0,0 +1,139 @@ +cmake_minimum_required(VERSION 3.10) +project(AutogenOriginDependsOn) +include("../AutogenTest.cmake") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +# -- Test dependency on header generated by a custom command +# +# The ORIGIN_autogen target must depend on the same *GENERATED* source files as +# the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepGenFile_autogen target of +# mocDepGenFile to the source file GenFile.hpp, which is *GENERATED* +# by a custom command. +# If mocDepGenFile_autogen gets built *before* or in *parallel* to the +# custom command, the build will fail. That's because GenFile.hpp, +# which is required by mocDepGenFile_autogen, is only valid after the +# custom command has been completed. +# +# The sleep seconds artificially increase the build time of the custom command +# to simulate a slow file generation process that takes longer to run than +# the build of the mocDepGenFile_autogen target. +add_custom_command( + OUTPUT ${CBD}/GenFile.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenFile.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenFile.hpp) + +add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp) +target_link_libraries(mocDepGenFile ${QT_QTCORE_TARGET}) +set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE) + + +# -- Test dependency on header generating custom target +# +# The ORIGIN_autogen target must depend on the same user defined targets +# as the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepTarget_autogen target of +# mocDepTarget to the utility target mocDepTargetUtil. +# If mocDepTarget_autogen gets built *before* or in *parallel* to +# mocDepTargetUtil, the build will fail. That's +# because GenTarget.hpp, which is required by mocDepTarget_autogen, +# is only valid after the mocDepTargetUtil build has been completed. +# +# The sleep seconds artificially increase the build time of mocDepTargetUtil +# to simulate a slow utility target build that takes longer to run than +# the build of the mocDepTarget_autogen target. +add_custom_target(mocDepTargetUtil + BYPRODUCTS ${CBD}/GenTarget.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenTarget.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenTarget.hpp) + +add_executable(mocDepTarget testGenTarget.cpp) +target_link_libraries(mocDepTarget ${QT_QTCORE_TARGET}) +set_target_properties(mocDepTarget PROPERTIES AUTOMOC TRUE) +add_dependencies(mocDepTarget mocDepTargetUtil) + + +# -- Test 3: Depend on generated linked library +# The ORIGIN_autogen target must depend on the same linked libraries +# as the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepGenLib_autogen target of mocDepGenLib +# to the user generated library SimpleLib, which mocDepGenLib links to. +# If mocDepGenLib_autogen gets built *before* or in *parallel* to SimpleLib, +# the build will fail. That's because simpleLib.hpp, which is required by +# mocDepGenLib_autogen, is only valid after the SimpleLib build has been +# completed. +# +# The sleep seconds artificially increase the build time of SimpleLib +# to simulate a slow utility library build that takes longer to run than +# the build of the mocDepGenLib_autogen target. +add_custom_command( + OUTPUT ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/simpleLib.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.hpp.in ${CBD}/simpleLib.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.cpp.in ${CBD}/simpleLib.cpp) +add_library(SimpleLib STATIC ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp) +target_link_libraries(SimpleLib ${QT_QTCORE_TARGET}) + +add_executable(mocDepGenLib testGenLib.cpp) +target_link_libraries(mocDepGenLib SimpleLib ${QT_QTCORE_TARGET}) +set_target_properties(mocDepGenLib PROPERTIES AUTOMOC TRUE) + + +# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency +# +# This tests the dependency of the mocDepATDFile_autogen target of +# mocDepATDTarget to the utility target mocDepATDFileUtil. +# If mocDepATDFile_autogen gets built *before* or in *parallel* to +# mocDepATDFileUtil, the build will fail. That's +# because ATDFile.hpp, which is required by mocDepATDFile_autogen, +# is only valid after the mocDepATDFileUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDFileUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDFile_autogen target. +add_custom_command( + OUTPUT ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) + +add_executable(mocDepATDFile testATDFile.cpp) +target_link_libraries(mocDepATDFile ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) + + +# -- Test AUTOGEN_TARGET_DEPENDS with target dependency +# +# This tests the dependency of the mocDepATDTarget_autogen target of +# mocDepATDTarget to the utility target mocDepATDTargetUtil. +# If mocDepATDTarget_autogen gets built *before* or in *parallel* to +# mocDepATDTargetUtil, the build will fail. That's +# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, +# is only valid after the mocDepATDTargetUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDTargetUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDTarget_autogen target. +add_custom_target(mocDepATDTargetUtil + BYPRODUCTS ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) + +add_executable(mocDepATDTarget testATDTarget.cpp) +target_link_libraries(mocDepATDTarget ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in new file mode 100644 index 0000000..854d9a1 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in @@ -0,0 +1 @@ +#ifndef diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/object_valid.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/object_valid.hpp.in new file mode 100644 index 0000000..f364f7c --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/object_valid.hpp.in @@ -0,0 +1,14 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include + +class Object : public QObject +{ + Q_OBJECT +public: + Q_SLOT + void aSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.cpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.cpp.in new file mode 100644 index 0000000..fa33bd3 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.cpp.in @@ -0,0 +1,9 @@ +#include "simpleLib.hpp" + +SimpleLib::SimpleLib() +{ +} + +SimpleLib::~SimpleLib() +{ +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.hpp.in new file mode 100644 index 0000000..b65b0cb --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.hpp.in @@ -0,0 +1,14 @@ +#ifndef SIMPLE_LIB_H +#define SIMPLE_LIB_H + +#include + +class SimpleLib : public QObject +{ + Q_OBJECT +public: + SimpleLib(); + ~SimpleLib(); +}; + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp new file mode 100644 index 0000000..6bddfcd --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp @@ -0,0 +1,9 @@ + +#include "ATDFile.hpp" +#include "moc_ATDFile.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp new file mode 100644 index 0000000..831fc26 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp @@ -0,0 +1,9 @@ + +#include "ATDTarget.hpp" +#include "moc_ATDTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testGenFile.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenFile.cpp new file mode 100644 index 0000000..7df6e13 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenFile.cpp @@ -0,0 +1,8 @@ + +#include "GenFile.hpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.cpp new file mode 100644 index 0000000..c14e159 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.cpp @@ -0,0 +1,12 @@ + +#include "testGenLib.hpp" + +int main() +{ + SimpleLib libObject; + LObject lobject; + return 0; +} + +// Depend on and AUTOMOC the SimpleLib header simpleLib.hpp +#include "moc_simpleLib.cpp" diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp new file mode 100644 index 0000000..408335b --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp @@ -0,0 +1,16 @@ +#ifndef TEST3_HPP +#define TEST3_HPP + +#include "simpleLib.hpp" +#include + +// This object triggers the AUTOMOC on this file +class LObject : public QObject +{ + Q_OBJECT +public: + Q_SLOT + void aSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testGenTarget.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenTarget.cpp new file mode 100644 index 0000000..911076e --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenTarget.cpp @@ -0,0 +1,9 @@ + +#include "GenTarget.hpp" +#include "moc_GenTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 46d56cb..ccbddbd 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -16,7 +16,7 @@ if(QT_TEST_VERSION GREATER 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) endif() ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff) -ADD_AUTOGEN_TEST(MocDepends) +ADD_AUTOGEN_TEST(AutogenOriginDependsOn) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) diff --git a/Tests/QtAutogen/MocDepends/CMakeLists.txt b/Tests/QtAutogen/MocDepends/CMakeLists.txt deleted file mode 100644 index 6ea72be..0000000 --- a/Tests/QtAutogen/MocDepends/CMakeLists.txt +++ /dev/null @@ -1,139 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(MocDepends) -include("../AutogenTest.cmake") - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) -set(CBD ${CMAKE_CURRENT_BINARY_DIR}) - -# -- Test dependency on header generated by a custom command -# -# The ORIGIN_autogen target must depend on the same *GENERATED* source files as -# the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepGenFile_autogen target of -# mocDepGenFile to the source file GenFile.hpp, which is *GENERATED* -# by a custom command. -# If mocDepGenFile_autogen gets built *before* or in *parallel* to the -# custom command, the build will fail. That's because GenFile.hpp, -# which is required by mocDepGenFile_autogen, is only valid after the -# custom command has been completed. -# -# The sleep seconds artificially increase the build time of the custom command -# to simulate a slow file generation process that takes longer to run than -# the build of the mocDepGenFile_autogen target. -add_custom_command( - OUTPUT ${CBD}/GenFile.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenFile.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenFile.hpp) - -add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp) -target_link_libraries(mocDepGenFile ${QT_QTCORE_TARGET}) -set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE) - - -# -- Test dependency on header generating custom target -# -# The ORIGIN_autogen target must depend on the same user defined targets -# as the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepTarget_autogen target of -# mocDepTarget to the utility target mocDepTargetUtil. -# If mocDepTarget_autogen gets built *before* or in *parallel* to -# mocDepTargetUtil, the build will fail. That's -# because GenTarget.hpp, which is required by mocDepTarget_autogen, -# is only valid after the mocDepTargetUtil build has been completed. -# -# The sleep seconds artificially increase the build time of mocDepTargetUtil -# to simulate a slow utility target build that takes longer to run than -# the build of the mocDepTarget_autogen target. -add_custom_target(mocDepTargetUtil - BYPRODUCTS ${CBD}/GenTarget.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenTarget.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenTarget.hpp) - -add_executable(mocDepTarget testGenTarget.cpp) -target_link_libraries(mocDepTarget ${QT_QTCORE_TARGET}) -set_target_properties(mocDepTarget PROPERTIES AUTOMOC TRUE) -add_dependencies(mocDepTarget mocDepTargetUtil) - - -# -- Test 3: Depend on generated linked library -# The ORIGIN_autogen target must depend on the same linked libraries -# as the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepGenLib_autogen target of mocDepGenLib -# to the user generated library SimpleLib, which mocDepGenLib links to. -# If mocDepGenLib_autogen gets built *before* or in *parallel* to SimpleLib, -# the build will fail. That's because simpleLib.hpp, which is required by -# mocDepGenLib_autogen, is only valid after the SimpleLib build has been -# completed. -# -# The sleep seconds artificially increase the build time of SimpleLib -# to simulate a slow utility library build that takes longer to run than -# the build of the mocDepGenLib_autogen target. -add_custom_command( - OUTPUT ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/simpleLib.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.hpp.in ${CBD}/simpleLib.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.cpp.in ${CBD}/simpleLib.cpp) -add_library(SimpleLib STATIC ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp) -target_link_libraries(SimpleLib ${QT_QTCORE_TARGET}) - -add_executable(mocDepGenLib testGenLib.cpp) -target_link_libraries(mocDepGenLib SimpleLib ${QT_QTCORE_TARGET}) -set_target_properties(mocDepGenLib PROPERTIES AUTOMOC TRUE) - - -# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency -# -# This tests the dependency of the mocDepATDFile_autogen target of -# mocDepATDTarget to the utility target mocDepATDFileUtil. -# If mocDepATDFile_autogen gets built *before* or in *parallel* to -# mocDepATDFileUtil, the build will fail. That's -# because ATDFile.hpp, which is required by mocDepATDFile_autogen, -# is only valid after the mocDepATDFileUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDFileUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDFile_autogen target. -add_custom_command( - OUTPUT ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) - -add_executable(mocDepATDFile testATDFile.cpp) -target_link_libraries(mocDepATDFile ${QT_QTCORE_TARGET}) -set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) - - -# -- Test AUTOGEN_TARGET_DEPENDS with target dependency -# -# This tests the dependency of the mocDepATDTarget_autogen target of -# mocDepATDTarget to the utility target mocDepATDTargetUtil. -# If mocDepATDTarget_autogen gets built *before* or in *parallel* to -# mocDepATDTargetUtil, the build will fail. That's -# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, -# is only valid after the mocDepATDTargetUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDTargetUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDTarget_autogen target. -add_custom_target(mocDepATDTargetUtil - BYPRODUCTS ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) - -add_executable(mocDepATDTarget testATDTarget.cpp) -target_link_libraries(mocDepATDTarget ${QT_QTCORE_TARGET}) -set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/MocDepends/object_invalid.hpp.in b/Tests/QtAutogen/MocDepends/object_invalid.hpp.in deleted file mode 100644 index 854d9a1..0000000 --- a/Tests/QtAutogen/MocDepends/object_invalid.hpp.in +++ /dev/null @@ -1 +0,0 @@ -#ifndef diff --git a/Tests/QtAutogen/MocDepends/object_valid.hpp.in b/Tests/QtAutogen/MocDepends/object_valid.hpp.in deleted file mode 100644 index f364f7c..0000000 --- a/Tests/QtAutogen/MocDepends/object_valid.hpp.in +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OBJECT_HPP -#define OBJECT_HPP - -#include - -class Object : public QObject -{ - Q_OBJECT -public: - Q_SLOT - void aSlot(){}; -}; - -#endif diff --git a/Tests/QtAutogen/MocDepends/simpleLib.cpp.in b/Tests/QtAutogen/MocDepends/simpleLib.cpp.in deleted file mode 100644 index fa33bd3..0000000 --- a/Tests/QtAutogen/MocDepends/simpleLib.cpp.in +++ /dev/null @@ -1,9 +0,0 @@ -#include "simpleLib.hpp" - -SimpleLib::SimpleLib() -{ -} - -SimpleLib::~SimpleLib() -{ -} diff --git a/Tests/QtAutogen/MocDepends/simpleLib.hpp.in b/Tests/QtAutogen/MocDepends/simpleLib.hpp.in deleted file mode 100644 index b65b0cb..0000000 --- a/Tests/QtAutogen/MocDepends/simpleLib.hpp.in +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef SIMPLE_LIB_H -#define SIMPLE_LIB_H - -#include - -class SimpleLib : public QObject -{ - Q_OBJECT -public: - SimpleLib(); - ~SimpleLib(); -}; - -#endif diff --git a/Tests/QtAutogen/MocDepends/testATDFile.cpp b/Tests/QtAutogen/MocDepends/testATDFile.cpp deleted file mode 100644 index 6bddfcd..0000000 --- a/Tests/QtAutogen/MocDepends/testATDFile.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDFile.hpp" -#include "moc_ATDFile.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/MocDepends/testATDTarget.cpp b/Tests/QtAutogen/MocDepends/testATDTarget.cpp deleted file mode 100644 index 831fc26..0000000 --- a/Tests/QtAutogen/MocDepends/testATDTarget.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDTarget.hpp" -#include "moc_ATDTarget.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/MocDepends/testGenFile.cpp b/Tests/QtAutogen/MocDepends/testGenFile.cpp deleted file mode 100644 index 7df6e13..0000000 --- a/Tests/QtAutogen/MocDepends/testGenFile.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "GenFile.hpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/MocDepends/testGenLib.cpp b/Tests/QtAutogen/MocDepends/testGenLib.cpp deleted file mode 100644 index c14e159..0000000 --- a/Tests/QtAutogen/MocDepends/testGenLib.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#include "testGenLib.hpp" - -int main() -{ - SimpleLib libObject; - LObject lobject; - return 0; -} - -// Depend on and AUTOMOC the SimpleLib header simpleLib.hpp -#include "moc_simpleLib.cpp" diff --git a/Tests/QtAutogen/MocDepends/testGenLib.hpp b/Tests/QtAutogen/MocDepends/testGenLib.hpp deleted file mode 100644 index 408335b..0000000 --- a/Tests/QtAutogen/MocDepends/testGenLib.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef TEST3_HPP -#define TEST3_HPP - -#include "simpleLib.hpp" -#include - -// This object triggers the AUTOMOC on this file -class LObject : public QObject -{ - Q_OBJECT -public: - Q_SLOT - void aSlot(){}; -}; - -#endif diff --git a/Tests/QtAutogen/MocDepends/testGenTarget.cpp b/Tests/QtAutogen/MocDepends/testGenTarget.cpp deleted file mode 100644 index 911076e..0000000 --- a/Tests/QtAutogen/MocDepends/testGenTarget.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "GenTarget.hpp" -#include "moc_GenTarget.cpp" - -int main() -{ - Object obj; - return 0; -} -- cgit v0.12 From 336893d9eb0ee732683b18e2e9e8a17e86e09d99 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 30 Oct 2018 11:41:37 +0100 Subject: Autogen: Separate AUTOGEN_TARGET_DEPENDS tests into own tests suite The tests for AUTOGEN_TARGET_DEPENDS were part of the AutogenOriginDependsOn tests suite. This separates them into an own AutogenTargetDepends tests suite. --- .../AutogenOriginDependsOn/CMakeLists.txt | 48 ------------------- .../AutogenOriginDependsOn/testATDFile.cpp | 9 ---- .../AutogenOriginDependsOn/testATDTarget.cpp | 9 ---- .../QtAutogen/AutogenTargetDepends/CMakeLists.txt | 54 ++++++++++++++++++++++ .../AutogenTargetDepends/object_invalid.hpp.in | 1 + .../AutogenTargetDepends/object_valid.hpp.in | 14 ++++++ .../QtAutogen/AutogenTargetDepends/testATDFile.cpp | 9 ++++ .../AutogenTargetDepends/testATDTarget.cpp | 9 ++++ Tests/QtAutogen/CommonTests.cmake | 1 + 9 files changed, 88 insertions(+), 66 deletions(-) delete mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp delete mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp create mode 100644 Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in create mode 100644 Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in create mode 100644 Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp create mode 100644 Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt index f70d9ce..60869eb 100644 --- a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt +++ b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt @@ -89,51 +89,3 @@ target_link_libraries(SimpleLib ${QT_QTCORE_TARGET}) add_executable(mocDepGenLib testGenLib.cpp) target_link_libraries(mocDepGenLib SimpleLib ${QT_QTCORE_TARGET}) set_target_properties(mocDepGenLib PROPERTIES AUTOMOC TRUE) - - -# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency -# -# This tests the dependency of the mocDepATDFile_autogen target of -# mocDepATDTarget to the utility target mocDepATDFileUtil. -# If mocDepATDFile_autogen gets built *before* or in *parallel* to -# mocDepATDFileUtil, the build will fail. That's -# because ATDFile.hpp, which is required by mocDepATDFile_autogen, -# is only valid after the mocDepATDFileUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDFileUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDFile_autogen target. -add_custom_command( - OUTPUT ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) - -add_executable(mocDepATDFile testATDFile.cpp) -target_link_libraries(mocDepATDFile ${QT_QTCORE_TARGET}) -set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) - - -# -- Test AUTOGEN_TARGET_DEPENDS with target dependency -# -# This tests the dependency of the mocDepATDTarget_autogen target of -# mocDepATDTarget to the utility target mocDepATDTargetUtil. -# If mocDepATDTarget_autogen gets built *before* or in *parallel* to -# mocDepATDTargetUtil, the build will fail. That's -# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, -# is only valid after the mocDepATDTargetUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDTargetUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDTarget_autogen target. -add_custom_target(mocDepATDTargetUtil - BYPRODUCTS ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) - -add_executable(mocDepATDTarget testATDTarget.cpp) -target_link_libraries(mocDepATDTarget ${QT_QTCORE_TARGET}) -set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp deleted file mode 100644 index 6bddfcd..0000000 --- a/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDFile.hpp" -#include "moc_ATDFile.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp deleted file mode 100644 index 831fc26..0000000 --- a/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDTarget.hpp" -#include "moc_ATDTarget.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt new file mode 100644 index 0000000..63b7c98 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.10) +project(AutogenTargetDepends) +include("../AutogenTest.cmake") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency +# +# This tests the dependency of the mocDepATDFile_autogen target of +# mocDepATDTarget to the utility target mocDepATDFileUtil. +# If mocDepATDFile_autogen gets built *before* or in *parallel* to +# mocDepATDFileUtil, the build will fail. That's +# because ATDFile.hpp, which is required by mocDepATDFile_autogen, +# is only valid after the mocDepATDFileUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDFileUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDFile_autogen target. +add_custom_command( + OUTPUT ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) + +add_executable(mocDepATDFile testATDFile.cpp) +target_link_libraries(mocDepATDFile ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) + + +# -- Test AUTOGEN_TARGET_DEPENDS with target dependency +# +# This tests the dependency of the mocDepATDTarget_autogen target of +# mocDepATDTarget to the utility target mocDepATDTargetUtil. +# If mocDepATDTarget_autogen gets built *before* or in *parallel* to +# mocDepATDTargetUtil, the build will fail. That's +# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, +# is only valid after the mocDepATDTargetUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDTargetUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDTarget_autogen target. +add_custom_target(mocDepATDTargetUtil + BYPRODUCTS ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) + +add_executable(mocDepATDTarget testATDTarget.cpp) +target_link_libraries(mocDepATDTarget ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in b/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in new file mode 100644 index 0000000..854d9a1 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in @@ -0,0 +1 @@ +#ifndef diff --git a/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in b/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in new file mode 100644 index 0000000..f364f7c --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in @@ -0,0 +1,14 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include + +class Object : public QObject +{ + Q_OBJECT +public: + Q_SLOT + void aSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp b/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp new file mode 100644 index 0000000..6bddfcd --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp @@ -0,0 +1,9 @@ + +#include "ATDFile.hpp" +#include "moc_ATDFile.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp b/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp new file mode 100644 index 0000000..831fc26 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp @@ -0,0 +1,9 @@ + +#include "ATDTarget.hpp" +#include "moc_ATDTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index ccbddbd..58d9f0b 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -17,6 +17,7 @@ if(QT_TEST_VERSION GREATER 4) endif() ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff) ADD_AUTOGEN_TEST(AutogenOriginDependsOn) +ADD_AUTOGEN_TEST(AutogenTargetDepends) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) -- cgit v0.12 From 47f9c15c60e2898640fa57aed4c5ff5ee5c0d3ef Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 3 Nov 2018 12:11:24 +0100 Subject: Autogen: Update _autogen target documentation --- Help/manual/cmake-qt.7.rst | 38 +++++++++++++++++++++++--------------- Help/prop_tgt/AUTOMOC.rst | 4 ++-- Help/prop_tgt/AUTORCC.rst | 2 +- Help/prop_tgt/AUTOUIC.rst | 2 +- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst index 724d8ec..0382794 100644 --- a/Help/manual/cmake-qt.7.rst +++ b/Help/manual/cmake-qt.7.rst @@ -44,14 +44,10 @@ Qt Build Tools Qt relies on some bundled tools for code generation, such as ``moc`` for meta-object code generation, ``uic`` for widget layout and population, -and ``rcc`` for virtual filesystem content generation. These tools may be +and ``rcc`` for virtual file system content generation. These tools may be automatically invoked by :manual:`cmake(1)` if the appropriate conditions are met. The automatic tool invocation may be used with both Qt 4 and Qt 5. -The tools are executed as part of a synthesized custom target generated by -CMake. Target dependencies may be added to that custom target by adding them -to the :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property. - AUTOMOC ^^^^^^^ @@ -214,19 +210,31 @@ overrides options from the :prop_tgt:`AUTORCC_OPTIONS` target property. Source files can be excluded from :prop_tgt:`AUTORCC` processing by enabling :prop_sf:`SKIP_AUTORCC` or the broader :prop_sf:`SKIP_AUTOGEN`. +The ``_autogen`` target +=============================== + +The ``moc`` and ``uic`` tools are executed as part of a synthesized +``_autogen`` :command:`custom target ` generated by +CMake. By default that ``_autogen`` target inherits the dependencies +of the ```` target (see :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS`). +Target dependencies may be added to the ``_autogen`` target by adding +them to the :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property. + Visual Studio Generators ======================== -When using the :manual:`Visual Studio generators `, -CMake uses a ``PRE_BUILD`` :command:`custom command ` for -:prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`. -If the :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` processing depends on files, -a :command:`custom target ` is used instead. -This happens when - -- The origin target depends on :prop_sf:`GENERATED` files which aren't excluded - from :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` by :prop_sf:`SKIP_AUTOMOC`, - :prop_sf:`SKIP_AUTOUIC`, :prop_sf:`SKIP_AUTOGEN` or :policy:`CMP0071` +When using the :manual:`Visual Studio generators `, CMake +generates a ``PRE_BUILD`` :command:`custom command ` +instead of the ``_autogen`` :command:`custom target ` +(for :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC`). +This isn't always possible though and +an ``_autogen`` :command:`custom target ` is used, +when either + +- the ```` target depends on :prop_sf:`GENERATED` files which aren't + excluded from :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTOUIC` by + :prop_sf:`SKIP_AUTOMOC`, :prop_sf:`SKIP_AUTOUIC`, :prop_sf:`SKIP_AUTOGEN` + or :policy:`CMP0071` - :prop_tgt:`AUTOGEN_TARGET_DEPENDS` lists a source file qtmain.lib on Windows diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst index 3bd693a..70d89f2 100644 --- a/Help/prop_tgt/AUTOMOC.rst +++ b/Help/prop_tgt/AUTOMOC.rst @@ -3,8 +3,8 @@ AUTOMOC Should the target be processed with automoc (for Qt projects). -AUTOMOC is a boolean specifying whether CMake will handle the Qt ``moc`` -preprocessor automatically, i.e. without having to use the +:prop_tgt:`AUTOMOC` is a boolean specifying whether CMake will handle the Qt +``moc`` preprocessor automatically, i.e. without having to use the :module:`QT4_WRAP_CPP() ` or QT5_WRAP_CPP() macro. Currently Qt4 and Qt5 are supported. diff --git a/Help/prop_tgt/AUTORCC.rst b/Help/prop_tgt/AUTORCC.rst index 3cc5990..99c2b0e 100644 --- a/Help/prop_tgt/AUTORCC.rst +++ b/Help/prop_tgt/AUTORCC.rst @@ -3,7 +3,7 @@ AUTORCC Should the target be processed with autorcc (for Qt projects). -``AUTORCC`` is a boolean specifying whether CMake will handle +:prop_tgt:`AUTORCC` is a boolean specifying whether CMake will handle the Qt ``rcc`` code generator automatically, i.e. without having to use the :module:`QT4_ADD_RESOURCES() ` or ``QT5_ADD_RESOURCES()`` macro. Currently Qt4 and Qt5 are supported. diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst index 4fc603f..8cae0a7 100644 --- a/Help/prop_tgt/AUTOUIC.rst +++ b/Help/prop_tgt/AUTOUIC.rst @@ -3,7 +3,7 @@ AUTOUIC Should the target be processed with autouic (for Qt projects). -``AUTOUIC`` is a boolean specifying whether CMake will handle +:prop_tgt:`AUTOUIC` is a boolean specifying whether CMake will handle the Qt ``uic`` code generator automatically, i.e. without having to use the :module:`QT4_WRAP_UI() ` or ``QT5_WRAP_UI()`` macro. Currently Qt4 and Qt5 are supported. -- cgit v0.12