From 0161193cf97f46aa491501e665a75aa0afd9698d Mon Sep 17 00:00:00 2001 From: Constantine Grantcharov <cgrantcharov@trustpointinnovation.com> Date: Sun, 5 Mar 2017 12:29:09 -0500 Subject: Remove use of relative paths When doing out of source builds: mkdir build cd build && cmake -G "Unix Makefiles" ../ && make The build script tripped up on relative paths of /generator/proto and the files under generator/proto/*.proto. By using ${PROJECT_SOURCE_DIR}, the paths become absolute and the issue disappears. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c78f8c3c..22e6c70e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,11 +42,11 @@ if(nanopb_BUILD_GENERATOR) ) foreach(generator_proto IN LISTS generator_protos) - string(REGEX REPLACE "([^;]+)" "generator/proto/\\1.proto" generator_proto_file "${generator_proto}") + string(REGEX REPLACE "([^;]+)" "${PROJECT_SOURCE_DIR}/generator/proto/\\1.proto" generator_proto_file "${generator_proto}") string(REGEX REPLACE "([^;]+)" "\\1_pb2.py" generator_proto_py_file "${generator_proto}") add_custom_command( OUTPUT ${generator_proto_py_file} - COMMAND protoc --python_out=${CMAKE_CURRENT_BINARY_DIR} -Igenerator/proto ${generator_proto_file} + COMMAND protoc --python_out=${CMAKE_CURRENT_BINARY_DIR} -I${PROJECT_SOURCE_DIR}/generator/proto ${generator_proto_file} DEPENDS ${generator_proto_file} ) add_custom_target("generate_${generator_proto_py_file}" ALL DEPENDS ${generator_proto_py_file}) -- cgit 1.2.3-korg From 9deebe0f0f824ca9f2628fe7d927b2e8bf141be5 Mon Sep 17 00:00:00 2001 From: Constantine Grantcharov <cgrantcharov@trustpointinnovation.com> Date: Sun, 5 Mar 2017 13:02:43 -0500 Subject: Fixing install issue due to relative paths --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22e6c70e..7fb7ad4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,12 +46,12 @@ if(nanopb_BUILD_GENERATOR) string(REGEX REPLACE "([^;]+)" "\\1_pb2.py" generator_proto_py_file "${generator_proto}") add_custom_command( OUTPUT ${generator_proto_py_file} - COMMAND protoc --python_out=${CMAKE_CURRENT_BINARY_DIR} -I${PROJECT_SOURCE_DIR}/generator/proto ${generator_proto_file} + COMMAND protoc --python_out=${PROJECT_BINARY_DIR} -I${PROJECT_SOURCE_DIR}/generator/proto ${generator_proto_file} DEPENDS ${generator_proto_file} ) add_custom_target("generate_${generator_proto_py_file}" ALL DEPENDS ${generator_proto_py_file}) install( - FILES ${generator_proto_py_file} + FILES ${PROJECT_BINARY_DIR}/${generator_proto_py_file} DESTINATION ${PYTHON_INSTDIR} ) endforeach() -- cgit 1.2.3-korg