You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2019/10/02 18:46:31 UTC

[celix] branch feature/#80_bundle_start_with_exception created (now 67342d2)

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

pnoltes pushed a change to branch feature/#80_bundle_start_with_exception
in repository https://gitbox.apache.org/repos/asf/celix.git.


      at 67342d2  gh-118: Updates all Find<PKG>.cmake to created imported CMake targets. Also updates all link/include usage to use imported targets.

This branch includes the following new commits:

     new 87c387a  gh-80: Adds exception check and handle for bundle start
     new 67342d2  gh-118: Updates all Find<PKG>.cmake to created imported CMake targets. Also updates all link/include usage to use imported targets.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[celix] 01/02: gh-80: Adds exception check and handle for bundle start

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/#80_bundle_start_with_exception
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 87c387ad03eb4004f79300af514131f107f60804
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Tue Oct 1 20:11:18 2019 +0200

    gh-80: Adds exception check and handle for bundle start
---
 cmake/Modules/FindCUnit.cmake                      | 65 ----------------------
 libs/framework/include/celix_bundle_context.h      |  5 +-
 libs/framework/include/celix_framework.h           | 27 +++++++++
 libs/framework/private/mock/bundle_context_mock.c  |  3 +-
 libs/framework/private/mock/framework_mock.c       |  3 +-
 libs/framework/src/bundle_context.c                |  8 +--
 libs/framework/src/framework.c                     | 16 ++++--
 libs/framework/src/framework_private.h             |  2 -
 libs/framework/tst/CMakeLists.txt                  |  3 +-
 .../framework/tst/bundle_context_bundles_tests.cpp | 12 ++++
 libs/framework/tst/nop_activator.c                 | 35 ++++++++++++
 11 files changed, 95 insertions(+), 84 deletions(-)

diff --git a/cmake/Modules/FindCUnit.cmake b/cmake/Modules/FindCUnit.cmake
deleted file mode 100644
index 830f551..0000000
--- a/cmake/Modules/FindCUnit.cmake
+++ /dev/null
@@ -1,65 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-if (NOT WIN32)
-	include(FindCurses)
-endif (NOT WIN32)
-
-FIND_PATH(CUNIT_INCLUDE_DIR CUnit/Basic.h
-  /usr/local/include
-  /usr/include
-  /opt/local/include  
-)
-
-FIND_PATH(CUNIT_SHARE_DIR CUnit-List.dtd
-	/usr/local/share/Cunit
-  	/usr/share/CUnit
-  	/opt/local/share/CUnit
-)
-
-# On unix system, debug and release have the same name
-FIND_LIBRARY(CUNIT_LIBRARY cunit
-             ${CUNIT_INCLUDE_DIR}/../../lib
-             /usr/local/lib
-             /usr/lib
-             )
-FIND_LIBRARY(CUNIT_DEBUG_LIBRARY cunit
-             ${CUNIT_INCLUDE_DIR}/../../lib
-             /usr/local/lib
-             /usr/lib
-             )
-
-IF(CUNIT_INCLUDE_DIR)
-  IF(CUNIT_LIBRARY)
-    SET(CUNIT_FOUND "YES")
-    if (WIN32)
-    	SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY})
-	    SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY})
-    else (WIN32)
-    	SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY} ${CURSES_LIBRARY})
-	    SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY} ${CURSES_DEBUG_LIBRARY})
-    endif (WIN32)
-  ENDIF(CUNIT_LIBRARY)
-  IF(CUNIT_INCLUDE_DIR)
-  	if (WIN32)
-    	SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR})
-	else (WIN32)
-		MESSAGE(STATUS "Found CUNIT: ${CUNIT_INCLUDE_DIR}")
-		SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR} ${CURSES_INCLUDE_DIR})
-	endif (WIN32)
-  ENDIF(CUNIT_INCLUDE_DIR)
-ENDIF(CUNIT_INCLUDE_DIR)
diff --git a/libs/framework/include/celix_bundle_context.h b/libs/framework/include/celix_bundle_context.h
index 0c845a2..779c134 100644
--- a/libs/framework/include/celix_bundle_context.h
+++ b/libs/framework/include/celix_bundle_context.h
@@ -716,8 +716,9 @@ long celix_bundleContext_trackBundlesWithOptions(
  * @param callbackHandle    The data pointer, which will be used in the callbacks
  * @param use               The callback which will be called for the currently started bundles.
  *                          The bundle pointers are only guaranteed to be valid during the callback.
+ * @return                  Returns true if the bundle is found and the callback is called.
  */
-void celix_bundleContext_useBundle(
+bool celix_bundleContext_useBundle(
         celix_bundle_context_t *ctx,
         long bundleId,
         void *callbackHandle,
@@ -726,7 +727,7 @@ void celix_bundleContext_useBundle(
 
 /**
  * Use the currently active (started) bundles.
- * The provided callback will be called for all the currently started bundles.
+ * The provided callback will be called for all the currently started bundles (excluding the framework bundle).
  *
  * @param ctx               The bundle context.
  * @param callbackHandle    The data pointer, which will be used in the callbacks
diff --git a/libs/framework/include/celix_framework.h b/libs/framework/include/celix_framework.h
index 76ebcb5..470de9b 100644
--- a/libs/framework/include/celix_framework.h
+++ b/libs/framework/include/celix_framework.h
@@ -50,6 +50,33 @@ celix_bundle_context_t* celix_framework_getFrameworkContext(const celix_framewor
  */
 celix_bundle_t* celix_framework_getFrameworkBundle(const celix_framework_t *fw);
 
+/**
+ * Use the currently active (started) bundles.
+ * The provided callback will be called for all the currently started bundles.
+ *
+ * @param ctx                       The bundle context.
+ * @param includeFrameworkBundle    If true the callback will also be triggered for the framework bundle.
+ * @param callbackHandle            The data pointer, which will be used in the callbacks
+ * @param use                       The callback which will be called for the currently started bundles.
+ *                                  The bundle pointers are only guaranteed to be valid during the callback.
+ */
+void celix_framework_useBundles(celix_framework_t *fw, bool includeFrameworkBundle, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd));
+
+/**
+ * Use the bundle with the provided bundle id
+ * The provided callback will be called if the bundle is found.
+ *
+ * @param fw                The framework.
+ * @param onlyActive        If true only starting and active bundles will trigger the callback.
+ * @param bundleId          The bundle id.
+ * @param callbackHandle    The data pointer, which will be used in the callbacks
+ * @param use               The callback which will be called for the currently started bundles.
+ *                          The bundle pointers are only guaranteed to be valid during the callback.
+ * @return                  Returns true if the bundle is found and the callback is called.
+ */
+bool celix_framework_useBundle(celix_framework_t *fw, bool onlyActive, long bndId, void *callbackHandle, void(*use)(void *handle, const celix_bundle_t *bnd));
+
+
 
 #ifdef __cplusplus
 }
diff --git a/libs/framework/private/mock/bundle_context_mock.c b/libs/framework/private/mock/bundle_context_mock.c
index 4dec7db..8644a1a 100644
--- a/libs/framework/private/mock/bundle_context_mock.c
+++ b/libs/framework/private/mock/bundle_context_mock.c
@@ -273,7 +273,7 @@ void celix_bundleContext_useBundles(
 }
 
 
-void celix_bundleContext_useBundle(
+bool celix_bundleContext_useBundle(
 		bundle_context_t *ctx,
 		long bundleId,
 		void *callbackHandle,
@@ -283,6 +283,7 @@ void celix_bundleContext_useBundle(
 			->withLongIntParameters("bundleId", bundleId)
 			->withPointerParameters("callbackHandle", callbackHandle)
 			->withPointerParameters("use", use);
+	return mock_c()->returnValue().value.boolValue;
 }
 
 void celix_bundleContext_stopTracker(bundle_context_t *ctx, long trackerId) {
diff --git a/libs/framework/private/mock/framework_mock.c b/libs/framework/private/mock/framework_mock.c
index d651b94..8e49218 100644
--- a/libs/framework/private/mock/framework_mock.c
+++ b/libs/framework/private/mock/framework_mock.c
@@ -329,13 +329,14 @@ void celix_framework_useBundles(framework_t *fw, bool includeFrameworkBundle, vo
 			->withPointerParameters("use", use);
 }
 
-void celix_framework_useBundle(framework_t *fw, bool onlyActive, long bundleId, void *callbackHandle, void(*use)(void *handle, const bundle_t *bnd)) {
+bool celix_framework_useBundle(framework_t *fw, bool onlyActive, long bundleId, void *callbackHandle, void(*use)(void *handle, const bundle_t *bnd)) {
 	mock_c()->actualCall("celix_framework_useBundle")
 			->withPointerParameters("fw", fw)
 			->withBoolParameters("onlyActive", onlyActive)
 			->withLongIntParameters("bundleId", bundleId)
 			->withPointerParameters("callbackHandle", callbackHandle)
 			->withPointerParameters("use", use);
+	return mock_c()->returnValue().value.boolValue;
 }
 
 service_registration_t* celix_framework_registerServiceFactory(framework_t *fw , const celix_bundle_t *bnd, const char* serviceName, celix_service_factory_t *factory, celix_properties_t *properties) {
diff --git a/libs/framework/src/bundle_context.c b/libs/framework/src/bundle_context.c
index 3098884..dd76ba1 100644
--- a/libs/framework/src/bundle_context.c
+++ b/libs/framework/src/bundle_context.c
@@ -602,12 +602,12 @@ void celix_bundleContext_useBundles(
     celix_framework_useBundles(ctx->framework, false, callbackHandle, use);
 }
 
-void celix_bundleContext_useBundle(
+bool celix_bundleContext_useBundle(
         bundle_context_t *ctx,
         long bundleId,
         void *callbackHandle,
         void (*use)(void *handle, const bundle_t *bundle)) {
-    celix_framework_useBundle(ctx->framework, true, bundleId, callbackHandle, use);
+    return celix_framework_useBundle(ctx->framework, true, bundleId, callbackHandle, use);
 }
 
 static void bundleContext_cleanupBundleTrackers(bundle_context_t *ctx) {
@@ -690,10 +690,6 @@ long celix_bundleContext_installBundle(bundle_context_t *ctx, const char *bundle
         status = bundle_getBundleId(bnd, &bundleId);
         if (status == CELIX_SUCCESS && autoStart) {
             status = bundle_start(bnd);
-            if (status != CELIX_SUCCESS) {
-                bundleId = -1;
-                bundle_uninstall(bnd);
-            }
         }
     }
 
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index 35f0cef..17d56f3 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -930,7 +930,6 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int opti
                         status = CELIX_ENOMEM;
                     } else {
                         void * userData = NULL;
-                        bundle_context_t *context;
                         create_function_fp create = (create_function_fp) celix_libloader_getSymbol((celix_library_handle_t*) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE);
                         if (create == NULL) {
                             create = celix_libloader_getSymbol(bundle_getHandle(bundle), OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_CREATE);
@@ -976,6 +975,11 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int opti
 
                         status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_ACTIVE));
                         status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STARTED, bundle));
+
+                        if (status != CELIX_SUCCESS) {
+                            //state is still STARTING, back to resolved
+                            framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_RESOLVED);
+                        }
                     }
                 }
 
@@ -986,7 +990,6 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int opti
     fw_bundleEntry_decreaseUseCount(framework, bndId);
 
 	if (status != CELIX_SUCCESS) {
-	    module_pt module = NULL;
 	    const char *symbolicName = NULL;
 	    long id = 0;
 	    bundle_getCurrentModule(bundle, &module);
@@ -997,9 +1000,6 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int opti
 	    } else {
 	        fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]", symbolicName, id);
 	    }
-	    if(activator!=NULL){
-	    	free(activator);
-	    }
 	}
 
 	return status;
@@ -2584,7 +2584,8 @@ void celix_framework_useBundles(framework_t *fw, bool includeFrameworkBundle, vo
     celix_arrayList_destroy(bundleIds);
 }
 
-void celix_framework_useBundle(framework_t *fw, bool onlyActive, long bundleId, void *callbackHandle, void(*use)(void *handle, const bundle_t *bnd)) {
+bool celix_framework_useBundle(framework_t *fw, bool onlyActive, long bundleId, void *callbackHandle, void(*use)(void *handle, const bundle_t *bnd)) {
+    bool called = false;
     if (bundleId >= 0) {
         fw_bundleEntry_increaseUseCount(fw, bundleId);
         bundle_t *bnd = framework_getBundleById(fw, bundleId);
@@ -2592,14 +2593,17 @@ void celix_framework_useBundle(framework_t *fw, bool onlyActive, long bundleId,
             celix_bundle_state_e bndState = celix_bundle_getState(bnd);
             if (onlyActive && (bndState == OSGI_FRAMEWORK_BUNDLE_ACTIVE || bndState == OSGI_FRAMEWORK_BUNDLE_STARTING)) {
                 use(callbackHandle, bnd);
+                called = true;
             } else if (!onlyActive) {
                 use(callbackHandle, bnd);
+                called = true;
             }
         } else {
             framework_logIfError(fw->logger, CELIX_FRAMEWORK_EXCEPTION, NULL, "Bundle with id %li is not installed", bundleId);
         }
         fw_bundleEntry_decreaseUseCount(fw, bundleId);
     }
+    return called;
 }
 
 service_registration_t* celix_framework_registerServiceFactory(framework_t *fw , const celix_bundle_t *bnd, const char* serviceName, celix_service_factory_t *factory, celix_properties_t *properties) {
diff --git a/libs/framework/src/framework_private.h b/libs/framework/src/framework_private.h
index 20dad52..6728ff7 100644
--- a/libs/framework/src/framework_private.h
+++ b/libs/framework/src/framework_private.h
@@ -153,8 +153,6 @@ FRAMEWORK_EXPORT bundle_pt framework_getBundleById(framework_pt framework, long
  **********************************************************************************************************************
  **********************************************************************************************************************/
 
-void celix_framework_useBundles(framework_t *fw, bool includeFrameworkBundle, void *callbackHandle, void(*use)(void *handle, const bundle_t *bnd));
-void celix_framework_useBundle(framework_t *fw, bool onlyActive, long bundleId, void *callbackHandle, void(*use)(void *handle, const bundle_t *bnd));
 service_registration_t* celix_framework_registerServiceFactory(framework_t *fw , const celix_bundle_t *bnd, const char* serviceName, celix_service_factory_t *factory, celix_properties_t *properties);
 
 #endif /* FRAMEWORK_PRIVATE_H_ */
diff --git a/libs/framework/tst/CMakeLists.txt b/libs/framework/tst/CMakeLists.txt
index efd919e..7ef1ceb 100644
--- a/libs/framework/tst/CMakeLists.txt
+++ b/libs/framework/tst/CMakeLists.txt
@@ -18,6 +18,7 @@
 add_celix_bundle(simple_test_bundle1 NO_ACTIVATOR VERSION 1.0.0)
 add_celix_bundle(simple_test_bundle2 NO_ACTIVATOR VERSION 1.0.0)
 add_celix_bundle(simple_test_bundle3 NO_ACTIVATOR VERSION 1.0.0)
+add_celix_bundle(bundle_with_exception SOURCES nop_activator.c VERSION 1.0.0)
 add_subdirectory(subdir) #simple_test_bundle4 and simeple_test_bundle5
 
 add_executable(test_framework
@@ -30,7 +31,7 @@ add_executable(test_framework
 )
 
 target_link_libraries(test_framework Celix::framework ${CURL_LIBRARIES} ${CPPUTEST_LIBRARY})
-add_dependencies(test_framework simple_test_bundle1_bundle simple_test_bundle2_bundle simple_test_bundle3_bundle simple_test_bundle4_bundle simple_test_bundle5_bundle)
+add_dependencies(test_framework simple_test_bundle1_bundle simple_test_bundle2_bundle simple_test_bundle3_bundle simple_test_bundle4_bundle simple_test_bundle5_bundle bundle_with_exception)
 target_include_directories(test_framework PRIVATE ../src)
 
 configure_file(config.properties.in config.properties @ONLY)
diff --git a/libs/framework/tst/bundle_context_bundles_tests.cpp b/libs/framework/tst/bundle_context_bundles_tests.cpp
index 6887418..f193173 100644
--- a/libs/framework/tst/bundle_context_bundles_tests.cpp
+++ b/libs/framework/tst/bundle_context_bundles_tests.cpp
@@ -41,6 +41,7 @@ TEST_GROUP(CelixBundleContextBundlesTests) {
     const char * const TEST_BND3_LOC = "simple_test_bundle3.zip";
     const char * const TEST_BND4_LOC = "simple_test_bundle4.zip";
     const char * const TEST_BND5_LOC = "simple_test_bundle5.zip";
+    const char * const TEST_BND_WITH_EXCEPTION_LOC = "bundle_with_exception.zip";
 
     void setup() {
         properties = properties_create();
@@ -90,6 +91,17 @@ TEST(CelixBundleContextBundlesTests, useBundlesTest) {
     CHECK_EQUAL(1, count);
 };
 
+TEST(CelixBundleContextBundlesTests, startBundleWithException) {
+    long bndId = celix_bundleContext_installBundle(ctx, TEST_BND_WITH_EXCEPTION_LOC, true);
+    CHECK(bndId > 0); //bundle is installed, but not started
+
+    bool called = celix_framework_useBundle(fw, false, bndId, nullptr, [](void */*handle*/, const celix_bundle_t *bnd) {
+        auto state = celix_bundle_getState(bnd);
+        CHECK_EQUAL(state, OSGI_FRAMEWORK_BUNDLE_RESOLVED);
+    });
+    CHECK_TRUE(called);
+}
+
 TEST(CelixBundleContextBundlesTests, useBundleTest) {
     int count = 0;
 
diff --git a/libs/framework/tst/nop_activator.c b/libs/framework/tst/nop_activator.c
new file mode 100644
index 0000000..ad2b57d
--- /dev/null
+++ b/libs/framework/tst/nop_activator.c
@@ -0,0 +1,35 @@
+/**
+ *Licensed to the Apache Software Foundation (ASF) under one
+ *or more contributor license agreements.  See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.  The ASF licenses this file
+ *to you under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in compliance
+ *with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */
+
+#include "celix_api.h"
+
+struct bundle_act {
+
+};
+
+static celix_status_t act_start(struct bundle_act *act __attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
+    printf("Return a bundle 'exception'\n");
+    return CELIX_BUNDLE_EXCEPTION;
+}
+
+static celix_status_t act_stop(struct bundle_act *act __attribute__((unused)), celix_bundle_context_t *ctx __attribute__((unused))) {
+    return CELIX_SUCCESS;
+}
+
+CELIX_GEN_BUNDLE_ACTIVATOR(struct bundle_act, act_start, act_stop);
\ No newline at end of file


[celix] 02/02: gh-118: Updates all Find.cmake to created imported CMake targets. Also updates all link/include usage to use imported targets.

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/#80_bundle_start_with_exception
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 67342d2f0c56c800c116a2cf58a048368b4c4307
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Wed Oct 2 20:44:52 2019 +0200

    gh-118: Updates all Find<PKG>.cmake to created imported CMake targets. Also updates all link/include usage to use imported targets.
---
 CMakeLists.txt                                     |  2 +-
 bundles/deployment_admin/CMakeLists.txt            |  7 +--
 bundles/pubsub/examples/CMakeLists.txt             |  6 +--
 bundles/pubsub/keygen/CMakeLists.txt               | 10 ++--
 bundles/pubsub/pubsub_admin_tcp/CMakeLists.txt     |  4 +-
 bundles/pubsub/pubsub_admin_udp_mc/CMakeLists.txt  |  1 -
 .../pubsub/pubsub_admin_websocket/CMakeLists.txt   |  8 ---
 bundles/pubsub/pubsub_admin_zmq/CMakeLists.txt     | 12 +----
 bundles/pubsub/pubsub_discovery/CMakeLists.txt     |  6 +--
 .../pubsub/pubsub_serializer_json/CMakeLists.txt   |  3 +-
 bundles/pubsub/pubsub_spi/CMakeLists.txt           |  8 +--
 .../pubsub/pubsub_topology_manager/CMakeLists.txt  |  8 +--
 bundles/pubsub/test/CMakeLists.txt                 | 12 ++---
 .../discovery_configured/CMakeLists.txt            |  2 +-
 .../remote_services/discovery_etcd/CMakeLists.txt  |  3 +-
 .../remote_services/discovery_shm/CMakeLists.txt   |  2 +-
 .../remote_service_admin_dfi/CMakeLists.txt        | 11 ++--
 .../remote_service_admin_dfi/test/CMakeLists.txt   |  2 +-
 .../remote_service_admin_shm/CMakeLists.txt        |  3 +-
 .../private/test/CMakeLists.txt                    |  2 +-
 .../topology_manager/CMakeLists.txt                |  1 -
 .../topology_manager/tms_tst/CMakeLists.txt        |  2 +-
 bundles/shell/shell/CMakeLists.txt                 |  3 +-
 cmake/CelixConfig.cmake                            | 28 ++++++++++
 cmake/Modules/FindCZMQ.cmake                       | 11 +++-
 cmake/Modules/FindFFI.cmake                        | 61 ++++++++++------------
 cmake/Modules/FindJansson.cmake                    | 12 ++++-
 cmake/Modules/FindNanoMsg.cmake                    | 16 ++++--
 cmake/Modules/FindOpenSSL.cmake                    |  9 ++++
 cmake/Modules/FindSlp.cmake                        | 42 ---------------
 cmake/Modules/FindSyslog.cmake                     | 13 +++++
 cmake/Modules/FindUUID.cmake                       | 48 +++++++++++------
 cmake/Modules/FindZMQ.cmake                        |  9 ++++
 libs/dfi/CMakeLists.txt                            | 11 ++--
 libs/etcdlib/CMakeLists.txt                        | 14 ++---
 libs/framework/CMakeLists.txt                      | 15 ++----
 .../framework/include/celix/dm/DependencyManager.h | 11 +++-
 libs/framework/tst/CMakeLists.txt                  |  2 +-
 .../bundles/pubsub_admin_nanomsg/CMakeLists.txt    |  4 +-
 39 files changed, 206 insertions(+), 218 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba7bfe7..8e2ccde 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,7 @@ IF (ANDROID)
     set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall ${CMAKE_C_FLAGS}")
 ELSE ()
     set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fPIC ${CMAKE_C_FLAGS}")
-    set(CMAKE_CXX_FLAGS "-std=c++11 -fno-rtti -fno-exceptions ${CMAKE_CXX_FLAGS}")
+    set(CMAKE_CXX_FLAGS "-std=c++11 -fno-rtti ${CMAKE_CXX_FLAGS}")
     set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
     set(CMAKE_CXX_FLAGS "-Wall -Wextra -Weffc++ ${CMAKE_CXX_FLAGS}")
     set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG ${CMAKE_C_FLAGS}")
diff --git a/bundles/deployment_admin/CMakeLists.txt b/bundles/deployment_admin/CMakeLists.txt
index 08c7f0b..5bc52a9 100644
--- a/bundles/deployment_admin/CMakeLists.txt
+++ b/bundles/deployment_admin/CMakeLists.txt
@@ -23,10 +23,6 @@ if (DEPLOYMENT_ADMIN)
     find_package(UUID REQUIRED)
     find_package(ZLIB REQUIRED)
 
-    if (NOT UUID_LIBRARY)
-        set(UUID_LIBRARY "")
-    endif ()
-
     add_library(deployment_admin_api INTERFACE)
     target_include_directories(deployment_admin_api INTERFACE 
 	    $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api>
@@ -51,8 +47,7 @@ if (DEPLOYMENT_ADMIN)
     )
 
     target_compile_definitions(deployment_admin PRIVATE -DUSE_FILE32API)
-    target_link_libraries(deployment_admin PRIVATE ${CURL_LIBRARY} ${UUID_LIBRARY} ${ZLIB_LIBRARIES} ${OPENSLL_LIBRARY} deployment_admin_api)
-    target_include_directories(deployment_admin PRIVATE ${CURL_INCLUDE_DIRS})
+    target_link_libraries(deployment_admin PRIVATE CURL::libcurl UUID::lib ZLIB::ZLIB deployment_admin_api)
 
     install(TARGETS deployment_admin_api EXPORT celix COMPONENT deployment_admin)
     install(DIRECTORY api/ DESTINATION include/celix/deployment_admin COMPONENT deployment_admin)
diff --git a/bundles/pubsub/examples/CMakeLists.txt b/bundles/pubsub/examples/CMakeLists.txt
index e6b8cad..dc71b77 100644
--- a/bundles/pubsub/examples/CMakeLists.txt
+++ b/bundles/pubsub/examples/CMakeLists.txt
@@ -22,7 +22,7 @@ find_program(XTERM_CMD NAMES xterm)
 
 find_package(Jansson REQUIRED)
 
-set(PUBSUB_CONTAINER_LIBS ${JANSSON_LIBRARY} Celix::dfi)
+set(PUBSUB_CONTAINER_LIBS JANSSON::lib Celix::dfi)
 
 # UDP Multicast
 add_celix_container(pubsub_publisher_udp_mc
@@ -170,7 +170,7 @@ if (BUILD_PUBSUB_PSA_ZMQ)
     find_package(ZMQ REQUIRED)
     find_package(CZMQ REQUIRED)
 
-    set(PUBSUB_CONTAINER_LIBS ${PUBSUB_CONTAINER_LIBS} ${ZMQ_LIBRARIES} ${CZMQ_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY})
+    set(PUBSUB_CONTAINER_LIBS ${PUBSUB_CONTAINER_LIBS} ZMQ::lib CZMQ::lib OPENSSL::lib)
 
     # Dynamic ZMQ / UDP / TCP admin
     add_celix_container(pubsub_publisher
@@ -304,7 +304,7 @@ if (BUILD_PUBSUB_PSA_ZMQ)
 endif()
 
 if (BUILD_PUBSUB_PSA_NANOMSG)
-    set(PUBSUB_CONTAINER_LIBS ${NANOMSG_LIBRARIES} ${PUBSUB_CONTAINER_LIBS})
+    set(PUBSUB_CONTAINER_LIBS NANOMSG::lib ${PUBSUB_CONTAINER_LIBS})
 
     add_celix_container(pubsub_publisher1_nanomsg
         GROUP "pubsub"
diff --git a/bundles/pubsub/keygen/CMakeLists.txt b/bundles/pubsub/keygen/CMakeLists.txt
index 991648e..a4b1a63 100644
--- a/bundles/pubsub/keygen/CMakeLists.txt
+++ b/bundles/pubsub/keygen/CMakeLists.txt
@@ -20,15 +20,11 @@ if (BUILD_ZMQ_SECURITY)
     find_package(ZMQ REQUIRED)
     find_package(CZMQ REQUIRED)
     find_package(OpenSSL 1.1.0 REQUIRED)
-    
-    include_directories("${ZMQ_INCLUDE_DIR}")
-    include_directories("${CZMQ_INCLUDE_DIR}")
-    include_directories("${OPENSSL_INCLUDE_DIR}")
-    
+
     add_executable(makecert makecert.c)
-    target_link_libraries(makecert ${CZMQ_LIBRARIES})
+    target_link_libraries(makecert CZMQ::lib)
     
     add_executable(ed_file ed_file.c)
-    target_link_libraries(ed_file ${ZMQ_LIBRARIES} ${CZMQ_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY})
+    target_link_libraries(ed_file PUBLIC ZMQ::lib CZMQ::lib ${OPENSSL_CRYPTO_LIBRARY})
 
 endif()
diff --git a/bundles/pubsub/pubsub_admin_tcp/CMakeLists.txt b/bundles/pubsub/pubsub_admin_tcp/CMakeLists.txt
index 0fd4bbc..a2d4b3b 100644
--- a/bundles/pubsub/pubsub_admin_tcp/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_admin_tcp/CMakeLists.txt
@@ -36,10 +36,10 @@ target_link_libraries(celix_pubsub_admin_tcp PRIVATE
         Celix::pubsub_spi
         Celix::framework Celix::dfi Celix::log_helper
 )
-target_include_directories(celix_pubsub_admin_tcp PRIVATE ${JANSSON_INCLUDE_DIR} src)
+target_include_directories(celix_pubsub_admin_tcp PRIVATE src)
 # cmake find package UUID set the wrong include dir for OSX
 if (NOT APPLE)
-    target_include_directories(celix_pubsub_admin_tcp SYSTEM PRIVATE ${UUID_INCLUDE_DIRS})
+    target_link_libraries(celix_pubsub_admin_tcp PRIVATE UUID::lib)
 endif()
 
 install_celix_bundle(celix_pubsub_admin_tcp EXPORT celix COMPONENT pubsub)
diff --git a/bundles/pubsub/pubsub_admin_udp_mc/CMakeLists.txt b/bundles/pubsub/pubsub_admin_udp_mc/CMakeLists.txt
index 8b87422..dd0a095 100644
--- a/bundles/pubsub/pubsub_admin_udp_mc/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_admin_udp_mc/CMakeLists.txt
@@ -31,7 +31,6 @@ add_celix_bundle(celix_pubsub_admin_udp_multicast
 )
 target_include_directories(celix_pubsub_admin_udp_multicast PRIVATE
         src
-        ${JANSSON_INCLUDE_DIR}
 )
 set_target_properties(celix_pubsub_admin_udp_multicast PROPERTIES INSTALL_RPATH "$ORIGIN")
 target_link_libraries(celix_pubsub_admin_udp_multicast PRIVATE Celix::pubsub_spi Celix::framework Celix::dfi Celix::log_helper Celix::utils)
diff --git a/bundles/pubsub/pubsub_admin_websocket/CMakeLists.txt b/bundles/pubsub/pubsub_admin_websocket/CMakeLists.txt
index c992d5e..a7f8835 100644
--- a/bundles/pubsub/pubsub_admin_websocket/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_admin_websocket/CMakeLists.txt
@@ -18,12 +18,6 @@
 find_package(Jansson REQUIRED)
 find_package(UUID REQUIRED)
 
-if(NOT UUID_LIBRARY)
-    #i.e. not found for OSX
-    set(UUID_LIBRARY "")
-    set(UUID_INCLUDE_DIRS "")
-endif()
-
 add_celix_bundle(celix_pubsub_admin_websocket
     BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_websocket"
     VERSION "1.0.0"
@@ -43,8 +37,6 @@ target_link_libraries(celix_pubsub_admin_websocket PRIVATE
         Celix::http_admin_api
 )
 target_include_directories(celix_pubsub_admin_websocket PRIVATE
-    ${JANSSON_INCLUDE_DIR}
-    ${UUID_INCLUDE_DIRS}
     src
 )
 
diff --git a/bundles/pubsub/pubsub_admin_zmq/CMakeLists.txt b/bundles/pubsub/pubsub_admin_zmq/CMakeLists.txt
index bcf6199..70a6048 100644
--- a/bundles/pubsub/pubsub_admin_zmq/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_admin_zmq/CMakeLists.txt
@@ -22,12 +22,6 @@ if (BUILD_PUBSUB_PSA_ZMQ)
     find_package(Jansson REQUIRED)
     find_package(UUID REQUIRED)
 
-    if(NOT UUID_LIBRARY)
-        #i.e. not found for OSX
-        set(UUID_LIBRARY "")
-        set(UUID_INCLUDE_DIRS "")
-    endif()
-
     if (BUILD_ZMQ_SECURITY)
         add_definitions(-DBUILD_WITH_ZMQ_SECURITY=1)
 
@@ -54,13 +48,9 @@ if (BUILD_PUBSUB_PSA_ZMQ)
     target_link_libraries(celix_pubsub_admin_zmq PRIVATE
             Celix::pubsub_spi
             Celix::framework Celix::dfi Celix::log_helper Celix::utils
-            ${ZMQ_LIBRARIES} ${CZMQ_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY}
+            ZMQ::lib CZMQ::lib OPENSSL::lib
     )
     target_include_directories(celix_pubsub_admin_zmq PRIVATE
-        ${ZMQ_INCLUDE_DIR}
-        ${CZMQ_INCLUDE_DIR}
-        ${JANSSON_INCLUDE_DIR}
-        ${UUID_INCLUDE_DIRS}
         src
     )
 
diff --git a/bundles/pubsub/pubsub_discovery/CMakeLists.txt b/bundles/pubsub/pubsub_discovery/CMakeLists.txt
index 0d48101..5d51ff1 100644
--- a/bundles/pubsub/pubsub_discovery/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_discovery/CMakeLists.txt
@@ -27,14 +27,10 @@ add_celix_bundle(celix_pubsub_discovery_etcd
         src/pubsub_discovery_impl.c
 )
 target_include_directories(celix_pubsub_discovery_etcd PRIVATE src)
-target_include_directories(celix_pubsub_discovery_etcd SYSTEM PRIVATE 
-    ${CURL_INCLUDE_DIR}
-    ${JANSSON_INCLUDE_DIR}
-)
 target_link_libraries(celix_pubsub_discovery_etcd PRIVATE
         Celix::pubsub_spi Celix::framework Celix::etcdlib_static
         Celix::shell_api Celix::log_helper
-        ${CURL_LIBRARY} ${JANSSON_LIBRARIES})
+        CURL::libcurl JANSSON::lib)
 
 install_celix_bundle(celix_pubsub_discovery_etcd EXPORT celix COMPONENT pubsub)
 
diff --git a/bundles/pubsub/pubsub_serializer_json/CMakeLists.txt b/bundles/pubsub/pubsub_serializer_json/CMakeLists.txt
index 0231d81..8764f6f 100644
--- a/bundles/pubsub/pubsub_serializer_json/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_serializer_json/CMakeLists.txt
@@ -28,10 +28,9 @@ add_celix_bundle(celix_pubsub_serializer_json
 )
 target_include_directories(celix_pubsub_serializer_json PRIVATE
     src
-    ${JANSSON_INCLUDE_DIR}
 )
 set_target_properties(celix_pubsub_serializer_json PROPERTIES INSTALL_RPATH "$ORIGIN")
-target_link_libraries(celix_pubsub_serializer_json PRIVATE Celix::pubsub_spi Celix::framework Celix::dfi ${JANSSON_LIBRARIES} Celix::log_helper)
+target_link_libraries(celix_pubsub_serializer_json PRIVATE Celix::pubsub_spi Celix::framework Celix::dfi JANSSON::lib Celix::log_helper)
 
 install_celix_bundle(celix_pubsub_serializer_json EXPORT celix COMPONENT pubsub)
 
diff --git a/bundles/pubsub/pubsub_spi/CMakeLists.txt b/bundles/pubsub/pubsub_spi/CMakeLists.txt
index ffb9625..9ac6835 100644
--- a/bundles/pubsub/pubsub_spi/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_spi/CMakeLists.txt
@@ -17,19 +17,13 @@
 
 find_package(UUID REQUIRED)
 
-if(NOT UUID_LIBRARY)
-    #i.e. not found for OSX
-    set(UUID_LIBRARY "")
-    set(UUID_INCLUDE_DIRS "")
-endif()
-
 add_library(pubsub_spi STATIC
         src/pubsub_utils_match.c
         src/pubsub_endpoint.c
         src/pubsub_utils.c
         src/pubsub_admin_metrics.c
 )
-target_include_directories(pubsub_spi SYSTEM PRIVATE ${UUID_INCLUDE_DIRS})
+
 set_target_properties(pubsub_spi PROPERTIES OUTPUT_NAME "celix_pubsub_spi")
 target_include_directories(pubsub_spi PUBLIC
         $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
diff --git a/bundles/pubsub/pubsub_topology_manager/CMakeLists.txt b/bundles/pubsub/pubsub_topology_manager/CMakeLists.txt
index 1f2e1b9..5d9058e 100644
--- a/bundles/pubsub/pubsub_topology_manager/CMakeLists.txt
+++ b/bundles/pubsub/pubsub_topology_manager/CMakeLists.txt
@@ -17,12 +17,6 @@
 
 find_package(UUID REQUIRED)
 
-if(NOT UUID_LIBRARY)
-    #i.e. not found for OSX
-    set(UUID_LIBRARY "")
-    set(UUID_INCLUDE_DIRS "")
-endif()
-
 add_celix_bundle(celix_pubsub_topology_manager
     BUNDLE_SYMBOLICNAME "apache_celix_pubsub_topology_manager"
     VERSION "1.0.0"
@@ -33,7 +27,7 @@ add_celix_bundle(celix_pubsub_topology_manager
         src/pubsub_topology_manager.h
 )
 target_link_libraries(celix_pubsub_topology_manager PRIVATE Celix::framework Celix::log_helper Celix::pubsub_spi Celix::shell_api)
-target_include_directories(celix_pubsub_topology_manager PRIVATE ${UUID_INCLUDE_DIRS})
+target_link_libraries(celix_pubsub_topology_manager PRIVATE UUID::lib)
 
 get_target_property(DESC Celix::pubsub_spi TOPIC_INFO_DESCRIPTOR)
 celix_bundle_files(celix_pubsub_topology_manager
diff --git a/bundles/pubsub/test/CMakeLists.txt b/bundles/pubsub/test/CMakeLists.txt
index 7820dfa..641f2ba 100644
--- a/bundles/pubsub/test/CMakeLists.txt
+++ b/bundles/pubsub/test/CMakeLists.txt
@@ -120,7 +120,7 @@ add_celix_container(pubsub_udpmc_tests
             pubsub_sut
             pubsub_tst
 )
-target_link_libraries(pubsub_udpmc_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} ${JANSSON_LIBRARIES} Celix::dfi)
+target_link_libraries(pubsub_udpmc_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} JANSSON::lib Celix::dfi)
 target_include_directories(pubsub_udpmc_tests PRIVATE ${CPPUTEST_INCLUDE_DIR} test)
 message(WARNING "TODO fix issues with UDPMC and reanble test again")
 #add_test(NAME pubsub_udpmc_tests COMMAND pubsub_udpmc_tests WORKING_DIRECTORY $<TARGET_PROPERTY:pubsub_udpmc_tests,CONTAINER_LOC>)
@@ -141,7 +141,7 @@ add_celix_container(pubsub_tcp_tests
         pubsub_sut
         pubsub_tst
         )
-target_link_libraries(pubsub_tcp_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} ${JANSSON_LIBRARIES} Celix::dfi)
+target_link_libraries(pubsub_tcp_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} JANSSON::lib Celix::dfi)
 target_include_directories(pubsub_tcp_tests PRIVATE ${CPPUTEST_INCLUDE_DIR} test)
 add_test(NAME pubsub_tcp_tests COMMAND pubsub_tcp_tests WORKING_DIRECTORY $<TARGET_PROPERTY:pubsub_tcp_tests,CONTAINER_LOC>)
 SETUP_TARGET_FOR_COVERAGE(pubsub_tcp_tests_cov pubsub_tcp_tests ${CMAKE_BINARY_DIR}/coverage/pubsub_tcp_tests/pubsub_tcp_tests ..)
@@ -163,7 +163,7 @@ add_celix_container(pubsub_tcp_endpoint_tests
         pubsub_endpoint_sut
         pubsub_endpoint_tst
         )
-target_link_libraries(pubsub_tcp_endpoint_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} ${JANSSON_LIBRARIES} Celix::dfi)
+target_link_libraries(pubsub_tcp_endpoint_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} JANSSON::lib Celix::dfi)
 target_include_directories(pubsub_tcp_endpoint_tests PRIVATE ${CPPUTEST_INCLUDE_DIR} test)
 
 #TCP Endpoint test is disabled because the test is not stable when running on Travis
@@ -188,7 +188,7 @@ add_celix_container(pubsub_websocket_tests
             pubsub_sut
             pubsub_tst
 )
-target_link_libraries(pubsub_websocket_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} ${JANSSON_LIBRARIES} Celix::dfi)
+target_link_libraries(pubsub_websocket_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} JANSSON::lib Celix::dfi)
 target_include_directories(pubsub_websocket_tests PRIVATE ${CPPUTEST_INCLUDE_DIR} test)
 add_test(NAME pubsub_websocket_tests COMMAND pubsub_websocket_tests WORKING_DIRECTORY $<TARGET_PROPERTY:pubsub_websocket_tests,CONTAINER_LOC>)
 SETUP_TARGET_FOR_COVERAGE(pubsub_websocket_tests_cov pubsub_websocket_tests ${CMAKE_BINARY_DIR}/coverage/pubsub_websocket_tests/pubsub_websocket_tests ..)
@@ -208,7 +208,7 @@ if (BUILD_PUBSUB_PSA_ZMQ)
                 pubsub_tst
     )
 
-    target_link_libraries(pubsub_zmq_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} ${JANSSON_LIBRARIES} Celix::dfi)
+    target_link_libraries(pubsub_zmq_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} JANSSON::lib Celix::dfi)
     target_include_directories(pubsub_zmq_tests PRIVATE ${CPPUTEST_INCLUDE_DIR} test)
     add_test(NAME pubsub_zmq_tests COMMAND pubsub_zmq_tests WORKING_DIRECTORY $<TARGET_PROPERTY:pubsub_zmq_tests,CONTAINER_LOC>)
     SETUP_TARGET_FOR_COVERAGE(pubsub_zmq_tests_cov pubsub_zmq_tests ${CMAKE_BINARY_DIR}/coverage/pubsub_zmq_tests/pubsub_zmq_tests ..)
@@ -228,7 +228,7 @@ if (BUILD_PUBSUB_PSA_ZMQ)
                 pubsub_sut
                 pubsub_tst
     )
-    target_link_libraries(pubsub_zmq_zerocopy_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} ${JANSSON_LIBRARIES} Celix::dfi)
+    target_link_libraries(pubsub_zmq_zerocopy_tests PRIVATE Celix::pubsub_api ${CPPUTEST_LIBRARIES} JANSSON::lib Celix::dfi)
     target_include_directories(pubsub_zmq_zerocopy_tests PRIVATE ${CPPUTEST_INCLUDE_DIR} test)
     add_test(NAME pubsub_zmq_zerocopy_tests COMMAND pubsub_zmq_zerocopy_tests WORKING_DIRECTORY $<TARGET_PROPERTY:pubsub_zmq_zerocopy_tests,CONTAINER_LOC>)
     SETUP_TARGET_FOR_COVERAGE(pubsub_zmq_zerocopy_tests_cov pubsub_zmq_zerocopy_tests ${CMAKE_BINARY_DIR}/coverage/pubsub_zmq_tests/pubsub_zmq_zerocopy_tests ..)
diff --git a/bundles/remote_services/discovery_configured/CMakeLists.txt b/bundles/remote_services/discovery_configured/CMakeLists.txt
index 273fa2a..15bb1d4 100644
--- a/bundles/remote_services/discovery_configured/CMakeLists.txt
+++ b/bundles/remote_services/discovery_configured/CMakeLists.txt
@@ -34,7 +34,7 @@ if (RSA_DISCOVERY_CONFIGURED)
             $<TARGET_PROPERTY:Celix::rsa_discovery_common,INCLUDE_DIRECTORIES>
             $<TARGET_PROPERTY:Celix::civetweb,INCLUDE_DIRECTORIES>
     )
-    target_link_libraries(rsa_discovery_configured PRIVATE ${CURL_LIBRARY} ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARY} Celix::log_helper Celix::rsa_common)
+    target_link_libraries(rsa_discovery_configured PRIVATE CURL::libcurl ${LIBXML2_LIBRARIES} Celix::log_helper Celix::rsa_common)
 
     install_celix_bundle(rsa_discovery_configured EXPORT celix COMPONENT rsa)
     #Setup target aliases to match external usage
diff --git a/bundles/remote_services/discovery_etcd/CMakeLists.txt b/bundles/remote_services/discovery_etcd/CMakeLists.txt
index e8608d8..76117e7 100644
--- a/bundles/remote_services/discovery_etcd/CMakeLists.txt
+++ b/bundles/remote_services/discovery_etcd/CMakeLists.txt
@@ -41,10 +41,9 @@ if (RSA_DISCOVERY_ETCD)
 	)
         target_include_directories(rsa_discovery_etcd SYSTEM PRIVATE
 			${CURL_INCLUDE_DIR}
-			${JANSSON_INCLUDE_DIR}
 			${LIBXML2_INCLUDE_DIR}
 	)
-	target_link_libraries(rsa_discovery_etcd PRIVATE ${CURL_LIBRARY} ${LIBXML2_LIBRARIES} ${JANSSON_LIBRARIES} ${OPENSSL_LIBRARY})
+	target_link_libraries(rsa_discovery_etcd PRIVATE CURL::libcurl ${LIBXML2_LIBRARIES} JANSSON::lib)
 
 	install_celix_bundle(rsa_discovery_etcd EXPORT celix COMPONENT rsa)
 	#Setup target aliases to match external usage
diff --git a/bundles/remote_services/discovery_shm/CMakeLists.txt b/bundles/remote_services/discovery_shm/CMakeLists.txt
index 8ea0707..1c3b786 100644
--- a/bundles/remote_services/discovery_shm/CMakeLists.txt
+++ b/bundles/remote_services/discovery_shm/CMakeLists.txt
@@ -39,7 +39,7 @@ if (RSA_DISCOVERY_SHM)
 			$<TARGET_PROPERTY:Celix::rsa_discovery_common,INCLUDE_DIRECTORIES>
 			$<TARGET_PROPERTY:Celix::civetweb,INCLUDE_DIRECTORIES>
 	)
-	target_link_libraries(rsa_discovery_shm PRIVATE Celix::framework ${CURL_LIBRARY} ${LIBXML2_LIBRARIES})
+	target_link_libraries(rsa_discovery_shm PRIVATE Celix::framework CURL::libcurl ${LIBXML2_LIBRARIES})
 
 	install_celix_bundle(rsa_discovery_shm EXPORT celix COMPONENT rsa)
 
diff --git a/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt b/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt
index 5679611..a6d46ae 100644
--- a/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt
@@ -25,12 +25,6 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI)
     find_package(Jansson REQUIRED)
     find_package(UUID REQUIRED)
 
-    if(NOT UUID_LIBRARY)
-        #i.e. not found for OSX
-        set(UUID_LIBRARY "")
-        set(UUID_INCLUDE_DIRS "")
-    endif()
-
     add_celix_bundle(rsa_dfi
             VERSION 0.9.0
             SYMBOLIC_NAME "apache_celix_remote_service_admin_dfi"
@@ -46,12 +40,13 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI)
     )
     celix_bundle_private_libs(rsa_dfi Celix::dfi)
     target_include_directories(rsa_dfi PRIVATE $<TARGET_PROPERTY:Celix::civetweb,INCLUDE_DIRECTORIES>)
-    target_include_directories(rsa_dfi SYSTEM PRIVATE ${CURL_INCLUDE_DIRS} ${JANSSON_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS})
     target_link_libraries(rsa_dfi PRIVATE
             Celix::dfi
             Celix::log_helper
             Celix::rsa_common
-            ${CURL_LIBRARY} ${JANSSON_LIBRARIES} ${OPENSSL_LIBRARY})
+            CURL::libcurl
+            JANSSON::lib
+    )
 
     if (ENABLE_TESTING)
         add_subdirectory(test)
diff --git a/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt b/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt
index 9790181..20efa08 100644
--- a/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt
@@ -34,7 +34,7 @@ add_executable(test_rsa_dfi
     src/rsa_client_server_tests.cpp
 )
 target_include_directories(test_rsa_dfi PRIVATE src)
-target_link_libraries(test_rsa_dfi PRIVATE ${CURL_LIBRARY} ${CPPUTEST_LIBRARY}
+target_link_libraries(test_rsa_dfi PRIVATE CURL::libcurl ${CPPUTEST_LIBRARY}
         Celix::framework
         Celix::rsa_common
         calculator_api)
diff --git a/bundles/remote_services/remote_service_admin_shm/CMakeLists.txt b/bundles/remote_services/remote_service_admin_shm/CMakeLists.txt
index a5a708b..58d6a6f 100644
--- a/bundles/remote_services/remote_service_admin_shm/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_shm/CMakeLists.txt
@@ -32,7 +32,6 @@ if (RSA_REMOTE_SERVICE_ADMIN_SHM)
 	include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin_shm/public/include")
 	include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin_shm/private/include")
 	include_directories("${PROJECT_SOURCE_DIR}/remote_services/endpoint_listener/public/include")
-	include_directories(${UUID_INCLUDE_DIRS})
 
 	add_celix_bundle(remote_service_admin_shm
         VERSION 0.9.0
@@ -47,7 +46,7 @@ if (RSA_REMOTE_SERVICE_ADMIN_SHM)
         ${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/import_registration_impl
         ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
 	)
-	target_link_libraries(remote_service_admin_shm celix_framework)
+	target_link_libraries(remote_service_admin_shm Celix::framework)
 
        install_celix_bundle(remote_service_admin_shm EXPORT celix COMPONENT rsa)
        add_library(Celix::remote_service_admin_shm ALIAS remote_service_admin_shm)
diff --git a/bundles/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt b/bundles/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
index e43cede..44bd290 100644
--- a/bundles/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_shm/private/test/CMakeLists.txt
@@ -35,7 +35,7 @@ add_executable(test_rsa_shm
 
     ${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/private/src/endpoint_description.c
 )
-target_link_libraries(test_rsa_shm celix_framework celix_utils ${CURL_LIBRARY} ${CPPUTEST_LIBRARY})
+target_link_libraries(test_rsa_shm celix_framework celix_utils CURL::libcurl ${CPPUTEST_LIBRARY})
 
 get_property(rsa_bundle_file TARGET remote_service_admin_shm PROPERTY BUNDLE_FILE)
 get_property(calc_bundle_file TARGET calculator PROPERTY BUNDLE_FILE)
diff --git a/bundles/remote_services/topology_manager/CMakeLists.txt b/bundles/remote_services/topology_manager/CMakeLists.txt
index 8343d9f..8f56a13 100644
--- a/bundles/remote_services/topology_manager/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/CMakeLists.txt
@@ -36,7 +36,6 @@ if (RSA_TOPOLOGY_MANAGER)
         find_package(CppUTest REQUIRED)
 	    find_package(Jansson REQUIRED)
 
-        include_directories("${JANSSON_INCLUDE_DIR}")
         include_directories("${CPPUTEST_INCLUDE_DIR}")
         include_directories("${CPPUTEST_EXT_INCLUDE_DIR}")
         add_subdirectory(tms_tst)
diff --git a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
index fc0a016..f29b8ae 100644
--- a/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
+++ b/bundles/remote_services/topology_manager/tms_tst/CMakeLists.txt
@@ -41,7 +41,7 @@ target_include_directories(test_tm_scoped PRIVATE ../src ../include)
 target_link_libraries(test_tm_scoped PRIVATE
         Celix::framework
         ${CPPUTEST_LIBRARY}
-        ${JANSSON_LIBRARY}
+        JANSSON::lib
         calculator_api
         Celix::rsa_common
 )
diff --git a/bundles/shell/shell/CMakeLists.txt b/bundles/shell/shell/CMakeLists.txt
index 963e4ad..6c0f22d 100644
--- a/bundles/shell/shell/CMakeLists.txt
+++ b/bundles/shell/shell/CMakeLists.txt
@@ -47,8 +47,7 @@ if (SHELL)
 		  src/dm_shell_list_command
 	)
 	target_include_directories(shell PRIVATE src)
-	target_include_directories(shell SYSTEM PRIVATE	${CURL_INCLUDE_DIRS})
-	target_link_libraries(shell PRIVATE Celix::shell_api ${CURL_LIBRARY} ${OPENSSL_LIBRARY} Celix::log_service_api Celix::log_helper)
+	target_link_libraries(shell PRIVATE Celix::shell_api CURL::libcurl Celix::log_service_api Celix::log_helper)
 
 	install_celix_bundle(shell EXPORT celix COMPONENT shell)
 
diff --git a/cmake/CelixConfig.cmake b/cmake/CelixConfig.cmake
index 5dae9be..c3d0d19 100644
--- a/cmake/CelixConfig.cmake
+++ b/cmake/CelixConfig.cmake
@@ -28,6 +28,34 @@ get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH)
 get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH)
 get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH)
 
+set(CMAKE_PREFIX_PATH "${${REL_INSTALL_DIR}/share/celix/cmake/Modules}:${CMAKE_PREFIX_PATH}")
+
+#find required packages
+find_package(CURL REQUIRED) #framework, etcdlib
+find_package(ZLIB REQUIRED) #framework
+find_package(UUID REQUIRED) #framework
+find_package(JANSSON REQUIRED) #etcdlib, dfi
+find_package(FFI REQUIRED) #dfi
+
+if (NOT TARGET ZLIB::ZLIB)
+  message("Note ZLIB::ZLIB target not created by find_package(ZLIB). Creating one")
+  add_library(ZLIB::ZLIB SHARED IMPORTED)
+  set_target_properties(ZLIB::ZLIB PROPERTIES
+        IMPORTED_LOCATION "${ZLIB_LIBRARIES}"
+        INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}"
+  )
+endif ()
+
+if (NOT TARGET CURL::libcurl)
+  message("Note CURL::libcurl target not created by find_package(CURL). Creating one")
+  add_library(CURL::libcurl SHARED IMPORTED)
+  set_target_properties(CURL::libcurl PROPERTIES
+          IMPORTED_LOCATION "${CURL_LIBRARIES}"
+          INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
+  )
+endif ()
+
+
 include("${REL_INSTALL_DIR}/share/celix/cmake/cmake_celix/UseCelix.cmake") #adds celix commands (e.g. add_celix_bundle)
 include("${REL_INSTALL_DIR}/share/celix/cmake/Targets.cmake") #imports lib and exe targets (e.g. Celix::framework)
 include("${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake") #imports bundle targets (e.g. Celix::shell)
diff --git a/cmake/Modules/FindCZMQ.cmake b/cmake/Modules/FindCZMQ.cmake
index 4f4891c..30b1bb0 100644
--- a/cmake/Modules/FindCZMQ.cmake
+++ b/cmake/Modules/FindCZMQ.cmake
@@ -22,6 +22,7 @@
 #  CZMQ_INCLUDE_DIRS - The Zmq include directories
 #  CZMQ_LIBRARIES - The libraries needed to use Zmq
 #  CZMQ_DEFINITIONS - Compiler switches required for using Zmq
+#  CZMQ::lib - Imported CMake target for the library (include path + library)
 
 find_path(CZMQ_INCLUDE_DIR czmq.h
           /usr/include
@@ -39,4 +40,12 @@ include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Czmq  DEFAULT_MSG
                                   CZMQ_LIBRARY CZMQ_INCLUDE_DIR)
 
-mark_as_advanced(CZMQ_INCLUDE_DIR CZMQ_LIBRARY )
+mark_as_advanced(CZMQ_INCLUDE_DIR CZMQ_LIBRARY)
+
+if (CZMQ_FOUND AND NOT TARGET CZMQ::lib)
+    add_library(CZMQ::lib SHARED IMPORTED)
+    set_target_properties(CZMQ::lib PROPERTIES
+            IMPORTED_LOCATION "${CZMQ_LIBRARY}"
+            INTERFACE_INCLUDE_DIRECTORIES "${CZMQ_INCLUDE_DIR}"
+    )
+endif ()
diff --git a/cmake/Modules/FindFFI.cmake b/cmake/Modules/FindFFI.cmake
index 2da10d1..cb07ec4 100644
--- a/cmake/Modules/FindFFI.cmake
+++ b/cmake/Modules/FindFFI.cmake
@@ -19,7 +19,7 @@
 #
 # Once done this will define
 #  FFI_FOUND - System has libffi
-#  ffi::lib - Imported target for the libffi
+#  FFI::lib - Imported target for the libffi
 
 # try using pkg-config if available
 find_package(PkgConfig QUIET)
@@ -44,47 +44,40 @@ if (PkgConfig_FOUND)
     if (NOT FFI_ABS_LIB)
         message(WARNING "Cannot find abs path of libffi based on pkgconfig results. Tried to find libffi @ '${PC_LIBFFI_LIBRARY_DIRS}' and '${PC_LIBFFI_LIBDIR}'")
     else()    
-        set(LIBFFI_LIB_ADDED TRUE)
-        add_library(ffi::lib SHARED IMPORTED)
-        set_target_properties(ffi::lib PROPERTIES
-            IMPORTED_LOCATION "${FFI_ABS_LIB}"
-            INTERFACE_INCLUDE_DIRECTORIES "${PC_LIBFFI_INCLUDE_DIRS}"
-        )
+        unset(FFI_ABS_LIB)
     endif()
-
-    unset(FFI_ABS_LIB)
 endif()
 
-if (NOT LIBFFI_LIB_ADDED)
-    mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
+mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)
 
-    find_library(FFI_LIBRARY NAMES ffi libffi
-        PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local
-        PATH_SUFFIXES lib lib64 x86_64-linux-gnu lib/x86_64-linux-gnu
-        HINTS ${PC_LIBFFI_LIBDIR} ${PC_LIBFFI_LIBRARY_DIRS}
-    )
+find_library(FFI_LIBRARY NAMES ffi libffi
+    PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local
+    PATH_SUFFIXES lib lib64 x86_64-linux-gnu lib/x86_64-linux-gnu
+    HINTS ${PC_LIBFFI_LIBDIR} ${PC_LIBFFI_LIBRARY_DIRS}
+)
 
-    find_path(FFI_INCLUDE_DIR ffi.h
-         PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local 
-         PATH_SUFFIXES include include/ffi include/x86_64-linux-gnu x86_64-linux-gnu
-         HINTS ${PC_LIBFFI_INCLUDEDIR} ${PC_LIBFFI_INCLUDE_DIRS}
-    )
+find_path(FFI_INCLUDE_DIR ffi.h
+     PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local
+     PATH_SUFFIXES include include/ffi include/x86_64-linux-gnu x86_64-linux-gnu
+     HINTS ${PC_LIBFFI_INCLUDEDIR} ${PC_LIBFFI_INCLUDE_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set FFI_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(FFI DEFAULT_MSG
+                                  FFI_LIBRARY FFI_INCLUDE_DIR)
+mark_as_advanced(FFI_INCLUDE_DIR FFI_LIBRARY)
 
-    include(FindPackageHandleStandardArgs)
-    # handle the QUIETLY and REQUIRED arguments and set FFI_FOUND to TRUE
-    # if all listed variables are TRUE
-    find_package_handle_standard_args(FFI DEFAULT_MSG
-                                      FFI_LIBRARY FFI_INCLUDE_DIR)
-    mark_as_advanced(FFI_INCLUDE_DIR FFI_LIBRARY) 
+set(FFI_LIBRARIES ${FFI_LIBRARY})
+set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR})
 
-    if(FFI_FOUND)
-        set(FFI_LIBRARIES ${FFI_LIBRARY})
-        set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR})
 
-        add_library(ffi::lib SHARED IMPORTED)
-        set_target_properties(ffi::lib PROPERTIES
+if(FFI_FOUND AND NOT TARGET FFI::lib)
+    add_library(FFI::lib SHARED IMPORTED)
+    set_target_properties(FFI::lib PROPERTIES
             IMPORTED_LOCATION "${FFI_LIBRARY}"
             INTERFACE_INCLUDE_DIRECTORIES "${FFI_INCLUDE_DIR}"
-        )
-    endif()
+    )
+
 endif()
diff --git a/cmake/Modules/FindJansson.cmake b/cmake/Modules/FindJansson.cmake
index bedf8be..8584dba 100644
--- a/cmake/Modules/FindJansson.cmake
+++ b/cmake/Modules/FindJansson.cmake
@@ -22,6 +22,7 @@
 #  JANSSON_INCLUDE_DIRS - The Jansson include directories
 #  JANSSON_LIBRARIES - The libraries needed to use Jansson
 #  JANSSON_DEFINITIONS - Compiler switches required for using Jansson
+#  JANSSON::lib - Imported target for Jansson
 
 find_path(JANSSON_INCLUDE_DIR jansson.h
           /usr/include
@@ -39,4 +40,13 @@ include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Jansson  DEFAULT_MSG
                                   JANSSON_LIBRARY JANSSON_INCLUDE_DIR)
 
-mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY )
\ No newline at end of file
+mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY)
+
+if (JANSSON_FOUND AND NOT TARGET JANSSON::lib)
+    add_library(JANSSON::lib SHARED IMPORTED)
+    set_target_properties(JANSSON::lib PROPERTIES
+            IMPORTED_LOCATION "${JANSSON_LIBRARY}"
+            INTERFACE_INCLUDE_DIRECTORIES "${JANSSON_INCLUDE_DIR}"
+    )
+
+endif ()
diff --git a/cmake/Modules/FindNanoMsg.cmake b/cmake/Modules/FindNanoMsg.cmake
index 79d68c5..8bac2e2 100644
--- a/cmake/Modules/FindNanoMsg.cmake
+++ b/cmake/Modules/FindNanoMsg.cmake
@@ -18,10 +18,10 @@
 
 # - Try to find ZMQ
 # 	Once done this will define
-#  ZMQ_FOUND - System has Zmq
-#  ZMQ_INCLUDE_DIRS - The Zmq include directories
-#  ZMQ_LIBRARIES - The libraries needed to use Zmq
-#  ZMQ_DEFINITIONS - Compiler switches required for using Zmq
+#  NANOMSG_FOUND - System has Nanomsg
+#  NANOMSG_INCLUDE_DIRS - The Nanomsg include directories
+#  NANOMSG_LIBRARIES - The libraries needed to use Nanomsg
+#  NANOMSG::lib - Imported target for Nanomsg
 
 find_path(NANOMSG_INCLUDE_DIR nanomsg/nn.h
           /usr/include
@@ -40,3 +40,11 @@ find_package_handle_standard_args(NanoMsg  DEFAULT_MSG
                                   NANOMSG_LIBRARY NANOMSG_INCLUDE_DIR)
 
 mark_as_advanced(NANOMSG_INCLUDE_DIR NANOMSG_LIBRARY )
+
+if (NANOMSG_FOUND AND NOT TARGET NANOMSG::lib)
+    add_library(NANOMSG::lib SHARED IMPORTED)
+    set_target_properties(NANOMSG::lib PROPERTIES
+            IMPORTED_LOCATION "${NANOMSG_LIBRARY}"
+            INTERFACE_INCLUDE_DIRECTORIES "${NANOMSG_INCLUDE_DIR}"
+    )
+endif ()
\ No newline at end of file
diff --git a/cmake/Modules/FindOpenSSL.cmake b/cmake/Modules/FindOpenSSL.cmake
index 9b37bf4..fc14cb6 100644
--- a/cmake/Modules/FindOpenSSL.cmake
+++ b/cmake/Modules/FindOpenSSL.cmake
@@ -22,6 +22,7 @@
 #  OPENSSL_INCLUDE_DIRS - The OpenSSL include directories
 #  OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
 #  OPENSSL_DEFINITIONS - Compiler switches required for using OpenSSL
+#  OPENSSL::lib - Imported target for OpenSSL
 
 find_path(OPENSSL_INCLUDE_DIR ssl.h crypto.h
           /usr/include/openssl
@@ -45,3 +46,11 @@ find_package_handle_standard_args(OpenSSL  DEFAULT_MSG
              OPENSSL_LIBRARY CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
 
 mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARY CRYPTO_LIBRARY)
+
+if (OPENSSL_FOUND AND NOT TARGET OPENSSL::lib)
+    add_library(OPENSSL::lib SHARED IMPORTED)
+    set_target_properties(OPENSSL::lib PROPERTIES
+            IMPORTED_LOCATION "${OPENSSL_LIBRARY};${CRYPTO_LIBRARY}"
+            INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}"
+    )
+endif ()
\ No newline at end of file
diff --git a/cmake/Modules/FindSlp.cmake b/cmake/Modules/FindSlp.cmake
deleted file mode 100644
index 3461456..0000000
--- a/cmake/Modules/FindSlp.cmake
+++ /dev/null
@@ -1,42 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-# - Try to find Slp
-# Once done this will define
-#  SLP_FOUND - System has Slp
-#  SLP_INCLUDE_DIRS - The Slp include directories
-#  SLP_LIBRARIES - The libraries needed to use Slp
-#  SLP_DEFINITIONS - Compiler switches required for using Slp
-
-find_path(SLP_INCLUDE_DIR slp.h
-          /usr/include
-          /usr/local/include )
-
-find_library(SLP_LIBRARY NAMES slp
-             PATHS /usr/lib /usr/local/lib )
-
-set(SLP_LIBRARIES ${SLP_LIBRARY} )
-set(SLP_INCLUDE_DIRS ${SLP_INCLUDE_DIR} )
-
-include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set SLP_FOUND to TRUE
-# if all listed variables are TRUE
-find_package_handle_standard_args(Slp  DEFAULT_MSG
-                                  SLP_LIBRARY SLP_INCLUDE_DIR)
-
-mark_as_advanced(SLP_INCLUDE_DIR SLP_LIBRARY )
\ No newline at end of file
diff --git a/cmake/Modules/FindSyslog.cmake b/cmake/Modules/FindSyslog.cmake
index 769b806..98002e5 100644
--- a/cmake/Modules/FindSyslog.cmake
+++ b/cmake/Modules/FindSyslog.cmake
@@ -15,6 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
+# - Try to find Syslog
+# Once done this will define
+#  SYSLOG_FOUND - System has Syslog
+#  JANSSON_INCLUDE_DIRS - The Syslog include directories
+#  SYSLOG::lib - Imported target for Syslog
 
 find_path(SYSLOG_INCLUDE_DIR syslog.h /usr/include)
 
@@ -23,4 +28,12 @@ include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Syslog DEFAULT_MSG
                                   SYSLOG_INCLUDE_DIR)
 
+set(SYSLOG_INCLUDE_DIRS ${SYSLOG_INCLUDE_DIR})
 mark_as_advanced(SYSLOG_INCLUDE_DIR)
+
+if (SYSLOG_FOUND AND NOT TARGET SYSLOG::lib)
+    add_library(SYSLOG::lib SHARED IMPORTED)
+    set_target_properties(SYSLOG::lib PROPERTIES
+            INTERFACE_INCLUDE_DIRECTORIES "${SYSLOG_INCLUDE_DIR}"
+    )
+endif ()
\ No newline at end of file
diff --git a/cmake/Modules/FindUUID.cmake b/cmake/Modules/FindUUID.cmake
index 952be1c..4ce72b4 100644
--- a/cmake/Modules/FindUUID.cmake
+++ b/cmake/Modules/FindUUID.cmake
@@ -15,25 +15,43 @@
 # specific language governing permissions and limitations
 # under the License.
 
+# - Try to find UUID
+# Once done this will define
+#  UUID_FOUND - System has UUID
+#  UUID_INCLUDE_DIRS - The UUID include directories
+#  UUID_LIBRARIES - The libraries needed to use UUID
+#  UUID::lib - Imported target for UUID
 
-find_path(UUID_INCLUDE_DIR uuid/uuid.h
-          /usr/include
-          /usr/local/include )
+if (APPLE)
+    set(UUID_INCLUDE_DIRS )
+    set(UUID_LIBRARIES )
 
-find_library(UUID_LIBRARY NAMES uuid
-             PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu)
+    find_package_handle_standard_args(UUID DEFAULT_MSG)
 
-include(FindPackageHandleStandardArgs)
-if (APPLE)
-find_package_handle_standard_args(UUID  DEFAULT_MSG
-                                  UUID_INCLUDE_DIR)
+    if (NOT TARGET UUID::lib)
+        add_library(UUID::lib INTERFACE IMPORTED)
+    endif ()
 else ()
-find_package_handle_standard_args(UUID  DEFAULT_MSG
-                                  UUID_LIBRARY UUID_INCLUDE_DIR)
-endif ()
 
+    find_path(UUID_INCLUDE_DIR uuid/uuid.h
+              /usr/include
+              /usr/local/include )
+
+    find_library(UUID_LIBRARY NAMES uuid
+                 PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu)
 
-mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY)
-set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
-set(UUID_LIBRARIES ${UUID_LIBRARY})
+    include(FindPackageHandleStandardArgs)
+    find_package_handle_standard_args(UUID DEFAULT_MSG
+                                      UUID_LIBRARY UUID_INCLUDE_DIR)
 
+    mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY)
+    set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
+    set(UUID_LIBRARIES ${UUID_LIBRARY})
+    if (UUID_FOUND AND NOT TARGET UUID::lib)
+        add_library(UUID::lib SHARED IMPORTED)
+        set_target_properties(UUID::lib PROPERTIES
+                IMPORTED_LOCATION "${UUID_LIBRARY}"
+                INTERFACE_INCLUDE_DIRECTORIES "${UUID_INCLUDE_DIR}"
+        )
+    endif ()
+endif ()
\ No newline at end of file
diff --git a/cmake/Modules/FindZMQ.cmake b/cmake/Modules/FindZMQ.cmake
index b2c2663..0a7c33c 100644
--- a/cmake/Modules/FindZMQ.cmake
+++ b/cmake/Modules/FindZMQ.cmake
@@ -22,6 +22,7 @@
 #  ZMQ_INCLUDE_DIRS - The Zmq include directories
 #  ZMQ_LIBRARIES - The libraries needed to use Zmq
 #  ZMQ_DEFINITIONS - Compiler switches required for using Zmq
