From 6809ab7d2a8dbfbe9eb1357b01bfa501824ba3d8 Mon Sep 17 00:00:00 2001 From: Adam Gu Date: Fri, 3 Aug 2018 09:42:46 +0800 Subject: [PATCH] Basic CMake installation. --- CMakeLists.txt | 3 ++ webcc/CMakeLists.txt | 82 ++++++++++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4269eb..ac5aab1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,9 @@ if(WEBCC_BUILD_UNITTEST) enable_testing() endif() +# Adhere to GNU filesystem layout conventions. +include(GNUInstallDirs) + # Automatically detect _WIN32_WINNT for Asio. # See: https://stackoverflow.com/a/40217291 if(WIN32) diff --git a/webcc/CMakeLists.txt b/webcc/CMakeLists.txt index 73dc7f1..08b44b4 100644 --- a/webcc/CMakeLists.txt +++ b/webcc/CMakeLists.txt @@ -5,79 +5,93 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() -set(SRCS - globals.cc +set(HEADERS globals.h - http_async_client.cc http_async_client.h - http_client.cc http_client.h - http_connection.cc http_connection.h - http_message.cc http_message.h - http_parser.cc http_parser.h - http_request.cc http_request.h - http_request_handler.cc http_request_handler.h - http_request_parser.cc http_request_parser.h - http_response.cc http_response.h - http_response_parser.cc http_response_parser.h - http_server.cc http_server.h - logger.cc logger.h queue.h - rest_async_client.cc rest_async_client.h - rest_client.cc rest_client.h - rest_request_handler.cc rest_request_handler.h - rest_service_manager.cc - rest_service_manager.h rest_server.h - rest_service.cc rest_service.h - url.cc + rest_service_manager.h url.h - utility.cc utility.h ) +set(SOURCES + globals.cc + http_async_client.cc + http_client.cc + http_connection.cc + http_message.cc + http_parser.cc + http_request.cc + http_request_handler.cc + http_request_parser.cc + http_response.cc + http_response_parser.cc + http_server.cc + logger.cc + rest_async_client.cc + rest_client.cc + rest_request_handler.cc + rest_service_manager.cc + rest_service.cc + url.cc + utility.cc + ) + if(WEBCC_ENABLE_SSL) - set(SRCS ${SRCS} - http_ssl_client.cc + set(HEADERS ${HEADERS} http_ssl_client.h ) + + set(SOURCES ${SOURCES} + http_ssl_client.cc + ) endif() if(WEBCC_ENABLE_SOAP) - # SOAP specific sources. - set(SOAP_SRCS - soap_client.cc + set(SOAP_HEADERS soap_client.h - soap_message.cc soap_message.h soap_parameter.h - soap_response.cc soap_response.h - soap_request.cc soap_request.h - soap_request_handler.cc soap_request_handler.h soap_server.h soap_service.h - soap_xml.cc soap_xml.h ) - set(SRCS ${SRCS} ${SOAP_SRCS}) + set(SOAP_SOURCES + soap_client.cc + soap_message.cc + soap_response.cc + soap_request.cc + soap_request_handler.cc + soap_xml.cc + ) + + set(HEADERS ${HEADERS} ${SOAP_HEADERS}) + set(SOURCES ${SOURCES} ${SOAP_SOURCES}) endif() -add_library(webcc ${SRCS}) +set(TARGET webcc) + +add_library(${TARGET} ${HEADERS} ${SOURCES}) + +install(TARGETS ${TARGET} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/lib) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/webcc)