I going to you because i'm having a hard time solving an issue with the CMakeList build system.
Basically I want to share various components between various projects, without copy my components in each projects.
My directories are structured as below (extra_components is as the same level than project1/ ... projectN) :
MyProjets/
|---project1/
|---|---main/
|---|---|--- filemain.c
|---|---|--- filemain.h
|---|---|--- CMakeList.txt
|---|---CMakeList.txt
..........
|---projectN/
|...| same structure as project1
|...extra_components/
|...|... component1/
|...|... |... file1.c
|...|... |... file1.h
|---|----|--- CMakeList.txt
..............
|...|... componentN/
|...|... |... fileN.c
|...|... |... fileN.h
|---|----|--- CMakeList.txt
MyProjects/project1/main/CMakeList.txt which need component1 is :
- idf_component_register(SRCS "filemain.c"
- INCLUDE_DIRS "" "${PROJECT_DIR}/../extra_components/component1")
MyProjets/projet1/CMakeList.txt is :
- cmake_minimum_required(VERSION 3.5)
- set(EXTRA_COMPONENT_DIRS "${PROJECT_DIR}/../extra_components")
- include($ENV{IDF_PATH}/tools/cmake/project.cmake)
- project(project1)
unfortunately when i build project1, compilation works fine but component1 is not find by the linker, and is normal because when i check the components list and component path don't show any reference to component1.
I tryed to reference component1 using various CMake syntax like add_target_library, etc, with no success, component1 is never integrated neither in the components list nor the components path.
Thank you in advance for your help.
Regards.