[cmake-developers] [PATCH] Fix error in compiling C++ files generating by protobuf compiler when .proto files are organized in a directory hierarchy

ابراهیم محمدی mebrahim at gmail.com
Mon May 26 06:48:44 EDT 2014


Hi everybody there,

Subject says it all. See the attached patch please.

(Didn't care enough to leave hg for git to generate the patch. Sorry.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140526/96903e53/attachment.html>
-------------- next part --------------
# HG changeset patch
# User Ebrahim Mohammadi <mebrahim at gmail.com>
# Date 1401098735 -16200
#      Mon May 26 14:35:35 2014 +0430
# Node ID 0b2fc1eb05f57c9147b5cfb77b7e1887b443f3b2
# Parent  a9bf99d5c158d15d204838ab7dca6fb588ad0018
Fix error in compiling C++ files generating by protobuf compiler when .proto files are organized in a directory hierarchy.

diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -173,7 +173,9 @@
   set(${HDRS})
   foreach(FIL ${ARGN})
     get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
-    get_filename_component(FIL_WE ${FIL} NAME_WE)
+    get_filename_component(FILE_NAME_WE ${FIL} NAME_WE)
+    get_filename_component(FILE_PATH ${FIL} PATH)
+    set(FIL_WE "${FILE_PATH}/${FILE_NAME_WE}")
 
     list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
     list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")



More information about the cmake-developers mailing list