Skip to content

nlohmann_json not found when used opentelemetry-cpp as external project #3190

@chuandew

Description

@chuandew

Describe your environment

chuande@dingo11 ~ » gcc --version
gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

chuande@dingo11 ~ » uname -a
Linux dingo11.com 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Wed Nov 29 18:55:19 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
chuande@dingo11 ~ » cat /etc/redhat-release 
Rocky Linux release 8.9 (Green Obsidian)

opentelemetry-cpp v1.18.0

Steps to reproduce

git clone https://github.com/chuandew/dingofs.git

git checkout add_opentele

git submodule update --init --recursive

cd third-party

mkdir build

cd build 

cmake ..

make -j 64 VERBOSE=1

What is the expected behavior?
cmake configue success
What is the actual behavior?
error message

CMake Error at /home/chuande/workspace/dingofs/third-party/installed/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake:142 (set_target_properties):                                                                         
  The link interface of target "opentelemetry-cpp::otlp_http_client"
  contains:

    nlohmann_json::nlohmann_json

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /home/chuande/workspace/dingofs/third-party/installed/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake:131 (include)                                                                                                     
  cmake/external_dependencies.cmake:114 (find_package)
  CMakeLists.txt:199 (include)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions