Skip to content

Commit

Permalink
build: remove bad double negative when discovering 'git'
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
muggenhor committed Oct 2, 2024
1 parent 9ef681b commit 4c79885
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ else(FORCE_GIT_REVISION)
find_program(GIT_EXECUTABLE git)
message(STATUS "Found git: ${GIT_EXECUTABLE}")

if(NOT GIT_EXECUTABLE-NOTFOUND)
if(GIT_EXECUTABLE)
execute_process(COMMAND ${GIT_EXECUTABLE} describe
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE GIT_INFO_RESULT
Expand Down

0 comments on commit 4c79885

Please sign in to comment.