Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protobuf: library targets have different names under Windows and Linux #429

Closed
sigiesec opened this issue Sep 5, 2018 · 6 comments
Closed
Assignees
Labels

Comments

@sigiesec
Copy link

sigiesec commented Sep 5, 2018

Description of Problem, Request, or Question

Library targets have different names under Windows and Linux because of different handling if "lib" prefix.

Package Details (Include if Applicable)

  • Package Name/Version: protobuf/3.6.1
  • Operating System: Linux, Windows

Steps to reproduce (Include if Applicable)

Using the conan cmake generator, in the CMakeLists.txt of a dependent package, I want to reference the library as

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGET)

add_library(my_library STATIC)
target_link_libraries(my_library PUBLIC CONAN_LIB::Protobuf_protobuf)

But this variant only works under Linux, while under Windows, I need to use CONAN_LIB::Protobuf_libprotobuf instead.

@SSE4 SSE4 self-assigned this Sep 6, 2018
@SSE4 SSE4 added the bug label Sep 6, 2018
@SSE4
Copy link
Member

SSE4 commented Sep 6, 2018

@sigiesec have you tried to use CONAN_PKG::protobuf instead?

@sigiesec
Copy link
Author

sigiesec commented Sep 6, 2018

Yes, but CONAN_PKG::protobuf also depends on (lib)protoc, which I don't want. In general, I want to specify depedencies on a specific library, not a whole package.

Actually, we have a modified version of the recipe, which also builds (lib)protobuf_lite, which makes the problem more apparent, since you cannot link to both libraries, since this would yield ambiguous symbols.

@sigiesec
Copy link
Author

sigiesec commented Sep 6, 2018

I found a way to circumvent this problem now by using find_package(Protobuf).

@SSE4
Copy link
Member

SSE4 commented Sep 8, 2018

this one might be tricky to solve. I guess the following proposed conan feature may help:
conan-io/conan#2387

@sigiesec
Copy link
Author

Really? Hm, then the problem appears to be more fundamental than I thought, in general. As I wrote, for libprotobuf specifically I found a way to circumvent this, so for my part, we could close this issue.

@SSE4
Copy link
Member

SSE4 commented Oct 4, 2018

okay, I am closing this for now, as this requires some new conan feature to implement.

@SSE4 SSE4 closed this as completed Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants