Browse Source

cmake: Fix component group names for dbshema generation

- dbshema modules generated components that were not provided by user
- if a module with dbschema is included in the include_modules list, it will now be in "user_specified_list" component instead of the actual KGROUP component that might be not included.
Xenofon Karamanos 1 month ago
parent
commit
9734550704
1 changed files with 20 additions and 21 deletions
  1. 20 21
      cmake/groups.cmake

+ 20 - 21
cmake/groups.cmake

@@ -754,7 +754,7 @@ set(MODULE_GROUP_PACKAGE_GROUPS
 
 # Add group names to available group and provide "ALL_PACKAGED" as well
 # for easier packaging using components
-list(APPEND AVAILABLE_GROUPS ALL_PACKAGED ${MODULE_GROUP_PACKAGE_GROUPS})
+list(APPEND AVAILABLE_GROUPS ALL_PACKAGED KMINI ${MODULE_GROUP_PACKAGE_GROUPS})
 
 # Find the group name for the target by checking if the module is in the
 # list of modules to be built and if so, use the group name of that module
@@ -764,28 +764,20 @@ function(find_group_name module)
       ""
       PARENT_SCOPE
   )
-  # This was need due to the dbschema.cmake
-  # If one select one of these option as group
-  # we want the group name to match instead of the actual group it belongs to
-  if(MODULE_GROUP_NAME STREQUAL "ALL"
-     OR MODULE_GROUP_NAME STREQUAL "DEFAULT"
-     OR MODULE_GROUP_NAME STREQUAL "STANDARD"
-     OR MODULE_GROUP_NAME STREQUAL "COMMON"
-  )
-    set(group_name
-        "${MODULE_GROUP_NAME}"
-        PARENT_SCOPE
-    )
-    return()
+  separate_arguments(groups_to_search_in UNIX_COMMAND ${MODULE_GROUP_NAME})
+  list(FIND groups_to_search_in "ALL_PACKAGED" group_index)
+  if(group_index GREATER -1)
+    # Remove it from the list and append the package groups
+    list(REMOVE_AT groups_to_search_in ${group_index})
+    list(APPEND groups_to_search_in ${MODULE_GROUP_PACKAGE_GROUPS})
   endif()
-  #   message(WARNING "groups to search in" ${MODULE_GROUP_PACKAGE_GROUPS})
-  # Get all variable names in the current CMake context
-  foreach(group IN LISTS MODULE_GROUP_PACKAGE_GROUPS)
-    # message(WARNING "Modules in group ${group}: ${MODULES_IN_GROUP}")
-    # message(WARNING "Checking group ${group} for db ${module}")
+  # message(WARNING "Groups provided by the user ${groups_to_search_in}")
+  # message(WARNING "Looking for group for db ${module}")
+  foreach(group IN LISTS groups_to_search_in)
     get_property(MODULES_IN_GROUP VARIABLE PROPERTY "MODULE_GROUP_${group}")
+    # message(WARNING "Modules in group ${group}: ${MODULES_IN_GROUP}")
     if("${module}" IN_LIST MODULES_IN_GROUP)
-      #   message(WARNING "Found group ${group} for db ${module}")
+      # message(WARNING "Found group ${group} for db ${module}")
       set(group_name
           "${group}"
           PARENT_SCOPE
@@ -793,5 +785,12 @@ function(find_group_name module)
       return()
     endif()
   endforeach()
-  message((STATUS "module ${module} not found in any group"))
+  message(STATUS "module ${module} not found in any group")
+  # if not found in any group, it's probably in include_modules list
+  # Use the group name "user_specified_list" associated with include_modules
+  # list, otherwise it will generate Unknown group component
+  set(group_name
+      "user_specified_list"
+      PARENT_SCOPE
+  )
 endfunction()