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
bbad21f5
Commit
bbad21f5
authored
Oct 01, 2018
by
Mark Nunberg
Browse files
Add examples to CMakeLists
parent
ead586a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
bbad21f5
...
...
@@ -18,6 +18,8 @@ getVersionBit(HIREDIS_PATCH)
MESSAGE
(
"Detected version:
${
HIREDIS_MAJOR
}
.
${
HIREDIS_MINOR
}
.
${
HIREDIS_PATCH
}
"
)
INCLUDE_DIRECTORIES
(
${
PROJECT_SOURCE_DIR
}
)
ADD_LIBRARY
(
hiredis SHARED
async.c
dict.c
...
...
@@ -44,4 +46,5 @@ ADD_EXECUTABLE(hiredis-test
TARGET_LINK_LIBRARIES
(
hiredis-test hiredis
)
# Add examples
ADD_SUBDIRECTORY
(
examples
)
examples/CMakeLists.txt
0 → 100644
View file @
bbad21f5
INCLUDE
(
FindPkgConfig
)
# Check for GLib
PKG_CHECK_MODULES
(
GLIB2 glib-2.0
)
if
(
GLIB2_FOUND
)
INCLUDE_DIRECTORIES
(
${
GLIB2_INCLUDE_DIRS
}
)
LINK_DIRECTORIES
(
${
GLIB2_LIBRARY_DIRS
}
)
ADD_EXECUTABLE
(
example-glib example-glib.c
)
TARGET_LINK_LIBRARIES
(
example-glib hiredis
${
GLIB2_LIBRARIES
}
)
ENDIF
(
GLIB2_FOUND
)
FIND_PATH
(
LIBEV ev.h
HINTS /usr/local /usr/opt/local
ENV LIBEV_INCLUDE_DIR
)
if
(
LIBEV
)
# Just compile and link with libev
ADD_EXECUTABLE
(
example-libev example-libev.c
)
TARGET_LINK_LIBRARIES
(
example-libev hiredis ev
)
ENDIF
()
FIND_PATH
(
LIBEVENT event.h
)
if
(
LIBEVENT
)
ADD_EXECUTABLE
(
example-libevent example-libevent
)
TARGET_LINK_LIBRARIES
(
example-libevent hiredis event
)
ENDIF
()
FIND_PATH
(
LIBUV uv.h
)
IF
(
LIBUV
)
ADD_EXECUTABLE
(
example-libuv example-libuv.c
)
TARGET_LINK_LIBRARIES
(
example-libuv hiredis uv
)
ENDIF
()
IF
(
APPLE
)
FIND_LIBRARY
(
CF CoreFoundation
)
ADD_EXECUTABLE
(
example-macosx example-macosx.c
)
TARGET_LINK_LIBRARIES
(
example-macosx hiredis
${
CF
}
)
ENDIF
()
ADD_EXECUTABLE
(
example example.c
)
TARGET_LINK_LIBRARIES
(
example hiredis
)
\ No newline at end of file
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