QRedis/CMakeLists.txt

63 lines
1.6 KiB
CMake
Raw Normal View History

# CMake 2.8.9 is required in order to use the new Qt 5 functions.
cmake_minimum_required(VERSION 2.8.9)
project(qredis)
# These options can be used to control the build process.
option(BUILD_TESTS "Build the QRedis test suite" ON)
# These definitions are used to set the target properties later on.
set(QREDIS_MAJOR 0)
set(QREDIS_MINOR 1)
set(QREDIS_PATCH 0)
set(QREDIS_VERSION "${QREDIS_MAJOR}.${QREDIS_MINOR}.${QREDIS_PATCH}")
# The QtCore and QtNetwork libraries are both required.
find_package(Qt6Core REQUIRED)
find_package(Qt6Network REQUIRED)
# Specify where QRedis includes are located.
include_directories(include)
# QRedis source files.
set(QREDIS_SRC
src/client.cpp
2013-07-16 02:35:51 +08:00
src/lexer.cpp
src/parser.cpp
src/request.cpp)
# QRedis header files requiring MOC.
qt6_wrap_cpp(QREDIS_MOC
include/qredis/client.h
include/qredis/request.h
src/client_p.h
2013-07-16 02:35:51 +08:00
src/lexer.h
src/parser.h
src/request_p.h)
# Create the client library.
add_library(qredis SHARED
${QREDIS_SRC}
${QREDIS_MOC})
# Set the client library's properties.
set_target_properties(qredis PROPERTIES
VERSION ${QREDIS_VERSION}
SOVERSION ${QREDIS_MAJOR})
# This causes the appropriate libraries to be included in the link process.
target_link_libraries(qredis Qt6::Core Qt6::Network)
# Specify the proper installation paths.
install(TARGETS qredis
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include/qredis)
# If the tests are to be built, then add them to the project.
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()