Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cmake/FindUnwind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (Unwind_LIBRARY)
set (_Unwind_VERSION_HEADER ${Unwind_INCLUDE_DIR}/libunwind-common.h)

if (EXISTS ${_Unwind_VERSION_HEADER})
FILE (READ ${_Unwind_VERSION_HEADER} _Unwind_VERSION_CONTENTS)
file (READ ${_Unwind_VERSION_HEADER} _Unwind_VERSION_CONTENTS)

string (REGEX REPLACE ".*#define UNW_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
Unwind_VERSION_MAJOR "${_Unwind_VERSION_CONTENTS}")
Expand All @@ -50,9 +50,15 @@ if (Unwind_LIBRARY)
string (REGEX REPLACE ".*#define UNW_VERSION_EXTRA[ \t]+([0-9]+).*" "\\1"
Unwind_VERSION_PATCH "${_Unwind_VERSION_CONTENTS}")

set (Unwind_VERSION
${Unwind_VERSION_MAJOR}.${Unwind_VERSION_MINOR}.${Unwind_VERSION_PATCH})
set (Unwind_VERSION_COMPONENTS 3)
set (Unwind_VERSION ${Unwind_VERSION_MAJOR}.${Unwind_VERSION_MINOR})

if (CMAKE_MATCH_1)
# Third version component may be empty
set (Unwind_VERSION ${Unwind_VERSION}.${Unwind_VERSION_PATCH})
set (Unwind_VERSION_COMPONENTS 3)
else (CMAKE_MATCH_1)
set (Unwind_VERSION_COMPONENTS 2)
endif (CMAKE_MATCH_1)
endif (EXISTS ${_Unwind_VERSION_HEADER})
endif (Unwind_LIBRARY)

Expand Down