diff --git a/src/c++/perf_analyzer/CMakeLists.txt b/src/c++/perf_analyzer/CMakeLists.txt index a6ae75cda..bebdba4d5 100644 --- a/src/c++/perf_analyzer/CMakeLists.txt +++ b/src/c++/perf_analyzer/CMakeLists.txt @@ -35,11 +35,10 @@ add_subdirectory(client_backend) find_package(Git REQUIRED) -execute_process(COMMAND - "${GIT_EXECUTABLE}" log -n 1 --abbrev-commit --format=format:%h +execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND "${GIT_EXECUTABLE}" log -n 1 --abbrev-commit --format=format:%h RESULT_VARIABLE RETURN_CODE OUTPUT_VARIABLE GIT_SHA) - if(NOT RETURN_CODE EQUAL "0") set(GIT_SHA "unknown") endif()