I'd like to build a static library with following structure :
Foo/
|-- CMakeLists.txt
|-- file1.c
|-- some_definitions.h
|-- drivers/
|-- file2.c
This is the cmake code
add_library(myHAL STATIC)
target_sources(myHAL
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/file1.c"
"${CMAKE_CURRENT_LIST_DIR}/drivers/file2.c"
)
target_include_directories(myHAL PUBLIC ${CMAKE_CURRENT_LIST_DIR}/)
target_include_directories(myHAL PUBLIC ${CMAKE_CURRENT_LIST_DIR}/drivers/)
file2 includes some_definitions.h . In some_definitions, there are some #defines located.
I am not able to build, the definitions are not found (e.g FLS_FEATURE_A undecleared (first use)) When I move the some_definitions.h in the drivers folder, I am able to build.
What I am doing wrong? I suppose the preprocessor does not lookup for the defines or some_definitions.h is not found.