diff options
author | Brad King <brad.king@kitware.com> | 2017-10-31 14:18:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-31 14:18:14 (GMT) |
commit | 1df31aa92a398e0ef02e1ccccd41969a63bad29e (patch) | |
tree | 99ade5044a418a40121b42c01bf2951afb84df38 | |
parent | f49b6871e9f6de4948e8aa34446a1c933ca97935 (diff) | |
parent | d3caf941e4940bb133088bea4c790a90e749f8b8 (diff) | |
download | CMake-1df31aa92a398e0ef02e1ccccd41969a63bad29e.zip CMake-1df31aa92a398e0ef02e1ccccd41969a63bad29e.tar.gz CMake-1df31aa92a398e0ef02e1ccccd41969a63bad29e.tar.bz2 |
Merge branch 'autogen-moc-predefs-no-moc-options' into release-3.10
Merge-request: !1432
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 10 | ||||
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 5 |
2 files changed, 12 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<std::string> 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, 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) |