1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-21 12:10:05 +08:00

927 Commits

Author SHA1 Message Date
David Geldreich
5cb625eb2f Xcode: Pass compile definitions to Swift
correct Xcode generator Swift definitions
original code was defining GCC_PREPROCESSOR_DEFINITIONS which is valid only for C languages
add definitions to SWIFT_ACTIVE_COMPILATION_CONDITIONS when Swift language is used in the target
add test in SwiftOnly
for old Xcode (<8.0), append defines to cflags so it ends up in OTHER_SWIFT_FLAGS

Fixes: #23637
2022-07-07 15:00:32 +02:00
Ben Boeckel
386465bf83 cmTarget: add support for C++ module fileset types
C++ modules have two variants which are of importance to CMake:

  - `CXX_MODULES`: interface modules (those using `export module M;`,
    `export module M:part;`, or `module M:internal_part;`)
  - `CXX_MODULE_HEADER_UNITS`: importable header units

Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
2022-06-16 10:28:34 -04:00
Ben Boeckel
fffc7813a4 cmGlobalXCodeGenerator: avoid unused parameter warnings 2022-06-14 19:27:30 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Hyper Nova Sun
da4ccb502b Xcode: Check for multiple OSX_ARCHITECTURES on target
When determining a given target's object directory, also check for its
`OSX_ARCHITECTURES` before resorting to global defaults. This fixes inconsistent
object library references when:
- `CMAKE_OSX_ARCHITECTURES` is unset or singular
- but the object library's `OSX_ARCHITECTURES` property is set to multiple archs
2022-04-11 15:02:41 -07:00
Hyper Nova Sun
41ba35a42b cmTarget: Add HasKnownObjectFileLocation() shorthand
Allow `cmGlobalGenerator`s to decide `HasKnownObjectFileLocation()` per given
`cmTarget`

- `cmGlobalGenerator::HasKnownObjectFileLocation()` now takes an optional `cmGeneratorTarget`
- `cmTarget::HasKnownObjectFileLocation()` added as a shorthand
2022-04-11 14:10:29 -07:00
Gregor Jasny
53ca6edd8a xcode: add support for xcconfig files
Fixes: #18420
2022-04-03 22:39:34 +02:00
Brad King
73337cb383 LINK_LIBRARIES: Evaluate separately for linking and usage requirements
We evaluate `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` for two purposes:

* Constructing the link line.
* Collecting usage requirements.

We evaluate `INTERFACE_LINK_LIBRARIES` separately for each purpose in
order to support the `$<LINK_ONLY:...>` generator expression used to
express private link dependencies of a static library.  Previously we
only evaluated `LINK_LIBRARIES` for linking, and used that result for
collecting usage requirements too.  Therefore `$<LINK_ONLY:...>` does
not work in `LINK_LIBRARIES`.

With the introduction of `INTERFACE_LINK_LIBRARIES_DIRECT`, evaluation
of `LINK_LIBRARIES` now needs to distinguish these two cases in order to
honor link dependencies encountered through `$<LINK_ONLY:...>` without
also exposing other usage requirements through private dependencies of a
static library.  Revise internal infrastructure to distinguish the two
cases when evaluating `LINK_LIBRARIES`.  Make the information available
in code paths for `INTERFACE_LINK_LIBRARIES_DIRECT` and `LINK_ONLY`.
Defer actually using the information to later commits.

Issue: #22496
2022-03-22 11:57:48 -04:00
Brad King
de766bc7e0 Xcode: Fix support for source tree symlink inside build tree
Since commit 61495cdaae (Fix Xcode project references to the source
tree, 2009-09-22, v2.8.0~43) we force source file references to use
relative paths from the source tree.  If the source tree path is a
symbolic link inside the build tree, the relative `../` sequence
goes to the wrong place.  The problem with debug breakpoints motivating
that change does not seem to occur in modern Xcode versions, so update
the logic to use a relative path only when it does not need to start
in any `../` sequence.
2022-02-28 10:24:34 -05:00
Marc Chevrier
a2cfa2da4f GenEx/LINK_LIBRARY: Add features for framework support on Apple 2022-02-15 10:53:33 +01:00
Marc Chevrier
40178f3c90 cmGlobalGenerator: Add helper to split framework path
cmComputeLinkInformation and cmGlobalXCodeGenerator now rely on
this method to handle framework paths.
2022-02-13 15:39:14 +01:00
Marc Chevrier
42965799b4 Genex: Add $<LINK_LIBRARY:...>
This generator expression offers the capability, for the link step, to
decorate libraries with prefix/suffix flags and/or adding any specific flag for each
library.

