[Cmake-commits] CMake branch, next, updated. v2.8.4-1745-g4568693

Brad King brad.king at kitware.com
Tue Jun 14 09:26:10 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  4568693bbbfea752588a7cc89c466403924442c4 (commit)
       via  3982603c65f5db4f9c42eee3ac8b324f3ff93c7a (commit)
      from  b95ceab28c13481295ba5673e01c4473eb6a3573 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4568693bbbfea752588a7cc89c466403924442c4
commit 4568693bbbfea752588a7cc89c466403924442c4
Merge: b95ceab 3982603
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 14 09:26:08 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jun 14 09:26:08 2011 -0400

    Merge topic '10997_PROTOBDUF_GENERATE_CPP_returns_wrong_path' into next
    
    3982603 10997: PROTOBUF_GENERATE_CPP now supports proto files outside current dir


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3982603c65f5db4f9c42eee3ac8b324f3ff93c7a
commit 3982603c65f5db4f9c42eee3ac8b324f3ff93c7a
Author:     Philip Lowman <philip at yhbt.com>
AuthorDate: Tue Jun 7 01:07:41 2011 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 14 09:25:16 2011 -0400

    10997: PROTOBUF_GENERATE_CPP now supports proto files outside current dir

diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 88ef7cd..38f5a75 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -73,6 +73,20 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
     return()
   endif(NOT ARGN)
 
+  if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
+    # Create an include path for each file specified
+    foreach(FIL ${ARGN})
+      get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+      get_filename_component(ABS_PATH ${ABS_FIL} PATH)
+      list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
+      if(${_contains_already} EQUAL -1)
+          list(APPEND _protobuf_include_path -I ${ABS_PATH})
+      endif()
+    endforeach()
+  else()
+    set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
+  endif()
+
   set(${SRCS})
   set(${HDRS})
   foreach(FIL ${ARGN})
@@ -86,7 +100,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
       OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
              "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
       COMMAND  ${PROTOBUF_PROTOC_EXECUTABLE}
-      ARGS --cpp_out  ${CMAKE_CURRENT_BINARY_DIR} --proto_path ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL}
+      ARGS --cpp_out  ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
       DEPENDS ${ABS_FIL}
       COMMENT "Running C++ protocol buffer compiler on ${FIL}"
       VERBATIM )
@@ -125,11 +139,17 @@ function(_protobuf_find_libraries name filename)
    endif()
 endfunction()
 
-
 #
 # Main.
 #
 
+# By default have PROTOBUF_GENERATE_CPP macro pass -I to protoc
+# for each directory where a proto file is referenced.
+if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH)
+  set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE)
+endif()
+
+
 # Google's provided vcproj files generate libraries with a "lib"
 # prefix on Windows
 if(MSVC)

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list