Skip to content
Snippets Groups Projects
Commit 0161193c authored by Constantine Grantcharov's avatar Constantine Grantcharov
Browse files

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.
parent 2e6577dd
No related branches found
No related tags found
No related merge requests found
......@@ -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})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment