Re-fix QtLibraryInfo compilation issues

After the "CMake: make compile options consistent for Qt created libraries"
revert, this part of the code also get reverted, however, it's not
related to the revert reason: the user project's deprecation behavior
is changed. So restore this code. We need this code to make sure
we use the same parameters when compiling QtLibraryInfo, otherwise
some compilers may complain about it, such as clang-cl.

Change-Id: Ie50d4f820be3a2e950dd87902d794f1d2681b7a5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 71c9b9f05b9e3d0d655db33e75207a90509849e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Yuhang Zhao 2023-06-08 10:55:33 +08:00 committed by Qt Cherry-pick Bot
parent ecdd82ac34
commit c41547247b
2 changed files with 6 additions and 12 deletions

View File

@ -16,14 +16,14 @@ qt_add_library(QtLibraryInfo OBJECT
qmakelibraryinfo.cpp qmakelibraryinfo.h
)
# Make sure we use same parameters when building QtLibraryInfo and other Qt libraries,
# otherwise some compilers may have compilation errors, such as clang-cl.
target_link_libraries(QtLibraryInfo PUBLIC PlatformCommonInternal)
target_link_libraries(QtLibraryInfo PUBLIC Qt::CorePrivate)
qt_internal_add_sync_header_dependencies(QtLibraryInfo Core)
set_target_properties(QtLibraryInfo PROPERTIES
COMPILE_OPTIONS $<TARGET_PROPERTY:Qt::Core,INTERFACE_COMPILE_OPTIONS>
COMPILE_DEFINITIONS $<TARGET_PROPERTY:Qt::Core,INTERFACE_COMPILE_DEFINITIONS>
INCLUDE_DIRECTORIES $<TARGET_PROPERTY:Qt::Core,INTERFACE_INCLUDE_DIRECTORIES>
INCLUDE_DIRECTORIES $<TARGET_PROPERTY:Qt::CorePrivate,INTERFACE_INCLUDE_DIRECTORIES>
)
target_include_directories(QtLibraryInfo PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/library"
@ -41,8 +41,6 @@ target_compile_definitions(QtLibraryInfo PUBLIC
PROEVALUATOR_FULL
QT_BUILD_QMAKE
QT_USE_QSTRINGBUILDER
QT_NO_FOREACH
QT_VERSION_STR="${PROJECT_VERSION}"
QT_HOST_MKSPEC="${QT_QMAKE_HOST_MKSPEC}"
QT_TARGET_MKSPEC="${QT_QMAKE_TARGET_MKSPEC}"
QT_HOST_DATADIR="${hostdatadir}"
@ -100,7 +98,6 @@ qt_internal_add_tool(${target_name}
PRECOMPILED_HEADER
"qmake_pch.h"
LIBRARIES
Qt::CorePrivate
QtLibraryInfo
)
qt_internal_return_unless_building_tools()

View File

@ -14,9 +14,7 @@ qt_internal_add_tool(${target_name}
SOURCES
qtpaths.cpp
DEFINES
QT_NO_FOREACH
QTPATHS_VERSION_STR="2.0"
QT_VERSION_STR="${PROJECT_VERSION}"
)
qt_internal_return_unless_building_tools()
@ -26,7 +24,6 @@ qt_internal_return_unless_building_tools()
qt_internal_extend_target(${target_name} CONDITION QT_FEATURE_settings
LIBRARIES
QtLibraryInfo
Qt::CorePrivate
)
if(WIN32 AND TARGET ${target_name})