Skip to content

Commit ca7d0ef

Browse files
committed
More parsing goodies?
1 parent c294a1c commit ca7d0ef

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cmake/calc_version.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ if(NOT PROJECT_VERSION_RESULT EQUAL 0)
1717
endif()
1818

1919
# Strip CMake's status prefix and surrounding whitespace
20-
string(REGEX REPLACE "^--[ \t]*" "" PROJECT_VERSION "${PROJECT_VERSION}")
20+
# Drop any CMake status lines like "-- Found Git: ..."
21+
string(REGEX REPLACE "(^|\n)--[^\n]*" "" PROJECT_VERSION "${PROJECT_VERSION}")
22+
# Trim whitespace
2123
string(REGEX REPLACE "^[[:space:]]+|[[:space:]]+$" "" PROJECT_VERSION "${PROJECT_VERSION}")
2224

2325
if(PROJECT_VERSION STREQUAL "")

0 commit comments

Comments
 (0)