@@ -15,6 +15,13 @@ SET(VERSION "${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}")
1515MESSAGE ("Detected version: ${VERSION} " )
1616
1717PROJECT (hiredis LANGUAGES "C" VERSION "${VERSION} " )
18+
19+ #Built as a subproject or if it is the main project
20+ set (MAIN_PROJECT OFF )
21+ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR )
22+ set (MAIN_PROJECT ON )
23+ endif ()
24+
1825INCLUDE (GNUInstallDirs)
1926
2027OPTION (BUILD_SHARED_LIBS "Build shared libraries" ON )
@@ -71,31 +78,35 @@ TARGET_INCLUDE_DIRECTORIES(hiredis PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_I
7178
7279CONFIGURE_FILE (hiredis.pc.in hiredis.pc @ONLY)
7380
74- set (CPACK_PACKAGE_VENDOR "Redis" )
75- set (CPACK_PACKAGE_DESCRIPTION "\
76- Hiredis is a minimalistic C client library for the Redis database.
77-
78- It is minimalistic because it just adds minimal support for the protocol, \
79- but at the same time it uses a high level printf-alike API in order to make \
80- it much higher level than otherwise suggested by its minimal code base and the \
81- lack of explicit bindings for every Redis command.
82-
83- Apart from supporting sending commands and receiving replies, it comes with a \
84- reply parser that is decoupled from the I/O layer. It is a stream parser designed \
85- for easy reusability, which can for instance be used in higher level language bindings \
86- for efficient reply parsing.
87-
88- Hiredis only supports the binary-safe Redis protocol, so you can use it with any Redis \
89- version >= 1.2.0.
90-
91- The library comes with multiple APIs. There is the synchronous API, the asynchronous API \
92- and the reply parsing API." )
93- set (CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/redis/hiredis" )
94- set (CPACK_PACKAGE_CONTACT "michael dot grunder at gmail dot com" )
95- set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
96- set (CPACK_RPM_PACKAGE_AUTOREQPROV ON )
97-
98- include (CPack)
81+ if (MAIN_PROJECT)
82+ set (CPACK_PACKAGE_VENDOR "Redis" )
83+ set (CPACK_PACKAGE_DESCRIPTION "\
84+ Hiredis is a minimalistic C client library for the Redis database.
85+
86+ It is minimalistic because it just adds minimal support for the protocol, \
87+ but at the same time it uses a high level printf-alike API in order to make \
88+ it much higher level than otherwise suggested by its minimal code base and the \
89+ lack of explicit bindings for every Redis command.
90+
91+ Apart from supporting sending commands and receiving replies, it comes with a \
92+ reply parser that is decoupled from the I/O layer. It is a stream parser designed \
93+ for easy reusability, which can for instance be used in higher level language bindings \
94+ for efficient reply parsing.
95+
96+ Hiredis only supports the binary-safe Redis protocol, so you can use it with any Redis \
97+ version >= 1.2.0.
98+
99+ The library comes with multiple APIs. There is the synchronous API, the asynchronous API \
100+ and the reply parsing API." )
101+ set (CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/redis/hiredis" )
102+ set (CPACK_PACKAGE_CONTACT "michael dot grunder at gmail dot com" )
103+ set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
104+ set (CPACK_RPM_PACKAGE_AUTOREQPROV ON )
105+
106+ if (NOT CPack_CMake_INCLUDED)
107+ include (CPack)
108+ endif ()
109+ endif ()
99110
100111INSTALL (TARGETS hiredis
101112 EXPORT hiredis-targets
0 commit comments