[cmake-developers] PRE_BUILD misconception
Brad King
brad.king at kitware.com
Thu Aug 24 07:48:48 EDT 2017
On 08/23/2017 05:56 PM, Sebastian Holtermann wrote:
> It seems that in CMake 3.9/AUTOGEN the VS generator uses the *_autogen
> target more often than necessary (it could use PRE_BUILD instead).
>
> Let's assume a target `B` that depends on
> - a *GENERATED* file `FA`
> - a linked library `LA`
> - a utility target `TA` (via `add_dependencies()`)
>
> Using the VS generator, will `FA`, `LA` and `TA` be built completely before
> target B executes it's PRE_BUILD?
Target-level dependencies will be completely finished, including their
POST_BUILD if any, before the PRE_BUILD of a dependent target begins.
In your list above, `LA` and `TA` will definitely be built before `B`
starts. For the generated file `FA`, it depends whether the custom
command is attached to `B` or not. If it is inside `B` then it won't
generate until after PRE_BUILD is done.
PRE_BUILD in VS means "if any files associated with this .vcxproj
are about to be built due to updated dependencies or missing outputs,
then run this pre-build command first".
-Brad
More information about the cmake-developers
mailing list