1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-20 19:55:10 +08:00

969 Commits

Author SHA1 Message Date
Brad King
4e39c25fce Merge topic 'xcode-revert-header-map'
841272eb35 Xcode: Restore suppression of header maps

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8218
2023-02-20 08:32:11 -05:00
Brad King
841272eb35 Xcode: Restore suppression of header maps
In commit 8527f42b96 (Xcode: Explicitly disable deprecated user include
path feature, 2023-01-31, v3.26.0-rc1~7^2) we dropped the Xcode build
setting `USE_HEADERMAP = NO` because Xcode 14's "Build Documentation"
feature (`xcodebuild RUN_DOCUMENTATION_COMPILER=YES`) fails in some
cases without header maps.  However, enabling header maps causes Xcode
to add `-iquote .../foo.hmap` and `-I .../bar.hmap` flags that can
change the intended header file search order based on the contents of
the header maps.  This can break existing projects.  Restore the
`USE_HEADERMAP = NO` setting to fix the header file search order.

Further investigation will be needed to resolve the problematic cases
with the Xcode 14 "Build Documentation" feature.  Meanwhile projects
encountering such cases can set the `XCODE_ATTRIBUTE_USE_HEADERMAP`
target property to `YES` themselves.

Fixes: #24418
Issue: #24379
2023-02-17 18:02:45 -05:00
Kyle Edwards
480b363724 cmCustomCommand: Refactor custom command-specific policy values
Many custom commands are created by CMake itself rather than by
the user. These custom commands should always have their policies
set to NEW, and user-created custom commands should have their
policy values set only from the state snapshot. In addition, we
want to genericize the mechanism of recording a policy at the time
of custom command creation.

Add a CM_FOR_EACH_CUSTOM_COMMAND_POLICY macro to genericize
custom command policies. Use this to define all custom command
policies. Make all such policies NEW instead of WARN by default.
Remove individual policy modifier methods and add a single method
that records relevant values from a cmStateSnapshot. Remove the
no longer needed explicit policy settings from synthesized custom
commands.
2023-02-06 15:04:16 -05:00
Brad King
8527f42b96 Xcode: Explicitly disable deprecated user include path feature
The `ALWAYS_SEARCH_USER_PATHS` feature is documented [1] to search the
paths in `USER_HEADER_SEARCH_PATHS` before `HEADER_SEARCH_PATHS`.  The
behavior has been long discouraged and was deprecated by Xcode 8.3.
Furthermore, Xcode explicitly disables this setting when creating new
projects.  We can do that too since we do not generate any user header
search paths anyway.

Previously we always set `USE_HEADERMAP` to `NO` to prevent Xcode's
warning about an ancient "header map" feature deprecation.  However,
this somehow breaks Xcode 14's "Build Documentation" feature.  Setting
`ALWAYS_SEARCH_USER_PATHS` to `NO` seems to prevent the header map
warning too, so drop `USE_HEADERMAP` to fix the documentation feature.

[1] https://developer.apple.com/documentation/xcode/build-settings-reference

Fixes: #24379
2023-01-31 14:21:20 -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
Pierre Testart
a525f5f1bf cmGeneratorTarget: Cache full name components
Cache the result of cmGeneratorTarget::GetFullNameInternalComponents
to improve performance.
2023-01-18 09:12:17 -05:00
Brad King
84c2518a7b Merge topic 'COMPILE_DEFINITIONS-property-cleanup'
7480fa0a5f COMPILE_DEFINITIONS property: ensure leading -D is removed in all cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8004
2022-12-14 09:03:08 -05:00
Marc Chevrier
7480fa0a5f COMPILE_DEFINITIONS property: ensure leading -D is removed in all cases
Fixes: #24186
2022-12-13 16:54:56 +01:00
Rose
6d15754814 Make vector operations more efficient 2022-12-10 12:48:09 -05:00
Brad King
7c462e36c9 Merge topic 'XCode-XCODE_LINK_BUILD_PHASE_MODE-and-LINK_LIBRARY-genex'
61075d2d7b XCode: ensure LINK_LIBRARY genex is usable with XCODE_LINK_BUILD_PHASE_MODE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7947
2022-11-23 07:08:01 -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
62172b4ab7 Merge topic 'custom-command-comment-genex'
26d813092b add_custom_{command,target}: add genex support for COMMENT
60a5a39022 cmCustomCommandGenerator: refactor GetComment to return std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7887
2022-11-22 09:47:59 -05:00
Peter Würth
60a5a39022 cmCustomCommandGenerator: refactor GetComment to return std::string
Refactoring was done because EvaluateComment leaked memory.
2022-11-19 13:32:56 +01:00
Russell Greene
b99c386122 Xcode: Allow bundling extensionkit extensions
Fixes: #24150
2022-11-18 13:58:03 -06:00
Alex Turbov
6e3e8827fa Refactor: cmGlobalGeneratorFactory::GetDocumentation returns entry
Before, a documentation entry was in/out parameter.
Now it's a normal return value.

This also makes possible to eliminate defaulted default ctor
for `cmDocumentationEntry` for C++ 11.

Also, simplify `cmake::AppendGlobalGeneratorsDocumentation()`.
2022-11-17 16:37:13 +04:00
Brad King
55ef776a62 Merge topic 'xcode-swift-include-dirs'
cb4e6702b2 Xcode: Implement Swift include directories
e1ccab12d7 Xcode: Restore Swift framework search directories

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7858
2022-11-03 08:14:15 -04:00
Brad King
cb4e6702b2 Xcode: Implement Swift include directories
Populate Xcode's `SWIFT_INCLUDE_PATHS` build setting with the
target-wide include directories.

Issue: #24116
2022-11-02 17:03:21 -04:00
Brad King
e1ccab12d7 Xcode: Restore Swift framework search directories
Previously we selected a single "language for preprocessor" with which
to compute both target-wide `GCC_PREPROCESSOR_DEFINITIONS` and
`{HEADER,FRAMEWORK}_SEARCH_PATHS`.  Since commit c0dd3dd2c1 (Xcode:
Evaluate Swift compile definitions separately, 2022-10-25,
v3.25.0-rc3~16^2) we never compute `GCC_PREPROCESSOR_DEFINITIONS` for
Swift.  Therefore we need to select the language for target-wide include
and framework directories separately.

Fixes: #24116
2022-11-02 16:57:36 -04:00
Brad King
5752150c64 Merge topic 'xcode-obj-dir'
024e3d2bf6 Xcode: Put object files in a place that Xcode cleans

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7843
2022-10-31 09:42:29 -04: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
2bc177b002 Merge topic 'xcode-restore-install-path'
8d5631f0d0 Xcode: Revert "Don't set INSTALL_PATH unless target is SHARED_LIBRARY"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7839
2022-10-28 09:52:37 -04:00
Brad King
8d5631f0d0 Xcode: Revert "Don't set INSTALL_PATH unless target is SHARED_LIBRARY"
The change in commit 61acaa12af (xcode: Don't set INSTALL_PATH unless
target is SHARED_LIBRARY, 2022-07-14, v3.25.0-rc1~291^2) breaks some
existing use cases.  Revert it pending further investigation.

Fixes: #24087
Issue: #15183
2022-10-27 10:28:39 -04:00
Brad King
ca80e8bdf6 Merge topic 'xcode-swift-defs'
c0dd3dd2c1 Xcode: Evaluate Swift compile definitions separately

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7826
2022-10-27 09:42:03 -04:00
Brad King
c0dd3dd2c1 Xcode: Evaluate Swift compile definitions separately
Xcode has a separate setting for Swift compile definitions, so we can
compute a dedicated value for it.  Therefore we can:

* Support the COMPILE_LANGUAGE generator expression for Swift-specific
  filters.

* Avoid passing the `=value` part of definitions, which Swift does
  not support.

This revises commit 5cb625eb2f (Xcode: Pass compile definitions to
Swift, 2022-06-19, v3.25.0-rc1~493^2) and reverts commit 12c6fec6b4
(Xcode: Drop CMAKE_INTDIR= definition in Swift targets, 2022-09-30,
v3.25.0-rc1~60^2~2), as the latter is no longer needed.

Fixes: #24086
2022-10-25 14:09:28 -04:00
Brad King
6e89585d95 Merge topic 'swift-default-flags'
238e0f25b2 Xcode: Set WMO on non-debug build configurations
6063428de7 Swift: Update default build flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7741
2022-10-17 10:05:04 -04:00
Evan Wilde
238e0f25b2 Xcode: Set WMO on non-debug build configurations
This patch sets the swift compilation mode to wholemodule in the xcode
generator for all non-debug build configurations at the project level.

Leaving the target build-configurations default ensures that this
default can be overridden easily by editing either the project
configuration from the build settings editor or the per-target
configuration.

When set on versions of Xcode that do not recognize the
`SWIFT_COMPILATION_MODE` setting, Xcode will include the option as a
user-defined setting, but otherwise ignore it.
2022-10-14 09:23:47 -04:00
Marc Chevrier
4aa86da827 Xcode: ensure framework with custom output directory can be consumed
Fixes: #24046
2022-10-14 09:13:37 -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
12c6fec6b4 Xcode: Drop CMAKE_INTDIR= definition in Swift targets
Xcode 14.0 warns that Swift doesn't support definition values.
Therefore `CMAKE_INTDIR` is not useful to Swift sources.  Drop it.
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
Brad King
dc5fc898f6 Xcode: Set object file locations using TARGET_TEMP_DIR
This avoids relying on `SYMROOT` to locate the object files.

Issue: #22550
2022-09-29 15:04:07 -04:00
Brad King
a7fb4bc475 Xcode: Set build product locations using CONFIGURATION_BUILD_DIR
Since commit 59a2265576 (Xcode: Use EFFECTIVE_PLATFORM_NAME reference in
ComputeOutputDir, 2011-08-12, v2.8.6~43^2~1) we can now set the build
products path using `CONFIGURATION_BUILD_DIR` unconditionally because we
compute the correct value even when using `EFFECTIVE_PLATFORM_NAME`.
This avoids relying on `SYMROOT` to locate the build products.

Issue: #22550
2022-09-29 15:03:37 -04:00
Brad King
6883b82124 cmGlobalXCodeGenerator: Remove unused local variable settings 2022-09-29 14:26:51 -04:00
Marc Chevrier
0bd3efffbc Genex LINK_LIBRARY: Add support for framework with postfix 2022-09-21 16:14:36 +02:00
Brad King
ed8e860998 Merge topic 'xcode-lib-dirs'
d4cc39842e Xcode: Do not append per-config suffixes to library search paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7672
2022-09-16 10:25:14 -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
2b91a96633 Merge topic 'link-framework-with-multi-config-postfix'
fc06450ff4 Apple: Fix regression when linking a framework with postfix

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7675
2022-09-15 09:04:49 -04:00
Marc Chevrier
fc06450ff4 Apple: Fix regression when linking a framework with postfix
Fix a regression caused by commit 40178f3c90 (cmGlobalGenerator: Add
helper to split framework path, 2022-02-10, v3.24.0-rc1~661^2~1).

Fixes: #23961
2022-09-14 14:55:27 -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
Tor Arne Vestbø
61acaa12af xcode: Don't set INSTALL_PATH unless target is SHARED_LIBRARY
An empty INSTALL_PATH will confuse Xcode, resulting in the archive
action producing archives that can not be uploaded to the App Store.

The logic to pull out a install_name_dir only applies to
SHARED_LIBRARY targets, so we can skip the setting of the
property for all other targets.

There might be cases where the INSTALL_PATH code path will also
end up setting an empty INSTALL_PATH, but it's unclear whether
this is a problem, so to keep the patch minimal the existing
code is left as is.

Fixes: #15183
2022-08-16 13:35:36 -04:00
Robert Maynard
96bc59b1ca CUDA: Add Device LTO support for nvcc
Fixes #22200
2022-07-22 10:34:45 -04:00
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