|  |  | @ -18,6 +18,12 @@ | 
			
		
	
		
			
				
					|  |  |  | # and adjusting the output so that it tests false if there was no exact | 
			
		
	
		
			
				
					|  |  |  | # matching tag. | 
			
		
	
		
			
				
					|  |  |  | # | 
			
		
	
		
			
				
					|  |  |  | #  git_local_changes(<var>) | 
			
		
	
		
			
				
					|  |  |  | # | 
			
		
	
		
			
				
					|  |  |  | # Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. | 
			
		
	
		
			
				
					|  |  |  | # Uses the return code of "git diff-index --quiet HEAD --". | 
			
		
	
		
			
				
					|  |  |  | # Does not regard untracked files. | 
			
		
	
		
			
				
					|  |  |  | # | 
			
		
	
		
			
				
					|  |  |  | # Requires CMake 2.6 or newer (uses the 'function' command) | 
			
		
	
		
			
				
					|  |  |  | # | 
			
		
	
		
			
				
					|  |  |  | # Original Author: | 
			
		
	
	
		
			
				
					|  |  | @ -37,10 +43,10 @@ set(__get_git_revision_description YES) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | # We must run the following at "include" time, not at function call time, | 
			
		
	
		
			
				
					|  |  |  | # to find the path to this module rather than the path to a calling list file | 
			
		
	
		
			
				
					|  |  |  | get_filename_component(_gitdescmoddir GetGitRevisionDescription.cmake PATH) | 
			
		
	
		
			
				
					|  |  |  | get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | function(get_git_head_revision _refspecvar _hashvar) | 
			
		
	
		
			
				
					|  |  |  | 	set(GIT_PARENT_DIR ${PROJECT_SOURCE_DIR}) | 
			
		
	
		
			
				
					|  |  |  | 	set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") | 
			
		
	
		
			
				
					|  |  |  | 	set(GIT_DIR "${GIT_PARENT_DIR}/.git") | 
			
		
	
		
			
				
					|  |  |  | 	while(NOT EXISTS "${GIT_DIR}")	# .git dir not found, search parent directories | 
			
		
	
		
			
				
					|  |  |  | 		set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") | 
			
		
	
	
		
			
				
					|  |  | @ -71,7 +77,7 @@ function(get_git_head_revision _refspecvar _hashvar) | 
			
		
	
		
			
				
					|  |  |  | 	set(HEAD_FILE "${GIT_DATA}/HEAD") | 
			
		
	
		
			
				
					|  |  |  | 	configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	configure_file("${PROJECT_SOURCE_DIR}/resources/cmake/macros/GetGitRevisionDescription.cmake.in" | 
			
		
	
		
			
				
					|  |  |  | 	configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" | 
			
		
	
		
			
				
					|  |  |  | 		"${GIT_DATA}/grabRef.cmake" | 
			
		
	
		
			
				
					|  |  |  | 		@ONLY) | 
			
		
	
		
			
				
					|  |  |  | 	include("${GIT_DATA}/grabRef.cmake") | 
			
		
	
	
		
			
				
					|  |  | @ -110,7 +116,7 @@ function(git_describe _var) | 
			
		
	
		
			
				
					|  |  |  | 		${hash} | 
			
		
	
		
			
				
					|  |  |  | 		${ARGN} | 
			
		
	
		
			
				
					|  |  |  | 		WORKING_DIRECTORY | 
			
		
	
		
			
				
					|  |  |  | 		"${CMAKE_SOURCE_DIR}" | 
			
		
	
		
			
				
					|  |  |  | 		"${CMAKE_CURRENT_SOURCE_DIR}" | 
			
		
	
		
			
				
					|  |  |  | 		RESULT_VARIABLE | 
			
		
	
		
			
				
					|  |  |  | 		res | 
			
		
	
		
			
				
					|  |  |  | 		OUTPUT_VARIABLE | 
			
		
	
	
		
			
				
					|  |  | @ -124,7 +130,12 @@ function(git_describe _var) | 
			
		
	
		
			
				
					|  |  |  | 	set(${_var} "${out}" PARENT_SCOPE) | 
			
		
	
		
			
				
					|  |  |  | endfunction() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | function(git_describe_checkout _var) | 
			
		
	
		
			
				
					|  |  |  | function(git_get_exact_tag _var) | 
			
		
	
		
			
				
					|  |  |  | 	git_describe(out --exact-match ${ARGN}) | 
			
		
	
		
			
				
					|  |  |  | 	set(${_var} "${out}" PARENT_SCOPE) | 
			
		
	
		
			
				
					|  |  |  | endfunction() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | function(git_local_changes _var) | 
			
		
	
		
			
				
					|  |  |  | 	if(NOT GIT_FOUND) | 
			
		
	
		
			
				
					|  |  |  | 		find_package(Git QUIET) | 
			
		
	
		
			
				
					|  |  |  | 	endif() | 
			
		
	
	
		
			
				
					|  |  | @ -138,39 +149,20 @@ function(git_describe_checkout _var) | 
			
		
	
		
			
				
					|  |  |  | 		return() | 
			
		
	
		
			
				
					|  |  |  | 	endif() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	# TODO sanitize | 
			
		
	
		
			
				
					|  |  |  | 	#if((${ARGN}" MATCHES "&&") OR | 
			
		
	
		
			
				
					|  |  |  | 	#	(ARGN MATCHES "||") OR | 
			
		
	
		
			
				
					|  |  |  | 	#	(ARGN MATCHES "\\;")) | 
			
		
	
		
			
				
					|  |  |  | 	#	message("Please report the following error to the project!") | 
			
		
	
		
			
				
					|  |  |  | 	#	message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") | 
			
		
	
		
			
				
					|  |  |  | 	#endif() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	#message(STATUS "Arguments to execute_process: ${ARGN}") | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	execute_process(COMMAND | 
			
		
	
		
			
				
					|  |  |  | 		"${GIT_EXECUTABLE}" | 
			
		
	
		
			
				
					|  |  |  | 		describe | 
			
		
	
		
			
				
					|  |  |  | 		--tags | 
			
		
	
		
			
				
					|  |  |  | 		--dirty=-dirty | 
			
		
	
		
			
				
					|  |  |  | 		--long | 
			
		
	
		
			
				
					|  |  |  | 		${ARGN} | 
			
		
	
		
			
				
					|  |  |  | 		diff-index --quiet HEAD -- | 
			
		
	
		
			
				
					|  |  |  | 		WORKING_DIRECTORY | 
			
		
	
		
			
				
					|  |  |  | 		"${CMAKE_SOURCE_DIR}" | 
			
		
	
		
			
				
					|  |  |  | 		"${CMAKE_CURRENT_SOURCE_DIR}" | 
			
		
	
		
			
				
					|  |  |  | 		RESULT_VARIABLE | 
			
		
	
		
			
				
					|  |  |  | 		res | 
			
		
	
		
			
				
					|  |  |  | 		OUTPUT_VARIABLE | 
			
		
	
		
			
				
					|  |  |  | 		out | 
			
		
	
		
			
				
					|  |  |  | 		ERROR_QUIET | 
			
		
	
		
			
				
					|  |  |  | 		OUTPUT_STRIP_TRAILING_WHITESPACE) | 
			
		
	
		
			
				
					|  |  |  | 	if(NOT res EQUAL 0) | 
			
		
	
		
			
				
					|  |  |  | 		set(out "${out}-${res}-NOTFOUND") | 
			
		
	
		
			
				
					|  |  |  | 	if(res EQUAL 0) | 
			
		
	
		
			
				
					|  |  |  | 		set(${_var} "CLEAN" PARENT_SCOPE) | 
			
		
	
		
			
				
					|  |  |  | 	else() | 
			
		
	
		
			
				
					|  |  |  | 		set(${_var} "DIRTY" PARENT_SCOPE) | 
			
		
	
		
			
				
					|  |  |  | 	endif() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	set(${_var} "${out}" PARENT_SCOPE) | 
			
		
	
		
			
				
					|  |  |  | endfunction() | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | function(git_get_exact_tag _var) | 
			
		
	
		
			
				
					|  |  |  | 	git_describe(out --exact-match ${ARGN}) | 
			
		
	
		
			
				
					|  |  |  | 	set(${_var} "${out}" PARENT_SCOPE) | 
			
		
	
		
			
				
					|  |  |  | endfunction() |