cmake execute_process() always fails with “No such file or directory” when I call git

You have to pass the arguments as a second option like this:

cmake_minimum_required (VERSION 2.8)

set (git_cmd "git")
set (git_arg "--version")
message(STATUS "git cmd: ${git_cmd}")
execute_process(COMMAND ${git_cmd} ${git_arg}
  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  RESULT_VARIABLE git_result
  OUTPUT_VARIABLE git_ver)

message(STATUS "git ver[${git_result}]: ${git_ver}")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)