+#  ZMQ::lib - Imported target for UUID
 
 find_path(ZMQ_INCLUDE_DIR zmq.h zmq_utils.h
           /usr/include
@@ -40,3 +41,11 @@ find_package_handle_standard_args(Zmq  DEFAULT_MSG
                                   ZMQ_LIBRARY ZMQ_INCLUDE_DIR)
 
 mark_as_advanced(ZMQ_INCLUDE_DIR ZMQ_LIBRARY )
+
+if (ZMQ_FOUND AND NOT TARGET ZMQ::lib)
+    add_library(ZMQ::lib SHARED IMPORTED)
+    set_target_properties(ZMQ::lib PROPERTIES
+            IMPORTED_LOCATION "${ZMQ_LIBRARY}"
+            INTERFACE_INCLUDE_DIRECTORIES "${ZMQ_INCLUDE_DIR}"
+    )
+endif ()
\ No newline at end of file
diff --git a/libs/dfi/CMakeLists.txt b/libs/dfi/CMakeLists.txt
index 6b32a54..cd76e86 100644
--- a/libs/dfi/CMakeLists.txt
+++ b/libs/dfi/CMakeLists.txt
@@ -39,12 +39,8 @@ target_include_directories(dfi PUBLIC
 	$<INSTALL_INTERFACE:include/celix/dfi>
 )
 
-target_include_directories(dfi SYSTEM PRIVATE
-		${JANSSON_INCLUDE_DIRS}
-)
-target_link_libraries(dfi PRIVATE ffi::lib)
-target_include_directories(dfi SYSTEM PRIVATE)
-target_link_libraries(dfi PRIVATE ${JANSSON_LIBRARY})
+target_link_libraries(dfi PRIVATE FFI::lib)
+target_link_libraries(dfi PUBLIC JANSSON::lib)
 target_link_libraries(dfi PRIVATE Celix::utils)
 set_target_properties(dfi PROPERTIES "SOVERSION" 1)
 
@@ -72,8 +68,7 @@ if (ENABLE_TESTING)
 		test/run_tests.cpp
 	)
 
-    target_link_libraries(test_dfi PRIVATE Celix::dfi Celix::utils ffi::lib ${JANSSON_LIBRARY} ${CPPUTEST_LIBRARIES})
-    target_include_directories(test_dfi PRIVATE ${JANSSON_INCLUDE_DIRS})
+    target_link_libraries(test_dfi PRIVATE Celix::dfi Celix::utils FFI::lib JANSSON::lib ${CPPUTEST_LIBRARIES})
 
     file(COPY ${CMAKE_CURRENT_LIST_DIR}/test/schemas DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
     file(COPY ${CMAKE_CURRENT_LIST_DIR}/test/descriptors DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt
index 9fff290..faf8129 100644
--- a/libs/etcdlib/CMakeLists.txt
+++ b/libs/etcdlib/CMakeLists.txt
@@ -50,14 +50,10 @@ target_include_directories(etcdlib PUBLIC
     $<INSTALL_INTERFACE:include/etcdlib>
 )
 target_include_directories(etcdlib PRIVATE src)
-target_include_directories(etcdlib SYSTEM PRIVATE 
-    ${CURL_INCLUDE_DIRS}
-    ${JANSSON_INCLUDE_DIRS}
-)
 
 set_target_properties(etcdlib PROPERTIES SOVERSION 1)
 set_target_properties(etcdlib PROPERTIES VERSION 1.0.0)
-target_link_libraries(etcdlib PRIVATE ${CURL_LIBRARY} ${JANSSON_LIBRARIES} ${OPENSSL_LIBRARY})
+target_link_libraries(etcdlib PUBLIC CURL::libcurl JANSSON::lib)
 
 add_library(etcdlib_static STATIC
     src/etcd.c
@@ -67,15 +63,11 @@ target_include_directories(etcdlib_static PUBLIC
     $<INSTALL_INTERFACE:include/etcdlib>
 )
 target_include_directories(etcdlib_static PRIVATE src)
-target_include_directories(etcdlib_static SYSTEM PRIVATE 
-    ${CURL_INCLUDE_DIRS}
-    ${JANSSON_INCLUDE_DIRS}
-)
 set_target_properties(etcdlib_static PROPERTIES "SOVERSION" 1)
-target_link_libraries(etcdlib_static PRIVATE ${CURL_LIBRARY} ${JANSSON_LIBRARY})
+target_link_libraries(etcdlib_static PUBLIC CURL::libcurl JANSSON::lib)
 
 add_executable(etcdlib_test ${CMAKE_CURRENT_SOURCE_DIR}/test/etcdlib_test.c)
-target_link_libraries(etcdlib_test PRIVATE etcdlib_static ${CURL_LIBRARY} ${JANSSON_LIBRARY} ${OPENSSL_LIBRARY})
+target_link_libraries(etcdlib_test PRIVATE etcdlib_static CURL::libcurl JANSSON::lib)
 
 #TODO install etcdlib_static. For now left out, because the imported target leaks library paths
 install(DIRECTORY api/ DESTINATION include/etcdlib COMPONENT ${ETCDLIB_CMP})
diff --git a/libs/framework/CMakeLists.txt b/libs/framework/CMakeLists.txt
index b804a8d..d7da72e 100644
--- a/libs/framework/CMakeLists.txt
+++ b/libs/framework/CMakeLists.txt
@@ -20,12 +20,6 @@ find_package(UUID REQUIRED)
 find_package(CURL REQUIRED)
 find_package(OpenSSL REQUIRED)
 
-if(NOT UUID_LIBRARY)
-    #i.e. not found for OSX
-    set(UUID_LIBRARY "")
-    set(UUID_INCLUDE_DIRS "")
-endif()
-
 set(SOURCES
         src/attribute.c src/bundle.c src/bundle_archive.c src/bundle_cache.c
         src/bundle_context.c src/bundle_revision.c src/capability.c src/celix_errorcodes.c
@@ -41,15 +35,14 @@ set(SOURCES
 )
 add_library(framework SHARED ${SOURCES})
 set_target_properties(framework PROPERTIES OUTPUT_NAME "celix_framework")
-target_include_directories(framework PUBLIC 
+target_include_directories(framework PUBLIC
         $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
         $<INSTALL_INTERFACE:include/celix>
 )
 target_compile_options(framework PRIVATE -DUSE_FILE32API)
 set_target_properties(framework PROPERTIES "SOVERSION" 2)
 target_link_libraries(framework PUBLIC Celix::utils)
-target_link_libraries(framework PRIVATE ${UUID_LIBRARY} ${ZLIB_LIBRARY} ${CURL_LIBRARY} ${OPENSSL_LIBRARIES})
-target_include_directories(framework PRIVATE ${CURL_INCLUDE_DIR} ${UUID_INCLUDE_DIRS})
+target_link_libraries(framework PUBLIC UUID::lib CURL::libcurl ZLIB::ZLIB)
 
 install(TARGETS framework EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
 install(DIRECTORY include/ DESTINATION include/celix COMPONENT framework)
@@ -128,7 +121,7 @@ if (ENABLE_TESTING AND FRAMEWORK_TESTS)
         src/bundle_revision.c
         src/celix_errorcodes.c
         private/mock/celix_log_mock.c)
-    target_link_libraries(bundle_revision_test ${ZLIB_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
+    target_link_libraries(bundle_revision_test ZLIB::ZLIB ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} Celix::utils pthread)
 
     add_executable(bundle_test
         private/test/bundle_test.cpp
@@ -178,7 +171,7 @@ if (ENABLE_TESTING AND FRAMEWORK_TESTS)
         private/mock/celix_log_mock.c
         src/framework.c
         src/celix_library_loader.c)
-    target_link_libraries(framework_test ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} ${UUID_LIBRARY} Celix::utils pthread dl)
+    target_link_libraries(framework_test PRIVATE ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} UUID::lib Celix::utils pthread dl)
 
     add_executable(manifest_parser_test
         private/test/manifest_parser_test.cpp
diff --git a/libs/framework/include/celix/dm/DependencyManager.h b/libs/framework/include/celix/dm/DependencyManager.h
index e9136c9..3e8b6c1 100644
--- a/libs/framework/include/celix/dm/DependencyManager.h
+++ b/libs/framework/include/celix/dm/DependencyManager.h
@@ -52,7 +52,16 @@ namespace celix { namespace dm {
                 this->cDepMan = nullptr;
                 this->context = nullptr;
         }
-        DependencyManager& operator=(DependencyManager&&) = default;
+        DependencyManager& operator=(DependencyManager&& rhs) {
+            std::lock_guard<std::recursive_mutex> lock(rhs.componentsMutex);
+            context = rhs.context;
+            queuedComponents = std::move(rhs.queuedComponents);
+            startedComponents = std::move(rhs.startedComponents);
+            cDepMan = rhs.cDepMan;
+            rhs.cDepMan = nullptr;
+            rhs.context = nullptr;
+            return *this;
+        };
 
         DependencyManager(const DependencyManager&) = delete;
         DependencyManager& operator=(const DependencyManager&) = delete;
diff --git a/libs/framework/tst/CMakeLists.txt b/libs/framework/tst/CMakeLists.txt
index 7ef1ceb..4466761 100644
--- a/libs/framework/tst/CMakeLists.txt
+++ b/libs/framework/tst/CMakeLists.txt
@@ -30,7 +30,7 @@ add_executable(test_framework
     dm_tests.cpp
 )
 
-target_link_libraries(test_framework Celix::framework ${CURL_LIBRARIES} ${CPPUTEST_LIBRARY})
+target_link_libraries(test_framework Celix::framework CURL::libcurl ${CPPUTEST_LIBRARY})
 add_dependencies(test_framework simple_test_bundle1_bundle simple_test_bundle2_bundle simple_test_bundle3_bundle simple_test_bundle4_bundle simple_test_bundle5_bundle bundle_with_exception)
 target_include_directories(test_framework PRIVATE ../src)
 
diff --git a/misc/experimental/bundles/pubsub_admin_nanomsg/CMakeLists.txt b/misc/experimental/bundles/pubsub_admin_nanomsg/CMakeLists.txt
index b9344f3..02a71cd 100644
--- a/misc/experimental/bundles/pubsub_admin_nanomsg/CMakeLists.txt
+++ b/misc/experimental/bundles/pubsub_admin_nanomsg/CMakeLists.txt
@@ -36,11 +36,9 @@ if (BUILD_PUBSUB_PSA_NANOMSG)
     target_link_libraries(celix_pubsub_admin_nanomsg PRIVATE
             Celix::pubsub_spi
             Celix::framework Celix::dfi Celix::log_helper
-            ${NANOMSG_LIBRARIES}
+            NANOMSG::lib
     )
     target_include_directories(celix_pubsub_admin_nanomsg PRIVATE
-        ${NANOMSG_INCLUDE_DIR}
-        ${JANSSON_INCLUDE_DIR}
         src
     )