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

opentracing-shim target includes are missing when opentelemetry-cpp is added as a subdirectory to a larger project #2355

Closed
andremarianiello opened this issue Oct 10, 2023 · 0 comments · Fixed by #2356
Labels
bug Something isn't working

Comments

@andremarianiello
Copy link
Contributor

Describe your environment Describe any aspect of your environment relevant to the problem, including your platform, build system, version numbers of installed dependencies, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main branch.

Rocky Linux 8, cmake version 3.27.7

Steps to reproduce

  1. Create a cmake project (/myproject) that adds opentelemetry-cpp as a subdirectory, either with add_subdirectory or FetchContent_MakeAvailable
  2. Add opentelemetry_opentracing_shim as a link to a local target in your project
  3. Try to build your local target

What is the expected behavior?
I expect that the opentelemetry_opentracing_shim include paths point to the location of the third_party/opentracing-cpp header files

What is the actual behavior?
The include paths are relative to my local project's root, not the opentelemetry-cpp root. That is, I see paths like /myproject/third_party/opentracing-cpp/include instead of /myproject/opentelemetry-cpp/third_party/opentracing-cpp/include. This causes errors about missing headers.

Additional context
The root cause appears to be in opentracing-shim/CMakeLists.txt. It is added some include dirs to the shim target, but they are relative to CMAKE_BINARY_DIR/CMAKE_SORUCE_DIR. This works when opentelemetry-cpp is the top-level project, but in this case myproject is at the top-level, so these paths are no longer correct. I think making these paths relative to PROJECT_BINARY_DIR/PROJECT_SOURCE_DIR would be better since the paths would always be constructed relative to the actual opentelemetry-cpp directory.

@andremarianiello andremarianiello added the bug Something isn't working label Oct 10, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 10, 2023
@marcalff marcalff removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants