From 4e357e84c03c629a284c1f5505908f8a7644fba9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 7 Feb 2020 13:03:40 +0100 Subject: [PATCH] CMake build: Fix building sdktool against static Qt On Windows. This is a hack, but enough for the purpose of packaging. Change-Id: I308b80dcf37e26e5c69f2fd6631b4b38854d68e0 Reviewed-by: Cristian Adam --- src/tools/sdktool/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tools/sdktool/CMakeLists.txt b/src/tools/sdktool/CMakeLists.txt index 2c0c60b92ac..e25ae3f31a4 100644 --- a/src/tools/sdktool/CMakeLists.txt +++ b/src/tools/sdktool/CMakeLists.txt @@ -25,6 +25,15 @@ find_package(Qt5 REQUIRED ) +if (MSVC) + # find out if Qt is static and set /MT if so + get_target_property(_input_type Qt5::Core TYPE) + if (${_input_type} STREQUAL "STATIC_LIBRARY") + string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + endif() +endif() + if (APPLE) find_library(FWFoundation Foundation) endif()