From 39da5bcbcfae5ea256e3b1db1d6f02290ca812ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Wed, 25 Mar 2020 07:12:48 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@978 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- cmake/FindPIP.cmake | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cmake/FindPIP.cmake b/cmake/FindPIP.cmake index 89ea09bf..b1bfe07f 100644 --- a/cmake/FindPIP.cmake +++ b/cmake/FindPIP.cmake @@ -66,15 +66,21 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") endif() if(NOT PIP_VERSION) - file(STRINGS "${PIP_INCLUDES}/pip_version_str.h" _VERSION REGEX "\".*\"") - string(REGEX MATCH "\".*\"" _VERSION ${_VERSION}) - string(LENGTH ${_VERSION} SL) - math(EXPR SL ${SL}-2) - string(SUBSTRING ${_VERSION} 1 ${SL} _VERSION) - set(PIP_VERSION ${_VERSION} CACHE STRING "VERSION") - if (NOT _PIP_MSG) - set(_PIP_MSG 1 CACHE BOOL "msg_pip" FORCE) - message(STATUS "Found PIP version ${PIP_VERSION} (${PIP_LIBRARY})") + include(CheckSymbolExists) + check_symbol_exists(PIP_VERSION_NAME "${PIP_INCLUDES}/piversion.h" HAVE_PIP_VERSION) + if (HAVE_PIP_VERSION) + file(STRINGS "${PIP_INCLUDES}/piversion.h" _VERSION REGEX "^[ \t]*#define[ \t]+PIP_VERSION_NAME+[ \t]+.*$") + string(REGEX MATCH "\".*\"" _VERSION ${_VERSION}) + string(LENGTH ${_VERSION} SL) + math(EXPR SL ${SL}-2) + string(SUBSTRING ${_VERSION} 1 ${SL} _VERSION) + set(PIP_VERSION ${_VERSION} CACHE STRING "VERSION") + if (NOT _PIP_MSG) + set(_PIP_MSG 1 CACHE BOOL "msg_pip" FORCE) + message(STATUS "Found PIP version ${PIP_VERSION} (${PIP_LIBRARY})") + endif() + else() + message(FATAL_ERROR "PIP not found") endif() endif() if(PIP_FIND_VERSION VERSION_GREATER PIP_VERSION)