add ADD_LINK_DEFINITIONS support for cmakelist file

This commit is contained in:
Neucrack
2025-08-21 14:49:20 +08:00
parent e2517649e2
commit b913a091dd
2 changed files with 15 additions and 3 deletions

View File

@@ -174,10 +174,10 @@ namespace maix::app
continue;
}
ret = ini.GetStringValue(app_id, "icon", &app_icon);
if (ret != RET_OK)
if (ret != RET_OK || app_icon.empty())
{
printf("get app %s icon failed: %d\n", app_id.c_str(), ret);
continue;
printf("get app %s icon failed: %d, use default icon\n", app_id.c_str(), ret);
app_icon = "/maixapp/share/icon/icon.json";
}
if (fs::isabs(app_icon) == false)
{

View File

@@ -137,11 +137,23 @@ function(register_component)
endif()
endforeach()
# Add definitions public
foreach(difinition ${ADD_LINK_DEFINITIONS})
if(${include_type} STREQUAL INTERFACE)
target_link_options(${component_name} INTERFACE ${difinition})
else()
target_link_options(${component_name} PUBLIC ${difinition})
endif()
endforeach()
# Add definitions private
foreach(difinition ${ADD_DEFINITIONS_PRIVATE})
target_compile_options(${component_name} PRIVATE ${difinition})
target_link_options(${component_name} PRIVATE ${difinition})
endforeach()
foreach(difinition ${ADD_LINK_DEFINITIONS_PRIVATE})
target_link_options(${component_name} PRIVATE ${difinition})
endforeach()
# Add lib search path
if(ADD_LINK_SEARCH_PATH)