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

build: remove bad double negative when discovering 'git' #7342

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

Conversation

muggenhor
Copy link

This automatically works because CMake's if statement considers variables which' content ends with "-NOTFOUND" to be FALSE.

The previous version however was first tried as a variable which didn't exist. As a result after that it's interpreted as a string (not a variable anymore). So it skips the "-NOTFOUND" check and only does a "string not empty" check. Which, as this is a string constant, is always true.

Of course this only fixes the check. It doesn't address the fact that the remaining code below depends on GIT_REV having some content. So maybe instead find_program should be called with the REQUIRED flag?

@hatstand
Copy link
Contributor

Of course this only fixes the check. It doesn't address the fact that the remaining code below depends on GIT_REV having some content. So maybe instead find_program should be called with the REQUIRED flag?

git isn't intended to be required here, so that builds from source tars work without it.

This automatically works because CMake's `if` statement considers
variables which' content ends with "-NOTFOUND" to be FALSE.

The previous version however was first tried as a variable which didn't
exist. As a result after that it's interpreted as a string (not a
variable anymore). So it skips the "-NOTFOUND" check and only does a
"string not empty" check. Which, as this is a string constant, is always
true.
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.

2 participants