From 84079c92ca5c401e35aefacbcca25e0ac3e644d6 Mon Sep 17 00:00:00 2001 From: Philip Lowman Date: Sun, 18 Dec 2011 18:02:48 -0500 Subject: [PATCH 1/2] 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 --- Modules/FindProtobuf.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 53443040d..ac6fd86f8 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}) From 27bc9e2631a2f7b6d78064f5adf0b528982a2de7 Mon Sep 17 00:00:00 2001 From: Philip Lowman Date: Tue, 3 Jan 2012 19:47:05 -0500 Subject: [PATCH 2/2] FindProtobuf: Update documentation comment for 2.8.8 --- Modules/FindProtobuf.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index ac6fd86f8..1e1e49301 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -8,7 +8,7 @@ # for libraries and binaries. # # PROTOBUF_IMPORT_DIRS - List of additional directories to be searched for -# imported .proto files. (New in CMake 2.8.7) +# imported .proto files. (New in CMake 2.8.8) # # Defines the following variables: #