From c1327f2a192f975a9620a66436619bd82e6380cb Mon Sep 17 00:00:00 2001
From: Vladimir Davydov <vdavydov@tarantool.org>
Date: Tue, 7 Nov 2023 11:55:28 +0300
Subject: [PATCH] cmake: allow to include extra dependencies

Tarantool EE needs to build or find some extra libraries. Let's add
the new variable EXTRA_DEPENDENCIES_CMAKE for that. It'll be defined
by the parent project.

Since we might need to link the extra dependencies to the core library,
we also add the new list variable EXTRA_CORE_DEPENDENCIES. If set, its
contents will be appended to the core library dependencies list.

Follow-up #9242

NO_DOC=build
NO_TEST=build
NO_CHANGELOG=build

(cherry picked from commit a367265bbcfaf4d5a6be677444666ba6d6a72345)
---
 CMakeLists.txt              | 4 ++++
 src/lib/core/CMakeLists.txt | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2183ecbfea..cef135c7fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -742,6 +742,10 @@ include(BuildMisc)
 libmisc_build()
 add_dependencies(build_bundled_libs misc)
 
+if(DEFINED EXTRA_DEPENDENCIES_CMAKE)
+    include(${EXTRA_DEPENDENCIES_CMAKE})
+endif()
+
 # cpack config. called package.cmake to avoid
 # conflicts with the global CPack.cmake (On MacOS X
 # file names are case-insensitive)
diff --git a/src/lib/core/CMakeLists.txt b/src/lib/core/CMakeLists.txt
index 8d3630cb03..f9cfdabae2 100644
--- a/src/lib/core/CMakeLists.txt
+++ b/src/lib/core/CMakeLists.txt
@@ -89,6 +89,10 @@ if (ENABLE_BACKTRACE)
     endif()
 endif()
 
+if(EXTRA_CORE_DEPENDENCIES)
+    add_dependencies(core ${EXTRA_CORE_DEPENDENCIES})
+endif()
+
 if (ENABLE_BUNDLED_OPENSSL)
     add_dependencies(core bundled-openssl)
 endif()
-- 
GitLab