[cmake-developers] cmake --help-policy CMP0057 MAIN_DEPENDENCY
Brad King
brad.king at kitware.com
Mon Apr 27 09:31:36 EDT 2015
On 04/24/2015 05:43 PM, James Bigler wrote:
> This new policy breaks a long standing feature of FindCUDA.
>
> Basically I could add the MAIN_DEPENDENCY to all CUDA files built.
> If the same CUDA file was used in multiple custom commands it would
> attach the build rule to the first command, and leave the remaining
> ones as "phantom" .rule files in the project.
The policy was added to diagnose some previously-broken cases earlier.
We technically never supported duplicate MAIN_DEPENDENCY specification
but did not diagnose it. Instead it could produce bad builds in some
cases IIRC.
Nils, do you remember where this came up?
It is also somewhat non-sensical to use MAIN_DEPENDENCY for more than
one rule for the same source file. The purpose of it is to attach the
rule as the custom command for building the source file in VS IDE project
files. VS allows only one custom command for building a given source.
> should I push/pop the policy in FindCUDA.cmake?
No. Never set a policy to OLD in new code, and certainly not in
upstream CMake.
You could record in a source file property whether a source has been
used as the MAIN_DEPENDENCY for something else and then use plain
DEPENDS for later rules that depend on the source.
-Brad
More information about the cmake-developers
mailing list