aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-11-18 09:08:55 +0100
committerChristian Stenger <christian.stenger@qt.io>2020-11-23 11:07:49 +0000
commit6b62a99a8a7c37b119fc08a3b23ca386ba1cfe61 (patch)
tree6f61ba80f74a0c27dfeffdadeed14b8d85bc8085 /cmake
parent05a1b2a6e8a048ae2c893e541e7d09ab46ec62e8 (diff)
cmake: Fix building debug with release libclang
Parts of QC cannot be linked against a release build of clangTooling libs and vice versa when building on Windows. Check whether the provided libs match the current build mode and disable respective parts if necessary. Re-use this information to decide whether unittest should be build or not. Change-Id: Ibc2aab0d7886e78ebbf8f15a43152efad49f1eff Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindClang.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/FindClang.cmake b/cmake/FindClang.cmake
index 0e1f5db36c..3176db73b7 100644
--- a/cmake/FindClang.cmake
+++ b/cmake/FindClang.cmake
@@ -12,3 +12,15 @@ if (TARGET clangTooling AND NOT CLANGTOOLING_LINK_CLANG_DYLIB)
elseif (TARGET clang-cpp)
set(CLANG_TOOLING_LIBS libclang clang-cpp)
endif()
+
+SET(QTC_CLANG_BUILDMODE_MATCH ON)
+if (WIN32)
+ string(TOLOWER ${CMAKE_BUILD_TYPE} _type)
+ get_target_property(_llvmConfigs libclang IMPORTED_CONFIGURATIONS)
+ string(TOLOWER ${_llvmConfigs} _llvm_configs)
+ list(FIND _llvm_configs ${_type} _build_type_found)
+ if (_build_type_found LESS 0)
+ set(QTC_CLANG_BUILDMODE_MATCH OFF)
+ message("Build mode mismatch (debug vs release): limiting clangTooling")
+ endif()
+endif()