mirror of
https://github.com/neovim/neovim.git
synced 2025-11-04 09:44:31 +00:00
cmake: msgpack: Add more thorough version check
In 33bc332, version constraints were added to pkg_search_module(), but
that only affects the set of directories searched by
find_library()/find_path().
Once the header directory is found, parse the version from
version_master.h so it can be checked by the find_package() call in the
root CMakeLists.txt.
This commit is contained in:
@@ -279,7 +279,7 @@ include(CheckLibraryExists)
|
|||||||
find_package(LibUV REQUIRED)
|
find_package(LibUV REQUIRED)
|
||||||
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
|
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
|
||||||
|
|
||||||
find_package(Msgpack REQUIRED)
|
find_package(Msgpack 1.0.0 REQUIRED)
|
||||||
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
|
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
|
||||||
|
|
||||||
find_package(LuaJit REQUIRED)
|
find_package(LuaJit REQUIRED)
|
||||||
|
|||||||
@@ -19,10 +19,20 @@ endif()
|
|||||||
|
|
||||||
set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER})
|
set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER})
|
||||||
|
|
||||||
find_path(MSGPACK_INCLUDE_DIR msgpack.h
|
find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h
|
||||||
HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}
|
HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}
|
||||||
${LIMIT_SEARCH})
|
${LIMIT_SEARCH})
|
||||||
|
|
||||||
|
if(MSGPACK_INCLUDE_DIR)
|
||||||
|
file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h)
|
||||||
|
string(REGEX REPLACE ".*MSGPACK_VERSION_MAJOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MAJOR "${msgpack_version_h}")
|
||||||
|
string(REGEX REPLACE ".*MSGPACK_VERSION_MINOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MINOR "${msgpack_version_h}")
|
||||||
|
string(REGEX REPLACE ".*MSGPACK_VERSION_REVISION +([0-9]+).*" "\\1" MSGPACK_VERSION_REVISION "${msgpack_version_h}")
|
||||||
|
set(MSGPACK_VERSION_STRING "${MSGPACK_VERSION_MAJOR}.${MSGPACK_VERSION_MINOR}.${MSGPACK_VERSION_REVISION}")
|
||||||
|
else()
|
||||||
|
set(MSGPACK_VERSION_STRING)
|
||||||
|
endif()
|
||||||
|
|
||||||
# If we're asked to use static linkage, add libmsgpack{,c}.a as a preferred library name.
|
# If we're asked to use static linkage, add libmsgpack{,c}.a as a preferred library name.
|
||||||
if(MSGPACK_USE_STATIC)
|
if(MSGPACK_USE_STATIC)
|
||||||
list(APPEND MSGPACK_NAMES
|
list(APPEND MSGPACK_NAMES
|
||||||
@@ -44,6 +54,7 @@ set(MSGPACK_INCLUDE_DIRS ${MSGPACK_INCLUDE_DIR})
|
|||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
# handle the QUIETLY and REQUIRED arguments and set MSGPACK_FOUND to TRUE
|
# handle the QUIETLY and REQUIRED arguments and set MSGPACK_FOUND to TRUE
|
||||||
# if all listed variables are TRUE
|
# if all listed variables are TRUE
|
||||||
find_package_handle_standard_args(Msgpack DEFAULT_MSG
|
find_package_handle_standard_args(Msgpack
|
||||||
MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR)
|
REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR
|
||||||
|
VERSION_VAR MSGPACK_VERSION_STRING)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user