2021-03-10 20:34:57 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-08-10 20:44:56 +08:00
|
|
|
cmake_minimum_required(VERSION 3.20.0)
|
2021-03-10 20:34:57 +08:00
|
|
|
|
|
|
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
|
|
|
project(nanopb_sample)
|
|
|
|
|
2022-02-10 12:46:04 +08:00
|
|
|
# Note that here, we're adding CMAKE_SOURCE_DIR to the include path for nanopb.
|
|
|
|
# This is needed because the below call to nanopb_generate_cpp() is using
|
|
|
|
# 'RELPATH .'
|
|
|
|
set(NANOPB_OPTIONS "-I${CMAKE_SOURCE_DIR}")
|
2021-03-10 20:34:57 +08:00
|
|
|
nanopb_generate_cpp(proto_sources proto_headers RELPATH .
|
|
|
|
src/simple.proto
|
|
|
|
)
|
|
|
|
# we need to be able to include generated header files
|
|
|
|
zephyr_library_include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
FILE(GLOB app_sources src/*.c)
|
|
|
|
target_sources(app PRIVATE ${proto_sources} ${app_sources})
|