aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorConstantine Grantcharov <cgrantcharov@trustpointinnovation.com>2017-03-05 12:29:09 -0500
committerConstantine Grantcharov <cgrantcharov@trustpointinnovation.com>2017-03-05 12:29:09 -0500
commit0161193cf97f46aa491501e665a75aa0afd9698d (patch)
tree373e79e94e4b4d1ee3d2b816fecbd40fa1fb85c9 /CMakeLists.txt
parent2e6577dd120a26e0ab4cc985cffa2c2a82e8c59d (diff)
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c78f8c3..22e6c70 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})