summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtExecutableHelpers.cmake11
-rw-r--r--cmake/QtTestHelpers.cmake18
2 files changed, 20 insertions, 9 deletions
diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake
index 49d341597d1..90bbfee4ac3 100644
--- a/cmake/QtExecutableHelpers.cmake
+++ b/cmake/QtExecutableHelpers.cmake
@@ -184,10 +184,17 @@ function(qt_internal_add_executable name)
set_target_properties("${name}" PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}"
- WIN32_EXECUTABLE "${arg_GUI}"
- MACOSX_BUNDLE "${arg_GUI}"
)
+ if(arg_GUI)
+ # Only override if GUI is set. Otherwise leave up to
+ # CMake defaults, which may be set by the user elsewhere.
+ set_target_properties("${name}" PROPERTIES
+ MACOSX_BUNDLE ON
+ WIN32_EXECUTABLE ON
+ )
+ endif()
+
if(NOT arg_EXCEPTIONS)
qt_internal_set_exceptions_flags("${name}" "DEFAULT")
else()
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index e84a9bfa6b0..84d93297ed4 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -576,13 +576,17 @@ function(qt_internal_add_test name)
# Manual tests can be bundle apps
if(NOT arg_MANUAL)
- # Tests should not be bundles on macOS even if arg_GUI is true, because some tests make
- # assumptions about the location of helper processes, and those paths would be different
- # if a test is built as a bundle.
- set_property(TARGET "${name}" PROPERTY MACOSX_BUNDLE FALSE)
- # The same goes for WIN32_EXECUTABLE, but because it will detach from the console window
- # and not print anything.
- set_property(TARGET "${name}" PROPERTY WIN32_EXECUTABLE FALSE)
+ if(NOT DEFINED CMAKE_MACOSX_BUNDLE)
+ # Tests should not be bundles on macOS even if arg_GUI is true, because some tests make
+ # assumptions about the location of helper processes, and those paths would be different
+ # if a test is built as a bundle.
+ set_property(TARGET "${name}" PROPERTY MACOSX_BUNDLE FALSE)
+ endif()
+ if(NOT DEFINED CMAKE_WIN32_EXECUTABLE)
+ # The same goes for WIN32_EXECUTABLE, but because it will detach from the console window
+ # and not print anything.
+ set_property(TARGET "${name}" PROPERTY WIN32_EXECUTABLE FALSE)
+ endif()
endif()
# Tests on iOS must be app bundles.