summaryrefslogtreecommitdiffstats
path: root/Help/command/add_custom_command.rst
Commit message (Collapse)AuthorAgeFilesLines
* Help/add_custom_command: fix verb grammoBen Boeckel2024-02-281-1/+1
|
* add_custom_command: Allow adding build event via ALIAS targetChen Linxuan2024-02-011-0/+3
| | | | Signed-off-by: Chen Linxuan <me@black-desk.cn>
* cmGlobalNinjaGenerator: tell `ninja` to actually read the depfileBen Boeckel2023-11-011-0/+5
| | | | | | | But only do so if the depfile is not specified as an output of the command. Otherwise the command will out-of-date itself as `ninja` deletes depfiles that it incorporates into the database and a missing output will cause the command to run again.
* Ninja: Allow compilation before generation of dependencies' private sourcesMartin Duffy2023-09-201-0/+10
| | | | | | | | | | This requires knowing when a generated header is public, which we can model using file sets. Add policy CMP0154 to treat generated sources as private by default in targets with file sets. Generated public headers can be specified in public file sets. Fixes: #24959 Issue: #15555
* Merge topic 'doc-fixups-release-3.27'Craig Scott2023-08-071-1/+5
|\ | | | | | | | | | | | | | | | | | | 78e7ea598d cmLocalGenerator: Fix trivial spelling error in code comment 1285fe27ff Help: Improve formatting and fix wording for ENABLE_EXPORTS 91336d061c Help: Improve formatting and cross-references for DEPENDS_EXPLICIT_ONLY 03208d9e18 Help: Fix indenting within TARGET_RUNTIME_DLLS genex docs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8688
| * Help: Improve formatting and cross-references for DEPENDS_EXPLICIT_ONLYCraig Scott2023-08-041-1/+5
| |
* | Merge topic 'command-job-server-aware'Brad King2023-07-201-0/+14
|\ \ | | | | | | | | | | | | | | | | | | | | | 95941fd990 add_custom_{target,command}: Add argument JOB_SERVER_AWARE Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8547
| * | add_custom_{target,command}: Add argument JOB_SERVER_AWAREChris Mahoney2023-07-191-0/+14
| | | | | | | | | | | | Issue: #16273
* | | Merge topic 'doc-add_custom_command'Brad King2023-06-291-1/+1
|\ \ \ | |/ / |/| / | |/ | | | | | | | | e588d29eaf Help: add_custom_command(TARGET) does not support USES_TERMINAL Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: William Jones <william.luke.jones@gmail.com> Merge-request: !8602
| * Help: add_custom_command(TARGET) does not support USES_TERMINALBrad King2023-06-291-1/+1
| | | | | | | | | | | | | | Build events are attached to existing build statements so we cannot independently control the job pool. Issue: #25040
* | Drop Visual Studio 11 2012 generatorBrad King2023-06-131-1/+1
|/ | | | This generator has been deprecated since CMake 3.25. Remove it.
* Help: Clarify PRE_BUILD option for add_custom_command()Craig Scott2023-05-191-3/+6
| | | | Fixes: #24889
* Add variable CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLYAbdelmaged Khalifa2023-02-171-0/+3
| | | | | | | Add CMake variable `CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY` to enable option `DEPENDS_EXPLICIT_ONLY` on all uses of `add_custom_command`. Fixes: #17097
* add_custom_command: Add DEPENDS_EXPLICIT_ONLY option for NinjaAbdelmaged Khalifa2023-02-141-1/+17
| | | | | | | | | Add option `DEPENDS_EXPLICIT_ONLY` to `add_custom_command` to indicate that implicit dependencies coming from users of the output are not needed, and only consider dependencies explicitly specified in the custom command. Fixes: #17097
* Help: Clarify add_custom_command OUTPUT relative path behaviorBrad King2023-01-301-3/+12
| | | | Issue: #24372
* Help: Add add_custom_command example with output consumed by multiple targetsBrad King2022-12-081-3/+48
| | | | This is a common use case, so add an example demonstrating it.
* Help: Drop misleading add_custom_command "makefile terms" explanationBrad King2022-12-071-4/+0
| | | | | | | | | | | | The "In makefile terms" explanation is left from very early days of CMake to help developers migrating from hand-written makefiles. These days it is often misinterpreted, particularly in the context of multiple `add_custom_command` calls, to mean that we generate a single Makefile containing rules for all custom commands. This leads to an incorrect mental model of the expressed build system. The actual generated build system may spread the rules across multiple targets that do not see the each other's file-level rules, which makes target-level dependencies important too.
* add_custom_{command,target}: add genex support for COMMENTPeter Würth2022-11-191-0/+4
| | | | | | | | | | Evaluate and expand generator expressions in the `COMMENT` argument of the `add_custom_command()` and `add_custom_target()` commands. This allows to include generator expressions, e.g. a targets location $<TARGET_...> or the current configuration $<CONFIG>, in the build-time messages. Fixes #22507
* Help: Add _See Also_ sections to related CMake commandsAlex Turbov2022-11-091-0/+5
|
* Drop Visual Studio 10 2010 generatorBrad King2022-09-261-1/+1
| | | | This generator has been deprecated since CMake 3.22. Remove it.
* Help:custom_command: link policy on BYPRODUCTSHinell2022-09-161-0/+2
| | | | | | Link policy explaining BYPRODUCTS. Fixes: #23786
* Help: State behavior for add_custom_command(TARGET) without event typeCraig Scott2022-06-041-0/+5
| | | | | | | | | | Projects should always have specified one of PRE_BUILD, PRE_LINK or POST_BUILD, and the documentation has always shown that one must be given. But the argument parsing logic was such that if none was given, POST_BUILD would be used and no error or warning would be raised. Projects may be relying on this behavior, so document it as formally supported, but not recommended. Fixes: #23488
* find_* commands: add control over Windows registry viewsMarc Chevrier2022-04-291-2/+2
| | | | Fixes: #22775
* Depfile parsing: enhance compatibility with GNU MakeMarc Chevrier2022-01-161-4/+3
|
* Help: add_custom_command: describes depfile formatMarc Chevrier2022-01-111-3/+42
|
* Help: Clarify and correct wording around DEPFILE optionCraig Scott2021-07-241-18/+23
| | | | | | | The previous wording contradicted itself regarding whether Visual Studio generators were supported, and about when generator expressions could be used. Restructure the paragraphs and max it clearer what support was added in which CMake versions.
* VS: Add support for add_custom_command DEPFILEBrad King2021-06-091-3/+5
| | | | | | | | Transform the depfile into MSBuild `AdditionalInputs` content. Add MSBuild Targets to update `AdditionalInputs` and the `.tlog` files for future builds without actually modifying the `.vcxproj` file. Fixes: #20286
* add_custom_command: Target-dependent generator expression supportRaul Tambre2021-05-311-0/+5
| | | | | | | | | OUTPUT variant with a TARGET given to allow resolving target-based generator expressions wouldn't work because OUTPUT is resolved before generator targets are created, i.e. FindGeneratorTargetToUse() returns nullptr. This is a known limitation, see #21364. Implements #21336.
* Xcode: Add support of DEPFILE for add_custom_command, part 2Marc Chevrier2021-04-171-8/+0
| | | | | | This MR extend the support of 'DEPFILE' to buildsystem version 1. Issue: #20286
* Xcode: Add support of DEPFILE for add_custom_commandMarc Chevrier2021-04-151-10/+20
| | | | Issue: #20286
* Genex: add_custom_command: DEPFILE supports genexMarc Chevrier2021-04-121-1/+6
| | | | | | This facility is very useful for 'Ninja Multi-Config' and required as well for future support of DEPFILE in 'Xcode' and 'Visual Studio' generators (#20286).
* Help: Custom OUTPUT and BYPRODUCTS genexes cannot refer to targetsCraig Scott2021-03-251-2/+6
| | | Relates: #21364
* Help: Convert some genex names to explicit cross-referencesBrad King2021-02-051-2/+2
| | | | | | | | | Since commit c2dc7e0f53 (Help: Convert genex documentation to sphinx domain objects, 2021-01-15) we can use `:genex:` cross-references to link to named generator expressions. Update some places to do this. This is meant to demonstrate the capability, not as a comprehensive sweep.
* Makefiles: Add support of DEPFILE for add_custom_commandMarc Chevrier2020-12-231-3/+18
| | | | | Issue: #20286 Fixes: #21415
* Ninja Multi-Config: Add support for cross-config custom commandsKyle Edwards2020-12-151-0/+9
| | | | Co-Author: Brad King <brad.king@kitware.com>
* Help: Clarify version adding add_custom_{command,target} OUTPUT genex supportBrad King2020-12-151-32/+36
| | | | | | | Update the documentation added by commit c257c25419 (add_custom_{command,target}: Add genex support to OUTPUT and BYPRODUCTS, 2020-10-19) to use sphinx markup instead of prose to specify the version in which the feature was added.
* add_custom_{command,target}: Add genex support to OUTPUT and BYPRODUCTSBrad King2020-12-111-0/+48
| | | | | | | | | Move rejection of `#`, `<`, and `>` characters in outputs and byproducts to a generate-time check. This removes the front-end check that disallowed generator expressions. The generators have already been updated to handle them. Fixes: #12877
* Help: Add examples to add_custom_command reference documentationBrad King2020-12-101-0/+38
|
* Help: Add `.. versionadded` directives to commands documentationNikita Nemkin2020-11-091-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change ony concerns directives that appear in the document body. The guidelines for inserting version directives: * Baseline version is CMake 3.0, i.e. directives start at 3.1. * Always use `.. versionadded::` directive, avoid ad-hoc version references. Exception: policy pages. * For new command signatures, put `versionadded` on a separate line after the signature. * For a group of new signatures in a new document section, a single version note at the beginning of the section is sufficient. * For new options, put `versionadded` on a separate line before option description. * If all the option descriptions in the list are short one-liners, it's fine to put `versionadded` on the same line as the description. * If multiple option descriptions in close proximity would have the same ..versionadded directive, consider adding a single directive after the list, mentioning all added options. * For compact value lists and sub-option lists, put a single `versionadded` directive after the list mentioning all additions. * When a change is described in a single paragraph, put `versionadded` into that paragraph. * When only part of the paragraph has changed, separate the changed part if it doesn't break the flow. Otherwise, write a follow-up clarification paragraph and apply version directive to that. * When multiple version directives are close by, order earlier additions before later additions. * Indent related lists and code blocks to include them in the scope of `versionadded` directive. Issue: #19715
* Ninja: Transform DEPFILEs with policy CMP0116Kyle Edwards2020-10-131-0/+5
| | | | Fixes: #21267
* GenEx: Remove unneeded dependencies from target info queriesRobert Maynard2020-09-011-7/+16
| | | | | | | | | | Only generate a graph dependency between a custom command and a target when the custom command queries for the file path of an artifact of the target. This makes generator expressions such as `TARGET_FILE_DIR` behave the same way as `TARGET_PROPERTY` which never generated a graph dependency.
* Help: Expand discussion of GENERATED / BYPRODUCTSFeRD (Frank Dana)2020-03-121-0/+3
| | | | | | | | - Mention the Makefile Generators' `make clean` removal in the BYPRODUCTS section of add_custom_command and add_custom_target - Expand the GENERATED property docs' description of which files will be marked with the property, and of what it implies (including `make clean` removal)
* Help: Clarify add_custom_command DEPENDS conversion to file pathsBrad King2020-03-061-14/+30
| | | | | | | | | | | | | | | In commit f5126badd8 (add_custom_command: convert DEPENDS path arguments to absolute paths, 2019-12-18, v3.17.0-rc1~263^2) we updated the documentation to describe the behavior introduced by that commit. However, the behavior was removed again by commit fd0ba705ce (add_custom_command: check if a relative path should be an in-source path, 2020-01-09, v3.17.0-rc1~141^2~4) without updating the documentation. Update the documentation again to describe the behavior as of the latter commit. Spell out the steps that `cmLocalGenerator::GetRealDependency` and `cmTargetTraceDependencies::IsUtility` use to add file-level and target-level dependencies.
* add_custom_command: convert DEPENDS path arguments to absolute pathsBen Boeckel2019-12-181-3/+5
| | | | | | | This is only done if they are "obviously" paths in that they contain a directory separator. Fixes: #17111
* Help: Both add_custom_command signatures support COMMAND_EXPAND_LISTSMarc Aldorasi2019-11-111-1/+2
|
* Help: Clarify how target names are handled in custom commands/targetsCraig Scott2019-10-051-16/+24
| | | Fixes: #19771
* Depend: Hook up automatic target-level dependencies via byproductsDaniel Eiband2019-09-121-3/+3
| | | | | | | | Target-level dependencies to utility targets are added from another target if the other target requires a byproduct of the utility target or if it requires a byproduct of PRE_BUILD, PRE_LINK, or POST_BUILD build events of a target. Issue: #19005
* Support job pools in custom commands and targetsRosen Matev2019-05-141-0/+8
| | | | | | | | | | Provide a way for custom commands and targets to set the pool variable of the ninja build statement. Setting `JOB_POOL` is not compatible with `USES_TERMINAL`, which implies the `console` pool. The option is silently ignored with other generators. Closes: #18483
* Help: Apply syntax highlighting to project commandsJoachim Wuttke (o)2018-10-251-2/+4
| | | | | | * Replace most "::" by ".. code-block:: cmake" * Header sentence in imperative voice, detailed command description in present tense.
* add_custom_{command,target}: WORKING_DIRECTORY generator expressionsJon Chronopoulos2018-09-281-0/+3
| | | | | | | This teaches add_custom_command and add_custom_target WORKING_DIRECTORY about generator expressions Fixes: #14089