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 2020/06/11 10:59:52 UTC

[celix] branch master updated: Refactors generation and usage of CelixTargets cmake files (#254)

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

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/master by this push:
     new 67dfb18  Refactors generation and usage of CelixTargets cmake files (#254)
67dfb18 is described below

commit 67dfb18dbc5e4cec388a6b0e8eb4ab7800d8f04f
Author: Pepijn Noltes <pe...@gmail.com>
AuthorDate: Thu Jun 11 12:59:44 2020 +0200

    Refactors generation and usage of CelixTargets cmake files (#254)
    
    * Refactors generation and usage of CelixTargets cmake files for different configs
    * Adds celix cmake functions to get a bundle file/filename from a (imported) bundle target.
---
 bundles/http_admin/civetweb/CMakeLists.txt         |   2 +-
 cmake/CelixConfig.cmake                            |   6 +-
 cmake/cmake_celix/BundlePackaging.cmake            | 194 ++++++++++++++++++---
 cmake/cmake_celix/ContainerPackaging.cmake         |  11 +-
 cmake/cmake_celix/DockerPackaging.cmake            |  10 +-
 examples/CMakeLists.txt                            |   7 +-
 examples/celix-examples/CMakeLists.txt             |   1 +
 .../celix-examples/http_example/CMakeLists.txt     |   4 +-
 8 files changed, 196 insertions(+), 39 deletions(-)

diff --git a/bundles/http_admin/civetweb/CMakeLists.txt b/bundles/http_admin/civetweb/CMakeLists.txt
index 2269ec5..8b43cf2 100644
--- a/bundles/http_admin/civetweb/CMakeLists.txt
+++ b/bundles/http_admin/civetweb/CMakeLists.txt
@@ -25,7 +25,7 @@ target_include_directories(civetweb_shared PUBLIC
         $<INSTALL_INTERFACE:include/celix/http_admin>
         )
 target_link_libraries(civetweb_shared PUBLIC CURL::libcurl)
-
+add_library(Celix::civetweb_shared ALIAS civetweb_shared)
 
 #Create static library
 add_library(civetweb_static STATIC
diff --git a/cmake/CelixConfig.cmake b/cmake/CelixConfig.cmake
index f9cc1a4..db1eb3f 100644
--- a/cmake/CelixConfig.cmake
+++ b/cmake/CelixConfig.cmake
@@ -31,11 +31,7 @@ get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH)
 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)
 
-# Load information for each installed configuration.
-file(GLOB CONFIG_FILES "${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets-*.cmake")
-foreach(f ${CONFIG_FILES})
-  include(${f})
-endforeach()
+include("${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake")
 
 # The rest is added to ensure backwards compatiblity with project using the cmake lib/include var instead of targets.
 set(CELIX_CMAKE_MODULES_DIR ${REL_INSTALL_DIR}/share/celix/cmake/Modules)
diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake
index 3081b5d..45a976b 100644
--- a/cmake/cmake_celix/BundlePackaging.cmake
+++ b/cmake/cmake_celix/BundlePackaging.cmake
@@ -201,13 +201,19 @@ function(add_celix_bundle)
     endif ()
 
 
-    set(BUNDLE_FILENAME ${BASE_BUNDLE_FILENAME}-${CMAKE_BUILD_TYPE}.zip)
-    foreach (NO_POSTFIX_BT IN LISTS CELIX_NO_POSTFIX_BUILD_TYPES)
-        if (CMAKE_BUILD_TYPE STREQUAL NO_POSTFIX_BT)
-            #setting bundle file name without postfix
-            set(BUNDLE_FILENAME ${BASE_BUNDLE_FILENAME}.zip)
-        endif ()
-    endforeach ()
+    if (CMAKE_BUILD_TYPE)
+        set(BUNDLE_FILENAME ${BASE_BUNDLE_FILENAME}-${CMAKE_BUILD_TYPE}.zip)
+        foreach (NO_POSTFIX_BT IN LISTS CELIX_NO_POSTFIX_BUILD_TYPES)
+            if (CMAKE_BUILD_TYPE STREQUAL NO_POSTFIX_BT)
+                #setting bundle file name without postfix
+                set(BUNDLE_FILENAME ${BASE_BUNDLE_FILENAME}.zip)
+            endif ()
+        endforeach ()
+    else ()
+        #note if no CMAKE_BUILD_TYPE is set, do not use a postfix
+        set(BUNDLE_FILENAME ${BASE_BUNDLE_FILENAME}.zip)
+    endif ()
+
 
     set(BUNDLE_FILE "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_FILENAME}")
     #set(BUNDLE_CONTENT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${BUNDLE_TARGET_NAME}_content")
@@ -304,7 +310,7 @@ function(add_celix_bundle)
     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.
     set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CREATE_BUNDLE_TARGET" ${BUNDLE_TARGET_NAME}_bundle) #target which creat the bundle zip
-    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_IMPORTED" FALSE) #whether targer is a imported (bundle) target
+    set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_IMPORTED" FALSE) #whether target is a imported (bundle) target
 
     #bundle specific
     set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CONTENT_DIR" ${BUNDLE_CONTENT_DIR}) #location where the content to be jar/zipped.
@@ -841,13 +847,21 @@ function(install_celix_bundle_targets)
         message(FATAL_ERROR "Please provide a namespace used for the generated cmake targets.")
     endif ()
 
-    if (NOT DEFINED EXPORT_FILE)
-        set(EXPORT_FILE ${EXPORT_NAME}BundleTargets)
+    if (CMAKE_BUILD_TYPE)
+        string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
+    else ()
+        set(BUILD_TYPE "NOCONFIG")
     endif ()
 
-#    if (NOT CMAKE_BUILD_TYPE STREQUAL "Release")
-        set(EXPORT_FILE ${EXPORT_FILE}-${CMAKE_BUILD_TYPE})
-#    endif ()
+    if (DEFINED EXPORT_FILE)
+        #if present replace the .cmake from the export file
+        string(REGEX REPLACE ".cmake" "" EXPORT_FILE "${EXPORT_FILE}")
+
+        set(BASE_EXPORT_FILE ${EXPORT_FILE})
+    else ()
+        set(BASE_EXPORT_FILE ${EXPORT_NAME}BundleTargets)
+    endif ()
+    set(EXPORT_FILE ${BASE_EXPORT_FILE}-${BUILD_TYPE})
 
     if (NOT DEFINED EXPORT_PROJECT_NAME)
         string(TOLOWER ${PROJECT_NAME} EXPORT_PROJECT_NAME)
@@ -881,24 +895,164 @@ get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)
 
     foreach(BUNDLE_TARGET IN LISTS EXPORT_BUNDLES)
         set(TN "${EXPORT_NAMESPACE}${BUNDLE_TARGET}")
-        string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
         file(APPEND "${CONF_IN_FILE}" "
 if (NOT TARGET ${TN}) 
     add_library(${TN} SHARED IMPORTED)
-    set_property(TARGET ${TN} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${BUILD_TYPE})
-    set_target_properties(${TN} PROPERTIES
-        BUNDLE_IMPORTED TRUE
-        BUNDLE_FILE \"\${_IMPORT_PREFIX}/share/${EXPORT_PROJECT_NAME}/bundles/$<TARGET_PROPERTY:${BUNDLE_TARGET},BUNDLE_FILENAME>\"
-        BUNDLE_FILENAME \"$<TARGET_PROPERTY:${BUNDLE_TARGET},BUNDLE_FILENAME>\"
-    )
 endif ()
+set_property(TARGET ${TN} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${BUILD_TYPE})
+set_target_properties(${TN} PROPERTIES
+    BUNDLE_IMPORTED TRUE
+    BUNDLE_FILE_${BUILD_TYPE} \"\${_IMPORT_PREFIX}/share/${EXPORT_PROJECT_NAME}/bundles/$<TARGET_PROPERTY:${BUNDLE_TARGET},BUNDLE_FILENAME>\"
+    BUNDLE_FILENAME_${BUILD_TYPE} \"$<TARGET_PROPERTY:${BUNDLE_TARGET},BUNDLE_FILENAME>\"
+)
 ")
     endforeach()
+
     file(GENERATE OUTPUT "${CONF_FILE}" INPUT "${CONF_IN_FILE}")
 
+
+    #Generate not build type specific targets file
+    set(GENERIC_CONF_FILE "${CMAKE_BINARY_DIR}/celix/gen/cmake/${EXPORT_NAME}-BundleTargets.cmake")
+    file(GENERATE OUTPUT ${GENERIC_CONF_FILE} CONTENT "
+# Load bundle information for each installed configuration.
+get_filename_component(_DIR \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)
+file(GLOB CONFIG_FILES \"\${_DIR}/${BASE_EXPORT_FILE}-*.cmake\")
+foreach(f \${CONFIG_FILES})
+  include(\${f})
+endforeach()
+")
+
     if (EXPORT_COMPONENT)
         install(FILES "${CONF_FILE}" DESTINATION ${EXPORT_DESTINATION} RENAME ${EXPORT_FILE}.cmake COMPONENT ${EXPORT_COMPONENT})
+        install(FILES "${GENERIC_CONF_FILE}" DESTINATION ${EXPORT_DESTINATION} RENAME ${BASE_EXPORT_FILE}.cmake COMPONENT ${EXPORT_COMPONENT})
     else ()
         install(FILES "${CONF_FILE}" DESTINATION ${EXPORT_DESTINATION} RENAME ${EXPORT_FILE}.cmake)
+        install(FILES "${GENERIC_CONF_FILE}" DESTINATION ${EXPORT_DESTINATION} RENAME ${BASE_EXPORT_FILE}.cmake)
     endif ()
 endfunction()
+
+#[[
+Get bundle file (absolute path to bundle) from an (imported) bundle
+target taking into account the used CMAKE_BUILD_TYPE and available
+bundle configurations.
+
+celix_get_bundle_file(<bundle_target> VARIABLE_NAME)
+
+Example: celix_get_bundle_file(Celix::shell SHELL_BUNDLE_FILE)
+
+]]
+function(celix_get_bundle_file)
+
+if (TARGET ${ARGV0})
+    get_target_property(_IMP ${ARGV0} BUNDLE_IMPORTED)
+    if (_IMP)
+        _celix_extract_imported_bundle_info(${ARGV0})
+        set(${ARGV1} ${BUNDLE_FILE} PARENT_SCOPE)
+        unset(BUNDLE_FILE)
+        unset(BUNDLE_FILENAME)
+    else ()
+        get_target_property(BF ${ARGV0} BUNDLE_FILE)
+        set(${ARGV1} ${BF} PARENT_SCOPE)
+    endif ()
+else ()
+    message(FATAL_ERROR "Provided argument is not a CMake target: ${ARGV0}")
+endif ()
+
+endfunction ()
+
+#[[
+Get bundle filename from an (imported) bundle target taking into account the
+used CMAKE_BUILD_TYPE and available bundle configurations.
+
+celix_get_bundle_filename(<bundle_target> VARIABLE_NAME)
+
+Example: celix_get_bundle_filename(Celix::shell SHELL_BUNDLE_FILENAME)
+
+]]
+function(celix_get_bundle_filename)
+
+if (TARGET ${ARGV0})
+    get_target_property(_IMP ${ARGV0} BUNDLE_IMPORTED)
+    if (_IMP)
+        _celix_extract_imported_bundle_info(${ARGV0})
+        set(${ARGV1} ${BUNDLE_FILENAME} PARENT_SCOPE)
+    else ()
+        get_target_property(BF ${ARGV0} BUNDLE_FILENAME)
+        set(${ARGV1} ${BF} PARENT_SCOPE)
+    endif ()
+else ()
+    message(FATAL_ERROR "Provided argument is not a CMake target: ${ARGV0}")
+endif ()
+
+endfunction ()
+
+
+
+
+######################################### "Private" function ###########################################################
+
+
+#[[
+extract the BUNDLE_FILENAME and BUNDLE_FILE from a imported bundle target taking into account the used CMAKE_BUILD_TYPE
+and if configured the MAP_IMPORTED_CONFIG_* or CMAKE_MAP_IMPORTED_CONFIG_*
+
+_celix_extract_imported_bundle_info(<bundle_target>)
+
+Note this is considered a private function
+]]
+function (_celix_extract_imported_bundle_info)
+    set(BUNDLE ${ARGV0})
+    #get_target_property(_CONFIGS ${ARGV0} "IMPORTED_CONFIGURATIONS") #Not needed?
+
+    if (CMAKE_BUILD_TYPE)
+        string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
+    else ()
+        set(BUILD_TYPE "NOCONFIG")
+    endif ()
+
+    get_target_property(BF ${BUNDLE} BUNDLE_FILE_${BUILD_TYPE})
+    get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME_${BUILD_TYPE})
+
+    if (NOT BF)
+        #BUNDLE_FILE(NAME) not found for the current BUILD_TYPE looking for MAP value (if there is a cmake build type)
+        get_target_property(MAP_TO_CONFIG ${BUNDLE} MAP_IMPORTED_CONFIG_${BUILD_TYPE})
+        if (NOT MAP_TO_CONFIG AND CMAKE_MAP_IMPORTED_CONFIG_${BUILD_TYPE})
+            set(MAP_TO_CONFIG CMAKE_MAP_IMPORTED_CONFIG_${BUILD_TYPE})
+        endif ()
+        if (MAP_TO_CONFIG)
+            get_target_property(BF ${BUNDLE} BUNDLE_FILE_${MAP_TO_CONFIG})
+            get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME_${MAP_TO_CONFIG})
+        endif ()
+    endif ()
+
+    if (NOT BF)
+        get_target_property(BF ${BUNDLE} BUNDLE_FILE)
+        get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME)
+    endif ()
+
+    #fallback steps
+    if (NOT BF)
+        get_target_property(BF ${BUNDLE} BUNDLE_FILE_RELWITHDEBINFO)
+        get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME_RELWITHDEBINFO)
+    endif ()
+    if (NOT BF)
+        get_target_property(BF ${BUNDLE} BUNDLE_FILE_RELEASE)
+        get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME_RELEASE)
+    endif ()
+    if (NOT BF)
+        get_target_property(BF ${BUNDLE} BUNDLE_FILE_MINSIZEREL)
+        get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME_MINSIZEREL)
+    endif ()
+    if (NOT BF)
+        get_target_property(BF ${BUNDLE} BUNDLE_FILE_NOCONFIG)
+        get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME_NOCONFIG)
+    endif ()
+    if (NOT BF)
+        get_target_property(BF ${BUNDLE} BUNDLE_FILE_DEBUG)
+        get_target_property(BFN ${BUNDLE} BUNDLE_FILENAME_DEBUG)
+    endif ()
+
+
+    set(BUNDLE_FILE ${BF} PARENT_SCOPE)
+    set(BUNDLE_FILENAME ${BFN} PARENT_SCOPE)
+endfunction ()
diff --git a/cmake/cmake_celix/ContainerPackaging.cmake b/cmake/cmake_celix/ContainerPackaging.cmake
index 7d643b7..d1bb724 100644
--- a/cmake/cmake_celix/ContainerPackaging.cmake
+++ b/cmake/cmake_celix/ContainerPackaging.cmake
@@ -364,13 +364,14 @@ function(celix_container_bundles_dir)
             else ()
                 get_target_property(IMP ${BUNDLE} BUNDLE_IMPORTED)
                 if (IMP) #An imported bundle target -> handle target without DEPENDS
