Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
7d38176b
Commit
7d38176b
authored
Jan 21, 2019
by
Justin Brewer
Committed by
Mark Nunberg
Feb 20, 2019
Browse files
Call project() with parsed version string
Signed-off-by:
Justin Brewer
<
jzb0012@auburn.edu
>
parent
58d0e283
Changes
2
Show whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
7d38176b
CMAKE_MINIMUM_REQUIRED
(
VERSION 3.0.0
)
INCLUDE
(
GNUInstallDirs
)
PROJECT
(
redisearch
)
SET
(
ENABLE_EXAMPLES OFF CACHE BOOL
"Enable building hiredis examples"
)
# Get the version numbers
MACRO
(
getVersionBit name
)
EXECUTE_PROCESS
(
WORKING_DIRECTORY
"
${
CMAKE_SOURCE_DIR
}
"
COMMAND grep
"
${
name
}
"
hiredis.h COMMAND awk
"{print $3}"
OUTPUT_VARIABLE
"
${
name
}
"
OUTPUT_STRIP_TRAILING_WHITESPACE
)
SET
(
VERSION_REGEX
"^#define
${
name
}
(.+)$"
)
FILE
(
STRINGS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/hiredis.h"
VERSION_BIT REGEX
${
VERSION_REGEX
}
)
STRING
(
REGEX REPLACE
${
VERSION_REGEX
}
"
\\
1"
${
name
}
"
${
VERSION_BIT
}
"
)
ENDMACRO
(
getVersionBit
)
getVersionBit
(
HIREDIS_MAJOR
)
getVersionBit
(
HIREDIS_MINOR
)
getVersionBit
(
HIREDIS_PATCH
)
SET
(
VERSION
"
${
HIREDIS_MAJOR
}
.
${
HIREDIS_MINOR
}
.
${
HIREDIS_PATCH
}
"
)
MESSAGE
(
"Detected version:
${
VERSION
}
"
)
PROJECT
(
hiredis VERSION
"
${
VERSION
}
"
)
SET
(
ENABLE_EXAMPLES OFF CACHE BOOL
"Enable building hiredis examples"
)
INCLUDE_DIRECTORIES
(
${
PROJECT_SOURCE_DIR
}
)
ADD_LIBRARY
(
hiredis SHARED
...
...
hiredis.pc.in
View file @
7d38176b
...
...
@@ -6,6 +6,6 @@ pkgincludedir=${includedir}/hiredis
Name: hiredis
Description: Minimalistic C client library for Redis.
Version: @VERSION@
Version: @
PROJECT_
VERSION@
Libs: -L${libdir} -lhiredis
Cflags: -I${pkgincludedir} -D_FILE_OFFSET_BITS=64
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment