diff options
author | Oliver Lee <oliverzlee@gmail.com> | 2015-02-13 17:28:27 +0100 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2015-02-13 18:42:46 +0200 |
commit | 7c00b90910d4e14e23e027eb951e6f2a8dcfae29 (patch) | |
tree | 07dae73ed586d1a05b5571dc39924d5d7005774a /examples/cmake_simple/CMakeLists.txt | |
parent | 02bd49bc9379e3062a718b1c16d6e2c23ea2f1a0 (diff) |
Add simple example built with CMake
Diffstat (limited to 'examples/cmake_simple/CMakeLists.txt')
-rw-r--r-- | examples/cmake_simple/CMakeLists.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/cmake_simple/CMakeLists.txt b/examples/cmake_simple/CMakeLists.txt new file mode 100644 index 00000000..5439e8e6 --- /dev/null +++ b/examples/cmake_simple/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 2.8.12) +project(NANOPB_CMAKE_SIMPLE C) + +set(NANOPB_SRC_ROOT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/../..) +set(CMAKE_MODULE_PATH ${NANOPB_SRC_ROOT_FOLDER}/extra) +find_package(Nanopb REQUIRED) +include_directories(${NANOPB_INCLUDE_DIRS}) + +nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS simple.proto) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +#add_custom_target(generate_proto_sources DEPENDS ${PROTO_SRCS} ${PROTO_HDRS}) +set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} + PROPERTIES GENERATED TRUE) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -g -O0") + +add_executable(simple simple.c ${PROTO_SRCS} ${PROTO_HDRS}) |