Oh, I tried "target_link_libraries" but still failing... I can't understand why
Let me explain better my project.
My project is created using IDF 4.0 and use various custom modules created by me. Module for network, another module for NVS, RTC, webpage and etc.
[firmware_network] module have files for control WiFi, Ethernet, MQTT and so on.
[firmware_scheduler] module have files for control relay based on unix time.
However, to keep modules independents, in MQTT.cpp, when ESP receive [MQTT_EVENT_HANDLER -> data_event], this call 2 empty weak functions (weak functions inside mqtt.cpp contain a simple print inside).
- One weak function is called in main.cpp to process json to specific board. This work.
- Another weak function is called in [firmware_scheduler] to process specific scheduler jsons, but I can't do this work correctly.
I added "target_link_libraries(${COMPONENT_LIB} INTERFACE "-u mqtt_callback_scheduler")" in [firmware_network], but fail.
I tried to add this in command in [firmware_scheduler] but fail again.
In all tests of scheduler, weak function inside of mqtt.cpp keeps in use and function defined in scheduler.cpp is never called.
mqtt.h
Code: Select all
void mqtt_callback_scheduler(char *data) __attribute__((weak));
Code: Select all
void mqtt_callback_scheduler(char *data)
{
ESP_LOGW(__func__, "Replace me");
}
Code: Select all
void mqtt_callback_scheduler(char *data)
{
ESP_LOGI(__func__, "Scheduler test");
}