[Kst] branches/work/kst/portto4/kst/cmake/modules

Peter Kümmel syntheticpp at gmx.net
Tue Jan 11 21:01:41 CET 2011


SVN commit 1213840 by kuemmel:

cmakes regex has problems with multiple lines

 M  +14 -2     SubversionGenerator.cmake  


--- branches/work/kst/portto4/kst/cmake/modules/SubversionGenerator.cmake #1213839:1213840
@@ -13,8 +13,20 @@
 		ERROR_VARIABLE Subversion_src_info_error
 		RESULT_VARIABLE Subversion_src_info_result
 		OUTPUT_STRIP_TRAILING_WHITESPACE)
-	string(REGEX REPLACE "^(.*\n)?M ([^\n]+).*" "\\2" _modified "${src_WC_STATUS}")
-	message(STATUS "_modified  : ${_modified}")
+
+	# problems with multiple lines,
+	# http://www.mail-archive.com/cmake@cmake.org/msg07254.html
+	string(REGEX REPLACE "\r?\n" ";" lines "${src_WC_STATUS}")
+
+	set(_modified)
+	foreach(line ${lines})
+		string(REGEX MATCH "^(.*\n)?M ([^\n]+).*" _found "${line}")
+		if(_found)
+			message(STATUS "Modified file: ${_found}")
+			set(_modified ${_modified} _found)
+		endif()
+	endforeach()
+
 	if(_modified)
 		set(_revision "${_revision}${modified_str}")
 	endif()


More information about the Kst mailing list