ExternalProject_Add Component not linked with main application
Posted: Sun Apr 19, 2020 2:51 am
Hello all, I'm new to that CMake system and I must say that I'm very puzzled with it. I have a very very simple application (the HelloWorld app) to which I added a component (named oberon) that build a library in the component folder (liboberon.a). When doing the build process (idf.py build) the component is built properly (the liboberon.a is generated) but it doesn't appears in the ld command to link the application. I modified the main.c source code to add a call to a member of the component library, but the linker fail.
Any Clue??
Thanks!
The component is located in the components/oberon folder.
The main CMakeLists.tx is as follow:
The CMakeLists.txt in the components/oberon folder is as follow:
Any Clue??
Thanks!
The component is located in the components/oberon folder.
The main CMakeLists.tx is as follow:
Code: Select all
cmake_minimum_required(VERSION 3.5.2)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(trials)
Code: Select all
# External build process for oberon, runs in source dir and produces liboberon.a
idf_component_register()
ExternalProject_Add(oberon_build
PREFIX ${COMPONENT_DIR}
BINARY_DIR ${COMPONENT_DIR}
TMP_DIR ${COMPONENT_DIR}/build/tmp
STAMP_DIR ${COMPONENT_DIR}/build/stamp
SOURCE_DIR ${COMPONENT_DIR}/src
CONFIGURE_COMMAND ""
BUILD_COMMAND make liboberon.a
INSTALL_COMMAND ""
)
# Add liboberon.a to the build process
add_library(oberon STATIC IMPORTED GLOBAL)
add_dependencies(oberon oberon_build)
set_target_properties(oberon PROPERTIES IMPORTED_LOCATION
${COMPONENT_DIR}/liboberon.a)
set_directory_properties( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
"${COMPONENT_DIR}/liboberon.a")