| View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0010997 | CMake | Modules | public | 2010-07-15 17:11 | 2011-11-11 10:45 | ||||
| Reporter | bcmpinc | ||||||||
| Assigned To | Philip Lowman | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | OS | OS Version | |||||||
| Product Version | CMake-2-8 | ||||||||
| Target Version | CMake 2.8.5 | Fixed in Version | CMake 2.8.5 | ||||||
| Summary | 0010997: PROTOBUF_GENERATE_CPP returns wrong path. | ||||||||
| Description | The PROTOBUF_GENERATE_CPP returns the wrong paths when the *.proto file is not in the same directory as the CMakeLists.txt. Steps to reproduce: - Create a CMakeLists.txt file in /tmp containing: CMAKE_MINIMUM_REQUIRED(VERSION 2.8) FIND_PACKAGE(Protobuf) PROTOBUF_GENERATE_CPP(src h sub/dir/file.proto) MESSAGE("Generated file: ${src}") ADD_EXECUTABLE(test ${src}) - Create an empty file at /tmp/sub/dir/file.proto - cd to /tmp and run 'cmake .' - Run 'make' Actual result: CMake prints 'Generated file: /tmp/file.pb.cc', however Protoc creates the file /tmp/sub/dir/file.pb.cc Expected result: CMake prints 'Generated file: /tmp/sub/dir/file.pb.cc' Protoc creates the file /tmp/sub/dir/file.pb.cc | ||||||||
| Tags | No tags attached. | ||||||||
| Attached Files | |||||||||
| Relationships | |
| Relationships |
| Notes | |
|
(0021433) bcmpinc (reporter) 2010-07-20 17:02 |
I've added a patch that fixes this bug. |
|
(0026604) Philip Lowman (developer) 2011-05-25 22:46 |
Thanks for the patch. Your fix will be in 2.8.5 RC02 |
|
(0026605) Philip Lowman (developer) 2011-05-26 00:05 |
Unfortunately, the fix doesn't appear to work when using the include directive. Example: <subdir/Person.proto>: message Person { required int32 id = 1; } <subdir/SmallGroup.proto>: import "Person.proto"; message SmallGroup { repeated Person grp = 1; } <person_exec.cc>: #include <iostream> #include "Person.pb.h" int main() { Person p; p.set_id(15); return 0; } <CMakeLists.txt>: project(foo) cmake_minimum_required(VERSION 2.6) find_package(Protobuf) include_directories(${PROTOBUF_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS subdir/Person.proto subdir/SmallGroup.proto) add_executable(person person_exec.cc ${PROTO_SRCS} ${PROTO_HDRS}) target_link_libraries(person ${PROTOBUF_LIBRARIES}) if(UNIX) target_link_libraries(person pthread) endif() <OUTPUT>: lowman@lowman-desktop:~/cmaketests/proto/build$ make [ 20%] Running C++ protocol buffer compiler on subdir/SmallGroup.proto [ 40%] Running C++ protocol buffer compiler on subdir/Person.proto [ 60%] Building CXX object CMakeFiles/person.dir/person_exec.cc.o [ 80%] Building CXX object CMakeFiles/person.dir/subdir/Person.pb.cc.o [100%] Building CXX object CMakeFiles/person.dir/subdir/SmallGroup.pb.cc.o /home/lowman/cmaketests/proto/build/subdir/SmallGroup.pb.cc: In function ‘void protobuf_AddDesc_subdir_2fSmallGroup_2eproto()’: /home/lowman/cmaketests/proto/build/subdir/SmallGroup.pb.cc:72: error: ‘::protobuf_AddDesc_Person_2eproto’ has not been declared make[2]: *** [CMakeFiles/person.dir/subdir/SmallGroup.pb.cc.o] Error 1 make[1]: *** [CMakeFiles/person.dir/all] Error 2 make: *** [all] Error 2 |
|
(0026606) Philip Lowman (developer) 2011-05-26 00:10 |
What do you think about the attached version? I've made it so -I with the directory is passed for each proto file included in the macro. This appears to resolve this issue, as well as 11148 (specifying proto files outside of project directory). |
|
(0026732) Philip Lowman (developer) 2011-06-07 01:20 |
Merge topic '10997_PROTOBDUF_GENERATE_CPP_returns_wrong_path' into next Allow proto files outside of the current source directory to be compiled in the PROTOBUF_GENERATE_CPP module. This is accomplished by using the -I flag for each path where proto files are being compiled. |
|
(0027761) David Cole (manager) 2011-11-11 10:45 |
Closing resolved issues that have not been updated in more than 4 months. |
| Notes |
| Issue History | |||
| Date Modified | Username | Field | Change |
| 2010-07-15 17:11 | bcmpinc | New Issue | |
| 2010-07-20 17:01 | bcmpinc | File Added: FindProtobuf_subdirs.patch | |
| 2010-07-20 17:02 | bcmpinc | Note Added: 0021433 | |
| 2010-08-19 08:13 | Philip Lowman | Status | new => assigned |
| 2010-08-19 08:13 | Philip Lowman | Assigned To | => Philip Lowman |
| 2011-05-25 22:46 | Philip Lowman | Note Added: 0026604 | |
| 2011-05-25 22:46 | Philip Lowman | Status | assigned => resolved |
| 2011-05-25 22:46 | Philip Lowman | Resolution | open => fixed |
| 2011-05-25 22:46 | Philip Lowman | Fixed in Version | => CMake 2.8.5 |
| 2011-05-25 22:46 | Philip Lowman | Target Version | => CMake 2.8.5 |
| 2011-05-26 00:05 | Philip Lowman | Note Added: 0026605 | |
| 2011-05-26 00:05 | Philip Lowman | Status | resolved => feedback |
| 2011-05-26 00:05 | Philip Lowman | Resolution | fixed => reopened |
| 2011-05-26 00:07 | Philip Lowman | File Added: FindProtobuf.cmake | |
| 2011-05-26 00:10 | Philip Lowman | Note Added: 0026606 | |
| 2011-05-26 00:10 | Philip Lowman | Status | feedback => confirmed |
| 2011-05-26 00:10 | Philip Lowman | Resolution | reopened => open |
| 2011-05-26 00:10 | Philip Lowman | Fixed in Version | CMake 2.8.5 => |
| 2011-06-07 01:20 | Philip Lowman | Note Added: 0026732 | |
| 2011-06-07 01:20 | Philip Lowman | Status | confirmed => resolved |
| 2011-06-07 01:20 | Philip Lowman | Resolution | open => fixed |
| 2011-06-07 01:20 | Philip Lowman | Fixed in Version | => CMake 2.8.5 |
| 2011-11-11 10:45 | David Cole | Note Added: 0027761 | |
| 2011-11-11 10:45 | David Cole | Status | resolved => closed |
| Issue History |
| Copyright © 2000 - 2018 MantisBT Team |