From 38d0b0c1f62886f40db1279da64f2fac75473119 Mon Sep 17 00:00:00 2001
From: Roman Khabibov <roman.habibov@tarantool.org>
Date: Sun, 20 Dec 2020 13:08:40 +0500
Subject: [PATCH] build: install libcurl headers

Ship libcurl headers to system path "${PREFIX}/include/tarantool"
in the case of libcurl included as bundled library or static
build. It is needed to use SMTP client with tarantool's libcurl
instead of system libcurl.

See related issue: https://github.com/tarantool/smtp/issues/24

Closes #4559
---
 CMakeLists.txt                           | 7 +++++++
 changelogs/unreleased/install-headers.md | 4 ++++
 rpm/tarantool.spec                       | 1 +
 3 files changed, 12 insertions(+)
 create mode 100755 changelogs/unreleased/install-headers.md

diff --git a/CMakeLists.txt b/CMakeLists.txt
index feb56dfca0..1196b65b9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -428,6 +428,13 @@ else()
     find_package(CURL)
 endif()
 
+# Install headers.
+if (ENABLE_BUNDLED_LIBCURL)
+    install(DIRECTORY "${CURL_INCLUDE_DIRS}/curl"
+            DESTINATION ${MODULE_FULL_INCLUDEDIR}
+            FILES_MATCHING PATTERN "*.h")
+endif()
+
 #
 # Export libcurl symbols if the library is linked statically.
 #
diff --git a/changelogs/unreleased/install-headers.md b/changelogs/unreleased/install-headers.md
new file mode 100755
index 0000000000..957574c053
--- /dev/null
+++ b/changelogs/unreleased/install-headers.md
@@ -0,0 +1,4 @@
+## feature/build
+
+* Ship libcurl headers to system path "${PREFIX}/include/tarantool" in the
+  case of libcurl included as bundled library or static build (gh-4559).
diff --git a/rpm/tarantool.spec b/rpm/tarantool.spec
index 92e693955b..f8f6c124ac 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -268,6 +268,7 @@ fi
 %{_includedir}/tarantool/luajit.h
 %{_includedir}/tarantool/lualib.h
 %{_includedir}/tarantool/module.h
+%{_includedir}/tarantool/curl
 
 %changelog
 * Tue Sep 12 2017 Roman Tsisyk <roman@tarantool.org> 1.7.5.46-1
-- 
GitLab