Skip to content

Commit 950f21d

Browse files
committed
cmake: fix missing working directory for version header generation
By default `add_custom_command` runs in the current build directory. This resolves "Commit UNKNOWN" in the generated version header when the build directory is not a subdirectory of the git working tree.
1 parent 57c9d2b commit 950f21d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ add_custom_command(
134134
-D "GIT_FOUND=${GIT_FOUND}"
135135
-D "GIT_EXECUTABLE=${GIT_EXECUTABLE}"
136136
-P "${CMAKE_CURRENT_LIST_DIR}/cmake/scripts/version.cmake"
137+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
137138
)
138139

139140
add_library(acl_objs OBJECT

0 commit comments

Comments
 (0)