diff options
author | Markus Heß <hessi88@googlemail.com> | 2017-09-29 11:07:36 +0200 |
---|---|---|
committer | Markus Heß <hessi88@googlemail.com> | 2017-09-29 11:07:36 +0200 |
commit | f7e209951eb36f43a7447636da8ee8f1addb4412 (patch) | |
tree | d7d008ec35bd6350b62b7e02f7965483a70bc10a /cmake | |
parent | fc5aa5d910eb0e58ea7dbd545f2bc0a61e80a323 (diff) | |
download | protobuf-f7e209951eb36f43a7447636da8ee8f1addb4412.tar.gz protobuf-f7e209951eb36f43a7447636da8ee8f1addb4412.tar.bz2 protobuf-f7e209951eb36f43a7447636da8ee8f1addb4412.zip |
protobuf_generate: create include path only for proto files
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/protobuf-config.cmake.in | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in index 41ab5095..fd67edc3 100644 --- a/cmake/protobuf-config.cmake.in +++ b/cmake/protobuf-config.cmake.in @@ -49,9 +49,23 @@ function(protobuf_generate) endif() endif() + if(protobuf_generate_TARGET) + get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) + foreach(_file ${_source_list}) + if(_file MATCHES "proto$") + list(APPEND protobuf_generate_PROTOS ${_file}) + endif() + endforeach() + endif() + + if(NOT protobuf_generate_PROTOS) + message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") + return() + endif() + if(protobuf_generate_APPEND_PATH) # Create an include path for each file specified - foreach(_file ${ARGN}) + foreach(_file ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_file} ABSOLUTE) get_filename_component(_abs_path ${_abs_file} PATH) list(FIND _protobuf_include_path ${_abs_path} _contains_already) @@ -71,20 +85,6 @@ function(protobuf_generate) endif() endforeach() - if(protobuf_generate_TARGET) - get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) - foreach(_file ${_source_list}) - if(_file MATCHES "proto$") - list(APPEND protobuf_generate_PROTOS ${_file}) - endif() - endforeach() - endif() - - if(NOT protobuf_generate_PROTOS) - message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") - return() - endif() - set(_generated_srcs_all) foreach(_proto ${protobuf_generate_PROTOS}) get_filename_component(_abs_file ${_proto} ABSOLUTE) |