Fixes: #22812, #18751, #20078, #22703
2022-02-08 00:02:32 +01:00
Carsten Rudolph
193b8fca52 cmBuildOptions: Split build arguments into separate object. 2022-01-22 06:35:38 -05:00
Gregor Jasny
7d99cff236 Xcode: Properly identify frameworks with system includes
Check the complete include path for being a system include, not
the derived framework search path. The code for Ninja and Makefile
generators does exactly the same.

Fixes: #23011
2021-12-22 11:38:52 +01:00
NAKAMURA Takumi
c46b041a3b cmLocalGenerator: Simplify Add{Custom,Utility}Command 2021-11-18 12:02:38 -05:00
NAKAMURA Takumi
9b31a97748 cmCustomCommand: Move constructor arguments to individual setters
Make `cmCustomCommand` have just only default constructor.
Use each setter instead.  This follows the builder pattern.

Introduce `cc::SetOutputs(std::string output)`.
This will be used later, as substitution for `cc::SetOutputs({output})`.
2021-11-18 12:02:37 -05:00
NAKAMURA Takumi
67c75064d1 Source: Fix IWYU warnings in Xcode generators 2021-11-16 21:06:13 +09:00
Gusts Kaksis
9e1e7dc7db Xcode: Add embedded plugins option 2021-11-10 09:57:07 -05:00
Sean McBride
1cf14f8c03 Source: fix many -Wmissing-prototypes warnings by marking functions static 2021-10-25 12:27:09 -04:00
Brad King
84673a8243 Merge topic 'xcode-dead-code'
b8a2ce0484 cmGlobalXCodeGenerator: Remove dead buildsystem version check

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !6568
2021-09-29 09:57:00 -04:00
Jake Turner
16ea0e57f7 Xcode: Treat .inl files as C++ header files
Generate the `explicitFileType` as `sourcecode.cpp.h` instead of just
`sourcecode`.  This enables syntax highlighting in Xcode.
2021-09-28 10:49:04 -04:00
Brad King
b8a2ce0484 cmGlobalXCodeGenerator: Remove dead buildsystem version check
In commit 8d5f4c4db9 (Xcode: Switch to the "new build system" for Xcode
12 and above, 2020-09-14, v3.19.0-rc1~143^2~7) we accidentally added
code in an `else` block that under the opposite condition by which
the block can be entered.  Remove it.

Fixes: #22681
2021-09-28 10:42:48 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Lucas SOLTIC
6ef7bfbb64 Xcode: add support for embedding dynamic libraries 2021-09-14 08:39:22 +10:00
Marc Chevrier
f84193292c Use new AddCacheEntry signatures 2021-09-10 15:46:21 +02:00
Marc Chevrier
dc3aa4024e Refactor: Use new SetProperty signatures 2021-08-25 10:09:10 +02:00
Brad King
85ea0a9112 Merge topic 'xcode13-old-buildsystem'
71a2664ebb Xcode: Ignore deprecated build system

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6309
2021-07-07 09:26:35 -04:00
Gregor Jasny
71a2664ebb Xcode: Ignore deprecated build system
With Xcode 13 the key to suppress the check has changed.
Tested with Xcode 12.5 and 13.0-beta2.
2021-07-06 09:29:17 +02:00
Brad King
03bd9c4c10 cmMakefile: Add helper to initialize CMAKE_CONFIGURATION_TYPES
Factor out duplicate code from the Ninja Multi-Config, Visual Studio,
and Xcode generators.
2021-06-30 10:55:40 -04:00
Brad King
8a4ca110e4 cmComputeLinkInformation: Improve type safety of item IsPath member
Use an enum to avoid implicit conversions to bool.
2021-05-29 09:28:35 -04:00
Brad King
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work
directories (e.g. top of the build tree) as the local path.  Add helpers
for each of the common cases to simplify and clarify call sites.
2021-05-13 12:47:25 -04:00
Brad King
f69079577a cmGlobalXCodeGenerator: Simplify relative path conversion under project root 2021-05-12 15:43:58 -04:00
Brad King
ce19e38151 Merge topic 'xcode-inherited-params'
dfaf55fbfd Xcode: add extra '$(inherited)' entries using InheritBuildSettingAttribute.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6077
2021-05-12 07:27:00 -04:00
Josef Angstenberger
fd02f10103
Xcode: Fix typos and spelling in error message 2021-05-07 17:00:18 +02: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
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