diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-09-18 17:54:01 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-09-19 21:34:20 +0200 |
commit | db692f76c7248964f2668f8927236b5b9b70f617 (patch) | |
tree | 07916d57dde37425efa346df28c217fc97325e8f /cmake | |
parent | 5ab6feb696440764f0ef32128dc33e7d974a935f (diff) |
CMake: Fix building qdoc and qtools with Qt prebuilt Clang
Some Clang distributions offer the LLVM CMake target (like the
Ubuntu 20.04 system one, as well as the OpenSuse system one), whereas
others don't have it (like the official Ubuntu llvm package from
llvm.org or the Qt prebuilt one used in the CI which is based on
the llvm.org one).
Check for the existence of both the clang-cpp and the LLVM target
before trying to link to them, otherwise use the old method of linking
to clangHandleCXX.
Amends 166be41502ac77fc355f7c28c3289c95ee45b543
Change-Id: Ib496f7fc99d56dc4a051a6c9c8f162b1d6a4eacf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christophe Giboudeaux <christophe@krop.fr>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindWrapLibClang.cmake | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/FindWrapLibClang.cmake b/cmake/FindWrapLibClang.cmake index 206ba0448..c89dd8cde 100644 --- a/cmake/FindWrapLibClang.cmake +++ b/cmake/FindWrapLibClang.cmake @@ -27,7 +27,7 @@ if(WrapLibClang_FIND_VERSION AND LLVM_PACKAGE_VERSION set(__wrap_lib_clang_requested_version_found TRUE) endif() -if(TARGET libclang AND (TARGET clang-cpp OR TARGET clangHandleCXX) AND __wrap_lib_clang_requested_version_found) +if(TARGET libclang AND ((TARGET clang-cpp AND TARGET LLVM) OR TARGET clangHandleCXX) AND __wrap_lib_clang_requested_version_found) set(WrapLibClang_FOUND TRUE) get_target_property(type libclang TYPE) @@ -46,9 +46,12 @@ if(TARGET libclang AND (TARGET clang-cpp OR TARGET clangHandleCXX) AND __wrap_li find_package(Threads) endif() qt_internal_disable_find_package_global_promotion(Threads::Threads) + # lupdate must also link to LLVM when using clang-cpp + set(__qt_clang_genex_condition "$<AND:$<TARGET_EXISTS:clang-cpp>,$<TARGET_EXISTS:LLVM>>") + set(__qt_clang_genex "$<IF:${__qt_clang_genex_condition},clang-cpp;LLVM,clangHandleCXX>") target_link_libraries(WrapLibClang::WrapLibClang INTERFACE libclang - $<IF:$<TARGET_EXISTS:clang-cpp>,clang-cpp LLVM,clangHandleCXX> # lupdate must link to LLVM when using clang-cpp + ${__qt_clang_genex} Threads::Threads ) |