diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-04 18:52:33 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-09-06 09:01:00 +0000 |
commit | 7292c4ed1076c252a30d16557585ceb8fac2248b (patch) | |
tree | 8025cebc4e63390556ec9abddc83e579075e35e2 /cmake | |
parent | 9d5887fbc6fe0b20c4faf7eb42f1b71130e95120 (diff) | |
download | qttools-7292c4ed1076c252a30d16557585ceb8fac2248b.tar.gz |
Add build instructions for coin
The tests have not been ported yet and are omitted in this change.
* Disable qdoc when requesting static libclang linkage with MSVC but
the Qt build is not a release build. The object files cannot be mixed.
* Fix the static libclang build on Linux by adding the missing pthreads
linkage.
* Fix duplicated resource names that break the build when linking
statically. The name isn't referenced from anywhere and with cmake's
object library support the Q_INIT_RESOURCE isn't necessary, so this
local rename should be safe.
Change-Id: Ic9bc126ef74700fe07ec5b1c9e408055f7141004
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindWrapLibClang.cmake | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cmake/FindWrapLibClang.cmake b/cmake/FindWrapLibClang.cmake index 33fc29837..3b21966dc 100644 --- a/cmake/FindWrapLibClang.cmake +++ b/cmake/FindWrapLibClang.cmake @@ -18,6 +18,18 @@ function(qt_tools_find_llvm_version_from_lib_dir lib_dir out_var) endfunction() function(qt_tools_find_lib_clang) + if(NOT QDOC_USE_STATIC_LIBCLANG AND DEFINED ENV{QDOC_USE_STATIC_LIBCLANG}) + set(QDOC_USE_STATIC_LIBCLANG "$ENV{QDOC_USE_STATIC_LIBCLANG}") + endif() + + if(QDOC_USE_STATIC_LIBCLANG AND MSVC) + if (NOT CMAKE_BUILD_TYPE STREQUAL "Release") + message(STATUS "Static linkage against libclang with MSVC was requested, but the build is not a release build, therefore libclang cannot be used.") + set(WrapLibClang_FOUND FALSE PARENT_SCOPE) + return() + endif() + endif() + # We already looked up all the libclang information before, just create the target # and exit early. if(QT_LIB_CLANG_LIBS) @@ -26,10 +38,6 @@ function(qt_tools_find_lib_clang) return() endif() - if(NOT QDOC_USE_STATIC_LIBCLANG AND DEFINED ENV{QDOC_USE_STATIC_LIBCLANG}) - set(QDOC_USE_STATIC_LIBCLANG "$ENV{QDOC_USE_STATIC_LIBCLANG}") - endif() - if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") # on Windows we have only two host compilers, MSVC or mingw. The former we never # use for cross-compilation where it isn't also the target compiler. The latter @@ -207,6 +215,10 @@ function(qt_tools_create_lib_clang_target) target_link_directories(WrapLibClang::WrapLibClang INTERFACE ${QT_LIB_CLANG_LIBDIR}) target_include_directories(WrapLibClang::WrapLibClang INTERFACE ${QT_LIB_CLANG_INCLUDEPATH}) target_compile_definitions(WrapLibClang::WrapLibClang INTERFACE ${QT_LIB_CLANG_DEFINES}) + if (NOT TARGET Threads::Threads) + find_package(Threads) + endif() + target_link_libraries(WrapLibClang::WrapLibClang INTERFACE Threads::Threads) endfunction() function(qt_tools_get_flag_list_of_llvm_static_libs out_var) |