• Kevin Funk's avatar
    clang: Force linking against full lib path · 46126881
    Kevin Funk authored
    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'
      ...
    46126881
FindClang.cmake 4.3 KB