diff options
| author | Tor Arne Vestbø <[email protected]> | 2025-03-28 16:50:58 +0100 |
|---|---|---|
| committer | Tor Arne Vestbø <[email protected]> | 2025-03-31 17:29:48 +0200 |
| commit | 6a465729be812465ea97dda81e03c4d6d92f5d4c (patch) | |
| tree | fe150e772ac5ff8f90977d96a9f3bcb0ed7ea99a /cmake/QtTestHelpers.cmake | |
| parent | 80d680e82f545d3a0ae23aa65d07befbab57b71a (diff) | |
cmake: Respect CMAKE_MACOSX_BUNDLE and CMAKE_WIN32_EXECUTABLE
The user may set different global defaults for CMAKE_MACOSX_BUNDLE
and CMAKE_WIN32_EXECUTABLE, so we shouldn't unconditionally override
them on a target level.
This allows cmake ~/foo/ -DCMAKE_MACOSX_BUNDLE=ON to build a project
as a GUI app without needing to modify the CMakeLists.txt with target
specific overrides.
Change-Id: Id49adb1c0aedfe82a2b1d919d086c5112ba92b93
Reviewed-by: Alexandru Croitor <[email protected]>
Diffstat (limited to 'cmake/QtTestHelpers.cmake')
| -rw-r--r-- | cmake/QtTestHelpers.cmake | 18 |
1 files changed, 11 insertions, 7 deletions
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. |
