Hello, I'm trying to port an existing project from premake to cmake. I'm trying to avoid modifying the source files while doing so.
Right now, we have several libraries (read in different directories) using proto files with imports between them. All imports are made relative to the root of the project. e.g : work/lib1/sublib1/a.proto work/lib1/sublib1/b.proto with a.proto having a link to b.proto like this "import lib1/sublib1/b.proto" If I compile this with an unchanged FindProtobuf.cmake, I do this : protobuf_generate_cpp(PROTO_SRCS PROTO_HRDS a.proto b.proto) add_library(...) the problem being that it looks like the "namespaces" generated by protoc in b.proto do not match the one used in a.proto : it does not compile. Is there a way to make this work ? Otherwise, I made the patch below which solves my problem. Do you think it could be included in cmake ? it defines a new option PROTO_PATH, so the decl above becomes protobuf_generate_cpp(PROTO_SRCS PROTO_HRDS PROTO_PATH ${CMAKE_SOURCE_DIR} a.proto b.proto) With regards David $ diff share/cmake-3.10/Modules/FindProtobuf.cmake.orig share/cmake-3.10/Modules/FindProtobuf.cmake 123c123 < cmake_parse_arguments(protobuf "" "EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) --- > cmake_parse_arguments(protobuf "" "PROTO_PATH;EXPORT_MACRO;DESCRIPTORS" "" ${ARGN}) 130a131,139 > set(EXTRA_ARGS "") > set(OUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) > if(protobuf_PROTO_PATH) > get_filename_component(ABS_PROTO_PATH ${protobuf_PROTO_PATH} ABSOLUTE) > set(EXTRA_ARGS "--proto_path=${ABS_PROTO_PATH}") > file(RELATIVE_PATH PROTO_REL_PATH ${CMAKE_SOURCE_DIR} ${ABS_PROTO_PATH}) > set(OUT_PATH ${CMAKE_BINARY_DIR}/${PROTO_REL_PATH}) > endif() > 198c207,208 < "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}" --- > ${EXTRA_ARGS} > "--cpp_out=${DLL_EXPORT_DECL}${OUT_PATH}"
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake