From 96d20a4de3420fca0e25a67c24e6f7eaead4420d Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 31 Oct 2017 14:09:03 +0100 Subject: Autogen: Don't use AUTOMOC_MOC_OPTIONS in moc-predefs command Closes #17418 --- Source/cmQtAutoGenerators.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 87c0f89..b329d38 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1392,9 +1392,13 @@ bool cmQtAutoGenerators::MocGenerateAll() { // Compose command std::vector cmd = this->MocPredefsCmd; - // Add options - cmd.insert(cmd.end(), this->MocAllOptions.begin(), - this->MocAllOptions.end()); + // Add includes + cmd.insert(cmd.end(), this->MocIncludes.begin(), + this->MocIncludes.end()); + // Add definitions + for (std::string const& def : this->MocDefinitions) { + cmd.push_back("-D" + def); + } // Execute command if (!this->RunCommand(cmd, output)) { this->LogCommandError(cmQtAutoGen::MOC, -- cgit v0.12 From d3caf941e4940bb133088bea4c790a90e749f8b8 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 31 Oct 2017 14:55:49 +0100 Subject: Autogen: Tests: Set AUTOMOC_MOC_OPTIONS in a simple test --- Tests/QtAutogen/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index b9d8e46..32c2950 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -65,6 +65,11 @@ add_executable(mocOnly mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySo set_property(TARGET mocOnly PROPERTY AUTOMOC ON) target_link_libraries(mocOnly ${QT_LIBRARIES}) +add_executable(mocOnlyOpts mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp) +set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC ON) +set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC_MOC_OPTIONS "-nw") +target_link_libraries(mocOnlyOpts ${QT_LIBRARIES}) + # -- Test # UIC only if(ALLOW_WRAP_CPP) -- cgit v0.12