File: DetectGitBranch.cmake

package info (click to toggle)
edb-debugger 1.3.0-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,124 kB
  • sloc: cpp: 46,241; xml: 4,998; ansic: 3,088; sh: 52; asm: 33; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 341 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

function(git_get_branch RESULT)

	if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
		execute_process(
			COMMAND git rev-parse HEAD
			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
			OUTPUT_VARIABLE OUTPUT
			OUTPUT_STRIP_TRAILING_WHITESPACE
		)
		set(${RESULT} ${OUTPUT} PARENT_SCOPE)
	else()
		set(${RESULT} "Unknown" PARENT_SCOPE)
	endif()

endfunction()