cmake: Explicitly generate Xcode schemes for executables and libs
Otherwise, Xcode will auto-generate schemes for all targets, including internal targets such as foo_autogen and build-only targets such as ZERO_CHECK and ALL_BUILD, choosing one of them at random when opening the project for the first time. If multiple targets get a scheme they will be sorted alphabetically. We could prioritize them by generating a xcschememanagement.plist file, but that would require teaching CMake about that feature. This aligns the CMake behavior with qmake, where we also generate schemes explicitly. Pick-to: 6.6 6.5 Change-Id: I3756fced37a4ff7792370da10fc49169cc271ae8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 822dc75f1a0be988b25741a8f16ddc2fbeb48e77) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
15cf52cd59
commit
87aa94008b
@ -757,6 +757,20 @@ function(qt6_finalize_target target)
|
||||
_qt_internal_finalize_executable(${ARGV})
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# Tell CMake to generate run-scheme for the executable when generating
|
||||
# Xcode projects. This avoids Xcode auto-generating default schemes for
|
||||
# all targets, which includes internal and build-only targets.
|
||||
get_target_property(generate_scheme "${target}" XCODE_GENERATE_SCHEME)
|
||||
if(generate_scheme MATCHES "-NOTFOUND" AND (
|
||||
target_type STREQUAL "EXECUTABLE" OR
|
||||
target_type STREQUAL "SHARED_LIBRARY" OR
|
||||
target_type STREQUAL "STATIC_LIBRARY" OR
|
||||
target_type STREQUAL "MODULE_LIBRARY"))
|
||||
set_property(TARGET "${target}" PROPERTY XCODE_GENERATE_SCHEME TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(${target} PROPERTIES _qt_is_finalized TRUE)
|
||||
endfunction()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user