diff options
author | Philip Lowman <philip@yhbt.com> | 2011-12-18 23:02:48 (GMT) |
---|---|---|
committer | Philip Lowman <philip@yhbt.com> | 2011-12-18 23:02:48 (GMT) |
commit | 84079c92ca5c401e35aefacbcca25e0ac3e644d6 (patch) | |
tree | 7c49bc1789a81654b6e1bae51e7c64098a410780 /Modules/FindProtobuf.cmake | |
parent | 3c101429a4e563f4c711cae84317806284784eb6 (diff) | |
download | CMake-84079c92ca5c401e35aefacbcca25e0ac3e644d6.zip CMake-84079c92ca5c401e35aefacbcca25e0ac3e644d6.tar.gz CMake-84079c92ca5c401e35aefacbcca25e0ac3e644d6.tar.bz2 |
FindProtobuf: Merge patch that allows extra import dirs
Added support for additional import paths during protoc invocation
time to the PROTOBUF_GENERATE_CPP public macro via a new
PROTOBUF_IMPORT_DIRS optional variable.
Patch courtesy of Miroslav Kes <mkes@ra.rockwell.com>
Diffstat (limited to 'Modules/FindProtobuf.cmake')
-rw-r--r-- | Modules/FindProtobuf.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 5344304..ac6fd86 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -7,6 +7,9 @@ # (vsprojects/Debug & vsprojects/Release) will be searched # for libraries and binaries. # +# PROTOBUF_IMPORT_DIRS - List of additional directories to be searched for +# imported .proto files. (New in CMake 2.8.7) +# # Defines the following variables: # # PROTOBUF_FOUND - Found the Google Protocol Buffers library (libprotobuf & header files) @@ -91,6 +94,16 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS) + foreach(DIR ${PROTOBUF_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + endif() + set(${SRCS}) set(${HDRS}) foreach(FIL ${ARGN}) |