[package] protobuf/any: access to protobuf_generate_cpp function
See original GitHub issueCurrent good practice is to use cmake_find_package generator. on an other hand, i want conan to be as discreet as possible in my CMakelists.txt. So this generator can be very helpful when no standard "Find<Package_name>.cmake exists.
For the protobuf library case, this generator hide a very important feature : the protobuf_generate_cpp function. And as a user cmake_find_package seem broken!
As a conan developer, i understand the fact that cmake guys should separate “target detection” and function utilities. but cmake is a giant… conan is not…yet.
furthermore, protobuf test_package is so sad … download a binary (not built by conan!!!) and reinvent the wheel to generate cpp file.
Do u have a plan for this kind or issue?
Thx.
Package and Environment Details (include every applicable attribute)
- Package Name/Version: protobuf/any
- Operating System+version: any
- Compiler+version: GCC 8
- Docker image: conanio/gcc8
- Conan version: conan 1.26.0
- Python version: Python 3.7.4
Conan profile
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=8
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
CC=gcc-8
CXX=g++-8
Steps to reproduce (Include if Applicable)
conanfile.txt
[requires]
protobuf/3.11.4
[generators]
cmake_find_package
cmake_paths
CMakefiles.txt
...
include(${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake)
find_package(Protobuf REQUIRED)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
protobuf_generate_python(PROTO_PY foo.proto)
add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(bar protobuf::libprotobuf)
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
Works brilliantly for me @rockdreamer ! I submitted a PR.
I was able to build the conan-protobuf-example repo on macos by changing the ARGS line to
ARGS -E env "PATH=${CONAN_BIN_DIRS}/" "LD_LIBRARY_PATH=${Protobuf_LIB_DIRS}:${CONAN_LIB_DIRS}:${Protobuf_LIB_DIRS_RELEASE}:${Protobuf_LIB_DIRS_DEBUG}:${Protobuf_LIB_DIRS_RELWITHDEBINFO}:${Protobuf_LIB_DIRS_MINSIZEREL}" "DYLD_LIBRARY_PATH=${Protobuf_LIB_DIRS}:${CONAN_LIB_DIRS}:${Protobuf_LIB_DIRS_RELEASE}:${Protobuf_LIB_DIRS_DEBUG}:${Protobuf_LIB_DIRS_RELWITHDEBINFO}:${Protobuf_LIB_DIRS_MINSIZEREL}" protoc --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_protobuf_include_path} ${_abs_file}
I.e. setting the path to protoc’s position relative to the lib directory. Unsure if this is a useful thing for cmake_multi based targets or if it’s the minimum change required.As a sidenote, I wonder what the reasoning is for not exporting bin dirs in the cmake_find_package generators? I’m trying to integrate > 50 packages right now and I find myself wanting that more and more…