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 <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2020-02-07 13:03:40 +01:00
parent 43c17efe5e
commit 4e357e84c0

View File

@@ -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()