You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
CLion won't build install target of CMake. And if I build from source by CLion, the built targets won't carry correct INTERFACE include directories. So when linking with opentracing, the compiler will complain about not find the .h files.
something like this:
In file included from /somepath/TextMapCarrier.cpp:12:0:
/somepath/TextMapCarrier.h:14:10: fatal error: opentracing/propagation.h: No such file or directory
#include <opentracing/propagation.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
otherpath/CMakeFiles/tracing.dir/build.make:62: recipe for target 'otherpath/CMakeFiles/tracing.dir/TextMapCarrier.cpp.o' failed
make[3]: *** [otherpath/CMakeFiles/tracing.dir/TextMapCarrier.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /somepath/TraceContext.cpp:12:0:
/somepath/TraceContext.h:14:10: fatal error: opentracing/tracer.h: No such file or directory
#include <opentracing/tracer.h>
^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
otherpath/tracing.dir/build.make:75: recipe for target 'src/tracing/CMakeFiles/tracing.dir/TraceContext.cpp.o' failed
make[3]: *** [otherpath/tracing.dir/TraceContext.cpp.o] Error 1
/sompath/TracerUtil.cpp:14:10: fatal error: opentracing/dynamic_load.h: No such file or directory
#include <opentracing/dynamic_load.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
REASON
The reason is your CMakeLists.txt didn't give opentracing target a correct interface include directories. List below.
if (BUILD_SHARED_LIBS)
add_library(opentracing SHARED ${SRCS})
target_link_libraries(opentracing ${LIBRARIES})
target_include_directories(opentracing INTERFACE"$<INSTALL_INTERFACE:include/>")
...
endif()
if (BUILD_STATIC_LIBS)
add_library(opentracing-staticSTATIC${SRCS})
...
target_include_directories(opentracing-staticINTERFACE"$<INSTALL_INTERFACE:include/>")
...
endif()
You only give an INSTALL_INTERFACE include directories for the target
So if I don't install (If I use CLion or trying to integrate opentracing with my own cmake project), When I link with opentracing, the above build errors will occur.
Suggestions
add other include directories to opentracing's INTERFACE include directories, something like this:
The text was updated successfully, but these errors were encountered:
XuanYang-cn
changed the title
If I don't install, the built target opentracing won't carry correct INTERFACE include directories
[CMake BUG] If I don't install, the built target opentracing won't carry correct INTERFACE include directories
Aug 15, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
CLion won't build install target of CMake. And if I build from source by CLion, the built targets won't carry correct INTERFACE include directories. So when linking with opentracing, the compiler will complain about not find the .h files.
something like this:
REASON
The reason is your CMakeLists.txt didn't give opentracing target a correct interface include directories. List below.
You only give an INSTALL_INTERFACE include directories for the target
So if I don't install (If I use CLion or trying to integrate opentracing with my own cmake project), When I link with opentracing, the above build errors will occur.
Suggestions
add other include directories to opentracing's INTERFACE include directories, something like this:
The text was updated successfully, but these errors were encountered: