diff --git a/.gitignore b/.gitignore index 056959ffe..cb48fdef4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ /*.pc *.dSYM tags +build + diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b2e89a7f..64d1a5683 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,6 +200,8 @@ IF(NOT DISABLE_TESTS) COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh) ENDIF() +ADD_SUBDIRECTORY(adapters) + # Add examples IF(ENABLE_EXAMPLES) ADD_SUBDIRECTORY(examples) diff --git a/adapters/CMakeLists.txt b/adapters/CMakeLists.txt new file mode 100644 index 000000000..e9207fe69 --- /dev/null +++ b/adapters/CMakeLists.txt @@ -0,0 +1,19 @@ +find_package(Qt5Core) +IF (Qt5Core_FOUND) + set(CMAKE_AUTOMOC ON) + ADD_LIBRARY(hiredis-qt-adapter SHARED qt.h) + TARGET_COMPILE_DEFINITIONS(hiredis-qt-adapter PRIVATE ${Qt5Core_DEFINITIONS}) + TARGET_INCLUDE_DIRECTORIES(hiredis-qt-adapter PRIVATE ${Qt5Core_INCLUDES}) + TARGET_LINK_LIBRARIES(hiredis-qt-adapter hiredis ${Qt5Core_LIBRARIES}) + + ADD_LIBRARY(hiredis-qt-adapter_static STATIC qt.h) + TARGET_COMPILE_DEFINITIONS(hiredis-qt-adapter_static PRIVATE ${Qt5Core_DEFINITIONS}) + TARGET_INCLUDE_DIRECTORIES(hiredis-qt-adapter_static PRIVATE ${Qt5Core_INCLUDES}) + TARGET_LINK_LIBRARIES(hiredis-qt-adapter_static hiredis ${Qt5Core_LIBRARIES}) + + INSTALL(TARGETS hiredis-qt-adapter hiredis-qt-adapter_static + EXPORT hiredis-qt-adapter-targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +ENDIF() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1d5bc56e0..ff9df6003 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -42,6 +42,15 @@ IF (ENABLE_SSL) TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl) ENDIF() +find_package(Qt5Core) +IF (Qt5Core_FOUND) + SET(CMAKE_AUTOMOC ON) + ADD_EXECUTABLE(example-qt example-qt.cpp) + TARGET_COMPILE_DEFINITIONS(example-qt PRIVATE ${Qt5Core_DEFINITIONS}) + TARGET_INCLUDE_DIRECTORIES(example-qt PRIVATE ${Qt5Core_INCLUDES}) + TARGET_LINK_LIBRARIES(example-qt hiredis hiredis-qt-adapter ${Qt5Core_LIBRARIES}) +ENDIF() + ADD_EXECUTABLE(example example.c) TARGET_LINK_LIBRARIES(example hiredis)