1cmake_minimum_required(VERSION 2.8)
2project(NANOPB_CMAKE_SIMPLE C)
3
4set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../extra)
5find_package(Nanopb REQUIRED)
6include_directories(${NANOPB_INCLUDE_DIRS})
7
8nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH proto
9	proto/simple.proto proto/sub/unlucky.proto)
10
11include_directories(${CMAKE_CURRENT_BINARY_DIR})
12#add_custom_target(generate_proto_sources DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
13set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS}
14    PROPERTIES GENERATED TRUE)
15
16set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -g -O0")
17
18add_executable(simple simple.c ${PROTO_SRCS} ${PROTO_HDRS})
19