Call project() with parsed version string
Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
This commit is contained in:
parent
58d0e28333
commit
7d38176bdb
@ -1,26 +1,23 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
|
||||||
INCLUDE(GNUInstallDirs)
|
INCLUDE(GNUInstallDirs)
|
||||||
PROJECT(redisearch)
|
|
||||||
|
|
||||||
SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples")
|
|
||||||
|
|
||||||
# Get the version numbers
|
|
||||||
MACRO(getVersionBit name)
|
MACRO(getVersionBit name)
|
||||||
|
SET(VERSION_REGEX "^#define ${name} (.+)$")
|
||||||
EXECUTE_PROCESS(
|
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/hiredis.h"
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
VERSION_BIT REGEX ${VERSION_REGEX})
|
||||||
COMMAND grep "${name}" hiredis.h COMMAND awk "{print $3}"
|
STRING(REGEX REPLACE ${VERSION_REGEX} "\\1" ${name} "${VERSION_BIT}")
|
||||||
OUTPUT_VARIABLE "${name}"
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
ENDMACRO(getVersionBit)
|
ENDMACRO(getVersionBit)
|
||||||
|
|
||||||
getVersionBit(HIREDIS_MAJOR)
|
getVersionBit(HIREDIS_MAJOR)
|
||||||
getVersionBit(HIREDIS_MINOR)
|
getVersionBit(HIREDIS_MINOR)
|
||||||
getVersionBit(HIREDIS_PATCH)
|
getVersionBit(HIREDIS_PATCH)
|
||||||
|
|
||||||
SET(VERSION "${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}")
|
SET(VERSION "${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}")
|
||||||
MESSAGE("Detected version: ${VERSION}")
|
MESSAGE("Detected version: ${VERSION}")
|
||||||
|
|
||||||
|
PROJECT(hiredis VERSION "${VERSION}")
|
||||||
|
|
||||||
|
SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples")
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
ADD_LIBRARY(hiredis SHARED
|
ADD_LIBRARY(hiredis SHARED
|
||||||
|
@ -6,6 +6,6 @@ pkgincludedir=${includedir}/hiredis
|
|||||||
|
|
||||||
Name: hiredis
|
Name: hiredis
|
||||||
Description: Minimalistic C client library for Redis.
|
Description: Minimalistic C client library for Redis.
|
||||||
Version: @VERSION@
|
Version: @PROJECT_VERSION@
|
||||||
Libs: -L${libdir} -lhiredis
|
Libs: -L${libdir} -lhiredis
|
||||||
Cflags: -I${pkgincludedir} -D_FILE_OFFSET_BITS=64
|
Cflags: -I${pkgincludedir} -D_FILE_OFFSET_BITS=64
|
||||||
|
Loading…
Reference in New Issue
Block a user