This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

CMake linking errors, issue with target_link_libraries

Hello,

I am using the nrf9160 and I am developing using zephyr. I have an nrf connect project in Segger IDE.

Generally I am able to edit and build my project. The problem arose when I added and linked 2 libraries in CMakeLists.txt which is in my project root directory. So in the same directory as prj.conf and nrf9160_pca100090ns.overlay .

When I have two distinct target_link_libraries I get an error saying zephyr.h: No such file or directory. 

When I have one statement I get, cannot find-ldisplay_common, cannot find -ldispplay_hw, Id returned 1 exit status.

See my CMakeLists.txt file here.

cmake_minimum_required(VERSION 3.8.2)

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(DISP)

target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/ssd1315.c)
target_sources(app PRIVATE src/gpio_handler.c)
target_sources(app PRIVATE src/spi_handler.c)
target_sources(app PRIVATE src/i2c_handler.c)
target_sources(app PRIVATE src/max20303_pm.c)

file(GLOB display_hw_SRC "src/display_drivers/*.c" "src/display_drivers/cfgio/*.c" "inc/disp_inc/*.h" "inc/disp_inc/cfgio/*.h" "inc/disp_inc/cfg/*.h")
add_library(display_hw ${display_hw_SRC})

file(GLOB display_common_SRC "src/display_drivers/common/*.c" "inc/disp_inc/*.h" "inc/disp_inc/cfgio/*.h" "inc/disp_inc/cfg/*.h")
add_library(display_common ${display_common_SRC})

zephyr_include_directories(src)
include_directories(src)
include_directories(inc)
include_directories(inc/disp_inc)
include_directories(inc/disp_inc/fonts)
include_directories(inc/disp_inc/cfg)
include_directories(inc/disp_inc/cfgio)

add_compile_definitions(GHW_SINGLE_CHIP)

target_link_libraries(app PUBLIC display_common) # error:zephyr.h: No such file or directory. 
target_link_libraries(app PUBLIC display_hw) # error: zephyr.h: No such file or directory. 

#target_link_libraries(app PUBLIC dispay_common PUBLIC dispplay_hw) #error cannot find-ldisplay_common, cannot find -ldispplay_hw, Id returned 1 exit status.

Does anybody have any insight into this?  Am I supposed to link the libraries in some other CMakeLists.txt file?

Thank you.

Parents Reply Children
No Data
Related