1 From 6be95cf45c4b5beae8b364468cef42d5c5880836 Mon Sep 17 00:00:00 2001
2 From: Jan Tojnar <jtojnar@gmail.com>
3 Date: Sun, 9 Jan 2022 01:57:18 +0100
4 Subject: [PATCH] build: Make includedir properly overrideable
6 This is required by some package managers like Nix.
8 CMakeLists.txt | 20 ++++++++++++--------
9 1 file changed, 12 insertions(+), 8 deletions(-)
11 diff --git a/CMakeLists.txt b/CMakeLists.txt
12 index ad50174..e0be58c 100644
15 @@ -54,6 +54,10 @@ elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
16 set(CMAKE_INSTALL_LIBDIR "lib")
19 +if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
20 + set(CMAKE_INSTALL_INCLUDEDIR "include")
23 if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64")
24 set(FIND_LIBRARY_USE_LIB64_PATHS true)
26 @@ -302,7 +306,7 @@ endif ()
28 target_include_directories(${PROJECT_NAME} PUBLIC
29 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
30 - $<INSTALL_INTERFACE:include>)
31 + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
33 aws_use_package(aws-c-http)
34 aws_use_package(aws-c-mqtt)
35 @@ -316,13 +320,13 @@ aws_use_package(aws-c-s3)
37 target_link_libraries(${PROJECT_NAME} ${DEP_AWS_LIBS})
39 -install(FILES ${AWS_CRT_HEADERS} DESTINATION "include/aws/crt" COMPONENT Development)
40 -install(FILES ${AWS_CRT_AUTH_HEADERS} DESTINATION "include/aws/crt/auth" COMPONENT Development)
41 -install(FILES ${AWS_CRT_CRYPTO_HEADERS} DESTINATION "include/aws/crt/crypto" COMPONENT Development)
42 -install(FILES ${AWS_CRT_IO_HEADERS} DESTINATION "include/aws/crt/io" COMPONENT Development)
43 -install(FILES ${AWS_CRT_IOT_HEADERS} DESTINATION "include/aws/iot" COMPONENT Development)
44 -install(FILES ${AWS_CRT_MQTT_HEADERS} DESTINATION "include/aws/crt/mqtt" COMPONENT Development)
45 -install(FILES ${AWS_CRT_HTTP_HEADERS} DESTINATION "include/aws/crt/http" COMPONENT Development)
46 +install(FILES ${AWS_CRT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt" COMPONENT Development)
47 +install(FILES ${AWS_CRT_AUTH_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/auth" COMPONENT Development)
48 +install(FILES ${AWS_CRT_CRYPTO_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/crypto" COMPONENT Development)
49 +install(FILES ${AWS_CRT_IO_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/io" COMPONENT Development)
50 +install(FILES ${AWS_CRT_IOT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/iot" COMPONENT Development)
51 +install(FILES ${AWS_CRT_MQTT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/mqtt" COMPONENT Development)
52 +install(FILES ${AWS_CRT_HTTP_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/http" COMPONENT Development)
55 TARGETS ${PROJECT_NAME}