CMP0020: Remove support for OLD behavior

This commit is contained in:
Brad King 2024-11-17 12:04:08 -05:00
parent 092d6de4be
commit 094b42b643
4 changed files with 8 additions and 11 deletions

View File

@ -1,6 +1,9 @@
CMP0020
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
Automatically link Qt executables to ``qtmain`` target on Windows.
CMake 2.8.10 and lower required users of Qt to always specify a link
@ -21,7 +24,5 @@ The ``NEW`` behavior for this policy is to link executables to ``qtmain.lib``
automatically when they link to QtCore ``IMPORTED`` target.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.11
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt

View File

@ -1080,23 +1080,21 @@ if (QT_QMAKE_EXECUTABLE AND
set(_isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>)
set(_isWin32 $<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>)
set(_isNotExcluded $<NOT:$<BOOL:$<TARGET_PROPERTY:QT4_NO_LINK_QTMAIN>>>)
set(_isPolicyNEW $<TARGET_POLICY:CMP0020>)
get_target_property(_configs Qt4::QtCore IMPORTED_CONFIGURATIONS)
set_property(TARGET Qt4::QtCore APPEND PROPERTY
INTERFACE_LINK_LIBRARIES
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain>
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded}>:Qt4::qtmain>
)
foreach(_config ${_configs})
set_property(TARGET Qt4::QtCore APPEND PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES_${_config}
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain>
$<$<AND:${_isExe},${_isWin32},${_isNotExcluded}>:Qt4::qtmain>
)
endforeach()
unset(_configs)
unset(_isExe)
unset(_isWin32)
unset(_isNotExcluded)
unset(_isPolicyNEW)
endif()
#######################################

View File

@ -72,7 +72,7 @@ class cmMakefile;
11, NEW) \
SELECT(POLICY, CMP0020, \
"Automatically link Qt executables to qtmain target on Windows.", 2, \
8, 11, WARN) \
8, 11, NEW) \
SELECT( \
POLICY, CMP0021, \
"Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \

View File

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.10)
project(Qt4Targets)
cmake_policy(SET CMP0020 NEW)
find_package(Qt4 REQUIRED)
set(CMAKE_AUTOMOC ON)