Skip to content

chore: Simplify add_custom_(command|target) by removing obsolete syntax #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented May 30, 2025

Following the CMake minimum required version update from 3.15.6 to 3.20.6, add_custom_command and add_custom_target now automatically prepend the emulator (from the CROSSCOMPILING_EMULATOR property) to the target executable path when cross-compiling.

This eliminates the need for manual command construction previously required to handle emulated targets.

Note

When the COMMAND argument uses constructs like ${CMAKE_COMMAND} -E env (e.g. in generate_pegen_metaparser and generate_pegen_parse in the top-level CMakeLists.txt), the paths to CMAKE_CROSSCOMPILING_EMULATOR and target executable must be explicitly specified.


Working toward addressing:

…ntax

Following the CMake minimum required version update from 3.15.6 to 3.20.6,
`add_custom_command` and `add_custom_target` now automatically prepend the
emulator (from the `CROSSCOMPILING_EMULATOR` property) to the target executable
path when cross-compiling.

This eliminates the need for manual command construction previously required to handle emulated targets.

Note: When the `COMMAND` argument uses constructs like `${CMAKE_COMMAND} -E env`
(e.g. in `generate_pegen_metaparser` and `generate_pegen_parse` in the top-level
`CMakeLists.txt`), the paths to `CMAKE_CROSSCOMPILING_EMULATOR` and target executable
must be explicitly specified.
@jcfr jcfr enabled auto-merge (rebase) May 30, 2025 20:02
@jcfr jcfr merged commit 90caba4 into python-cmake-buildsystem:master May 30, 2025
24 checks passed
@jcfr jcfr deleted the simplify-custom-commands branch May 30, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant