Commit 09c0504f authored by Kevin Funk's avatar Kevin Funk
Browse files

clang: Do not create GLOBAL IMPORTED targets

Work-around CMake bug:
  https://gitlab.kitware.com/cmake/cmake/issues/17245

... which was only fixed in CMake 3.10.0

Instead, create the IMPORTED library where needed...
parent 219ae842
......@@ -50,19 +50,15 @@ if (LLVM_FOUND AND LLVM_LIBRARY_DIRS)
string(TOUPPER ${_libname_} _prettylibname_)
find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_} HINTS ${LLVM_LIBRARY_DIRS} ${ARGN})
if (CLANG_${_prettylibname_}_LIB)
add_library(${_libname_} UNKNOWN IMPORTED GLOBAL)
set_property(TARGET ${_libname_} PROPERTY IMPORTED_LOCATION ${CLANG_${_prettylibname_}_LIB})
set(CLANG_LIBS ${CLANG_LIBS} ${CLANG_${_prettylibname_}_LIB})
endif()
endmacro(FIND_AND_ADD_CLANG_LIB)
# note: On Windows there's 'libclang.dll' instead of 'clang.dll' -> search for 'libclang', too
FIND_AND_ADD_CLANG_LIB(clangFrontend)
# note: On Windows there's 'libclang.dll' instead of 'clang.dll' -> search for 'libclang', too
FIND_AND_ADD_CLANG_LIB(clang NAMES clang libclang HINTS ${LLVM_LIBRARY_DIRS}) # LibClang: high-level C interface
FIND_AND_ADD_CLANG_LIB(clangDriver)
FIND_AND_ADD_CLANG_LIB(clangCodeGen)
FIND_AND_ADD_CLANG_LIB(clangSema)
......
......@@ -51,6 +51,8 @@ if (CLANG_FOUND)
message(FATAL_ERROR "Could not find the Clang C library: libclang")
endif()
add_library(Clang::clang UNKNOWN IMPORTED)
set_property(TARGET Clang::clang PROPERTY IMPORTED_LOCATION ${CLANG_CLANG_LIB})
ecm_optional_add_subdirectory(clang)
endif()
# END: Languages
......
......@@ -104,7 +104,7 @@ LINK_PUBLIC
KDev::Language
KDev::Project
KDev::Util
clang
Clang::clang
)
install(FILES duchain/gcc_compat.h DESTINATION ${KDE_INSTALL_DATADIR}/kdevclangsupport PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
......
......@@ -19,7 +19,7 @@ add_executable(clang-minimal-visitor WIN32
)
ecm_mark_nongui_executable(clang-minimal-visitor)
target_link_libraries(clang-minimal-visitor
clang
Clang::clang
)
ecm_add_test(test_buddies.cpp
......@@ -48,7 +48,7 @@ ecm_add_test(test_clangutils.cpp
LINK_LIBRARIES
KDev::Tests
Qt5::Test
clang
Clang::clang
KDevClangPrivate
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment