clang: Force linking against full lib path

Authored by kfunk on May 8 2018, 6:36 AM.

Description

clang: Force linking against full lib path

Force link against full library path:

/usr/lib/x86_64-linux-gnu/libclang-5.0.so.1

... instead of:

-lclang

target_link_libraries has some heuristics where it prefers dropping the
full library path in case the library is detected within alternative
library search paths, cf.

https://cmake.org/cmake/help/latest/policy/CMP0060.html#policy:CMP0060

This is a problem in case e.g. libclang is detected in one of the
default linker search paths of the compiler in use (in my case compiler
was Clang 6.0 from Ubuntu repositories trying to link against libclang.so from Clang 5.0)
and CMake attempts to link using -lclang instead of the full library path,
thus running into issues like:

/usr/bin/ld: error: cannot find -lclang
.../kdevelop/plugins/clang/tests/minimal_visitor.cpp:27: error: undefined reference to 'clang_getCursorExtent'
...

Details

Committed
kfunkMay 8 2018, 6:45 AM
Parents
R32:a278fffd13c0: test_docker: Dont crash when docker unavailable
Branches
Unknown
Tags
Unknown