From 9c4907da9c032e0787a59ed19ffb90c9fb313f39 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 8 Oct 2021 10:50:29 -0700 Subject: [PATCH] Support configurable include install dir This is useful for split-output packaging, where the development headers are separate from the runtime libraries. --- CMakeLists.txt | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14964ecf..e9973f44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,13 @@ endif() if (UNIX AND NOT APPLE) include(GNUInstallDirs) -elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR "lib") +else() + if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) + set(CMAKE_INSTALL_INCLUDEDIR "include") + endif() + if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") + endif() endif() # This is required in order to append /lib/cmake to each element in CMAKE_PREFIX_PATH @@ -86,18 +91,18 @@ set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0.0) target_include_directories(${PROJECT_NAME} PUBLIC $ - $) + $) aws_use_package(aws-c-http) target_link_libraries(${PROJECT_NAME} PUBLIC ${DEP_AWS_LIBS}) aws_prepare_shared_lib_exports(${PROJECT_NAME}) -install(FILES ${AWS_MQTT_HEADERS} DESTINATION "include/aws/mqtt" COMPONENT Development) -install(FILES ${AWS_MQTT5_HEADERS} DESTINATION "include/aws/mqtt/v5" COMPONENT Development) -install(FILES ${AWS_MQTT_RR_HEADERS} DESTINATION "include/aws/mqtt/request-response" COMPONENT Development) -install(FILES ${AWS_MQTT_TESTING_HEADERS} DESTINATION "include/aws/testing/mqtt" COMPONENT Development) -install(FILES ${AWS_MQTT_PRIV_EXPOSED_HEADERS} DESTINATION "include/aws/mqtt/private" COMPONENT Development) +install(FILES ${AWS_MQTT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/mqtt" COMPONENT Development) +install(FILES ${AWS_MQTT5_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/mqtt/v5" COMPONENT Development) +install(FILES ${AWS_MQTT_RR_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/mqtt/request-response" COMPONENT Development) +install(FILES ${AWS_MQTT_TESTING_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/testing/mqtt" COMPONENT Development) +install(FILES ${AWS_MQTT_PRIV_EXPOSED_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/mqtt/private" COMPONENT Development) if (BUILD_SHARED_LIBS) set (TARGET_DIR "shared")