This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch feature/remove_dfi_dep
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/feature/remove_dfi_dep by this 
push:
     new 05559468 Make libffi and jansson optional dependencies.
05559468 is described below

commit 0555946865e41a46325c022d5ddb8081b05dcc5b
Author: PengZheng <[email protected]>
AuthorDate: Thu Feb 9 19:32:06 2023 +0800

    Make libffi and jansson optional dependencies.
---
 CMakeLists.txt          | 11 -----------
 cmake/CelixConfig.cmake | 11 ++++++++---
 conanfile.py            |  1 -
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b65d2bc..184b90d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,8 +32,6 @@ find_package(ZLIB REQUIRED) #framework
 find_package(libuuid REQUIRED) #framework
 find_package(CURL REQUIRED) #framework, etcdlib
 find_package(libzip REQUIRED) #framework, etcdlib
-find_package(jansson REQUIRED) #etcdlib, dfi
-find_package(libffi REQUIRED) #dfi
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 
@@ -57,15 +55,6 @@ if (NOT TARGET CURL::libcurl)
             )
 endif ()
 
-if (NOT TARGET jansson::jansson)
-    message("Note jansson::jansson target not created by 
find_package(jansson). Creating jansson::jansson Target.")
-    add_library(jansson::jansson SHARED IMPORTED)
-    set_target_properties(jansson::jansson PROPERTIES
-            IMPORTED_LOCATION "${JANSSON_LIBRARIES}"
-            INTERFACE_INCLUDE_DIRECTORIES "${JANSSON_INCLUDE_DIRS}"
-            )
-endif ()
-
 # see https://public.kitware.com/Bug/view.php?id=15696
 IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 3.3 AND 
${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
     message( FATAL_ERROR "Building Celix using CMake 3.3 and makefiles is not 
supported due to a bug in the Makefile Generator (see Bug 15696). Please change 
the used CMake version - both, CMake 3.2 and CMake 3.4 are working fine. Or use 
a different generator (e.g. Ninja)." )
diff --git a/cmake/CelixConfig.cmake b/cmake/CelixConfig.cmake
index d65a4df1..7c6048c4 100644
--- a/cmake/CelixConfig.cmake
+++ b/cmake/CelixConfig.cmake
@@ -78,10 +78,8 @@ include(CMakeFindDependencyMacro)
 
 find_dependency(ZLIB) #Needed by framework
 find_dependency(libuuid) #Needed by framework
-find_dependency(CURL) #Needed by framework (used for curl initialization)
+find_dependency(CURL) #Needed by framework (used for curl initialization), 
etcdlib
 find_dependency(libzip) #Needed by utils
-find_dependency(jansson) #Needed by dfi, etcdlib, remote services, pubsub
-find_dependency(libffi) #Needed by dfi
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_dependency(Threads)
 
@@ -105,6 +103,13 @@ if (NOT TARGET CURL::libcurl)
           )
 endif ()
 
+if (TARGET Celix::dfi)
+  find_dependency(libffi)
+  find_dependency(jansson)
+endif ()
+if (TARGET Celix::etcdlib)
+  find_dependency(jansson)
+endif ()
 if (TARGET Celix::RsaConfiguredDiscovery)
   find_dependency(RapidJSON)
 endif ()
diff --git a/conanfile.py b/conanfile.py
index 5d5a7e9e..8cced60a 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -230,7 +230,6 @@ class CelixConan(ConanFile):
             self.requires("libffi/[>=3.2.1 <4.0.0]")
             self.options['libffi'].shared = True
 
-
     def _configure_cmake(self):
         if self._cmake:
             return self._cmake

Reply via email to