1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-23 04:44:05 +08:00

893 Commits

Author SHA1 Message Date
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
Brad King
395e1d458e Merge topic 'xcode_app_extensions'
eb5e33ba47 Xcode: Add support for embedding app extensions
f62a2bf44f Tests: Factor out XcodeProject-Embed check function findAttribute()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5934
2021-04-26 11:34:38 -04:00
Alexander Akhundzhanov
eb5e33ba47 Xcode: Add support for embedding app extensions
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2021-04-22 15:17:02 +10:00
Marc Chevrier
253aff6c94 Xcode: Add support of DEPFILE for add_custom_command, part 2
This MR extend the support of 'DEPFILE' to buildsystem version 1.

Issue: #20286
2021-04-17 11:05:26 +02:00
Marc Chevrier
d67cc4882d Xcode: Add support of DEPFILE for add_custom_command
Issue: #20286
2021-04-15 12:17:31 -04:00
Brad King
b6cc9be009 Merge branch 'backport-xcode-framework-quoting' into xcode-framework-quoting 2021-03-10 10:03:36 -05:00
Brad King
4f9a71974e Xcode: Restore support for spaces in framework names
In commit ce2dee9e5b (Xcode: Don't add framework as -framework argument
in linker info list, 2020-09-28, v3.19.0-rc1~47^2) we split up the path
to a framework into the directory and framework name parts, but only
retained the quoting on the directory part.  Restore quoting of the
framework name.

Fixes: #21910
2021-03-10 10:01:11 -05:00
Brad King
3e7dd39747 cmLocalGenerator: Simplify some GetIncludeFlag call sites
The path style argument is meaningful only with the Ninja generator,
so drop it from call sites in Makefile and Xcode generators.
2021-02-25 13:24:54 -05:00
Brad King
a133a583d4 cmLocalGenerator: Clarify GetIncludeFlags signature
Make the `config` argument non-optional so all callers must be explicit.
Convert the path style argument to an enumeration to make its role clear
at call sites.

The path style argument is implemented by `ConvertToIncludeReference`,
which was introduced with the Ninja generator by commit 5b114c9bee
(Introduce a cmLocalGenerator::ConvertToIncludeReference function,
2011-09-07, v2.8.7~187^2~4).  Its only purpose is to allow the Ninja
generator to use relative paths in `-I` flags.  Add a comment explaining
this role.
2021-02-25 13:24:45 -05:00
Kyle Edwards
f01f10e8fb cmCustomCommand: Record value of CMP0116 at time of creation 2021-02-23 09:14:31 -05:00
Brad King
e8ae5d1c32 Merge topic 'xcode-framework-path'
5389bb4274 Xcode: Don't hard-code SDK-provided implicit framework search paths
df08f8df30 cmComputeLinkInformation: Fix misspelt private variable name
375b307bae Apple: Fix linking to frameworks that do not exist until build time

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5760
2021-02-04 08:18:21 -05:00
Craig Scott
5389bb4274 Xcode: Don't hard-code SDK-provided implicit framework search paths
When a framework is linked to a target by its full path and that
framework is located in one of the implicit framework search directories,
CMake 3.18.5 and earlier discarded that path.
ce2dee9e5ba (Xcode: Don't add framework as -framework argument in
linker info list, 2020-09-28) introduced a regression which resulted in
the framework path always being added to the search path even if it
matched one of the implicit search paths. This broke the ability to do
device and simulator builds from the same configured project.

Fixes: #21678
2021-02-03 23:11:21 +11:00
Hayden
30360cb05f iOS: Fix compilation of CMake itself
There are no ApplicationServices on iOS.
2021-02-02 08:45:11 -05:00
Brad King
38335f275f Merge topic 'xcode-object-ids'
b8b6573db8 Xcode: Use deterministic object ids for script build phases
2892228dc9 cmGlobalXCodeGenerator: Add infrastructure for deterministic object ids
d250b67722 cmGlobalXCodeGenerator: Adopt pbxproj object id generation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5671
2021-01-08 09:07:18 -05:00
Brad King
b8b6573db8 Xcode: Use deterministic object ids for script build phases
The Xcode "new build system" only considers a script build phase up to
date if it has run before, even if outputs are newer than inputs.  Use a
deterministic object id for script build phases associated with custom
commands so that they do not need to re-run after CMake re-generates the
project.

Fixes: #21669
2021-01-06 18:46:30 -05:00
Brad King
2892228dc9 cmGlobalXCodeGenerator: Add infrastructure for deterministic object ids 2021-01-06 16:24:12 -05:00
Brad King
d250b67722 cmGlobalXCodeGenerator: Adopt pbxproj object id generation 2021-01-06 16:21:53 -05: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
Brad King
6b6230b23b cmGlobalXCodeGenerator: Factor out helper to append attribute 2020-12-21 10:19:45 -05:00
Brad King
20e4db4a66 cmGeneratorTarget: Make GetConfigCommonSourceFiles Xcode-specific
The Xcode generator is the only place left that we do not support
per-config sources.  Make the corresponding helper Xcode-specific to
avoid any other new uses.
2020-12-16 14:04:30 -05:00
Andrew Shaitorov
0a60d1b6b4 Allow empty source file list for iOS Sticker packs 2020-12-06 11:31:26 -05:00
Brad King
48aac247e9 Compile with explicit language flag when source LANGUAGE property is set
This change was originally made by commit 74b1c9fc8e (Explicitly specify
language flag when source LANGUAGE property is set, 2020-06-01,
v3.19.0-rc1~722^2), but it was reverted by commit 30aa715fac (Revert
"specify language flag when source LANGUAGE property is set",
2020-11-19) to restore compatibility with pre-3.19 behavior.

Implement the change again, but add policy CMP0119 to make this change
while preserving compatibility with existing projects.

Note that the `Compiler/{Clang,Intel,MSVC}-CXX` modules do not need to
specify `-TP` for their MSVC-like variants because we already use the
flag in `CMAKE_CXX_COMPILE_OBJECT`.  Similarly for `Compiler/XL-CXX`
and `Platform/Windows-Embarcadero`.

Note also that this does not seem possible to implement for XL C.
Even with `-qsourcetype=c`, `xlc` complains about an unknown suffix:
`1501-218 (W) file /.../AltExtC.zzz contains an incorrect file suffix`.
It returns non-zero even with `-qsuppress=1501-218`.

Co-Author: Robert Maynard <robert.maynard@kitware.com>
Fixes: #14516, #20716
2020-12-02 11:39:11 -05:00
Gusts Kaksis
5651901c54 Xcode: add support for embedding frameworks
This commit also prepares for embedding things other than
frameworks. In the future, we may want to embed resources and
other types supported by Xcode, so the target properties have
been documented in a way that clearly signals the future intent.
2020-11-28 15:36:24 +11:00
Brad King
2bca5fa6aa Merge topic 'xcode-cc-work-dir'
36921d2d23 Xcode: Fix custom command work-dir placeholders in "new build system"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5527
2020-11-24 08:41:24 -05:00
Brad King
36921d2d23 Xcode: Fix custom command work-dir placeholders in "new build system"
The placeholders for `CONFIGURATION` and `EFFECTIVE_PLATFORM_NAME` need
to be handled in the `WORKING_DIRECTORY` of custom commands just as we
already do for the `COMMAND`.

Fixes: #21483
2020-11-23 10:24:13 -05:00
Brad King
60a131efd5 Merge topic 'revert-explicit-LANGUAGE-flag'
30aa715fac Revert "specify language flag when source LANGUAGE property is set"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5519
2020-11-20 10:05:11 -05:00
Brad King
30aa715fac Revert "specify language flag when source LANGUAGE property is set"
Revert commit 74b1c9fc8e (Explicitly specify language flag when source
LANGUAGE property is set, 2020-06-01, v3.19.0-rc1~722^2) and the lookup
tables from its two immediate ancestors.  The purpose of that change was
to convert an explicit `LANGUAGE` source file property into an explicit
language specification compiler flag like `-x c`.  This seems reasonable
since the property is documented as meaning "indicate what programming
language the source file is".  It is also needed to help compilers deal
with non-standard source file extensions they don't recognize.

However, some projects have been setting `LANGUAGE C` on `.S` assembler
source files to mean "use the C compiler".  Passing `-x c` for them
breaks the build because the `.S` sources are not written in C.  These
projects should be updated to use `enable_language(ASM)`, for which
CMake often chooses the C compiler as the assembler when using
toolchains that support it (which would have to be the case for projects
using the approach).

Revert the change for now to preserve the old behavior for such projects.
We can re-introduce it with a policy in a future version of CMake.

Fixes: #21469
Issue: #14516, #20716
2020-11-19 17:06:03 -05:00
Craig Scott
67ebcfbcbb Merge topic 'xcode-clean-lib-paths'
b1ef2fffe7 Xcode: Clean library paths to avoid linker duplicate symbol definitions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5511
2020-11-16 14:23:52 -05:00
Gusts Kaksis
b1ef2fffe7 Xcode: Clean library paths to avoid linker duplicate symbol definitions 2020-11-16 07:14:57 +11:00
Brad King
b2552d50da Merge topic 'xcode-inherit-paths'
bffb17be3d Xcode: Inherit target library and framework search paths from project

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5463
2020-11-06 07:43:03 -05:00
Gusts Kaksis
bffb17be3d Xcode: Inherit target library and framework search paths from project
Xcode has multiple levels of build settings with priority in descending
order:

1. Target
2. Project
3. Workspace
4. SDK defaults

`CMAKE_XCODE_ATTRIBUTE_*` path variables add these to project level, but
linked frameworks and libraries override this in target level.  Add the
`$(inherited)` macro to keep both in the final list.

Fixes: #21387
2020-11-05 13:48:54 +02:00
Brad King
9b4016a61a Merge topic 'xcode_build_jobs'
e794509faa XCode: Use -j build option when job capacity is specified by user

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5429
2020-10-28 07:38:07 -04:00
Gusts Kaksis
5dc23300b1 Xcode: Fix regression that automatically links libraries in source list
In commit e637744c51 (Xcode: Use "Link Binary With Libraries" to link
any library, 2019-07-10, v3.19.0-rc1~494^2~1) we accidentally added all
the library type files to "Link Binary With Libraries" build phase if
they were passed in as source files.  Revert that change as any actually
linked libraries will be added to that build phase later in the
`AddDependAndLinkInformation` call.

Fixes: #21361
2020-10-27 07:12:26 -04:00
Fred Baksik
e794509faa XCode: Use -j build option when job capacity is specified by user
Fixes: #18304
2020-10-26 13:28:54 -04:00
Kyle Edwards
5a36542086 Refactor: Add allowArch parameter to cmake::CreateGlobalGenerator() 2020-10-05 09:49:59 -04:00
Gusts Kaksis
ce2dee9e5b Xcode: Don't add framework as -framework argument in linker info list 2020-10-02 22:13:00 +10:00
Brad King
2e8b85b040 Merge topic 'macos-arm64'
b6c60f14b6 macOS: Default to arm64 architecture on Apple Silicon hosts
383e81aa60 Tests: Teach RunCMake to ignore Xcode internal objc warnings
8f75912176 Tests: Enable Assembler test case when CMAKE_OSX_ARCHITECTURES has one value

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5291
2020-10-01 08:45:13 -04:00
Brad King
b6c60f14b6 macOS: Default to arm64 architecture on Apple Silicon hosts
Detect `arm64` hardware using a method that pierces Rosetta.  If
`CMAKE_OSX_ARCHITECTURES` is not set, pass explicit flags to the
toolchain to use `arm64` instead of letting the toolchain pick.

Fixes: #20989
2020-09-30 11:58:44 -04:00
vvs31415
d298ae7470 cmake::GetCacheDefinition: Return cmProp 2020-09-28 09:32:22 -07:00
Brad King
0a67c3ebe1 Xcode: Remove dependency Makefile hacks under the "new build system"
The original Xcode build system did not properly re-link targets that consumed
object libraies.  We worked around that with a post-build command on the object
libraries themselves that removed their consumers if out of date.  The "new
build system" does not appear to need such help, so drop the workaround.
2020-09-24 14:53:28 -04:00
Brad King
c6c7f6fbeb Xcode: Remove remnants of ancient XCODE_DEPEND_HELPER utility target
The target has not been generated since commit d92d51429e (BUG: fix for bug
6193, fix xcode depend helper, 2008-01-10, v2.6.0~553).  Remove it from
the list of special targets.
2020-09-24 14:53:22 -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
2db623f554 Xcode: Add option to specify build system variant
Extend the `-T <toolset>` option to support a `buildsystem=` field with
the Xcode generator.  Add a `CMAKE_XCODE_BUILD_SYSTEM` variable to
inform project code about the selected build system variant.
2020-09-18 12:49:17 -04:00
Brad King
3ab18c870d Xcode: Factor out build phase variable declarations 2020-09-18 12:49:17 -04:00
Brad King
0d03717996 Xcode: Clarify name of legacy run script build phase helper 2020-09-18 12:49:17 -04:00
Brad King
c4e296a609 cmGlobalGenerator: Compute a global target ordering respecting dependencies
Move this up from `cmGlobalXCodeGenerator`.  It will be useful for all
generators.
2020-09-04 09:31:06 -04:00
Brad King
ca5babfd7a Merge topic 'getdef'
11425041f0 cmMakefile::GetDefinition: return cmProp

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5179
2020-09-03 09:18:05 -04:00
Vitaly Stakhovsky
11425041f0 cmMakefile::GetDefinition: return cmProp 2020-09-02 07:27:32 -04:00
Brad King
e33f8f078a Xcode: Avoid unnecessary duplication of custom commands across targets
Do not attach a custom command to a target if it is already attached to one of
the target's dependencies.  The command's output will be available by the time
the target needs it because the dependency containing the command will have
already been built.

Since commit fb45559e09 (Xcode: Process targets in depth-first order during
generation, 2018-07-19, v3.13.0-rc1~293^2) we generate a target only after
generating its dependencies.  Therefore when visiting the custom commands in a
target, we can assume that custom commands in its dependencies have already
been visited.
2020-09-01 14:05:57 -04:00
Brad King
8c60c49ae2 Xcode: Refactor custom command dependency expansion
Compute and store the "real" dependencies earlier.
2020-09-01 14:05:47 -04:00