CMake: Allow WIN32 and MACOSX_BUNDLE arguments for qt6_add_executable

qt6_add_executable will forward all arguments to add_executable, which
works fine on Windows and macOS in regards of WIN32 and MACOSX_BUNDLE
arguments.

On Android however add_library is being used, and those arguments need
to be removed otherwise they will be consided as source files.

Pick-to: 6.0
Fixes: QTBUG-88926
Change-Id: Id22fdf91d58d9053eaad2d3c080ea72060d928c0
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
bb10
Cristian Adam 2020-11-30 17:16:41 +01:00
parent cfad8a352a
commit 7b5fd05e8b
1 changed files with 1 additions and 0 deletions

View File

@ -430,6 +430,7 @@ set(_Qt6_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
# Wrapper function that adds an executable with some Qt specific behavior.
function(qt6_add_executable target)
if(ANDROID)
list(REMOVE_ITEM ARGN "WIN32" "MACOSX_BUNDLE")
add_library("${target}" MODULE ${ARGN})
# On our qmake builds we do don't compile the executables with
# visibility=hidden. Not having this flag set will cause the