From 0c61c54b73971efd0d9f3e61052193c5b19a2774 Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Tue, 15 Dec 2015 15:18:35 +0100 Subject: [PATCH] only strip string if not empty --- modules/git_info/git_info_sub.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/git_info/git_info_sub.cmake b/modules/git_info/git_info_sub.cmake index 7b55f17..acbacaa 100644 --- a/modules/git_info/git_info_sub.cmake +++ b/modules/git_info/git_info_sub.cmake @@ -42,7 +42,10 @@ if(GIT_FOUND) OUTPUT_VARIABLE _git_branch ERROR_QUIET ) - string(STRIP ${_git_branch} _git_branch) + + if(_git_branch) + string(STRIP ${_git_branch} _git_branch) + endif() endif() # CMAKE_CURRENT_LIST_DIR is undefined in CMake 2.8.2