+                    _celix_extract_imported_bundle_info(${BUNDLE}) #extracts BUNDLE_FILE and BUNDLE_FILENAME
                     string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars (e.g. for target like Celix::shell)
                     set(OUT "${CMAKE_BINARY_DIR}/celix/gen/containers/${CONTAINER_TARGET}/copy-bundle-for-target-${BUNDLE_ID}.timestamp")
-                    set(DEST "${CONTAINER_LOC}/${BD_DIR_NAME}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
+                    set(DEST "${CONTAINER_LOC}/${BD_DIR_NAME}/${BUNDLE_FILENAME}")
                     add_custom_command(OUTPUT ${OUT}
                         COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
                         COMMAND ${CMAKE_COMMAND} -E make_directory ${CONTAINER_LOC}/${BD_DIR_NAME}
-                        COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" ${DEST}
+                        COMMAND ${CMAKE_COMMAND} -E copy_if_different "${BUNDLE_FILE}" ${DEST}
                         COMMENT "Copying (imported) bundle '${BUNDLE}' to '${CONTAINER_LOC}/${BD_DIR_NAME}'"
                     )
                     set(HANDLED TRUE)
@@ -461,8 +462,10 @@ function(celix_container_bundles)
                else()
                    get_target_property(IMP ${BUNDLE} BUNDLE_IMPORTED)
                    if (IMP) #An imported bundle target -> handle target without DEPENDS
-                       set(COPY_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
-                       set(ABS_LOC "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>")
+                       _celix_extract_imported_bundle_info(${BUNDLE}) #extracts BUNDLE_FILE and BUNDLE_FILENAME
+
+                       set(COPY_LOC "${BUNDLE_FILENAME}")
+                       set(ABS_LOC "${BUNDLE_FILE}")
                        set(HANDLED TRUE)
                    endif ()
                endif ()
diff --git a/cmake/cmake_celix/DockerPackaging.cmake b/cmake/cmake_celix/DockerPackaging.cmake
index 430e96f..78643c1 100644
--- a/cmake/cmake_celix/DockerPackaging.cmake
+++ b/cmake/cmake_celix/DockerPackaging.cmake
@@ -392,21 +392,22 @@ function(celix_docker_bundles)
         get_target_property(IMP ${BUNDLE} BUNDLE_IMPORTED)
         if (IMP) #An imported bundle target -> handle target without DEPENDS
           string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars (e.g. for target like Celix::shell)
+          _celix_extract_imported_bundle_info(${BUNDLE}) #extracts BUNDLE_FILE and BUNDLE_FILENAME
           set(OUT "${CMAKE_BINARY_DIR}/celix/gen/docker/${DOCKER_TARGET}/copy-bundle-for-target-${BUNDLE_ID}.timestamp")
-          set(DEST "${LOC}/${BUNDLES_DIR}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
+          set(DEST "${LOC}/${BUNDLES_DIR}/${BUNDLE_FILENAME}")
           add_custom_command(OUTPUT ${OUT}
             COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
             COMMAND ${CMAKE_COMMAND} -E make_directory ${LOC}/${BUNDLES_DIR}
-            COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" ${DEST}
+            COMMAND ${CMAKE_COMMAND} -E copy_if_different "${BUNDLE_FILE}" ${DEST}
             COMMENT "Copying (imported) bundle '${BUNDLE}' to '${LOC}/${BUNDLES_DIR}'"
             )
-          list(APPEND BUNDLES "${BUNDLES_DIR}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
+          list(APPEND BUNDLES "${BUNDLES_DIR}/${BUNDLE_FILENAME}")
           set(HANDLED TRUE)
         endif ()
       endif ()
     endif ()
 
-    if (NOT HANDLED) #assuming (future) bundle target
+    if (NOT HANDLED) #assuming (future) bundle target)
       string(MAKE_C_IDENTIFIER ${BUNDLE} BUNDLE_ID) #Create id with no special chars (e.g. for target like Celix::shell)
       set(OUT "${CMAKE_BINARY_DIR}/celix/gen/docker/${DOCKER_TARGET}/copy-bundle-for-target-${BUNDLE_ID}.timestamp")
       set(DEST "${LOC}/${BUNDLES_DIR}/$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILENAME>")
@@ -564,6 +565,7 @@ function(install_celix_docker)
 
   if(CELIX_BUILD_DOCKER_USE_DOCKER_DIR_TAR)
     add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME}/${DOCKER_IMAGE_NAME}.tar.gz
+            COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME}
             COMMAND tar czf ${CMAKE_BINARY_DIR}/${DOCKER_PROJECT_NAME}/${DOCKER_IMAGE_NAME}.tar.gz --directory=$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC> .
             DEPENDS ${DOCKERFILE} ${DOCKER_TARGET}
             COMMENT "Generating '${DOCKER_IMAGE_NAME}.tar.gz'" VERBATIM
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index d775f8f..d26439c 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -21,14 +21,15 @@
 # To build these example:
 # - build and install celix
 # - Create a new build project dir and cd to it
-# - set the CMAKE_PREFIX_PATH to the install location
+# - set the MAKE_FIND_ROOT_PATH to the install location
 #   of Celix (e.g. /opt/local) if this is different from
 #   /usr or /usr/local
 # - cmake <loc_to_celix_src>/examples
 # - make -j all
 
-cmake_minimum_required (VERSION 3.2)
+cmake_minimum_required (VERSION 3.4)
 project (CelixUse C CXX)
-set(CMAKE_CXX_FLAGS "-std=c++11")
+set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 ${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
 find_package(Celix REQUIRED)
 add_subdirectory(celix-examples examples)
diff --git a/examples/celix-examples/CMakeLists.txt b/examples/celix-examples/CMakeLists.txt
index 221fb63..7e06819 100644
--- a/examples/celix-examples/CMakeLists.txt
+++ b/examples/celix-examples/CMakeLists.txt
@@ -39,6 +39,7 @@ if (EXAMPLES)
     add_subdirectory(embedding)
     add_subdirectory(track_tracker_example)
     add_subdirectory(log_service_example)
+
     add_subdirectory(bundle_with_private_lib)
 
 endif(EXAMPLES)
diff --git a/examples/celix-examples/http_example/CMakeLists.txt b/examples/celix-examples/http_example/CMakeLists.txt
index ac55add..e6f7b77 100644
--- a/examples/celix-examples/http_example/CMakeLists.txt
+++ b/examples/celix-examples/http_example/CMakeLists.txt
@@ -26,7 +26,7 @@ if (TARGET Celix::http_admin AND TARGET Celix::shell AND TARGET Celix::shell_wui
     )
 
     target_link_libraries(http_example PRIVATE Celix::http_admin_api)
-    celix_bundle_private_libs(http_example civetweb_shared)
+    celix_bundle_private_libs(http_example Celix::civetweb_shared)
     celix_bundle_add_dir(http_example resources)
     celix_bundle_headers(http_example "X-Web-Resource: /hello$<SEMICOLON>/resources")
 
@@ -40,4 +40,4 @@ if (TARGET Celix::http_admin AND TARGET Celix::shell AND TARGET Celix::shell_wui
             #SHELL_USE_ANSI_COLORS=false
     )
 
-endif ()
\ No newline at end of file
+endif ()