Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Unwind version parser #598

Closed
smartnet-club opened this issue Dec 5, 2020 · 1 comment · Fixed by #609
Closed

Incorrect Unwind version parser #598

smartnet-club opened this issue Dec 5, 2020 · 1 comment · Fixed by #609
Labels
Milestone

Comments

@smartnet-club
Copy link

cat /usr/include/libunwind-common.h

#define UNW_VERSION_MAJOR	1
#define UNW_VERSION_MINOR	1
#define UNW_VERSION_EXTRA	

Parser:
string (REGEX REPLACE ".*#define UNW_VERSION_EXTRA[ \t]+([0-9]+).*" "\\1" Unwind_VERSION_PATCH "${_Unwind_VERSION_CONTENTS}")

cat glog-config.cmake

if (CMAKE_VERSION VERSION_LESS 3.9)
  message (FATAL_ERROR "CMake >= 3.9 required")
endif (CMAKE_VERSION VERSION_LESS 3.9)


####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was glog-config.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

####################################################################################

include (CMakeFindDependencyMacro)
include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake)

find_dependency (gflags 2.2.2 NO_MODULE)
find_dependency (Unwind 1.1./* libunwind - a platform-independent unwind library
   Copyright (C) 2001-2004 Hewlett-Packard Co
	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>

This file is part of libunwind.
...
@smartnet-club
Copy link
Author

Fix:

if(CMAKE_MATCH_1)
    set (Unwind_VERSION
            ${Unwind_VERSION_MAJOR}.${Unwind_VERSION_MINOR}.${Unwind_VERSION_PATCH})
    set (Unwind_VERSION_COMPONENTS 3)
else()
    set (Unwind_VERSION
            ${Unwind_VERSION_MAJOR}.${Unwind_VERSION_MINOR})
    set (Unwind_VERSION_COMPONENTS 2)
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants