Commit Graph

109 Commits

Author SHA1 Message Date
Stepanov Igor
26869fb4ba cmake --build: Fix building multiple targets in Xcode workspace
Extend commit 844d79916a (cmake --build: Add support for driving Xcode
workspaces, 2025-06-02) to support multiple `--target` arguments.
`xcodebuild -scheme` cannot be repeated in a single call, so call it
multiple times instead.

Issue: #26958

Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2025-06-14 16:53:25 +10:00
Stepanov Igor
844d79916a cmake --build: Add support for driving Xcode workspaces
External tools may create a `.xcworkspace` directory next to the
`.xcodeproj` directory that CMake generates.  If a workspace exists,
drive the build through it instead.

Closes: #26958
Co-authored-by: Brad King <brad.king@kitware.com>
2025-06-10 11:08:04 -04:00
Alexandra Cherdantseva
2dc8c1d45f Xcode: Fix POST_BUILD order in bundle targets on Xcode 16+
XCode 16+ no longer delays our POST_BUILD phase until after bundle files
like `Info.plist` are generated.  Teach the Xcode generator to add
explicit dependencies to the POST_BUILD phase in bundle targets to
ensure the files are created before it runs.

Fixes: #26656
2025-02-25 08:15:12 -05:00
Brad King
5cd2669146 Add deprecation warnings for policies CMP0142 and below
The OLD behaviors of all policies are deprecated, but only by
documentation.  Add an explicit deprecation diagnostic for policies
introduced in CMake 3.25 and below to encourage projects to port
away from setting policies to OLD.
2025-02-05 14:20:48 -05:00
Cristiano Carvalheiro
7d28005244 Xcode: Support for test action 'Build Configuration' scheme property
Also allow scoped property checking on Xcode scheme tests to
 be able to distinguish between launch and test actions build config.
2025-01-09 16:36:33 +00:00
Cristiano Carvalheiro
419cfe30d0 Xcode: Support for 'LLDB Init File' scheme property
Fixes: #24002
2024-12-13 08:31:11 -05:00
Brad King
a96d6a98d3 Tests/RunCMake/XcodeProject: Improve XcodeSchemaProperty failure messages 2024-12-13 08:30:56 -05:00
Brad King
68a07a6610 Tests: Add missing cmake_minimum_required calls 2024-11-20 10:54:01 -05:00
Brad King
f4aa34daa7 Tests/RunCMake: Update cmake_minimum_required versions to 3.10
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.10 where possible.
2024-10-03 11:52:22 -04:00
Brad King
74beb6dba8 Xcode: Restore support for CMAKE_OSX_ARCHITECTURES=$(ARCHS_STANDARD)
Skip the `CMAKE_OSX_ARCHITECTURES` validation added by commit db409e5e68
(APPLE: Check if compilers respect CMAKE_OSX_ARCHITECTURES, 2024-05-04,
v3.30.0-rc1~15^2) if the value contains a placeholder, since we do not
know the real value.

Fixes: #26128
2024-07-19 09:42:45 -04:00
Ilya Kulakov
3071660247 Xcode: Use builtin "default" file type
"sourcecode" is not appropriate for binary files, such as video, and
hinders Xcode performance.
2024-04-22 20:53:07 -04:00
Tor Arne Vestbø
021492038e Xcode: Generate BuildableProductRunnable for ProfileAction
Similarly to the LaunchAction we need to associate a runnable
executable with the launch action.
2024-02-15 16:37:07 +01:00
Brad King
264dcae5e4 Tests: Fix clang -Wstrict-prototypes warnings 2023-10-26 09:20:45 -04:00
Brad King
a4d114e8cd Tests: Split some RunCMake.XcodeProject cases into a separate test
The `RunCMake.XcodeProject` has many cases and occasionally fails
due to timeout.  Move iOS and other device-specific cases to a new
`RunCMake.XcodeProject-Device` test.
2023-05-15 10:18:54 -04:00
Brad King
6aae34ec53 Tests: Fix RunCMake.XcodeProject XcodeSchemaGeneration case on arm64
Explicitly specify the xcodebuild scheme destination architecture to
match the host.
2023-05-10 10:04:48 -04:00
Brad King
1edf138506 Tests/RunCMake: Update cmake_minimum_required versions
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.5 where possible.

Also, remove `cmake_minimum_required()` and `project()` calls from
individual cases where they are handled by `CMakeLists.txt`.
2023-02-11 06:24:22 -05:00
Ross Kilgariff
01c1d81527 Xcode: Inherit Swift flags and compilation conditions
Extend the change from commit dfaf55fbfd (Xcode: add extra
'$(inherited)' entries using InheritBuildSettingAttribute, 2021-05-03,
v3.21.0-rc1~182^2) to cover Swift flags and compilation conditions,
allowing CocoaPods and CMake to interoperate when used in the same
project.
2023-01-25 15:15:03 -05:00
Marc Chevrier
61075d2d7b XCode: ensure LINK_LIBRARY genex is usable with XCODE_LINK_BUILD_PHASE_MODE
Fixes: #24176
2022-11-22 16:44:45 +01:00
Brad King
024e3d2bf6 Xcode: Put object files in a place that Xcode cleans
Since commit dc5fc898f6 (Xcode: Set object file locations using
TARGET_TEMP_DIR, 2022-09-29, v3.25.0-rc1~64^2~1), `xcodebuild clean`
does not remove the object files in our explicit `TARGET_TEMP_DIR`
because it is not under the `SYMROOT`.  Put it there.

Fixes: #24096
2022-10-28 15:38:07 -04:00
Brad King
25630863ea Tests: Add case covering XCODE_EMIT_EFFECTIVE_PLATFORM_NAME=OFF for iOS
This use case was fixed by commit a7fb4bc475 (Xcode: Set build product
locations using CONFIGURATION_BUILD_DIR, 2022-09-28).  Add a test to
verify the fix.

Fixes: #23970
2022-10-03 12:41:59 -04:00
Brad King
42c0428e5f Merge topic 'ci-xcode-14.0'
9cdf4c9be4 gitlab-ci: update macOS jobs to use Xcode 14.0
5d2c2b2558 Tests: Update RunCMake.XcodeProject iOS cases for Xcode 14.0
12c6fec6b4 Xcode: Drop CMAKE_INTDIR= definition in Swift targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7732
2022-10-03 10:31:27 -04:00
Brad King
5d2c2b2558 Tests: Update RunCMake.XcodeProject iOS cases for Xcode 14.0
Issue: #24011
2022-09-30 13:08:05 -04:00
Brad King
d0a6ebf57b Xcode: Fix "clean" operation under the "new build system"
Previously we set `SYMROOT` to tell Xcode where to place the build
products.  However, the "clean" operation in the Xcode "new build
system" expects that only Xcode creates the `SYMROOT` directory or
contents inside it.  Since we create that directory, "clean" fails.

We now explicitly set `CONFIGURATION_BUILD_DIR` and `TARGET_TEMP_DIR`
instead of letting Xcode compute their values from `SYMROOT`, so we no
longer need to set the latter.  Drop the now-unnecessary `SYMROOT`.

Fixes: #22550
2022-09-29 15:04:08 -04:00
Mikko Sivulainen
d4cc39842e Xcode: Do not append per-config suffixes to library search paths
Add policy `CMP0142` to remove the automatic addition of the
`$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)` suffix in a compatible way.

Fixes: #21757
2022-09-15 10:27:23 -04:00
Brad King
899e09cbca Merge topic 'Link-MACOSX_BUNDLE'
71dae4eb5c Merge branch 'backport-3.24-Link-MACOSX_BUNDLE' into Link-MACOSX_BUNDLE
f5a441a616 Xcode: Fix erroneous MACOSX_BUNDLE link

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7624
2022-09-01 09:58:17 -04:00
Marc Chevrier
71dae4eb5c Merge branch 'backport-3.24-Link-MACOSX_BUNDLE' into Link-MACOSX_BUNDLE 2022-08-31 09:54:46 -04:00
Marc Chevrier
f5a441a616 Xcode: Fix erroneous MACOSX_BUNDLE link
Refactoring in commit a2cfa2da4f (GenEx/LINK_LIBRARY: Add features for
framework support on Apple, 2022-02-10, v3.24.0-rc1~661^2) accidentally
removed a `GetParentDirectory` call.  Restore it.

Fixes: #23891
2022-08-31 09:52:38 -04:00
PatriceJiang
39456c70e1 Xcode: Add settings to control a scheme's GPU Validation values 2022-08-30 10:26:48 -04:00
Harry Mallon
a1a0ae3ad4 Xcode: Add Xcode SCHEME control for 'Launch' control 2022-06-15 19:02:56 +01:00
Gregor Jasny
53ca6edd8a xcode: add support for xcconfig files
Fixes: #18420
2022-04-03 22:39:34 +02:00
Jake Turner
0798edfb85 Tests: Xcode scheme ENABLE_GPU_FRAME_CAPTURE_MODE
Setting numerical value
Caseless comparison of string values
"Metal" is converted to value 1
"Disabled" is converted to value 3
2021-11-09 06:28:33 +00:00
Brad King
75901f0472 Tests: Fix RunCMake.XcodeProject XcodeIOSInstallCombined cases for Xcode 13.0
The output of `otool -vf` now contains additional content that happens
to be matched by our architectures regex.  Make the regex more strict.
2021-10-05 09:13:23 -04:00
Gregor Jasny
0e86fea0be Tests: Specify destination for Xcode scheme
The `Using the first of multiple matching destinations` warning
vanishes if we explicitly specify a destination.

Fixes: #22704
2021-10-05 07:38:48 -04:00
Yauheni Khnykin
0b5301a778 FindXCTest: Fix output directory for test bundle with Xcode 12.5
The fix from commit eafe740ead (FindXCTest: Fix output directory for
test bundle with new build system, 2021-02-09, v3.19.5~5^2) is not
necessary with Xcode 12.5, which seems to have changed/fixed the
behaviour again.

Fixes: #22462
2021-07-26 13:31:10 -04:00
Danny Parker
dfaf55fbfd Xcode: add extra '$(inherited)' entries using InheritBuildSettingAttribute.
These have been added to:
GCC_PREPROCESSOR_DEFINITIONS
OTHER_CFLAGS
OTHER_LDFLAGS

This is to allow Cocoapods to work correctly as it uses xcconfig files to alter build settings in Xcode, and requires these build settings to inherit from their parent, not overwrite.
2021-05-05 14:38:33 +01:00
Yauheni Khnykin
74eda8ab1f Tests: Add XCTest cases to cover output directory selection
Fixes: #21800
2021-03-13 00:54:25 +01:00
Brad King
cab99f7dba Merge topic 'xcode12-ios_install_combined'
0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5785
2021-02-09 08:23:30 -05:00
Craig Scott
0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)
Xcode 12 doesn't allow nested builds within the same build directory.
That means we can no longer do an install by building the install target
when IOS_INSTALL_COMBINED is true. We can, however, still do an install
by running the cmake_install.cmake script or executing cmake --install,
since there is no outer build and therefore the associated SDK can be
built as a sub-build.

The non-build methods previously didn't work when
IOS_INSTALL_COMBINED was true because the generated install script
and the CMakeIOSInstallCombined script both made certain assumptions
that relied on being part of a build. Those assumptions are now
removed. A side-effect of this work is that cpack now also works from the
command line when IOS_INSTALL_COMBINED is true.

Relates: #21282
Fixes: #20023
2021-02-08 18:02:46 +11:00
Brad King
5115e8b2b6 Xcode: Generalize inheritance of project-level search paths
Generalize the change from commit bffb17be3d (Xcode: Inherit target
library and framework search paths from project, 2020-11-04,
v3.19.0-rc3~4^2) to apply to framework and other kinds of search paths
added either for include directories or for linking.

Issue: #21617
2020-12-22 08:56:26 -05:00
Yauheni Khnykin
31d3e64080 Tests: Add Xcode cases fixed by switch to the "new build system"
Support of 'new build system' in Xcode fixes indirectly few issues
which were caused by workaround with `XCODE_DEPEND_HELPER.cmake`
autogenerated script.

This patch adds test which is originated from issue #20260 and
reproduces this issue when 'new build system' is disabled.

Fixes: #20260
2020-11-30 13:02:51 -05:00
Gusts Kaksis
ce2dee9e5b Xcode: Don't add framework as -framework argument in linker info list 2020-10-02 22:13:00 +10:00
Gregor Jasny
2092ab08fe xcode: conditionally enable combined install tests
The new Xcode 12 build system does not support recursive
invocation. Therefore lazily triggered builds for the
corresponding platform which run during the `install` target
fail with:

```
error: unable to attach DB: error: accessing build database
```

While looking for a work-around we conditionally disable those
tests.

Issue: #21206
2020-09-25 09:38:30 +02:00
Gregor Jasny
62ce9e16e0 xcode: annotate test output with selected SDK 2020-09-25 09:30:17 +02:00
Brad King
fe258f6382 Tests: Skip RunCMake.XcodeProject device cases for Xcode "new build system"
The Xcode "new build system" selects different architectures for device
builds than the old build system does.  Skip those tests on Xcode 12+
pending further investigation.

Issue: #21206
2020-09-18 13:46:39 -04:00
Brad King
542884e527 Tests: Update RunCMake.XcodeProject cases for Xcode "new build system" 2020-09-18 13:02:20 -04:00
Brad King
8d5f4c4db9 Xcode: Switch to the "new build system" for Xcode 12 and above
Provide an option to switch back to the original build system via
`-T buildsystem=1`.

Fixes: #18088
2020-09-18 13:02:14 -04:00
Brad King
d1688ff300 Tests: Tell Xcode to disallow signing altogether in relevant cases
The Xcode 'new build system' rejects empty signing identities unless
signing is explicitly marked as not allowed.  Update test cases where we
turn off signing to explicitly disallow it too.

Also turn off signing in the XCTest test.
2020-09-01 10:38:22 -04:00
Gusts Kaksis
525464ed2a Xcode: Use "Link Binary With Libraries" build phase in some cases
OBJECT and STATIC libraries (framework or non-framework) do not use
this build phase. Not all items to be linked use this build phase either.

Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2020-09-01 07:38:48 +10:00
Brad King
386bec2d9d Merge topic 'xcode12-link-matching-zlib'
862dbe1367 Xcode: Link matching zlib for iOS Simulator SDK

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5125
2020-08-17 14:52:51 -04:00
Brad King
3313bf06eb Merge topic 'ios-combined-prune-archs'
5852b8867f CMakeIOSInstallCombined: Enforce disjoint architecture sets
79098d23eb Tests: Avoid warnings about unused arguments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5111
2020-08-17 14:52:08 -04:00