diff options
author | m <m@bitsnbites.eu> | 2019-03-31 19:15:11 +0200 |
---|---|---|
committer | Marcus Geelnard <marcus.geelnard@smarteye.se> | 2019-04-01 11:54:37 +0200 |
commit | e38cd75562ddb3a20e5dff8969c96568a4fb1ea1 (patch) | |
tree | 3d963d9e7fddb9db41da1469b989471b2c54ac07 | |
parent | dc6d19b9ece7204609980272e4b158deff224a9a (diff) |
CMake: Minor modernization
Rely more on transitive dependencies, as provided by
TARGET_LINK_LIBRARIES. Avoid using ADD_DEFINITIONS and
INCLUDE_DIRECTORIES. This avoids leakage/pollution of defines and
includes.
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0616fa6..c8c8071 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,6 @@ PROJECT(hiredis VERSION "${VERSION}") SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples") -INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}) - ADD_LIBRARY(hiredis SHARED async.c dict.c @@ -40,6 +38,7 @@ SET_TARGET_PROPERTIES(hiredis IF(WIN32 OR MINGW) TARGET_LINK_LIBRARIES(hiredis PRIVATE ws2_32) ENDIF() +TARGET_INCLUDE_DIRECTORIES(hiredis PUBLIC .) CONFIGURE_FILE(hiredis.pc.in hiredis.pc @ONLY) @@ -59,9 +58,9 @@ IF(HIREDIS_SSL) ENDIF() ENDIF() FIND_PACKAGE(OpenSSL REQUIRED) - ADD_DEFINITIONS(-DHIREDIS_SSL) - INCLUDE_DIRECTORIES("${OPENSSL_INCLUDE_DIR}") - TARGET_LINK_LIBRARIES(hiredis ${OPENSSL_LIBRARIES}) + TARGET_COMPILE_DEFINITIONS(hiredis PRIVATE HIREDIS_SSL) + TARGET_INCLUDE_DIRECTORIES(hiredis PRIVATE "${OPENSSL_INCLUDE_DIR}") + TARGET_LINK_LIBRARIES(hiredis PRIVATE ${OPENSSL_LIBRARIES}) ENDIF() IF(NOT (WIN32 OR MINGW)) |