Skip to content
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

find_program: add a kwarg to skip searching the source dir #14119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pks-t
Copy link
Contributor

@pks-t pks-t commented Jan 11, 2025

Unless search directories or overrides are provided, find_program() will by first search for an executable name in the source directory before trying to look it up via the PATH environment variable. This can create issues in some projects where the executable exists in the source directory, but when the actual program should be looked up via PATH.

While the obvious answer is to move out the given executable from the source directory it's not always feasible. Git for example supports being built with both Makefiles and Meson. In the former case, the resulting git executable will be put into the root level source directory. So if one then sets up Meson, we would find that binary instead of the system-provided binary.

Add a new "skip_source_dir" kwarg to find_program() that allows the user to skip looking up programs via the source directory.

@pks-t pks-t requested a review from jpakkane as a code owner January 11, 2025 10:56
@pks-t pks-t force-pushed the pks-find-program-skip-source-dir branch from 4d70212 to 228a270 Compare January 11, 2025 10:59
Unless search directories or overrides are provided, `find_program()`
will by first search for an executable name in the source directory
before trying to look it up via the `PATH` environment variable. This
can create issues in some projects where the executable exists in the
source directory, but when the actual program should be looked up via
PATH.

While the obvious answer is to move out the given executable from the
source directory it's not always feasible. Git for example supports
being built with both Makefiles and Meson. In the former case, the
resulting `git` executable will be put into the root level source
directory. So if one then sets up Meson, we would find that binary
instead of the system-provided binary.

Add a new "skip_source_dir" kwarg to `find_program()` that allows the
user to skip looking up programs via the source directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
@pks-t pks-t force-pushed the pks-find-program-skip-source-dir branch from 228a270 to f33120e Compare January 11, 2025 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant