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 2016/01/07 16:49:13 UTC

[3/3] celix git commit: CELIX-335: Refactor cmake packaging

CELIX-335: Refactor cmake packaging

- bundle has become add_bundle
- deploy has become add_deploy
- signatures are different.
- LegacyPackaing added to still support bundle/deploy statements
- Packaging now heavily relies on target properties makeing the setup more flexible to
  change bundle/deploy settings after the initial add_bundle/add_deploy
- deploy statement can be in CMakeLists.txt files and can refer to future targets


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/49ab9ab5
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/49ab9ab5
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/49ab9ab5

Branch: refs/heads/CELIX-335_deploy_refactoring
Commit: 49ab9ab5315a1cd770e148f58e78e19e97db95ee
Parents: 265bcb4
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Dec 30 21:40:57 2015 +0100
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Jan 7 16:46:09 2016 +0100

----------------------------------------------------------------------
 CMakeLists.txt                                  |    3 +-
 cmake/CMakeCelix.cmake                          |    1 +
 cmake/UseDoxygen.cmake                          |    4 +-
 cmake/cmake_celix/CPackConfig-Installation.in   |   29 -
 cmake/cmake_celix/CPackConfig.in                |   25 -
 cmake/cmake_celix/CPackConfigPKG.in             |   25 -
 cmake/cmake_celix/Dependencies.cmake            |   37 +-
 cmake/cmake_celix/Manifest.template.in          |   10 +
 cmake/cmake_celix/NOTE                          |    4 +-
 cmake/cmake_celix/Packaging.cmake               | 1027 ++++++++++--------
 cmake/cmake_celix/PackagingLegacy.cmake         |  108 ++
 cmake/cmake_celix/config.properties.in          |    2 -
 cmake/cmake_celix/installation.cmake            |   30 -
 cmake/cmake_celix/manifest.in                   |    2 -
 cmake/cmake_celix/run.sh.in                     |    2 -
 config_admin/CMakeLists.txt                     |    3 +
 config_admin/deploy.cmake                       |   24 -
 .../examples/example_test/CMakeLists.txt        |    7 +-
 .../bundle_configuring/CMakeLists.txt           |    6 +-
 .../bundle_managed_service/CMakeLists.txt       |    6 +-
 config_admin/service/CMakeLists.txt             |    7 +-
 dependency_manager/CMakeLists.txt               |   31 +-
 deployment_admin/CMakeLists.txt                 |   60 +-
 deployment_admin/deploy.cmake                   |   24 -
 device_access/CMakeLists.txt                    |    2 +-
 device_access/deploy.cmake                      |   21 -
 device_access/device_access/CMakeLists.txt      |   32 +-
 device_access/driver_locator/CMakeLists.txt     |   14 +-
 device_access/example/CMakeLists.txt            |   11 +-
 .../example/base_driver/CMakeLists.txt          |   14 +-
 .../example/consuming_driver/CMakeLists.txt     |   14 +-
 .../example/refining_driver/CMakeLists.txt      |   14 +-
 dfi/CMakeLists.txt                              |   10 +-
 event_admin/CMakeLists.txt                      |    6 +-
 event_admin/deploy.cmake                        |   23 -
 event_admin/event_admin/CMakeLists.txt          |   10 +-
 event_admin/event_handler/CMakeLists.txt        |    9 +-
 event_admin/event_publisher/CMakeLists.txt      |   10 +-
 examples/CMakeLists.txt                         |   14 +
 examples/deploy.cmake                           |   34 -
 examples/dm_example/CMakeLists.txt              |   15 +
 examples/dm_example/deploy.cmake                |   32 -
 examples/dm_example/phase1/CMakeLists.txt       |   13 +-
 examples/dm_example/phase2a/CMakeLists.txt      |   12 +-
 examples/dm_example/phase2b/CMakeLists.txt      |   12 +-
 examples/dm_example/phase3/CMakeLists.txt       |   12 +-
 examples/echo_service/client/CMakeLists.txt     |   16 +-
 examples/echo_service/server/CMakeLists.txt     |   16 +-
 examples/embedding/CMakeLists.txt               |    8 -
 examples/hello_world/CMakeLists.txt             |   41 +-
 examples/hello_world_test/CMakeLists.txt        |   80 +-
 .../hello_world_test/private/src/activator.c    |    3 -
 examples/hello_world_test/private/src/test.c    |   32 +
 examples/hello_world_test/public/include/test.h |   34 +
 examples/locking/CMakeLists.txt                 |    8 +
 examples/locking/benchmark/CMakeLists.txt       |    9 +-
 examples/locking/deploy.cmake                   |   26 -
 examples/locking/math_provider/CMakeLists.txt   |   11 +-
 .../modified_bool_benchmark/CMakeLists.txt      |    5 +-
 examples/locking/mutex_benchmark/CMakeLists.txt |   11 +-
 .../locking/reference_benchmark/CMakeLists.txt  |    5 +-
 .../locking/start_stop_benchmark/CMakeLists.txt |    5 +-
 examples/mongoose/CMakeLists.txt                |   17 +-
 .../client/CMakeLists.txt                       |    5 +-
 .../greeting/CMakeLists.txt                     |    5 +-
 .../chapter04-correct-listener/CMakeLists.txt   |    3 +-
 .../chapter04-correct-lookup/CMakeLists.txt     |    5 +-
 .../chapter04-paint-example/CMakeLists.txt      |    2 +
 .../circle/CMakeLists.txt                       |    2 +-
 .../chapter04-paint-example/deploy.cmake        |   22 -
 .../paint/CMakeLists.txt                        |    2 +-
 .../square/CMakeLists.txt                       |    2 +-
 .../triangle/CMakeLists.txt                     |    2 +-
 .../producer_consumer/consumer/CMakeLists.txt   |    8 +-
 .../producer_consumer/database/CMakeLists.txt   |    8 +-
 .../producer_consumer/producer/CMakeLists.txt   |    8 +-
 examples/whiteboard/publisherA/CMakeLists.txt   |    4 +-
 examples/whiteboard/publisherB/CMakeLists.txt   |    5 +-
 examples/whiteboard/tracker/CMakeLists.txt      |    5 +-
 .../whiteboard/tracker_depman/CMakeLists.txt    |    5 +-
 framework/CMakeLists.txt                        |   14 +-
 .../test_bundle1/CMakeLists.txt                 |    7 +-
 framework/private/src/framework.c               |   27 +-
 framework/private/src/manifest.c                |    3 +-
 framework/private/src/utils.c                   |   17 +
 framework/public/include/constants.h            |    2 -
 framework/public/include/utils.h                |    1 +
 log_service/CMakeLists.txt                      |   11 +-
 log_writer/log_writer_stdout/CMakeLists.txt     |   18 +-
 log_writer/log_writer_syslog/CMakeLists.txt     |   10 +-
 .../discovery_configured/CMakeLists.txt         |    9 +-
 remote_services/discovery_etcd/CMakeLists.txt   |   11 +-
 remote_services/discovery_shm/CMakeLists.txt    |   10 +-
 remote_services/examples/CMakeLists.txt         |   69 ++
 .../examples/calculator_endpoint/CMakeLists.txt |    7 +-
 .../calculator_endpoint2/CMakeLists.txt         |    7 +-
 .../examples/calculator_proxy/CMakeLists.txt    |    7 +-
 .../examples/calculator_proxy2/CMakeLists.txt   |    7 +-
 .../examples/calculator_service/CMakeLists.txt  |   12 +-
 .../examples/calculator_shell/CMakeLists.txt    |   15 +-
 remote_services/examples/deploy.cmake           |   59 -
 .../remote_service_admin/CMakeLists.txt         |    5 -
 .../remote_service_admin_dfi/rsa/CMakeLists.txt |   10 +-
 .../rsa_tst/CMakeLists.txt                      |   12 +-
 .../rsa_tst/bundle/CMakeLists.txt               |   16 +-
 .../remote_service_admin_http/CMakeLists.txt    |   10 +-
 .../private/test/CMakeLists.txt                 |   14 +-
 .../remote_service_admin_shm/CMakeLists.txt     |    9 +-
 .../private/test/CMakeLists.txt                 |   14 +-
 remote_services/topology_manager/CMakeLists.txt |   10 +-
 .../topology_manager/tms_tst/CMakeLists.txt     |   16 +-
 .../tms_tst/bundle/CMakeLists.txt               |   14 +-
 .../tms_tst/disc_mock/CMakeLists.txt            |    7 +-
 remote_shell/CMakeLists.txt                     |   28 +-
 remote_shell/deploy.cmake                       |   20 -
 scr/scr/CMakeLists.txt                          |    2 +-
 scr/test/CMakeLists.txt                         |    2 +-
 shell/CMakeLists.txt                            |   37 +-
 shell_bonjour/CMakeLists.txt                    |    7 +-
 shell_bonjour/deploy.cmake                      |   25 -
 shell_tui/CMakeLists.txt                        |    9 +-
 utils/CMakeLists.txt                            |    3 +-
 122 files changed, 1406 insertions(+), 1418 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9453411..bfe3288 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,7 +62,6 @@ endif()
 
 
 include(CMakeCelix)
-include(cmake_celix/installation)
 include(UseDoxygen)  
 
 # Default bundle version
@@ -92,4 +91,4 @@ add_subdirectory(framework)
 add_subdirectory(utils)
 add_subdirectory(dfi)
 
-deploy_targets()
+#deploy_targets()

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/CMakeCelix.cmake
----------------------------------------------------------------------
diff --git a/cmake/CMakeCelix.cmake b/cmake/CMakeCelix.cmake
index c6432db..2bff25b 100644
--- a/cmake/CMakeCelix.cmake
+++ b/cmake/CMakeCelix.cmake
@@ -27,6 +27,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 include(cmake_celix/Dependencies)
 include(cmake_celix/Packaging)
+include(cmake_celix/PackagingLegacy)
 #include(cmake_celix/Test)
 include(cmake_celix/ApacheRat)
 include(cmake_celix/CodeCoverage)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/UseDoxygen.cmake
----------------------------------------------------------------------
diff --git a/cmake/UseDoxygen.cmake b/cmake/UseDoxygen.cmake
index 7537eeb..376dbe2 100644
--- a/cmake/UseDoxygen.cmake
+++ b/cmake/UseDoxygen.cmake
@@ -159,7 +159,9 @@ if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
 
 	configure_file("${DOXYFILE_IN}" "${DOXYFILE}" @ONLY)
 
-	get_target_property(DOC_TARGET doc TYPE)
+    if(TARGET doc)
+        get_target_property(DOC_TARGET doc TYPE)
+    endif()
 	if(NOT DOC_TARGET)
 		add_custom_target(doc)
 	endif()

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/CPackConfig-Installation.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/CPackConfig-Installation.in b/cmake/cmake_celix/CPackConfig-Installation.in
deleted file mode 100644
index 0efde50..0000000
--- a/cmake/cmake_celix/CPackConfig-Installation.in
+++ /dev/null
@@ -1,29 +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.
-
-SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
-SET(CPACK_GENERATOR "ZIP;STGZ")
-SET(CPACK_INSTALL_CMAKE_PROJECTS "@PROJECT_BINARY_DIR@;Apache Celix;framework;/")
-set(CPACK_PACKAGE_NAME "Apache Celix")
-SET(CPACK_PACKAGE_DESCRIPTION "Package containing a release for Apache Celix")
-SET(CPACK_PACKAGE_FILE_NAME "apache.celix-@CELIX_MAJOR@.@CELIX_MINOR@.@CELIX_MICRO@.@CELIX_QUALIFIER@")
-set(CPACK_PACKAGE_VENDOR "celix.apache.org")
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Framework")
-set(CPACK_PACKAGE_VERSION_MAJOR "@CELIX_MAJOR@")
-set(CPACK_PACKAGE_VERSION_MINOR "@CELIX_MINOR@")
-set(CPACK_PACKAGE_VERSION_PATCH "@CELIX_MICRO@.@CELIX_QUALIFIER@")
-set(CPACK_RESOURCE_FILE_LICENSE "@PROJECT_SOURCE_DIR@/LICENSE.txt")

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/CPackConfig.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/CPackConfig.in b/cmake/cmake_celix/CPackConfig.in
deleted file mode 100644
index 1b8d49b..0000000
--- a/cmake/cmake_celix/CPackConfig.in
+++ /dev/null
@@ -1,25 +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.
-
-SET(CPACK_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
-SET(CPACK_GENERATOR "@CPACK_GENERATOR@")
-SET(CPACK_INSTALL_CMAKE_PROJECTS "@BUNDLE_BIN_DIR@;@_BUNDLE_NAME@;@_BUNDLE_NAME_INSTALL@;/")
-SET(CPACK_PACKAGE_DESCRIPTION "@BUNDLE_DESCRIPTION@")
-SET(CPACK_PACKAGE_FILE_NAME "@_BUNDLE_NAME@")
-SET(CPACK_PACKAGE_NAME "@_BUNDLE_NAME@")
-SET(CPACK_PACKAGE_VERSION "@BUNDLE_VERSION@")
-SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "0")

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/CPackConfigPKG.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/CPackConfigPKG.in b/cmake/cmake_celix/CPackConfigPKG.in
deleted file mode 100644
index 6faa66a..0000000
--- a/cmake/cmake_celix/CPackConfigPKG.in
+++ /dev/null
@@ -1,25 +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.
-
-SET(CPACK_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
-SET(CPACK_GENERATOR "@CPACK_GENERATOR@")
-SET(CPACK_INSTALL_CMAKE_PROJECTS "@BUNDLE_BIN_DIR@;@INT_BUNDLE_NAME@;@PACKAGE_COMPONENT@;/")
-SET(CPACK_PACKAGE_DESCRIPTION "@INT_BUNDLE_SYMBOLICNAME@ Package")
-SET(CPACK_PACKAGE_FILE_NAME "@PACKAGE_NAME@-dev")
-SET(CPACK_PACKAGE_NAME "@PACKAGE_NAME@")
-SET(CPACK_PACKAGE_VERSION "@BUNDLE_VERSION@")
-SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "0")

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/Dependencies.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Dependencies.cmake b/cmake/cmake_celix/Dependencies.cmake
index b5c31e7..c02db35 100644
--- a/cmake/cmake_celix/Dependencies.cmake
+++ b/cmake/cmake_celix/Dependencies.cmake
@@ -16,11 +16,22 @@
 # under the License.
 
 MACRO(celix_subproject)
