CMake: Make qt_add_executable more minimalistic

As per the public API review, we want qt_add_executable to be a
minimal shim around CMake's add_executable with as little Qt specific
behavior as it makes sense.

This means:
- not setting the WIN32 and MACOSX_BUNDLE
- not linking against Gui, only Core
- not generating a windows RC file

Users should handle those particularities themselves, ensuring that
qt_add_executable can be used by a bigger audience.

Fixes: QTBUG-87664
Task-number: QTBUG-86827
Change-Id: Ib424dd95266352eb035a344ca03b6b81e47bd9e8
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-10-26 13:42:58 +01:00
parent f7d3ff1fe6
commit 07ab7c11b5

View File

@ -439,16 +439,9 @@ function(qt6_add_executable target)
set_property(TARGET "${target}" PROPERTY OBJCXX_VISIBILITY_PRESET default)
qt6_android_apply_arch_suffix("${target}")
else()
add_executable("${target}" WIN32 MACOSX_BUNDLE ${ARGN})
add_executable("${target}" ${ARGN})
endif()
target_link_libraries("${target}" PRIVATE Qt::Core)
if(TARGET Qt::Gui)
target_link_libraries("${target}" PRIVATE Qt::Gui)
endif()
if (WIN32)
_qt_internal_generate_win32_rc_file(${target})
endif()
if(ANDROID)
qt_android_generate_deployment_settings("${target}")