From 6480102b38244f95ab283af6b3b82b3100a9a681 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 20 May 2017 01:50:50 +0100 Subject: [PATCH] Add headers to the install target and add a version number. --- CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de1bac8..264931e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,16 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) -project(incredis CXX) +project(incredis VERSION 0.1.0 LANGUAGES CXX) list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) include(shared_git_project) include(CTest) option(INCREDIS_FORCE_DISABLE_TESTS "Ignore unit tests even if BUILD_TESTING is set to ON - useful if you want to disable incredis tests from your top-level cmake project" OFF) +set(CMAKE_INSTALL_INCLUDEDIR "" CACHE PATH "Specify the output directory for header files (default is include)") + +if(NOT CMAKE_INSTALL_INCLUDEDIR) + set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include") +endif(NOT CMAKE_INSTALL_INCLUDEDIR) find_package(hiredis 0.11.0 REQUIRED) find_package(CryptoPP 5.6) @@ -32,9 +37,10 @@ target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${HIREDIS_INCLUDE_DIRS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lib/better-enums PRIVATE ${LIBEV_INCLUDE_DIRS} - PRIVATE ${Boost_INCLUDE_DIRS} ) -target_include_directories(${PROJECT_NAME} +target_include_directories(${PROJECT_NAME} PUBLIC + $ + $ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${CMAKE_CURRENT_BINARY_DIR} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/incredis @@ -70,6 +76,8 @@ install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib/static ) +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(EXPORT ${PROJECT_NAME}Config DESTINATION share/${PROJECT_NAME}/cmake) target_compile_features(${PROJECT_NAME} PUBLIC cxx_nullptr