更新时间:2023-01-27 23:36:50
或者,您可以使用 WORKING_DIRECTORY
参数从cmake中将 execute_process()
用作参数。这就是我的工作:
Or you can use the WORKING_DIRECTORY
-argument to execute_process()
from cmake. This is what I do:
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
$ b
然后在 $ {out}
中找到版本。