yuzu
yuzu copied to clipboard
cmake: fix git detection
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR, CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR to the current working directory.
So if doing an out-of-source build, the GetGitRevisionDescription
module will search the .git
directory inside the build/binary directory and will not find it (hence the *-NOTFOUND
value for some variables).
The other solution is to copy the .git
directory, before the compilation, inside the future build/binary directory. But including GenerateSCMRev
is more straight forward than passing every CMake variable to an external (CMake) script.