Skip to content

Commit 9dcffda

Browse files
Fix cmake execute_process working directory (yhirose#622)
Correct the working directory of the execute_process call, to get the version from git tags. The working directory should be the the directory of this libary. Otherwise, if you include httplib as a git submodule and call add_subdirectory, the execute_process command will be run in a wrong directory leading to error.
1 parent e590363 commit 9dcffda

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
@@ -66,6 +66,7 @@ if(Git_FOUND)
6666
# Gets the latest tag as a string like "v0.6.6"
6767
# Can silently fail if git isn't on the system
6868
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
69+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
6970
OUTPUT_VARIABLE _raw_version_string
7071
ERROR_VARIABLE _git_tag_error
7172
)

0 commit comments

Comments
 (0)