Skip to content

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

Open
muggenhor wants to merge 1 commit intoclementine-player:masterfrom
muggenhor:build/fix-git-check
Open

build: remove bad double negative when discovering 'git'#7342
muggenhor wants to merge 1 commit intoclementine-player:masterfrom
muggenhor:build/fix-git-check

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 hatstand force-pushed the build/fix-git-check branch from 4c79885 to 7d09106 Compare October 14, 2024 12:25
@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