Files
qt-creator/cmake/FindClang.cmake
Eike Ziller 6cff79d377 CMake build: Support building clang tooling without static libs
Create a FindClang.cmake and move all Clang configuration there.
Find Clang and choose static libraries if available, otherwise use
clang-cpp if available.
Add option to link to clang-cpp even if static libraries are available.

Fixes: QTCREATORBUG-23172
Change-Id: If40304d174469df0c786259e724cbee8de0e2d0e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-09-03 10:03:45 +00:00

15 lines
521 B
CMake

find_package(Clang CONFIG)
# silence a lot of warnings from building against llvm
if(MSVC AND TARGET libclang)
target_compile_options(libclang INTERFACE /wd4100 /wd4141 /wd4146 /wd4244 /wd4267 /wd4291)
endif()
option(CLANGTOOLING_LINK_CLANG_DYLIB "Force linking of Clang tooling against clang-cpp" NO)
if (TARGET clangTooling AND NOT CLANGTOOLING_LINK_CLANG_DYLIB)
set(CLANG_TOOLING_LIBS libclang clangTooling clangQuery clangIndex)
elseif (TARGET clang-cpp)
set(CLANG_TOOLING_LIBS libclang clang-cpp)
endif()