CMake/Tests/QtAutogen
Stephen Kelly 9bc6eb8e1f cmGlobalGenerator: Initialize generator targets on construction (#15729)
The Ninja generator and Visual Studio generators are special-cased for the
QtAutogen feature.  In order to reduce the number of custom targets, the Visual
Studio generators prefer to create custom commands instead, and in order to
create appropriate Ninja files, generated rcc files are listed as byproducts.

This requires the use of the GetConfigCommonSourceFiles API of the
cmGeneratorTarget for those generators when initializing the autogen target.
The initializer method is called from Compute() after the cmGeneratorTarget
objects are created, however the initialization of the object directory occurs
later in the InitGeneratorTargets method.  That means that the resulting object
locations are computed incorrectly and cached before the object directory is
determined, so the generated buildsystem can not find the object files.

The initialization of the object directory was split from the creation of
cmGeneratorTarget instances in commit 0e0258c8 (cmGlobalGenerator: Split
creation of generator object from initialization., 2015-07-25).  The motivation
for the split was to do only what is essential to do early in cases where
cmGeneratorTargets need to be created at configure-time.  That is required for
the purpose of implementing policies CMP0024 and CMP0026, and for
try_compile(LINK_LIBRARIES).  However, the split was not really necessary.

Compute the object directory in the cmGeneratorTarget constructor instead.

The QtAutogen unit test already tests the use of TARGET_OBJECTS with AUTOMOC,
and that test already passes on Ninja.  The reason it already passes is that
the QtAutogen target also uses the AUTORCC feature, and specifies several qrc
files in its SOURCES.  Later in the Compute algorithm (after the
InitGeneratorTargets call), the rcc files are determined and target->AddSource
is called.  The AddSource call clears the previously mentioned cache of source
files, causing it to be regenerated when next queried, this time taking account
of the object directory.

Extend the test suite with a new target which does not make use of AUTORCC with
qrc files so that the test added alone would break without the fix in this
commit.
2015-09-29 09:56:34 -04:00
..
Adir
Bdir Rename the QtAutomoc tests to QtAutogen. 2013-10-24 11:50:58 +02:00
automoc_rerun QtAutogen: Always run autogen step even when rcc is enabled (#15608) 2015-06-19 10:29:38 -04:00
autorcc_depends QtAutogen: Workaround rcc CRCRLF newlines on Windows (#15459) 2015-04-16 15:10:40 -04:00
defines_test Rename the QtAutomoc tests to QtAutogen. 2013-10-24 11:50:58 +02:00
sub QtAutogen: Make uic work even when the source is in a subdir. 2014-02-04 13:21:43 -05:00
CMakeLists.txt cmGlobalGenerator: Initialize generator targets on construction (#15729) 2015-09-29 09:56:34 -04:00
abc.cpp
abc.h Rename the QtAutomoc tests to QtAutogen. 2013-10-24 11:50:58 +02:00
abc_p.h
bar.cpp
blub.cpp
blub.h Rename the QtAutomoc tests to QtAutogen. 2013-10-24 11:50:58 +02:00
calwidget.cpp QtAutoUic: Add a test for the regression in the parent commit. 2015-01-12 01:41:27 +01:00
calwidget.h Add automatic uic invocation for Qt. 2013-10-24 12:30:38 +02:00
calwidget.ui Add automatic uic invocation for Qt. 2013-10-24 12:30:38 +02:00
codeeditor.cpp
codeeditor.h
debug_class.cpp cmTarget: Make the source files depend on the config. 2014-04-02 23:14:02 +02:00
debug_class.h cmTarget: Make the source files depend on the config. 2014-04-02 23:14:02 +02:00
debug_class.ui cmTarget: Make the source files depend on the config. 2014-04-02 23:14:02 +02:00
debug_resource.qrc cmTarget: Make the source files depend on the config. 2014-04-02 23:14:02 +02:00
empty.cpp
empty.h
foo.cpp
foo.h Merge topic 'fix-automoc-compile-definitions' 2013-11-05 13:32:15 -05:00
gadget.cpp
gadget.h
generated.cpp cmQtAutogen: Allow specifying depends for autogen targets. 2013-11-25 22:41:21 +01:00
generated.h QtAutogen: Fix AUTOGEN depends on custom command output with VS. 2014-03-10 13:01:29 +01:00
generated.txt.in QtAutogen: Process 'rcc --list' stdout and stderr separately (#15523) 2015-04-21 09:33:19 -04:00
generated_resource.qrc.in QtAutogen: Process 'rcc --list' stdout and stderr separately (#15523) 2015-04-21 09:33:19 -04:00
libC.cpp
libC.h
main.cpp cmTarget: Make the source files depend on the config. 2014-04-02 23:14:02 +02:00
multiplewidgets.cpp QtAutogen: Process all ui files in a source file (#14981). 2014-09-18 09:41:16 +02:00
multiplewidgets.h QtAutogen: Process all ui files in a source file (#14981). 2014-09-18 09:41:16 +02:00
myinterface.h.in cmQtAutogen: Allow specifying depends for autogen targets. 2013-11-25 22:41:21 +01:00
myotherinterface.h.in QtAutogen: Fix AUTOGEN depends on custom command output with VS. 2014-03-10 13:01:29 +01:00
not_generated_file.qrc QtAutogen: Only add source files to the target if AUTORCC is ON. 2014-02-05 10:13:39 +01:00
private_slot.cpp
private_slot.h
rcconly.cpp QtAutogen: Add source files to target when only AUTORCC is used. 2014-09-17 14:39:42 +02:00
resourcetester.cpp cmTarget: Make the source files depend on the config. 2014-04-02 23:14:02 +02:00
resourcetester.h Add automatic rcc invocation for Qt. 2013-10-24 12:30:41 +02:00
second_resource.qrc QtAutogen: Use the basename for resource files. 2014-03-25 01:16:49 +01:00
second_widget.cpp QtAutogen: Fix use of multiple ui files in a single target. 2014-03-25 01:39:03 +01:00
second_widget.h QtAutogen: Fix use of multiple ui files in a single target. 2014-03-25 01:39:03 +01:00
second_widget.ui QtAutogen: Fix use of multiple ui files in a single target. 2014-03-25 01:39:03 +01:00
targetObjectsTest.cpp cmGlobalGenerator: Initialize generator targets on construction (#15729) 2015-09-29 09:56:34 -04:00
test.qrc Add automatic rcc invocation for Qt. 2013-10-24 12:30:41 +02:00
widget1.ui QtAutogen: Process all ui files in a source file (#14981). 2014-09-18 09:41:16 +02:00
widget2.ui QtAutogen: Process all ui files in a source file (#14981). 2014-09-18 09:41:16 +02:00
xyz.cpp Rename the QtAutomoc tests to QtAutogen. 2013-10-24 11:50:58 +02:00
xyz.h
yaf.cpp
yaf.h
yaf_p.h