diff options
| author | Craig Scott <craig.scott@qt.io> | 2021-09-07 15:51:18 +1000 |
|---|---|---|
| committer | Craig Scott <craig.scott@qt.io> | 2021-09-08 22:20:06 +1000 |
| commit | 0d4b2355e58c3d9d286a266d2f9f50f4b8e0e3b3 (patch) | |
| tree | 4699208eaf91bcdb3861348f6e6fb3bccd7513d7 /src/concurrent/qtconcurrentfunctionwrappers.h | |
| parent | 6d20630b066286dbe2d4cb8e7aa0b07bc498bfcd (diff) | |
Fix dependencies on sources generated in a different scope to target
In certain situations, a file generated by add_custom_command(OUTPUT)
may be added as a source to a target defined in a different directory
scope. That makes its GENERATED source property not visible to the
target for CMake versions before 3.20. For 3.20 and later, policy
CMP0118 can make the generated state of a source file global, but that
policy is under the control of the user project, since its value at
the end of the target's directory scope is what is used. Therefore we
can force that global visibility using CMP0118. With CMake 3.18 or
later, we can set source properties in arbitrary scopes, which allows
us to force visibility in the scopes we need it. Use that for all
CMake versions 3.18 and later to make the source file properties
visible to the target.
Making the generated state of a source file visible to the target
isn't enough on its own. In the scope that the file is generated,
there must be a target that depends on the file or else CMake won't
set up the necessary dependencies to ensure that generation happens
before the target tries to use it. Add targets in the generated
file's own scope where we currently might not do that.
Task-number: QTBUG-95200
Pick-to: 6.2
Change-Id: Ic1dfca1a193041de01d7f903b79473b9d47f1d1d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrentfunctionwrappers.h')
0 files changed, 0 insertions, 0 deletions