-    PARSE_ARGUMENTS(OPTION "DEPS" "" ${ARGN})
-    LIST(GET OPTION_DEFAULT_ARGS 0 OPTION_NAME)
-    LIST(GET OPTION_DEFAULT_ARGS 1 OPTION_DESCRIPTION)
-    LIST(GET OPTION_DEFAULT_ARGS 2 OPTION_DEFAULT)
-    
+    set(ARGS "${ARGN}")
+
+    list(GET ARGS 0 OPTION_NAME)
+    list(REMOVE_AT ARGS 0)
+
+    list(GET ARGS 0 OPTION_DESCRIPTION)
+    list(REMOVE_AT ARGS 0)
+
+    list(GET ARGS 0 OPTION_DEFAULT)
+    list(REMOVE_AT ARGS 0)
+
+    set(OPTIONS )
+    set(ONE_VAL_ARGS )
+    set(MULTI_VAL_ARGS DEPS)
+    cmake_parse_arguments(OPTION "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGS})
+
     string(TOUPPER ${OPTION_NAME} UC_OPTION_NAME)
     set(NAME "BUILD_${UC_OPTION_NAME}")
     
@@ -46,17 +57,13 @@ MACRO(celix_subproject)
 ENDMACRO(celix_subproject)
 
 MACRO(is_enabled name)
-	string(TOUPPER ${name} UC_NAME)
-    set(NAME "BUILD_${UC_NAME}")
+    string(TOUPPER "BUILD_${name}_INTERNAL" OPTION)
     
-    get_property(BUILD GLOBAL PROPERTY ${NAME}_INTERNAL)
-    if (NOT DEFINED BUILD)
-        set(BUILD "OFF")
-    endif (NOT DEFINED BUILD)
+    get_property(BUILD GLOBAL PROPERTY ${OPTION})
     
-    IF (${BUILD})
+    if(BUILD)
         set(${name} "ON")
-    ELSE (${BUILD})
+    else()
         set(${name} "OFF")
-    ENDIF (${BUILD})
-ENDMACRO(is_enabled)
\ No newline at end of file
+    endif()
+ENDMACRO(is_enabled)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/Manifest.template.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Manifest.template.in b/cmake/cmake_celix/Manifest.template.in
new file mode 100644
index 0000000..c458754
--- /dev/null
+++ b/cmake/cmake_celix/Manifest.template.in
@@ -0,0 +1,10 @@
+Bundle-SymbolicName: $<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_SYMBOLIC_NAME>
+Bundle-Name: $<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_TARGET_NAME>
+Bundle-Version: $<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_VERSION>
+Bundle-Description: $<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_DESCRIPTION>
+Bundle-Activator: $<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_ACTIVATOR>
+Private-Library: $<JOIN:$<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_PRIVATE_LIBS>,, >
+Import-Library: $<JOIN:$<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_IMPORT_LIBS>,, >
+Export-Library: $<JOIN:$<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_EXPORT_LIBS>,, >
+$<JOIN:$<TARGET_PROPERTY:@BUNDLE_TARGET_NAME@,BUNDLE_HEADERS>,
+>

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/NOTE
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/NOTE b/cmake/cmake_celix/NOTE
index 5eca783..de8b7be 100644
--- a/cmake/cmake_celix/NOTE
+++ b/cmake/cmake_celix/NOTE
@@ -18,9 +18,7 @@
 All files in this directory are licensed to the Apache Software Foundation (as included above).
 Normally source/txt files should include this header but for templates this sometimes is not possible.
 The following templates do not include the header:
-* config.properties.in
+* Manifest.template.in
 * run.sh.in
-* RunConfig.in
-* manifest.in
 
 This note is added to explicitly mention that the same licensing applies to these files as to any other having the header.  
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/Packaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Packaging.cmake b/cmake/cmake_celix/Packaging.cmake
index f802a9c..aadc4b4 100644
--- a/cmake/cmake_celix/Packaging.cmake
+++ b/cmake/cmake_celix/Packaging.cmake
@@ -15,501 +15,582 @@
 # specific language governing permissions and limitations
 # under the License.
 
-GET_FILENAME_COMPONENT(__cmake_path ${CMAKE_COMMAND} PATH)
-FIND_PROGRAM(CPACK_COMMAND cpack ${__cmake_path})
-MESSAGE(STATUS "Found CPack at: ${CPACK_COMMAND}")
-IF(NOT CPACK_COMMAND)
-	MESSAGE(FATAL_ERROR "Need CPack!")
-ENDIF(NOT CPACK_COMMAND)
-
-include(CPackComponent)
-
-macro( CELIX_ADD_COMPONENT_GROUP _group )
-  set( _readVariable )
-  set( _parentGroup )
-  foreach( _i ${ARGN} )
-    if( _readVariable )
-      set( ${_readVariable} "${_i}" )
-      break()
-    else( _readVariable )
-      if( "${_i}" STREQUAL PARENT_GROUP )
-        set( _readVariable _parentGroup )
-      endif( "${_i}" STREQUAL PARENT_GROUP )
-    endif( _readVariable )
-  endforeach( _i ${ARGN} )
-
-  cpack_add_component_group( ${_group} ${ARGN} )
-  add_custom_target( install-${_group} )
-  if( _parentGroup )
-    add_dependencies( install-${_parentGroup} install-${_group} )
-  endif( _parentGroup )
-endmacro( CELIX_ADD_COMPONENT_GROUP _group )
-
-macro( CELIX_ADD_COMPONENT _component )
-  set( _readVariable )
-  set( _group )
-  foreach( _i ${ARGN} )
-    if( _readVariable )
-      set( ${_readVariable} "${_i}" )
-      break()
-    else( _readVariable )
-      if( "${_i}" STREQUAL GROUP )
-        set( _readVariable _group )
-      endif( "${_i}" STREQUAL GROUP )
-    endif( _readVariable )
-  endforeach( _i ${ARGN} )
-
-  cpack_add_component( ${_component} ${ARGN} )
-  add_custom_target( install-${_component}
-                     COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${_component} -P
-"${CMAKE_BINARY_DIR}/cmake_install.cmake" )
-  add_dependencies( install-${_group} install-${_component} )
-endmacro( CELIX_ADD_COMPONENT _component _group )
-
-find_program(JAR_COMMAND jar)
-if(JAR_COMMAND)
-	message(STATUS "Using JAR to repack bundles, bundles can be used by Apache ACE")
-else(JAR_COMMAND)
-    message("No JAR support, generated bundles are not usable for Apache ACE")
-endif(JAR_COMMAND)
+find_program(JAR_COMMAND jar) #TODO enable
 
-SET(CPACK_GENERATOR "ZIP")
+if(JAR_COMMAND)
+    message(STATUS "Using jar to create bundles")
+else()
+    find_program(ZIP_COMMAND zip) #TODO enable
+    if(ZIP_COMMAND)
+        message(STATUS "Using zip to create bundles")
+    else()
+        get_filename_component(__cmake_path ${CMAKE_COMMAND} PATH)
+        find_program(CPACK_COMMAND cpack ${__cmake_path})
+        if(CPACK_COMMAND)
+            message(STATUS "Using cpack to create bundles.")
+            message(WARNING "Please note that using jar and/or zip is prefered. When packaging bundles with cpack you must use 'make install-all' to install the project instead of 'make install'")
+        else()
+            message(FATAL_ERROR "A jar,zip or cpack command is needed to jar,zip or pack bundles")
+        endif()
+    endif()
+endif()
 
-celix_add_component_group(all)
-celix_add_component_group(bundles PARENT_GROUP all)
 
+##### setup bundles/deploy target
 add_custom_target(bundles ALL)
+add_custom_target(deploy ALL)
+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/deploy")
+#####
+
+macro(extract_version_parts VERSION MAJOR MINOR PATCH)
+    set(MAJOR "0")
+    set(MINOR "0")
+    set(PATCH "0")
+
+    string(REGEX MATCH "^([0-9]+).*" TMP "${VERSION}")
+    if (CMAKE_MATCH_1)
+        set(MAJOR ${CMAKE_MATCH_1})
+    endif()
+    string(REGEX MATCH "^([0-9]+)\\.([0-9])+.*" TMP "${VERSION}")
+    if (CMAKE_MATCH_2)
+        set(MINOR ${CMAKE_MATCH_2})
+    endif()
+    string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" TMP "${VERSION}")
+    if (CMAKE_MATCH_3)
+        set(PATCH ${CMAKE_MATCH_3})
+    endif()
 
-MACRO(CHECK_HEADERS)
-    if (NOT BUNDLE_SYMBOLICNAME)
-        MESSAGE(FATAL_ERROR "Bundle Symbolic Name not set, please set it using \"SET(BUNDLE_SYMBOLICNAME \"bundle_symbolic_name\")\".")
-    endif (NOT BUNDLE_SYMBOLICNAME)
-    
-    if (NOT BUNDLE_VERSION)
-        MESSAGE(WARNING "Bundle version not set, using default \"0.0.0\" version.")
-        SET(BUNDLE_VERSION "0.0.0")
-    endif (NOT BUNDLE_VERSION)
-ENDMACRO(CHECK_HEADERS)
-
-MACRO(SET_HEADER header content)
-    SET(${header} "${content}")
-    string(STRIP ${${header}} ${${header}})
-ENDMACRO(SET_HEADER)
-
-MACRO(SET_HEADERS content)
-	SET(INT_BUNDLE_EXTRAHEADER "${INT_BUNDLE_EXTRAHEADER}\n${content}")
-	string(STRIP "${INT_BUNDLE_EXTRAHEADER}" INT_BUNDLE_EXTRAHEADER)
-ENDMACRO(SET_HEADERS)
-
-MACRO(BUNDLE_PRIVATE_LIBRARY)
-    PARSE_ARGUMENTS(BUNDLE_LIBRARY "SOURCES;LINK_LIBRARIES" "" ${ARGN})
-    LIST(GET BUNDLE_LIBRARY_DEFAULT_ARGS 0 BUNDLE_LIBRARY_NAME)
-    
-    CHECK_HEADERS()
-    
-    SET(BUNDLE_LIBRARY_VERSIONED_NAME ${BUNDLE_SYMBOLICNAME}-${BUNDLE_LIBRARY_NAME})
-    
-    add_library(${BUNDLE_LIBRARY_VERSIONED_NAME} SHARED ${BUNDLE_LIBRARY_SOURCES})
-    target_link_libraries(${BUNDLE_LIBRARY_VERSIONED_NAME} ${BUNDLE_LIBRARY_LINK_LIBRARIES})
-ENDMACRO(BUNDLE_PRIVATE_LIBRARY)
-
-MACRO(BUNDLE_LIBRARY)
-    PARSE_ARGUMENTS(BUNDLE_LIBRARY "SOURCES;LINK_LIBRARIES" "" ${ARGN})
-    LIST(GET BUNDLE_LIBRARY_DEFAULT_ARGS 0 BUNDLE_LIBRARY_NAME)
-    
-    SET(BUNDLE_LIBRARY_VERSIONED_NAME ${BUNDLE_LIBRARY_NAME})
-    
-    add_library(${BUNDLE_LIBRARY_VERSIONED_NAME} SHARED ${BUNDLE_LIBRARY_SOURCES})
-    target_link_libraries(${BUNDLE_LIBRARY_VERSIONED_NAME} ${BUNDLE_LIBRARY_LINK_LIBRARIES})
-ENDMACRO(BUNDLE_LIBRARY)
-
-MACRO(_parseExportLibraryName _export)
-    STRING(REPLACE "|" ";" _exports ${_export})
-    LIST(LENGTH _exports _size)
-    LIST(GET _exports 0 _library)
-    SET(EXPORT_LIBRARY_NAME ${_library})
-    
-    IF(${_size} EQUAL 2)
-        LIST(GET _exports 1 _version)
-        IF(_version)
-            string(FIND ${_version} "\"" _start)
-            string(FIND ${_version} "\"" _end REVERSE)
-            MATH(EXPR _start ${_start}+1)
-            MATH(EXPR _length ${_end}-${_start})
-            string(SUBSTRING ${_version} ${_start} ${_length} ENDIF)
-            
-            SET(EXPORT_LIBRARY_NAME ${_library}-${ENDIF})
-        ENDIF()
-    ENDIF()
-ENDMACRO()
-
-MACRO(PROCESS_MANIFEST_HEADERS)
-    IF(BUNDLE_DESCRIPTION)
-        SET_HEADERS("Bundle-Description: ${BUNDLE_DESCRIPTION}")
-    ENDIF()
-    IF(BUNDLE_VERSION)
-        SET_HEADERS("Bundle-Version: ${BUNDLE_VERSION}")
-    ENDIF()
-    IF(BUNDLE_NAME)
-        SET_HEADERS("Bundle-Name: ${BUNDLE_NAME}")
-    ENDIF()
-
-    SET_HEADERS("Manifest-Version: 1.0")
-
-ENDMACRO()
-
-
-MACRO(bundle)
-    PARSE_ARGUMENTS(_BUNDLE "SOURCES;LINK_LIBRARIES;EXPORT_VERSION;ACTIVATOR;PRIVATE_LIBRARIES;EXPORT_LIBRARIES;IMPORT_LIBRARIES;FILES;DIRECTORIES;INSTALL_FILES" "PRIVATE;EXPORT;INSTALL" ${ARGN})
-    LIST(GET _BUNDLE_DEFAULT_ARGS 0 _BUNDLE_NAME)
-    
-    CHECK_HEADERS()
-    
-    PROCESS_MANIFEST_HEADERS()
-    
-    if (NOT _BUNDLE_NAME)
-      message(STATUS "NO bundle name set, using symbolic name")
-      SET(_BUNDLE_NAME ${BUNDLE_SYMBOLICNAME})
-    endif(NOT _BUNDLE_NAME)
-    
-    set(_BUNDLE_NAME_INSTALL ${_BUNDLE_NAME}_install)
-    
-    if(_BUNDLE_SOURCES)
-        add_library(${_BUNDLE_NAME} SHARED ${_BUNDLE_SOURCES})
-        target_link_libraries(${_BUNDLE_NAME} ${_BUNDLE_LINK_LIBRARIES})
-        SET_HEADERS("Bundle-Activator: ${_BUNDLE_NAME}")
-    else(_BUNDLE_SOURCES)
-        add_custom_target(${_BUNDLE_NAME})
-        add_dependencies(bundles ${_BUNDLE_NAME})
-    endif(_BUNDLE_SOURCES)
-    
-    SET(TEMP)
-    foreach(_PRIVATE_LIBRARY ${_BUNDLE_PRIVATE_LIBRARIES})
-        SET(_BUNDLE_LIBRARY_VERSIONED_NAME ${BUNDLE_SYMBOLICNAME}-${_PRIVATE_LIBRARY})
-        add_dependencies(${_BUNDLE_NAME} "${_BUNDLE_LIBRARY_VERSIONED_NAME}")
-        install(TARGETS ${_BUNDLE_LIBRARY_VERSIONED_NAME} DESTINATION . COMPONENT ${_BUNDLE_NAME}_install)
-        
-        SET(TEMP ${TEMP} ${_BUNDLE_LIBRARY_VERSIONED_NAME})
-    endforeach()
-    SET(_BUNDLE_PRIVATE_LIBRARIES ${TEMP})
-    UNSET(TEMP)
-    
-    FOREACH(_EXPORT_LIBRARY ${_BUNDLE_EXPORT_LIBRARIES})
-        _parseExportLibraryName(${_EXPORT_LIBRARY})
-        ADD_DEPENDENCIES(${_BUNDLE_NAME} ${EXPORT_LIBRARY_NAME})
-        INSTALL(TARGETS ${EXPORT_LIBRARY_NAME} DESTINATION . COMPONENT ${_BUNDLE_NAME}_install)
-    ENDFOREACH()
-    
-    set_property(TARGET ${_BUNDLE_NAME} PROPERTY BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip")
-    
-    if(_BUNDLE_SOURCES)
-        list(APPEND _BUNDLE_PRIVATE_LIBRARIES ${_BUNDLE_NAME})
-    endif(_BUNDLE_SOURCES)
-    
-    string (REPLACE ";" "," _BUNDLE_PRIVATE_LIBRARIES "${_BUNDLE_PRIVATE_LIBRARIES}")
-    string (REPLACE ";" "," _BUNDLE_EXPORT_LIBRARIES "${_BUNDLE_EXPORT_LIBRARIES}")
-    string (REPLACE "|" ";" _BUNDLE_EXPORT_LIBRARIES "${_BUNDLE_EXPORT_LIBRARIES}")
-    string (REPLACE ";" "," _BUNDLE_IMPORT_LIBRARIES "${_BUNDLE_IMPORT_LIBRARIES}")
-    string (REPLACE "|" ";" _BUNDLE_IMPORT_LIBRARIES "${_BUNDLE_IMPORT_LIBRARIES}")
-    
-    if(_BUNDLE_ACTIVATOR)
-        SET_HEADERS("Bundle-Activator: ${_BUNDLE_ACTIVATOR}")
+    #TODO add support qualifier 
+endmacro()
+
+function(set_library_version TARGET VERSION) 
+    if (VERSION AND TARGET)
+        extract_version_parts("${VERSION}" MAJOR MINOR PATCH)
+
+        #NOTE setting aligning ABI version with major part of the interface version.
+        #This is simpeler than using the <current>:<revision>:<age> approach of libtool
+        set_property(TARGET ${TARGET} PROPERTY VERSION "${VERSION}")
+        set_property(TARGET ${TARGET} PROPERTY SOVERSION ${MAJOR})
+        #set_property(TARGET ${TARGET} PROPERTY VERSION "${VERSION}")
+        #message("target '${TARGET}' with provided version '${VERSION}' has version parts: '${MAJOR}' '${MINOR}' '${PATCH}'")
+    else ()
+        message(WARNING "set_library_version: Cannot set version info TARGET and/or VERSION not provided")
+    endif ()
+endfunction()
+
+function(check_lib LIB)
+   if(TARGET ${LIB})
+        #ok
+    elseif(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
+        #ok
+    else() 
+        message(FATAL_ERROR "Provided library (${LIB}) is not a target nor a absolute path to an existing library")
     endif()
-    if(_BUNDLE_PRIVATE_LIBRARIES)
-        SET_HEADERS("Private-Library: ${_BUNDLE_PRIVATE_LIBRARIES}")
+endfunction()
+
+function(check_bundle BUNDLE)
+    if(TARGET ${BUNDLE})
+        get_target_property(BUNDLE_FILE ${BUNDLE} "BUNDLE_FILE")
+        if(NOT BUNDLE_FILE)
+            message(FATAL_ERROR "Provided target must be a bundle target")
+        endif()
+    else()
+        message(FATAL_ERROR "first argument must be a target")
     endif()
-    if(_BUNDLE_EXPORT_LIBRARIES)
-        SET_HEADERS("Export-Library: ${_BUNDLE_EXPORT_LIBRARIES}")
+endfunction()
+
+
+function(add_bundle)
+    list(GET ARGN 0 BUNDLE_TARGET_NAME)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS NO_ACTIVATOR)
+    set(ONE_VAL_ARGS VERSION ACTIVATOR SYMBOLIC_NAME NAME) 
+    set(MULTI_VAL_ARGS SOURCES PRIVATE_LIBRARIES EXPORT_LIBRARIES HEADERS)
+    cmake_parse_arguments(BUNDLE "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
+
+    ##check arguments
+    if(NOT BUNDLE_TARGET_NAME)
+        message(FATAL_ERROR "add_bunde function requires first target name argument")
     endif()
-    if(_BUNDLE_IMPORT_LIBRARIES)
-        SET_HEADERS("Import-Library: ${_BUNDLE_IMPORT_LIBRARIES}")
+    if((NOT (BUNDLE_SOURCES OR BUNDLE_ACTIVATOR)) AND (NOT BUNDLE_NO_ACTIVATOR))
+        message(FATAL_ERROR "Bundle contain no SOURCES or ACTIVATOR target and the option NO_ACTIVATOR is not set")
     endif()
-    
-    SET(__bundleManifest ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.MF)
-    CONFIGURE_FILE(${CELIX_CMAKE_DIRECTORY}/cmake_celix/manifest.in ${__bundleManifest} @ONLY)
-    install (FILES ${__bundleManifest} DESTINATION ./META-INF COMPONENT ${_BUNDLE_NAME_INSTALL})
-    
-    if(_BUNDLE_SOURCES)
-        install (TARGETS ${_BUNDLE_NAME} DESTINATION . COMPONENT ${_BUNDLE_NAME_INSTALL})
-    endif(_BUNDLE_SOURCES)
-    
-    if(_BUNDLE_FILES)
-        install (FILES ${_BUNDLE_FILES} DESTINATION . COMPONENT ${_BUNDLE_NAME_INSTALL})
+    if(BUNDLE_SOURCES AND BUNDLE_ACTIVATOR)
+        message(FATAL_ERROR "add_bundle function requires a value for SOURCES or ACTIVATOR not both")
     endif()
-    if(_BUNDLE_DIRECTORIES)
-        install (DIRECTORY ${_BUNDLE_DIRECTORIES} DESTINATION . COMPONENT ${_BUNDLE_NAME_INSTALL})
+    if(BUNDLE_ACTIVATOR)
+        check_lib(${BUNDLE_ACTIVATOR})
     endif()
 
-    SET(__bundleConfig ${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${_BUNDLE_NAME}-bundle.cmake)
-    SET(BUNDLE_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
-    CONFIGURE_FILE(${CELIX_CMAKE_DIRECTORY}/cmake_celix/CPackConfig.in ${__bundleConfig} @ONLY)
-
+    #setting defaults
+    if(NOT BUNDLE_VERSION) 
+        set(BUNDLE_VERSION "0.0.0")
+        message(WARNING "Bundle version for ${BUNDLE_NAME} not provided. Using 0.0.0")
+    endif()
+    if (NOT BUNDLE_NAME)
+        set(BUNDLE_NAME ${BUNDLE_TARGET_NAME})
+    endif()
+    if (NOT BUNDLE_SYMBOLIC_NAME)
+        set(BUNDLE_SYMBOLIC_NAME ${BUNDLE_TARGET_NAME})
+    endif()
+    set(BUNDLE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_TARGET_NAME}.zip") 
+    set(BUNDLE_CONTENT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_TARGET_NAME}_content")
+    set(BUNDLE_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_TARGET_NAME}_gen")
+
+
+    ###### Setting up dependency for bundles target
+    get_target_property(DEPS bundles "BUNDLES_DEPS")
+    list(APPEND DEPS "${BUNDLE_FILE}")
+    set_target_properties(bundles PROPERTIES "BUNDLES_DEPS" "${DEPS}")
+    #####
+
+    ####### Setting target for activator lib if neccesary ####################
+    if(BUNDLE_SOURCES)
+        #create lib from sources
+        add_library(${BUNDLE_TARGET_NAME} SHARED ${BUNDLE_SOURCES})
+        set_library_version(${BUNDLE_TARGET_NAME} ${BUNDLE_VERSION})
+        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_TARGET_IS_LIB" TRUE)
+        add_dependencies(bundles ${BUNDLE_TARGET_NAME})
+    else()
+        add_custom_target(${BUNDLE_TARGET_NAME}
+          DEPENDS "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>"
+        )
+    endif()
+    add_custom_target(${BUNDLE_TARGET_NAME}_bundle
+        DEPENDS "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_FILE>"
+    )
+    add_dependencies(bundles ${BUNDLE_TARGET_NAME}_bundle)
+    #######################################################################
+   
+
+    ##### MANIFEST configuration and generation ##################
+    #Step1 configure the file so that the target name is present in in the template
+    configure_file(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Manifest.template.in ${BUNDLE_GEN_DIR}/MANIFEST.template @ONLY)
+    #Step2 replace headers with target property values. Note this is done build time
+    file(GENERATE 
+        OUTPUT "${BUNDLE_GEN_DIR}/MANIFEST.tmp"
+        INPUT "${BUNDLE_GEN_DIR}/MANIFEST.template"
+    )
+    #Step3 The replaced values in step 2 can contain generator expresssion, generated again to resolve those. Note this is done build time
+    file(GENERATE 
+        OUTPUT "${BUNDLE_GEN_DIR}/MANIFEST.MF"
+        INPUT "${BUNDLE_GEN_DIR}/MANIFEST.tmp"
+    )   
+    #########################################################
+
+    ###### Packaging the bundle using using jar,zip or cpack and a content dir. Configuring dependencies ######
     if(JAR_COMMAND)
-        ADD_CUSTOM_COMMAND(TARGET ${_BUNDLE_NAME}
-        POST_BUILD
-            COMMAND ${CPACK_COMMAND} ARGS -C Debug --config ${__bundleConfig}
-            COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/ziptojar
-            COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -xf ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip
-            COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -cfm ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip META-INF/MANIFEST.MF .
-            COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/ziptojar
+        add_custom_command(OUTPUT ${BUNDLE_FILE}
+            COMMAND ${JAR_COMMAND} -cfm ${BUNDLE_FILE} ${BUNDLE_GEN_DIR}/MANIFEST.MF -C ${BUNDLE_CONTENT_DIR} .
+            COMMENT "Packaging ${BUNDLE_TARGET_NAME}"
+            DEPENDS  ${BUNDLE_TARGET_NAME} "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_DEPEND_TARGETS>" ${BUNDLE_GEN_DIR}/MANIFEST.MF
             WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
         )
-    else(JAR_COMMAND)
-        ADD_CUSTOM_COMMAND(TARGET ${_BUNDLE_NAME}
-        POST_BUILD
-            COMMAND ${CPACK_COMMAND} ARGS -C Debug --config ${__bundleConfig}
-            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    elseif(ZIP_COMMAND)
+        add_custom_command(OUTPUT ${BUNDLE_FILE}
+            COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BUNDLE_GEN_DIR}/MANIFEST.MF META-INF/MANIFEST.MF
+            COMMAND ${ZIP_COMMAND} -rq ${BUNDLE_FILE} *
+            COMMENT "Packaging ${BUNDLE_TARGET_NAME}"
+            DEPENDS  ${BUNDLE_TARGET_NAME} "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_DEPEND_TARGETS>" ${BUNDLE_GEN_DIR}/MANIFEST.MF
+            WORKING_DIRECTORY ${BUNDLE_CONTENT_DIR}
         )
-    endif(JAR_COMMAND)
-    
-    if (_BUNDLE_INSTALL)
-        CELIX_ADD_COMPONENT(${_BUNDLE_NAME}
-            DISPLAY_NAME ${BUNDLE_SYMBOLICNAME}
-            DESCRIPTION ${BUNDLE_DESCRIPTION}
-            GROUP bundles
+    elseif(CPACK_COMMAND)
+        install(DIRECTORY ${BUNDLE_CONTENT_DIR}/ DESTINATION . COMPONENT ${BUNDLE_TARGET_NAME}_install_cmp)
+        install(FILES ${BUNDLE_GEN_DIR}/MANIFEST.MF DESTINATION META-INF COMPONENT ${BUNDLE_TARGET_NAME}_install_cmp)
+        file(GENERATE OUTPUT ${BUNDLE_GEN_DIR}/cpack.cmake CONTENT "
+SET(CPACK_CMAKE_GENERATOR \"Unix Makefiles\")
+SET(CPACK_GENERATOR \"ZIP\")
+SET(CPACK_INSTALL_CMAKE_PROJECTS \"${CMAKE_CURRENT_BINARY_DIR};${BUNDLE_TARGET_NAME};${BUNDLE_TARGET_NAME}_install_cmp;/\")
+SET(CPACK_PACKAGE_DESCRIPTION \"\")
+SET(CPACK_PACKAGE_FILE_NAME \"${BUNDLE_TARGET_NAME}\")
+SET(CPACK_PACKAGE_NAME \"${BUNDLE_TARGET_NAME}\")
+SET(CPACK_PACKAGE_VERSION \"0.0.1\")
+SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY \"0\")
+")
+        add_custom_command(OUTPUT ${BUNDLE_FILE}
+            COMMAND ${CPACK_COMMAND} ARGS -C Debug --config ${BUNDLE_GEN_DIR}/cpack.cmake
+            COMMENT "Packaging ${BUNDLE_TARGET_NAME}"
+            DEPENDS  ${BUNDLE_TARGET_NAME} "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_DEPEND_TARGETS>" ${BUNDLE_GEN_DIR}/MANIFEST.MF
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
         )
-        add_dependencies( install-${_BUNDLE_NAME} ${_BUNDLE_NAME} )
-        
-        if (_BUNDLE_INSTALL_FILES)
-            install (FILES ${_BUNDLE_INSTALL_FILES} DESTINATION include/celix/${_BUNDLE_NAME} COMPONENT ${_BUNDLE_NAME})
+    endif()
+    ###################################################################################
+
+
+    ###################################
+    ##### Additional Cleanup info #####
+    ###################################
+    set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_GEN_DIR>;$<TARGET_PROPERTY:${BUNDLE_TARGET_NAME},BUNDLE_CONTENT_DIR>")
+
+    #############################
+    ### BUNDLE TARGET PROPERTIES
+    #############################
+    #internal use
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_DEPEND_TARGETS" "") #bundle target dependencies. Note can be extended after the add_bundle call
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_GEN_DIR" ${BUNDLE_GEN_DIR}) #location for generated output. 
+
+    #bundle specific
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CONTENT_DIR" ${BUNDLE_CONTENT_DIR}) #location where the content to be jar/zipped. 
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_FILE" ${BUNDLE_FILE}) #target bundle file (.zip)
+
+    #name and version
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_NAME" ${BUNDLE_NAME}) #The bundle name default target name
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_SYMBOLIC_NAME" ${BUNDLE_SYMBOLIC_NAME}) #The bundle symbolic name. Default target name
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_VERSION" ${BUNDLE_VERSION}) #The bundle version. Default 0.0.0
+
+    #headers
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_ACTIVATOR" 1) #Library containing the activator (if any)
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_PRIVATE_LIBS" "") #List of private libs. 
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_IMPORT_LIBS" "") #List of libs to import
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_EXPORT_LIBS" "") #list of libs to export
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_HEADERS" "") #Additional headers will be added (new line seperated) to the manifest
+    ################################
+    ################################
+
+    if(BUNDLE_SOURCES) 
+        bundle_private_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_TARGET_NAME})
+        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_ACTIVATOR" "$<TARGET_SONAME_FILE_NAME:${BUNDLE_TARGET_NAME}>")
+
+        if(APPLE)
+            set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
+        else()
+            set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN")
         endif()
-        
-        INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip DESTINATION share/celix/bundles COMPONENT ${_BUNDLE_NAME})
+    else() #ACTIVATOR 
+        bundle_private_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_ACTIVATOR})
+        get_filename_component(ACT_NAME ${BUNDLE_ACTIVATOR} NAME)
+        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_ACTIVATOR" ${ACT_NAME})
     endif()
-    
-    SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip)
-ENDMACRO(bundle)
 
-MACRO(install_bundle)
-    PARSE_ARGUMENTS(BUNDLE "HEADERS;RESOURCES" "" ${ARGN})
-    LIST(GET BUNDLE_DEFAULT_ARGS 0 INT_BUNDLE_NAME)
+    bundle_private_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_PRIVATE_LIBRARIES})
+    bundle_export_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_EXPORT_LIBRARIES})
+    bundle_headers(${BUNDLE_TARGET_NAME} ${BUNDLE_HEADERS})
+endfunction()
+
+function(get_bundle_file BUNDLE OUT)
+    check_bundle(${BUNDLE})
+    get_target_property(${OUT} ${BUNDLE} "BUNDLE_FILE")
+endfunction()
+
+function(bundle_export_libs)
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+    bundle_libs(${BUNDLE} "EXPORT" ${ARGN})
+endfunction()
+
+function(bundle_private_libs)
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+    bundle_libs(${BUNDLE} "PRIVATE" ${ARGN})
+endfunction()
+
+function(bundle_libs)
+    #0 is bundle TARGET
+    #1 is type (PRIVATE,EXPORT
+    #2..n is libs
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+
+    list(GET ARGN 0 TYPE)
+    list(REMOVE_AT ARGN 0)
+
+    #check if arg 0 is corrent
+    check_bundle(${BUNDLE})
+    get_target_property(BUNDLE_DIR ${BUNDLE} "BUNDLE_CONTENT_DIR")
+    get_target_property(BUNDLE_GEN_DIR ${BUNDLE} "BUNDLE_GEN_DIR")
+
+
+    get_target_property(LIBS ${BUNDLE} "BUNDLE_${TYPE}_LIBS")
+    get_target_property(DEPS ${BUNDLE} "BUNDLE_DEPEND_TARGETS")
+
+    foreach(LIB IN ITEMS ${ARGN})
+        check_lib(${LIB})
+
+        if(TARGET ${LIB})
+
+            #NOTE add_custom_command does not support generator expression in OUTPUT value (e.g. $<TARGET_FILE:${LIB}>)
+            #Using a two step approach to be able to use add_custom_command instead of add_custom_target
+            get_target_property(EXTENSION ${LIB} SUFFIX)
+            set(OUT "${BUNDLE_GEN_DIR}/lib-${LIB}-copy")
+            add_custom_command(OUTPUT ${OUT}
+                COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${LIB}>" ${OUT}
+                COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OUT} "${BUNDLE_DIR}/$<TARGET_SONAME_FILE_NAME:${LIB}>"
+                DEPENDS ${LIB}
+            )
+            list(APPEND DEPS "${OUT}") #NOTE depending on ${OUT} not on $<TARGET_FILE:${LIB}>.
+            list(APPEND LIBS "$<TARGET_SONAME_FILE_NAME:${LIB}>")
+        else()
+            get_filename_component(LIB_NAME ${LIB} NAME) 
+            set(OUT "${BUNDLE_DIR}/${LIB_NAME}") 
+            add_custom_command(OUTPUT ${OUT} 
+                COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB} ${OUT} 
+            )
+            list(APPEND LIBS ${LIB_NAME})
+            list(APPEND DEPS ${OUT}) 
+        endif()
+
+        get_target_property(IS_LIB ${BUNDLE} "BUNDLE_TARGET_IS_LIB")
+        if ("${LIB}" STREQUAL "${BUNDLE}")
+            #ignore. Do not have to link agaist own lib
+        elseif(IS_LIB)
+            target_link_libraries(${BUNDLE} ${LIB})
+        endif()
+    endforeach()
+
+
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_${TYPE}_LIBS" "${LIBS}")
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_DEPEND_TARGETS" "${DEPS}")
+endfunction()
+
+#TODO
+#
+# bundle_import_libs(<target> LIB <lib> RANGE <version_range> ?)
+#
+#
+function(bundle_import_libs)
+    #0 is bundle TARGET
+    #1..n is libs
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+
+    message(WARNING "IMPORT BUNDLES STILL TODO")
+
+endfunction()
+
+function(bundle_files)
+    #0 is bundle TARGET
+    #1..n is header name / header value
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS )
+    set(ONE_VAL_ARGS DESTINATION)
+    set(MULTI_VAL_ARGS )
+    cmake_parse_arguments(FILES "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
+
+    get_target_property(BUNDLE_DIR ${BUNDLE} "BUNDLE_CONTENT_DIR") 
+
+    if (FILES_DESTINATION)
+        set(DESTINATION "${BUNDLE_DIR}/${FILES_DESTINATION}")
+    else()
+        set(DESTINATION "${BUNDLE_DIR}")
+    endif()
+
+    #message("call: files(COPY ${FILES_UNPARSED_ARGUMENTS} DESTINATION \"${DESTINATION}\"")
+    file(COPY ${FILES_UNPARSED_ARGUMENTS} DESTINATION ${DESTINATION})
+endfunction()
+
+function(bundle_headers)
+    #0 is bundle TARGET
+    #1..n is header name / header value
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+
+    get_target_property(HEADERS ${BUNDLE} "BUNDLE_HEADERS")
+
+    foreach(HEADER IN ITEMS ${ARGN})
+        list(APPEND HEADERS "${HEADER}")
+    endforeach()
+
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_HEADERS" "${HEADERS}")
+endfunction()
+
+function(bundle_symbolic_name BUNDLE SYMBOLIC_NAME) 
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_SYMBOLIC_NAME" ${SYMBOLIC_NAME})
+endfunction()
+
+function(bundle_name BUNDLE NAME) 
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_NAME" ${NAME})
+endfunction()
+
+function(bundle_version BUNDLE VERSION) 
+    set_target_properties(${BUNDLE} PROPERTIES "BUNDLE_VERSION" ${VERSION})
+endfunction()
+
+function(install_bundle)
+    #0 is bundle TARGET
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS )
+    set(ONE_VAL_ARGS PROJECT_NAME BUNDLE_NAME) 
+    set(MULTI_VAL_ARGS HEADERS RESOURCES)
+    cmake_parse_arguments(INSTALL "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
     
-	CELIX_ADD_COMPONENT(${INT_BUNDLE_NAME}
-    	DISPLAY_NAME ${INT_BUNDLE_NAME}
-        DESCRIPTION ${INT_BUNDLE_NAME}
-        GROUP bundles
+    if (NOT INSTALL_PROJECT_NAME)
+        string(TOLOWER ${PROJECT_NAME} INSTALL_PROJECT_NAME)
+    endif()
+    if (NOT INSTALL_BUNDLE_NAME)
+        set(INSTALL_BUNDLE_NAME ${BUNDLE})
+    endif()
+
+    install(FILES "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" DESTINATION share/${INSTALL_PROJECT_NAME}/bundles COMPONENT ${BUNDLE})
+    if(INSTALL_HEADERS)
+        install (FILES ${INSTALL_HEADERS} DESTINATION include/${INSTALL_PROJECT_NAME}/${INSTALL_BUNDLE_NAME} COMPONENT ${BUNDLE})
+    endif()
+    if (INSTALL_RESOURCES)
+        install (FILES ${INSTALL_RESOURCES} DESTINATION share/${INSTALL_PROJECT_NAME}/${INSTALL_BUNDLE_NAME} COMPONENT ${BUNDLE})
+    endif()
+
+endfunction()
+
+function(add_deploy)
+    list(GET ARGN 0 DEPLOY_TARGET)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS COPY)
+    set(ONE_VAL_ARGS GROUP NAME)
+    set(MULTI_VAL_ARGS BUNDLES PROPERTIES)
+    cmake_parse_arguments(DEPLOY "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
+
+    ##### Check arguments #####
+    if(NOT DEPLOY_NAME) 
+        set(DEPLOY_NAME "${DEPLOY_TARGET}")
+    endif()
+    ######
+
+    ##### Setting defaults #####
+    if(DEPLOY_GROUP) 
+        set(DEPLOY_LOCATION "${CMAKE_BINARY_DIR}/deploy/${DEPLOY_GROUP}/${DEPLOY_NAME}")
+    else()
+        set(DEPLOY_LOCATION "${CMAKE_BINARY_DIR}/deploy/${DEPLOY_NAME}")
+    endif()
+    ######
+
+
+    ###### Setup deploy custom target and config.properties file
+    add_custom_target(${DEPLOY_TARGET}
+        DEPENDS  "${DEPLOY_LOCATION}/timestamp"
     )
-    add_dependencies( install-${INT_BUNDLE_NAME} ${INT_BUNDLE_NAME} )
+    add_dependencies(deploy ${DEPLOY_TARGET})
 
+    add_custom_command(OUTPUT ${DEPLOY_LOCATION}/timestamp
+        COMMAND ${CMAKE_COMMAND} -E touch ${DEPLOY_LOCATION}/timestamp
+        DEPENDS  "$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_TARGET_DEPS>" "${DEPLOY_LOCATION}/config.properties" "${DEPLOY_LOCATION}/run.sh"
+        WORKING_DIRECTORY "${DEPLOY_LOCATION}"
+        COMMENT "Deploying ${DEPLOY_NAME}" VERBATIM
+    )
 
-    string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
-    
-    if (BUNDLE_HEADERS)
-        install (FILES ${BUNDLE_HEADERS} DESTINATION include/${PROJECT_NAME_LOWER}/${INT_BUNDLE_NAME} COMPONENT ${INT_BUNDLE_NAME})
-    endif(BUNDLE_HEADERS)
-    if (BUNDLE_RESOURCES)
-        install (FILES ${BUNDLE_RESOURCES} DESTINATION share/${PROJECT_NAME_LOWER}/${INT_BUNDLE_NAME} COMPONENT ${INT_BUNDLE_NAME})
-    endif(BUNDLE_RESOURCES)
-    
-    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${INT_BUNDLE_NAME}.zip DESTINATION share/${PROJECT_NAME_LOWER}/bundles COMPONENT ${INT_BUNDLE_NAME})
-ENDMACRO(install_bundle)
-	
-MACRO(package)
-    PARSE_ARGUMENTS(PACKAGE "FILES;DIRECTORIES" "" ${ARGN})
-    LIST(GET PACKAGE_DEFAULT_ARGS 0 PACKAGE_NAME)
-	
-	SET(PACKAGE_COMPONENT package_${PACKAGE_NAME})
-	
-	get_property(bundle_file TARGET ${INT_BUNDLE_NAME} PROPERTY BUNDLE)
-	
-	install (FILES ${bundle_file} DESTINATION . COMPONENT ${PACKAGE_COMPONENT})
-	
-	if (PACKAGE_FILES)
-	    install (FILES ${PACKAGE_FILES} DESTINATION . COMPONENT ${PACKAGE_COMPONENT})
-    endif(PACKAGE_FILES)
-    if (PACKAGE_DIRECTORIES)
-	    install (DIRECTORY ${PACKAGE_DIRECTORIES} DESTINATION . COMPONENT ${PACKAGE_COMPONENT})
-    endif(PACKAGE_DIRECTORIES)
-
-	SET(__packageConfig ${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${PACKAGE_NAME}-pkg.cmake)
-	CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/CPackConfigPKG.in ${__packageConfig} @ONLY)
-	ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_NAME}
-		POST_BUILD
-		COMMAND	${CPACK_COMMAND} --config "${__packageConfig}"
-		WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-	)
-	
-	GET_DIRECTORY_PROPERTY(PROPS ADDITIONAL_MAKE_CLEAN_FILES)
-	SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROPS};${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-dev.zip")
-ENDMACRO(package)
-
-
-ADD_CUSTOM_TARGET(deploy)
-MACRO(deploy)
-    PARSE_ARGUMENTS(DEPLOY "BUNDLES;DRIVERS;ENDPOINTS;PROPERTIES" "" ${ARGN})
-    LIST(GET DEPLOY_DEFAULT_ARGS 0 DEPLOY_NAME)
-    
-	SET(DEPLOY_COMPONENT deploy_${DEPLOY_NAME})
-	SET(__deployTarget deploy_${DEPLOY_NAME})
-		
-	SET(BUNDLES "")
-	SET(DEPS)
-	SET(PROPERTIES "")
-	
-	FOREACH(BUNDLE ${DEPLOY_BUNDLES})
-		SET(DEP_NAME ${DEPLOY_NAME}_${BUNDLE}) 
-		IF(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})  #it is a full path not a bundle name (e.g. a target)
-			get_filename_component(BUNDLE_NAME ${BUNDLE} NAME_WE)	
-			add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles/${BUNDLE_NAME}.zip
-				COMMAND ${CMAKE_COMMAND} -E copy ${BUNDLE} 
-				${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles/${BUNDLE_NAME}.zip
-				COMMENT "Deploying ${BUNDLE} to ${DEPLOY_NAME}"
-			)
-		ELSE()
-			set(BUNDLE_NAME ${BUNDLE})
-			get_property(bundle_file TARGET ${BUNDLE} PROPERTY BUNDLE)
-			add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles/${BUNDLE}.zip
-				COMMAND ${CMAKE_COMMAND} -E copy ${bundle_file} 
-				${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles/${BUNDLE}.zip
-				DEPENDS ${BUNDLE}
-				COMMENT "Deploying ${BUNDLE} to ${DEPLOY_NAME}"
-			)
-		ENDIF()
-	    	SET(BUNDLES "${BUNDLES} bundles/${BUNDLE_NAME}.zip")
-	    	SET(DEPS ${DEPS};${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles/${BUNDLE_NAME}.zip)
-	ENDFOREACH(BUNDLE)
-
-	FOREACH(BUNDLE ${DEPLOY_DRIVERS})
-        SET(DEP_NAME ${DEPLOY_NAME}_${BUNDLE}) 
-        get_property(bundle_file TARGET ${BUNDLE} PROPERTY BUNDLE)
-        add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/drivers/${BUNDLE}.zip
-            COMMAND ${CMAKE_COMMAND} -E copy ${bundle_file} 
-                ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/drivers/${BUNDLE}.zip
-            DEPENDS ${BUNDLE}
-            COMMENT "Deploying ${BUNDLE} to ${DEPLOY_NAME}"
-        )
-        #SET(BUNDLES "${BUNDLES} drivers/${BUNDLE}.zip")
-        SET(DEPS ${DEPS};${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/drivers/${BUNDLE}.zip)
-    	ENDFOREACH(BUNDLE)
-
-	FOREACH(BUNDLE ${DEPLOY_ENDPOINTS})
-        SET(DEP_NAME ${DEPLOY_NAME}_${BUNDLE}) 
-        get_property(bundle_file TARGET ${BUNDLE} PROPERTY BUNDLE)
-        add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/endpoints/${BUNDLE}.zip
-            COMMAND ${CMAKE_COMMAND} -E copy ${bundle_file} 
-                ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/endpoints/${BUNDLE}.zip
-            DEPENDS ${BUNDLE}
-            COMMENT "Deploying ${BUNDLE} to ${DEPLOY_NAME}"
-        )
-        #SET(BUNDLES "${BUNDLES} drivers/${BUNDLE}.zip")
-        SET(DEPS ${DEPS};${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/endpoints/${BUNDLE}.zip)
-    	ENDFOREACH(BUNDLE)
-	
-	FOREACH(PROPERTY ${DEPLOY_PROPERTIES})
-		SET(PROPERTIES "${PROPERTIES}\n${PROPERTY}")
-	ENDFOREACH(PROPERTY)
-	
-	IF(NOT(CELIX_FOUND)) #celix project
-		set(DEPS ${DEPS};celix)
-	ENDIF()
-    ADD_CUSTOM_TARGET(${__deployTarget} 
-    	DEPENDS ${DEPS}
-    	COMMENT "Deploy target ${DEPLOY_NAME}")
-    ADD_DEPENDENCIES(deploy ${__deployTarget})
-    
-    GET_DIRECTORY_PROPERTY(PROPS ADDITIONAL_MAKE_CLEAN_FILES)
-	SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROPS};${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/bundles")
-	SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROPS};${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/drivers")
-	
-	CONFIGURE_FILE(${CELIX_CMAKE_DIRECTORY}/cmake_celix/config.properties.in ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/config.properties @ONLY)
-	
-	IF(UNIX)
-		if(CELIX_FOUND)
-			GET_FILENAME_COMPONENT(FW_PATH ${CELIX_FRAMEWORK_LIBRARY} PATH)
-			GET_FILENAME_COMPONENT(UTILS_PATH ${CELIX_UTILS_LIBRARY} PATH)
-			set(LAUNCHER ${CELIX_LAUNCHER})
-		ELSE(CELIX_FOUND)
-			set(FW_PATH ${CMAKE_BINARY_DIR}/framework)
-			set(UTILS_PATH ${CMAKE_BINARY_DIR}/utils)
-			set(LAUNCHER ${CMAKE_BINARY_DIR}/launcher/celix)
-		ENDIF(CELIX_FOUND)
-		
-		
-		IF(UNIX)
-		  IF(APPLE)
-		    set(LIBRARY_PATH DYLD_LIBRARY_PATH)
-		  ELSE(APPLE)
-		    set(LIBRARY_PATH LD_LIBRARY_PATH)
-		  ENDIF(APPLE)
-		ENDIF(UNIX)
-	
-		CONFIGURE_FILE(${CELIX_CMAKE_DIRECTORY}/cmake_celix/run.sh.in ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/run.sh @ONLY)
-
-		# Generate an Eclipse launch file to be able to run the deployment from Eclipse	
-		# Linux/unix is assumed since we do only support VS on windows
-		string(REPLACE "/" ";" LIST ${PROJECT_BINARY_DIR})
-		list(LENGTH LIST len)
-		MATH(EXPR test "${len} - 1")
-		LIST(GET LIST ${test} last)
-	
-		SET(CONTAINER_NAME ${DEPLOY_NAME})
-		SET(PROGRAM_NAME ${LAUNCHER})
-		SET(PROJECT_ATTR ${last})
-		SET(WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/")
-		
-		CONFIGURE_FILE(${CELIX_CMAKE_DIRECTORY}/cmake_celix/RunConfig.in ${CMAKE_CURRENT_BINARY_DIR}/deploy/${DEPLOY_NAME}/${DEPLOY_NAME}.launch @ONLY)
-	ENDIF(UNIX)
-	
-	IF(WIN32)
-		GET_FILENAME_COMPONENT(zlib_path ${ZLIB_LIBRARY} PATH)
-		GET_FILENAME_COMPONENT(curl_path ${CURL_LIBRARY} PATH)
-		
-		IF(CELIX_FOUND)
-			SET(celixutils_path "${CELIX_FRAMEWORK_LIBRARY}/utils/${CMAKE_BUILD_TYPE}")
-			SET(celixframework_path "${CELIX_FRAMEWORK_LIBRARY}/framework/${CMAKE_BUILD_TYPE}")
-		ELSE(CELIX_FOUND)
-			SET(celixutils_path "${PROJECT_BINARY_DIR}/utils/${CMAKE_BUILD_TYPE}")
-			SET(celixframework_path "${PROJECT_BINARY_DIR}/framework/${CMAKE_BUILD_TYPE}")
-		ENDIF(CELIX_FOUND)
-		
-		SET(PATH "%PATH%;${zlib_path};${curl_path};${celixutils_path};${celixframework_path}")
-		
-		CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/vcxproj.user.in ${CMAKE_CURRENT_BINARY_DIR}/deploy_${DEPLOY_NAME}.vcxproj.user @ONLY)
-	ENDIF(WIN32)
-ENDMACRO(deploy)
-
-# macro for scanning subdirectories for deploy.cmake files
-# these files contain the deployment of targets
-MACRO(deploy_targets)
-    FILE(GLOB_RECURSE new_list deploy.cmake)
-    SET(dir_list "")
-    FOREACH(file_path ${new_list})
-        SET(dir_list ${dir_list} ${file_path})
-    ENDFOREACH()
-    LIST(REMOVE_DUPLICATES dir_list)
-    FOREACH(file_path ${dir_list})
-		include(${file_path})
-	ENDFOREACH()
-ENDMACRO()
-
-MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
-  SET(DEFAULT_ARGS)
-  FOREACH(arg_name ${arg_names})    
-    SET(${prefix}_${arg_name})
-  ENDFOREACH(arg_name)
-  FOREACH(option ${option_names})
-    SET(${prefix}_${option} FALSE)
-  ENDFOREACH(option)
-
-  SET(current_arg_name DEFAULT_ARGS)
-  SET(current_arg_list)
-  FOREACH(arg ${ARGN})            
-    SET(larg_names ${arg_names})    
-    LIST(FIND larg_names "${arg}" is_arg_name)                   
-    IF (is_arg_name GREATER -1)
-      SET(${prefix}_${current_arg_name} ${current_arg_list})
-      SET(current_arg_name ${arg})
-      SET(current_arg_list)
-    ELSE (is_arg_name GREATER -1)
-      SET(loption_names ${option_names})    
-      LIST(FIND loption_names "${arg}" is_option)            
-      IF (is_option GREATER -1)
-	     SET(${prefix}_${arg} TRUE)
-      ELSE (is_option GREATER -1)
-	     SET(current_arg_list ${current_arg_list} ${arg})
-      ENDIF (is_option GREATER -1)
-    ENDIF (is_arg_name GREATER -1)
-  ENDFOREACH(arg)
-  SET(${prefix}_${current_arg_name} ${current_arg_list})
-ENDMACRO(PARSE_ARGUMENTS)
+    file(GENERATE 
+        OUTPUT "${DEPLOY_LOCATION}/config.properties.tmp"
+        CONTENT "cosgi.auto.start.1=$<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_BUNDLES>, >
+$<JOIN:$<TARGET_PROPERTY:${DEPLOY_TARGET},DEPLOY_PROPERTIES>,
+>
+"
+    )
+
+    file(GENERATE
+        OUTPUT "${DEPLOY_LOCATION}/config.properties"
+        INPUT "${DEPLOY_LOCATION}/config.properties.tmp"
+    )
+
+    file(GENERATE
+        OUTPUT ${DEPLOY_LOCATION}/run.sh
+        CONTENT "export DYLD_LIBRARY_PATH=$<TARGET_FILE_DIR:celix_framework>:$<TARGET_FILE_DIR:celix_utils>:$<TARGET_FILE_DIR:celix_dfi>
+$<TARGET_FILE:celix> $@
+"
+    )
+
+    #TODO eclipse launcher file
+    #####
+
+    ##### Deploy Target Properties #####
+    #internal use
+    set_target_properties(${DEPLOY_TARGET} PROPERTIES "DEPLOY_TARGET_DEPS" "") #bundles to deploy.
+    set_target_properties(${DEPLOY_TARGET} PROPERTIES "DEPLOY_BUNDLES" "") #bundles to deploy.
+    set_target_properties(${DEPLOY_TARGET} PROPERTIES "DEPLOY_COPY_BUNDLES" ${DEPLOY_COPY}) #copy bundles in bundle dir or link using abs paths.
+
+    #deploy specific
+    set_target_properties(${DEPLOY_TARGET} PROPERTIES "DEPLOY_LOCATION" ${DEPLOY_LOCATION})
+    set_target_properties(${DEPLOY_TARGET} PROPERTIES "DEPLOY_PROPERTIES" "")
+    #####
+
+    deploy_bundles(${DEPLOY_TARGET} ${DEPLOY_BUNDLES})
+    deploy_properties(${DEPLOY_TARGET} ${DEPLOY_PROPERTIES})
+endfunction()
+
+#NOTE can be used for drivers/proxies/endpoints bundle dirs
+function(deploy_bundles_dir)
+    list(GET ARGN 0 DEPLOY_NAME)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS)
+    set(ONE_VAL_ARGS DIR_NAME)
+    set(MULTI_VAL_ARGS BUNDLES)
+    cmake_parse_arguments(BD "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN})
+
+    if(NOT BD_DIR_NAME)
+        message(FATAL_ERROR "Missing mandatory DIR_NAME argument")
+    endif()
+
+    get_target_property(DEPLOY_LOC ${DEPLOY_NAME} "DEPLOY_LOCATION")
+    get_target_property(DEPS ${DEPLOY_NAME} "DEPLOY_TARGET_DEPS")
+
+    foreach(BUNDLE IN ITEMS ${BD_BUNDLES})
+        set(OUT "${DEPLOY_LOC}/${BD_DIR_NAME}/${BUNDLE}.zip")
+        list(APPEND DEPS "${OUT}")
+
+        if (IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
+            add_custom_command(OUTPUT ${OUT}
+                COMMAND ${CMAKE_COMMAND} -E copy_if_different ${BUNDLE} ${OUT}
+            )
+        else()
+            add_custom_command(OUTPUT ${OUT}
+                COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" ${OUT}
+                DEPENDS ${BUNDLE}
+                #DEPENDS "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>"
+            )
+        endif()
+    endforeach()
+
+    set_target_properties(${DEPLOY_NAME} PROPERTIES "DEPLOY_TARGET_DEPS" "${DEPS}")
+endfunction()
+
+function(deploy_bundles)
+    #0 is deploy TARGET
+    #1..n is bundles
+    list(GET ARGN 0 DEPLOY_NAME)
+    list(REMOVE_AT ARGN 0)
+
+    get_target_property(BUNDLES ${DEPLOY_NAME} "DEPLOY_BUNDLES")
+    get_target_property(COPY ${DEPLOY_NAME} "DEPLOY_COPY_BUNDLES")
+
+    foreach(BUNDLE IN ITEMS ${ARGN})
+           if(COPY)
+                if(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
+                    get_filename_component(BUNDLE_FILENAME ${BUNDLE} NAME) 
+                    list(APPEND BUNDLES ${BUNDLE_FILENAME})
+                else() #assuming target
+                    list(APPEND BUNDLES "bundles/${BUNDLE}.zip")
+                endif()
+           else()
+                if(IS_ABSOLUTE ${BUNDLE} AND EXISTS ${BUNDLE})
+                    list(APPEND BUNDLES ${BUNDLE})
+                else() #assuming target
+                    list(APPEND BUNDLES "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>")
+                endif()
+           endif()
+   endforeach()
+
+   if(DEPLOY_COPY) 
+       deploy_bundles_dir(${DEPLOY_NAME} DIR_NAME bundles BUNDLES ${ARGN})
+   endif()
+
+   set_target_properties(${DEPLOY_NAME} PROPERTIES "DEPLOY_BUNDLES" "${BUNDLES}")
+endfunction()
+
+function(deploy_properties)
+    #0 is deploy TARGET
+    #1..n is bundles
+    list(GET ARGN 0 DEPLOY_NAME)
+    list(REMOVE_AT ARGN 0)
+
+    get_target_property(PROPS ${DEPLOY_NAME} "DEPLOY_PROPERTIES")
+
+    foreach(PROP IN ITEMS ${ARGN})
+        list(APPEND PROPS ${PROP})
+    endforeach()
 
+   set_target_properties(${DEPLOY_NAME} PROPERTIES "DEPLOY_PROPERTIES" "${PROPS}")
+endfunction()

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/PackagingLegacy.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/PackagingLegacy.cmake b/cmake/cmake_celix/PackagingLegacy.cmake
new file mode 100644
index 0000000..58667cd
--- /dev/null
+++ b/cmake/cmake_celix/PackagingLegacy.cmake
@@ -0,0 +1,108 @@
+# 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.
+
+macro(SET_HEADER NAME VALUE)
+    SET(BUNDLE_${NAME} ${VALUE})
+endmacro()
+
+macro(SET_HEADERS HEADERS)
+    if(NOT HEADERS)
+        set(BUNDLE_HEADERS ${HEADERS})
+    else()
+        list(APPEND BUNDLE_HEADERS ${HEADERS})
+    endif()
+endmacro()
+
+function(bundles)
+    list(GET ARGN 0 BUNDLE)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS INSTALL )
+    set(ONE_VAL_ARGS DESTINATION)
+    set(MULTI_VAL_ARGS SOURCES LINK_LIBRARIES EXPORT_VERSION ACTIVATOR PRIVATE_LIBRARIES EXPORT_LIBRARIES IMPORT_LIBRARIES FILES DIRECTORIES INSTALL_FILES)
+    cmake_parse_arguments(BUNDLE "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) 
+    #original PARSE_ARGUMENTS(_BUNDLE "SOURCES;LINK_LIBRARIES;EXPORT_VERSION;ACTIVATOR;PRIVATE_LIBRARIES;EXPORT_LIBRARIES;IMPORT_LIBRARIES;FILES;DIRECTORIES;INSTALL_FILES" "PRIVATE;EXPORT;INSTALL" ${ARGN})
+
+    if(BUNDLE_SOURCES) 
+        add_bundle(${BUNDLE} SOURCES ${BUNDLE_SOURCES} VERSION 0.0.0) 
+    else()
+        add_bundle(${BUNDLE} ACTIVATOR ${BUNDLE_ACTIVATOR} VERSION 0.0.0)
+    endif()
+
+    if(BUNDLE_FILES)
+        bundle_files(${BUNDLE} ${BUNDLE_FILES} DESTINATION .)
+    if(BUNDLE_EXPORT_VERSION) 
+        message(WARNING "EXPORT_VERSION argument not supported")
+    endif()
+    if(BUNDLE_LINK_LIBRARIES) 
+        target_link_libraries(${BUNDLE} ${BUNDLE_LINK_LIBRARIES})
+    endif()
+    if(BUNDLE_PRIVATE_LIBRARIES) 
+        bundle_private_libs(${BUNDLE} ${BUNDLE_PRIVATE_LIBS})
+    endif()
+    if(BUNDLE_EXPORT_LIBRARIES)
+        bundle_export_libs(${BUNDLE} ${BUNDLE_PRIVATE_LIBS})
+    endif()
+    if(BUNDLE_IMPORT_LIBRARIES)
+        message(FATAL_ERROR "TODO IMPORT LIBRARIES")
+    endif()
+    if(BUNDLE_DIRECTORIES)
+        message(WARNING "DIRECTORIES argument not supported")
+    endif()
+    if(BUNDLE_INSTALL_FILES)
+        message(WARNING "INSTALL_FILES argument not supported")
+    endif()
+    if(BUNDLE_INSTALL)
+        bundle_install(${BUNDLE})
+    endif()
+
+    if(BUNDLE_NAME)
+        bundle_name(${BUNDLE} ${BUNDLE_NAME})
+    endif()
+    if(BUNDLE_SYMBOLICNAME)
+        bundle_symbolic_name(${BUNDLE} ${BUNDLE_SYMBOLICNAME})
+    endif()
+    if(BUNDLE_VERSION)
+        bundle_version(${BUNDLE} ${BUNDLE_VERSION})
+    endif()
+    if (BUNDLE_HEADERS)
+        bundle_headers(${BUNDLE} ${BUNDLE_HEADERS})
+    endif()
+
+    message(STATUS "bundle function is deprecated. update to add_bundle")
+endfunction()
+
+
+function(deploy)
+    list(GET ARGN 0 DEPLOY)
+    list(REMOVE_AT ARGN 0)
+
+    set(OPTIONS )
+    set(ONE_VAL_ARGS )
+    set(MULTI_VAL_ARGS BUNDLES DRIVERS ENDPOINTS PROPERTIES)
+    cmake_parse_arguments(DEPLOY "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) 
+    #original    PARSE_ARGUMENTS(DEPLOY "BUNDLES;DRIVERS;ENDPOINTS;PROPERTIES" "" ${ARGN})                                                                                                                                      
+
+    add_deploy(${DEPLOY} BUNDLES ${DEPLOY_BUNDLES} PROPERTIES ${DEPLOY_PROPERTIES})
+    if(DEPLOY_DRIVERS)
+        deploy_bundles_dir(${DEPLOY} DIR_NAME "drivers" BUNDLES ${DEPLOY_DRIVERS})
+    endif()
+    if(DEPLOY_ENDPOINTS)
+        deploy_bundles_dir(${DEPLOY} DIR_NAME "endpoints" BUNDLES ${DEPLOY_ENDPOINTS})
+    endif()
+    message(STATUS "deploy function is deprecated. update to add_deploy")
+endfunction()

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/config.properties.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/config.properties.in b/cmake/cmake_celix/config.properties.in
deleted file mode 100644
index 30dd9f5..0000000
--- a/cmake/cmake_celix/config.properties.in
+++ /dev/null
@@ -1,2 +0,0 @@
-cosgi.auto.start.1=@BUNDLES@
-@PROPERTIES@

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/installation.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/installation.cmake b/cmake/cmake_celix/installation.cmake
deleted file mode 100644
index 3be7c37..0000000
--- a/cmake/cmake_celix/installation.cmake
+++ /dev/null
@@ -1,30 +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.
-
-SET(CMAKE_INSTALL_COMPONENT "Framework")
-GET_FILENAME_COMPONENT(__cmake_path ${CMAKE_COMMAND} PATH)
-FIND_PROGRAM(CPACK_COMMAND cpack ${__cmake_path})
-MESSAGE(STATUS "Found CPack at: ${CPACK_COMMAND}")
-IF(NOT CPACK_COMMAND)
-	MESSAGE(FATAL_ERROR "Need CPack!")
-ENDIF(NOT CPACK_COMMAND)
-
-CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/CPackConfig-Installation.in CPackConfig-Installation.cmake @ONLY)
-ADD_CUSTOM_TARGET(package-release
-  ${CPACK_COMMAND} --config "CPackConfig-Installation.cmake"
-  )
-  

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/manifest.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/manifest.in b/cmake/cmake_celix/manifest.in
deleted file mode 100644
index d1d9c5c..0000000
--- a/cmake/cmake_celix/manifest.in
+++ /dev/null
@@ -1,2 +0,0 @@
-Bundle-SymbolicName: @BUNDLE_SYMBOLICNAME@
-@INT_BUNDLE_EXTRAHEADER@

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/cmake/cmake_celix/run.sh.in
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/run.sh.in b/cmake/cmake_celix/run.sh.in
deleted file mode 100644
index 606f0e6..0000000
--- a/cmake/cmake_celix/run.sh.in
+++ /dev/null
@@ -1,2 +0,0 @@
-export @LIBRARY_PATH@=@FW_PATH@:@UTILS_PATH@
-@LAUNCHER@ $@

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/config_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/CMakeLists.txt b/config_admin/CMakeLists.txt
index 8075c31..81040db 100644
--- a/config_admin/CMakeLists.txt
+++ b/config_admin/CMakeLists.txt
@@ -22,4 +22,7 @@ if (CONFIG_ADMIN)
 	add_subdirectory(service)
 	add_subdirectory(examples)
 
+	add_deploy("config_admin1" BUNDLES config_admin shell shell_tui log_service log_writer example_test)
+	add_deploy("config_admin2" BUNDLES config_admin shell shell_tui log_service log_writer bundle_managed_service bundle_configuring)
+
 endif (CONFIG_ADMIN)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/config_admin/deploy.cmake
----------------------------------------------------------------------
diff --git a/config_admin/deploy.cmake b/config_admin/deploy.cmake
deleted file mode 100644
index d1a769d..0000000
--- a/config_admin/deploy.cmake
+++ /dev/null
@@ -1,24 +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 (CONFIG_ADMIN)
- 	
-	deploy("config_admin1" BUNDLES config_admin shell shell_tui log_service log_writer example_test)
-	deploy("config_admin2" BUNDLES config_admin shell shell_tui log_service log_writer bundle_managed_service bundle_configuring)
-
-endif (CONFIG_ADMIN)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/config_admin/examples/example_test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test/CMakeLists.txt b/config_admin/examples/example_test/CMakeLists.txt
index 5529d45..810f381 100644
--- a/config_admin/examples/example_test/CMakeLists.txt
+++ b/config_admin/examples/example_test/CMakeLists.txt
@@ -21,10 +21,9 @@ include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
 include_directories("private/include")
 
-SET(BUNDLE_SYMBOLICNAME "example_test")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(example_test SOURCES 
+add_bundle(example_test
+    VERSION 0.1.0
+    SOURCES
 	private/src/activator
 	private/src/example_managed_service_impl
 )

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt b/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
index 344ace2..915a418 100644
--- a/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
+++ b/config_admin/examples/example_test2/bundle_configuring/CMakeLists.txt
@@ -20,11 +20,9 @@ include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
 
-SET(BUNDLE_SYMBOLICNAME  "bundle_configuraring")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(bundle_configuring SOURCES 
+add_bundle(bundle_configuring SOURCES
 	private/src/activator
+    VERSION 0.1.0
 )
 
 target_link_libraries(bundle_configuring celix_framework celix_utils config_admin ${APR_LIBRARY})

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt b/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
index 3de8d69..434496a 100644
--- a/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
+++ b/config_admin/examples/example_test2/bundle_managed_service/CMakeLists.txt
@@ -21,12 +21,10 @@ include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/config_admin/service/public/include")
 include_directories("private/include")
 
-SET(BUNDLE_SYMBOLICNAME "bundle_managed_service")
-SET(BUNDLE_VERSION "0.1.0")
-
-bundle(bundle_managed_service SOURCES 
+add_bundle(bundle_managed_service SOURCES
 	private/src/activator
 	private/src/example_managed_service_impl
+    VERSION 0.1.0
 )
 
 target_link_libraries(bundle_managed_service celix_framework celix_utils config_admin ${APR_LIBRARY})

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/config_admin/service/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/config_admin/service/CMakeLists.txt b/config_admin/service/CMakeLists.txt
index 0dfd419..e194081 100644
--- a/config_admin/service/CMakeLists.txt
+++ b/config_admin/service/CMakeLists.txt
@@ -20,11 +20,10 @@ include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
 include_directories("public/include")
 include_directories("private/include")
-
-SET(BUNDLE_SYMBOLICNAME "config_admin")
-SET(BUNDLE_VERSION "0.0.1")
  		
-bundle(config_admin SOURCES 
+add_bundle(config_admin 
+    VERSION 0.0.1
+    SOURCES
 	private/src/activator 
 	private/src/configuration_admin_factory
 	private/src/configuration_admin_impl

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/dependency_manager/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dependency_manager/CMakeLists.txt b/dependency_manager/CMakeLists.txt
index 7e86931..48214b0 100644
--- a/dependency_manager/CMakeLists.txt
+++ b/dependency_manager/CMakeLists.txt
@@ -17,9 +17,7 @@
 
 celix_subproject(DEPENDENCY_MANAGER "Option to build the dependency manager static library" ON DEPS framework)
 if (DEPENDENCY_MANAGER)
-    SET(BUNDLE_SYMBOLICNAME "apache_celix_dm_shell")
-    SET(BUNDLE_VERSION "0.0.1")
-    SET(BUNDLE_NAME "Apache Celix DM Shell commands")
+
     # Add -fPIC for x86_64 Unix platforms; this lib will be linked to a shared lib
     if(UNIX AND NOT WIN32)
       find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
@@ -31,13 +29,19 @@ if (DEPENDENCY_MANAGER)
         endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
       endif(CMAKE_UNAME)
     endif(UNIX AND NOT WIN32)
-    
-    CELIX_ADD_COMPONENT(dependency_manager
-    	DISPLAY_NAME Dependency Manager
-        DESCRIPTION "The Apache Celix dependency manager (static) library"
-        GROUP all
-    )
-    bundle(dm_shell SOURCES
+
+    #TODO check if something needs to be done?
+    #CELIX_ADD_COMPONENT(dependency_manager
+    #	DISPLAY_NAME Dependency Manager
+    #    DESCRIPTION "The Apache Celix dependency manager (static) library"
+    #    GROUP all
+    #)
+
+    add_bundle(dm_shell
+        SYMBOLIC_NAME "apche_celix_dm_shell"
+        VERSION "0.0.1"
+        NAME "Apache Celix DM Shell Commands"
+        SOURCES
             private/src/dm_shell_activator
             private/src/dm_shell_list_command
     )
@@ -66,9 +70,10 @@ if (DEPENDENCY_MANAGER)
             public/include/dm_service_dependency.h
             public/include/dm_info.h
 		DESTINATION 
-			include/celix/dependency_manager
-		COMPONENT 
-			dependency_manager
+	    	include/celix/dependency_manager
+	    #TODO install componnent
+		#COMPONENT
+		#	dependency_manager
 	)
     install_bundle(dm_shell)
     install(TARGETS dependency_manager DESTINATION lib COMPONENT dependency_manager)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/deployment_admin/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/deployment_admin/CMakeLists.txt b/deployment_admin/CMakeLists.txt
index 00dfa13..d299970 100644
--- a/deployment_admin/CMakeLists.txt
+++ b/deployment_admin/CMakeLists.txt
@@ -22,38 +22,39 @@ if (DEPLOYMENT_ADMIN)
     find_package(UUID REQUIRED)
 
     add_definitions(-DUSE_FILE32API)
-    
-    SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_deployment_admin")
-    SET(BUNDLE_VERSION "0.0.1")
-	SET_HEADERS("Bundle-Name: Apache Celix Deployment Admin") 
-    
+
     include_directories("${CURL_INCLUDE_DIR}")
     include_directories("${UUID_INCLUDE_DIR}")
     include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
     include_directories("${PROJECT_SOURCE_DIR}/deployment_admin/private/include")
     include_directories("${PROJECT_SOURCE_DIR}/deployment_admin/public/include")
     
-    bundle(deployment_admin SOURCES
-    	private/src/deployment_package 
-    	private/src/deployment_admin
-    	private/src/deployment_admin_activator
-    	private/src/ioapi
-    	private/src/miniunz
-    	private/src/unzip
-    	private/src/log
-    	private/src/log_store
-    	private/src/log_sync
-        
-        private/include/deployment_admin.h
-        private/include/deployment_package.h
-        private/include/ioapi.h
-        private/include/log.h
-        private/include/log_event.h
-        private/include/log_store.h
-        private/include/log_sync.h
-        private/include/miniunz.h
-        private/include/unzip.h
+    add_bundle(deployment_admin
+        SYMBOLIC_NAME "apache_celix_deployment_admin"
+        VERSION "0.0.1"
+        NAME "Apache Celix Deployment Admin"
+        SOURCES
+            private/src/deployment_package
+            private/src/deployment_admin
+            private/src/deployment_admin_activator
+            private/src/ioapi
+            private/src/miniunz
+            private/src/unzip
+            private/src/log
+            private/src/log_store
+            private/src/log_sync
+
+            private/include/deployment_admin.h
+            private/include/deployment_package.h
+            private/include/ioapi.h
+            private/include/log.h
+            private/include/log_event.h
+            private/include/log_store.h
+            private/include/log_sync.h
+            private/include/miniunz.h
+            private/include/unzip.h
     )
+
     
     install_bundle(deployment_admin
     	HEADERS
@@ -61,4 +62,13 @@ if (DEPLOYMENT_ADMIN)
 	)
     
     target_link_libraries(deployment_admin celix_framework ${CURL_LIBRARIES})
+
+
+    add_deploy(deployment-admin
+        BUNDLES deployment_admin shell shell_tui log_service log_writer
+        PROPERTIES
+    		"deployment_admin_url=http://localhost:8080"
+    		"deployment_admin_identification=celix"
+    		"org.osgi.framework.storage.clean=onFirstInit"
+    )
 endif (DEPLOYMENT_ADMIN)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/deployment_admin/deploy.cmake
----------------------------------------------------------------------
diff --git a/deployment_admin/deploy.cmake b/deployment_admin/deploy.cmake
deleted file mode 100644
index 6ab6e3e..0000000
--- a/deployment_admin/deploy.cmake
+++ /dev/null
@@ -1,24 +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.
-is_enabled(DEPLOYMENT_ADMIN)
-if (DEPLOYMENT_ADMIN)
-	deploy("deployment-admin" BUNDLES deployment_admin shell shell_tui log_service log_writer PROPERTIES 
-		"deployment_admin_url=http://localhost:8080"
-		"deployment_admin_identification=celix"
-		"org.osgi.framework.storage.clean=onFirstInit"
-	)
-endif (DEPLOYMENT_ADMIN)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/device_access/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/device_access/CMakeLists.txt b/device_access/CMakeLists.txt
index e707df0..63576f6 100644
--- a/device_access/CMakeLists.txt
+++ b/device_access/CMakeLists.txt
@@ -21,5 +21,5 @@ if(DEVICE_ACCESS)
     add_subdirectory(device_access)
     add_subdirectory(driver_locator)   
     add_subdirectory(example)
-    
+
 endif(DEVICE_ACCESS)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/device_access/deploy.cmake
----------------------------------------------------------------------
diff --git a/device_access/deploy.cmake b/device_access/deploy.cmake
deleted file mode 100644
index b335dc7..0000000
--- a/device_access/deploy.cmake
+++ /dev/null
@@ -1,21 +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.
-is_enabled(DEVICE_ACCESS_EXAMPLE)
-if(DEVICE_ACCESS_EXAMPLE)
-	deploy("device_access_example" BUNDLES device_manager driver_locator shell shell_tui log_service base_driver
-	                               DRIVERS word_consumingdriver char_refiningdriver)
-endif(DEVICE_ACCESS_EXAMPLE)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/device_access/device_access/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/device_access/device_access/CMakeLists.txt b/device_access/device_access/CMakeLists.txt
index 03e7817..f3eec60 100644
--- a/device_access/device_access/CMakeLists.txt
+++ b/device_access/device_access/CMakeLists.txt
@@ -15,23 +15,23 @@
 # specific language governing permissions and limitations
 # under the License.
 
-SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_device_manager")
-SET(BUNDLE_VERSION "0.0.1")
-SET_HEADERS("Bundle-Name: Apache Celix Device Access Device Manager") 
+add_bundle(device_manager
+	SYMBOLIC_NAME "apache_celix_device_manager"
+	VERSION "0.0.1"
+	NAME "Apache Celix Device Access Device Manager"
+	SOURCES
+		private/src/activator
+		private/src/driver_attributes
+		private/src/device_manager
+		private/src/driver_loader
+		private/src/driver_matcher
 
-bundle(device_manager SOURCES 
-	private/src/activator
-	private/src/driver_attributes 
-	private/src/device_manager
-	private/src/driver_loader
-	private/src/driver_matcher
-    
-    ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
-    
-    private/include/device_manager.h
-    private/include/driver_attributes.h
-    private/include/driver_loader.h
-    private/include/driver_matcher.h
+		${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
+
+		private/include/device_manager.h
+		private/include/driver_attributes.h
+		private/include/driver_loader.h
+		private/include/driver_matcher.h
 )
 
 install_bundle(device_manager

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/device_access/driver_locator/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/device_access/driver_locator/CMakeLists.txt b/device_access/driver_locator/CMakeLists.txt
index f47696a..12b23d6 100644
--- a/device_access/driver_locator/CMakeLists.txt
+++ b/device_access/driver_locator/CMakeLists.txt
@@ -15,13 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
-SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_driver_locator")
-SET(BUNDLE_VERSION "0.0.1")
-SET_HEADERS("Bundle-Name: Apache Celix Device Access Driver Locator")
-
-bundle(driver_locator SOURCES 
-	private/src/activator 
-	private/src/driver_locator
+add_bundle(driver_locator
+	SYMBOLIC_NAME "apache_celix_driver_locator"
+	VERSION "0.0.1"
+	NAME "Apache Celix Device Access Driver Locator"
+	SOURCES
+		private/src/activator
+		private/src/driver_locator
 )
 
 install_bundle(driver_locator)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/device_access/example/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/device_access/example/CMakeLists.txt b/device_access/example/CMakeLists.txt
index dc888a6..acf16f7 100644
--- a/device_access/example/CMakeLists.txt
+++ b/device_access/example/CMakeLists.txt
@@ -20,4 +20,13 @@ if(DEVICE_ACCESS_EXAMPLE)
 	add_subdirectory(base_driver)
 	add_subdirectory(consuming_driver)
 	add_subdirectory(refining_driver)
-endif(DEVICE_ACCESS_EXAMPLE)
\ No newline at end of file
+
+    add_deploy(device_access_example
+        BUNDLES device_manager driver_locator shell shell_tui log_service base_driver
+    )
+
+    deploy_bundles_dir(device_access_example
+            DIR_NAME "DRIVERS"
+            BUNDLES word_consumingdriver char_refiningdriver
+    )
+endif(DEVICE_ACCESS_EXAMPLE)

http://git-wip-us.apache.org/repos/asf/celix/blob/49ab9ab5/device_access/example/base_driver/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/device_access/example/base_driver/CMakeLists.txt b/device_access/example/base_driver/CMakeLists.txt
index 82b916e..c354d3b 100644
--- a/device_access/example/base_driver/CMakeLists.txt
+++ b/device_access/example/base_driver/CMakeLists.txt
@@ -15,13 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 
-SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_base_driver_example")
-SET(BUNDLE_VERSION "0.0.1")
-SET_HEADERS("Bundle-Name: Apache Celix Device Access Base Driver Example")
-
-bundle(base_driver SOURCES 
-	private/src/activator 
-	private/src/base_driver
+add_bundle(base_driver
+ 	SYMBOLIC_NAME "apache_celix_base_driver_example"
+ 	VERSION "0.0.1"
+ 	NAME "Apache Celix Device Access Base Driver Example"
+	SOURCES
+		private/src/activator
+		private/src/base_driver
 )
 
 include_directories(${PROJECT_SOURCE_DIR}/device_access/device_access/public/include)