Defining the path for multiple files

Hello,

I am starting to work on a sample project, wherein I need to include multiple C++ files, all present under a common folder.
Can I define that common file path under a variable like "app_sources", so that in CMakelists.txt I can define as: 

target_sources(app PRIVATE
  ${app_sources/sample.cpp}
  )

where can I define this path "app_sources"..?

I am using nRF Connect extension on VScode.

Parents
  • cmake_minimum_required(VERSION 3.20.0)
    
    
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    
    project(NONE)
    
    
    
    # NORDIC SDK APP START
    
    FILE(GLOB app_sources ../Code/uC/nRF52/*.cpp)
    
    FILE(GLOB app_includes ../Code/uC/nRF52/*.h)
    
    FILE(GLOB app_Interface_sources ../Nordic_SDK/Interface_Files/*.c)
    
    FILE(GLOB app_Interface_includes ../Nordic_SDK/Interface_Files/*.h)
    
    target_sources(app PRIVATE
    
        src/main.cpp
    
        src/model_handler.c
    
        src/chat_cli.c
    
        ${app_sources}
    
        ${app_Interface_sources})
    
    target_include_directories(app PRIVATE include ${app_includes} ${app_Interface_includes})
    
    
    
    zephyr_library_include_directories(${ZEPHYR_BASE}/samples/bluetooth include)
    
    # NORDIC SDK APP END

    Attaching the error snaps and CMakeLists.txt changes I made for your kind reference.!

    Where else do I need to add file paths.?

  • Oops, missed this update. I'll take a look at this now.

Reply Children
Related