forked from qt-creator/qt-creator
CMake build: Fix static build of cdbext and sdktool
Remove workaround for building statically, which was required for CMake < 3.15. Since we increase the CMake requirement to 3.16, the /MD option is no longer part of the CXX_FLAGS variables, so the old workaround breaks the static build of these tools. Change-Id: Ifc4b1c81210777e1274b4907feb3b023f7454191 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -25,18 +25,6 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|||||||
set(ArchSuffix 64)
|
set(ArchSuffix 64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# statically link MSVC runtime
|
|
||||||
# see https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#how-can-i-build-my-msvc-application-with-a-static-runtime
|
|
||||||
# TODO change to MSVC_RUNTIME_LIBRARY when CMake 3.15 is required
|
|
||||||
# set_property(TARGET qtcreatorcdbext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
||||||
foreach(flag_var
|
|
||||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
||||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
||||||
if(${flag_var} MATCHES "/MD")
|
|
||||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_qtc_library(qtcreatorcdbext
|
add_qtc_library(qtcreatorcdbext
|
||||||
COMPONENT qtcreatorcdbext
|
COMPONENT qtcreatorcdbext
|
||||||
DEPENDS ${DbgEngLib}
|
DEPENDS ${DbgEngLib}
|
||||||
@@ -60,6 +48,9 @@ add_qtc_library(qtcreatorcdbext
|
|||||||
|
|
||||||
qtc_library_enabled(_library_enabled qtcreatorcdbext)
|
qtc_library_enabled(_library_enabled qtcreatorcdbext)
|
||||||
if (_library_enabled)
|
if (_library_enabled)
|
||||||
|
# statically link MSVC runtime
|
||||||
|
set_property(TARGET qtcreatorcdbext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
|
||||||
find_package(Python3 3.8 COMPONENTS Development)
|
find_package(Python3 3.8 COMPONENTS Development)
|
||||||
|
|
||||||
if (NOT ${Python3_Development_FOUND})
|
if (NOT ${Python3_Development_FOUND})
|
||||||
|
@@ -25,15 +25,6 @@ find_package(Qt5
|
|||||||
REQUIRED
|
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)
|
if (APPLE)
|
||||||
find_library(FWFoundation Foundation)
|
find_library(FWFoundation Foundation)
|
||||||
endif()
|
endif()
|
||||||
@@ -74,6 +65,14 @@ add_qtc_executable(sdktool
|
|||||||
settings.cpp settings.h
|
settings.cpp settings.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (MSVC AND TARGET sdktool)
|
||||||
|
# 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")
|
||||||
|
set_property(TARGET sdktool PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
extend_qtc_executable(sdktool
|
extend_qtc_executable(sdktool
|
||||||
SOURCES_PREFIX "${UtilsSourcesDir}"
|
SOURCES_PREFIX "${UtilsSourcesDir}"
|
||||||
DEFINES QTCREATOR_UTILS_STATIC_LIB
|
DEFINES QTCREATOR_UTILS_STATIC_LIB
|
||||||
|
Reference in New Issue
Block a user