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

845 Commits

Author SHA1 Message Date
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
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
Gusts Kaksis
dc0898205c Xcode: Add special case for file type extension map for .xcassets 2020-08-28 21:20:38 +03:00
Gusts Kaksis
7b3d8411a2 Xcode: Refactor build setting append code and attribute getter naming
Support both STRING and OBJECT_LIST types in build setting attributes and make it possible to mix them
2020-08-28 21:20:38 +03:00
Brad King
4391913133 Add INTERFACE libraries to generated buildsystem if they have SOURCES
INTERFACE libraries were created with the intention of collecting usage
requirements for use by other targets via `target_link_libraries`.
Therefore they were not allowed to have SOURCES and were not included in
the generated buildsystem.  In practice, this has become limiting:

* Header-only libraries do have sources, they just do not compile.
  Developers should be able to edit those sources (the header files)
  in their IDE.

* Header-only libraries may need to generate some of their header
  files via custom commands.

Some projects work around these limitations by pairing each interface
library with an `add_custom_target` that makes the header files and
custom commands appear in the generated buildsystem and in IDEs.

Lift such limitations by allowing INTERFACE libraries to have SOURCES.
For those with sources, add a corresponding build target to the
generated buildsystem.

Fixes: #19145
2020-08-07 08:46:32 -04:00
Vitaly Stakhovsky
f37c14e930 Source: use cmNonempty() 2020-07-28 08:31:31 -04:00
Brad King
261a2585d9 Merge topic 'cleanup-target-types'
ef796cc743 cmGeneratorTarget: Skip computing link implementation for custom targets
45158b2afe cmGeneratorTarget: Simplify logic in ComputeLinkInterfaceLibraries
d6b1f5704e cmGeneratorTarget: Add missing nullptr checks
7695b67500 cmComputeTargetDepends: Add missing nullptr check
95b5df8646 cmGeneratorTarget: Skip computing languages for custom targets
2f0790df50 Factor out generator checks for filtering on non-compiling targets
422d9a0ab2 Factor out generator checks for filtering out interface libraries
bce82df0aa cmGeneratorTarget: Remove unnecessary target type check in dependency tracing
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !5038
2020-07-28 08:26:23 -04:00
Brad King
e0002c3e54 Merge topic 'xcode-12-legacy-deprecation'
36fc3a1e84 Xcode: Suppress legacy build system deprecation warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5052
2020-07-27 10:45:15 -04:00
Brad King
422d9a0ab2 Factor out generator checks for filtering out interface libraries
Add a `cmGeneratorTarget::IsInBuildSystem` helper method to tell
generators whether a target should participate in the generated build
system.
2020-07-23 13:31:44 -04:00
Brad King
36fc3a1e84 Xcode: Suppress legacy build system deprecation warning
Xcode 12 beta 3 now warns about using the legacy build system.
Since generation of the build system is CMake's responsibility,
the warning is not relevant to our users.  Suppress it.

Issue: #18088
2020-07-23 13:00:42 -04:00
Craig Scott
8abeec58f3 Merge topic 'xcode-native-arch'
26673bf480 Xcode: Explicitly specify default native architecture on macOS
ce624cfbd4 cmGlobalXCodeGenerator: Save CMAKE_SYSTEM_NAME in member

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5023
2020-07-21 07:19:02 -04:00
Brad King
26673bf480 Xcode: Explicitly specify default native architecture on macOS
When `CMAKE_OSX_ARCHITECTURES` is not specified, we add the Xcode
setting `ONLY_ACTIVE_ARCH = YES` with the intention of targeting the
native architecture of the host.  However, the default `ARCHS` value
chosen by "Xcode 12 Universal Apps" includes multiple architectures.
Add an explicit `ARCHS` setting with value `$(NATIVE_ARCH_ACTUAL)`
to tell Xcode to use the host's native architecture only.

Fixes: #20893
2020-07-20 10:03:15 -04:00
Brad King
ce624cfbd4 cmGlobalXCodeGenerator: Save CMAKE_SYSTEM_NAME in member 2020-07-16 14:17:47 -04:00
Brad King
d3a64c4e3f Xcode: Explicitly turn off signing in try_compile projects
Fixes: #18407, #20571, #20688
2020-07-16 10:42:39 -04:00
Gusts Kaksis
3603ca8e86 Xcode: Special treatment for directly linked framework binaries
Always refer to framework directory instead of binary directly.
2020-07-14 08:08:45 -04:00
Gusts Kaksis
e637744c51 Xcode: Use "Link Binary With Libraries" to link any library
Add external libraries as fileRefs to Xcode project and add those
references to Link Binary With Libraries build phase.  This allows
linking .a, .o, .dylib, .framework and .tbd libraries through "Link
Binary With Libraries" build phase, as opposed to `OTHER_LINKER_FLAGS`.

This improves on the approach added by commit 58c05e1c73 (Xcode: Use
"Link Binary With Libraries" build phase when possible, 2020-06-12).
2020-07-14 08:07:55 -04:00
Brad King
a4cfc7d03c Merge topic 'refactor-generator-configs'
7a969fe21d cmMakefile: Refactor API to better handle empty config values

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4957
2020-07-06 09:28:11 -04:00
Robert Maynard
7a969fe21d cmMakefile: Refactor API to better handle empty config values 2020-07-03 07:43:18 -04:00
Harry Mallon
258c8734a9 Xcode: Fix LANGUAGE property on .m/.mm files
When OBJC or OBJCXX is enabled as a language, prefer that for .m and .mm
source file language selection.

Fixes: #20257
2020-07-03 07:30:50 -04:00
Gusts Kaksis
58c05e1c73 Xcode: Use "Link Binary With Libraries" build phase when possible
Try linking all target linked libraries through frameworks build phase
instead of linker flags, thus letting Xcode manage build product paths
correctly.  Prevent adding duplicate entries to "Link Binary With
Libraries" build phase.

Add check for configuration-dependent linking - in case the library is
not present in all configurations revert back to linker flags which are
per-configuration.

This does change the order of libraries linked, but that does not seem
to matter for Apple linkers invoked by Xcode, even for static libraries.
The linker will go back and re-consider a static library from earlier
on the link line when more symbols from its objects are needed.

Fixes: #14185
2020-06-17 06:35:25 -04:00
Gusts Kaksis
927373b678 Xcode: Refactor generator variable names and types
* Instead of `classes` use name `commonSourceFiles`.
* No need for reference when you have pointer.
2020-06-15 11:20:32 -04:00
Robert Maynard
74b1c9fc8e Explicitly specify language flag when source LANGUAGE property is set
Fixes: #14516, #20716
2020-06-09 19:41:20 -04:00
Vitaly Stakhovsky
7ed8c9ebe3 cmMakefile: add GetDefExpandList() that splits value into std::vector
Combines cmMakefile:GetDefinition() and cmExpandList()
2020-05-30 08:59:20 -04:00
Vitaly Stakhovsky
53675adbcf GetSafeProperty: return std::string const& 2020-04-30 10:27:16 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Vitaly Stakhovsky
4fd28b9911 cmOutputConverter::GetFortranFormat(): delete const char* overload 2020-04-27 07:38:47 -04:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Brad King
156196938c Merge topic 'cmprop-source'
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp
fc223f9860 cmGlobalXCodeGenerator: Fix genex interpreter overloads

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4603
2020-04-15 09:49:46 -04:00
Brad King
a67565751f Merge topic 'msbuildUtf8Support'
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4587
2020-04-15 09:44:48 -04:00
Vitaly Stakhovsky
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp 2020-04-14 10:57:17 -04:00
Brad King
fc223f9860 cmGlobalXCodeGenerator: Fix genex interpreter overloads
Overload both signatures to add Xcode-specific functionality.

Co-Author: Vitaly Stakhovsky <vvs31415@gitlab.org>
2020-04-14 10:56:45 -04:00
Justin Goshi
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding
Adds a flag to indicate that pipe output from a custom command should be
interpreted as UTF-8 encoded. This change does not introduce a public
way to set the flag, but generators that create internally-generated
commands know if they are calling cmake, which uses UTF-8 pipes.

MSBuild added support for interpreting output of PreBuildEvent,
PreLinkEvent, PostBuildEvent, and CustomBuildStep as UTF-8. This change
will appear in Visual Studio 16.6 Preview 3. It is opt-in, and you need
to add the StdOutEncoding tag. MSBuild treats these as property bags so
if we emit the tag for earlier versions of Visual Studio it would be
safely ignored. This change emits the StdOutEncoding tag and sets it to
UTF-8 whenever the custom command UTF-8 pipe flag is set. This fixes
globalization issues when the output from cmake contained characters
that required MSBuild to interpret as UTF-8 before displaying them.
2020-04-13 12:54:47 -07:00
Brad King
dc0dc974a9 Xcode: Fix quoting of paths with square brackets
The Xcode project file format needs paths containing square
brackets ('[' or ']') to be quoted.

Issue: #20555
2020-04-10 09:37:18 -04:00
Brad King
25a920e827 cmLocalGenerator: Convert GetStaticLibraryFlags to take original-case config
Move upper-case conversion of the configuration into the implementation.
2020-04-01 10:55:59 -04:00
Brad King
a6611577c3 Merge topic 'cmprop-getglobalprop'
c84cf42897 cmState::GetGlobalProperty: return cmProp

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4521
2020-03-27 07:50:28 -04:00
Vitaly Stakhovsky
c84cf42897 cmState::GetGlobalProperty: return cmProp 2020-03-25 09:10:46 -04:00
Rolf Eike Beer
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix() 2020-03-23 22:41:43 +01:00
Craig Scott
54863e28ce Merge topic 'rename-macho-version-properties'
14732d3f30 macOS: Rename OSX_*_VERSION properties to MACHO_*_VERSION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4452
2020-03-12 06:52:11 -04:00
Brad King
14732d3f30 macOS: Rename OSX_*_VERSION properties to MACHO_*_VERSION
The properties added by commit 4a62e3d97c (macOS: Add
OSX_COMPATIBILITY_VERSION and OSX_CURRENT_VERSION properties,
2020-01-24, v3.17.0-rc1~80^2~1) are general-purpose for all platforms
using Mach-O formats and not just on OS X.  Rename them accordingly.
The properties are new to the CMake 3.17 release so we can rename
them without compatibility concerns.

Fixes: #20442
2020-03-12 21:15:40 +11:00
Vitaly Stakhovsky
b0dc52704b cmGeneratorExpression: remove const char* overloads 2020-03-08 17:22:43 -04:00
Marc Chevrier
9de0355d4f Modernize memory management
Update internals of various classes.
2020-03-05 07:34:01 -05:00
Kyle Edwards
7abc3d61ac Ninja Multi-Config: Fix issue with framework dependencies and Autogen
Fixes: #20345
2020-02-17 08:24:57 -05:00
Brad King
8752c1bd64 Merge branch 'backport-3.16-link-line-backtrace' 2020-02-10 16:17:03 -05:00
Brad King
e756328434 Propagate backtraces from LINK_LIBRARIES through to link line items
Since commit d4d0dd0f6a (cmLinkLineComputer: Add ComputeLinkLibs
overload with backtraces, 2019-09-13, v3.16.0-rc1~87^2~4), backtraces
have been collected by `ComputeLinkLibs` by looking back through the
link implementation libraries for one matching the text of the link line
item.  This is slow in projects with long link lines.

Instead, teach `cmComputeLinkDepends` and `cmComputeLinkInformation` to
carry backtrace information explicitly along with the text of each item.

Fixes: #20322
2020-02-10 16:11:38 -05:00
Brad King
7706b6a714 Merge topic 'xcode-top-level-only-with-object-library'
64304fe72b Xcode: Fix post build script for 'top level project only' opt

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4284
2020-01-28 11:05:17 -05:00
Yauheni Khnykin
64304fe72b Xcode: Fix post build script for 'top level project only' opt
When CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY is set on
Xcode generator created post build scripts which tried to call
XCODE_DEPEND_HELPER.make script in subproject.
But XCODE_DEPEND_HELPER.make don't exist in
subprojects when mentioned option is set on.

Fixes: #20262
2020-01-27 16:14:19 -05:00
Isuru Fernando
4a62e3d97c macOS: Add OSX_COMPATIBILITY_VERSION and OSX_CURRENT_VERSION properties
Fixes: #17652
2020-01-24 14:13:41 -05:00
Brad King
b7b8331d68 Xcode: Drop hard-coded default warning flags like -Wmost
The `-Wmost` flag was added by commit 97a51d2172 (ENH: add more xcode
stuff, 2005-01-27, v2.4.0~2396), along with a couple others, as part of
very early work on the Xcode generator.  I suspect that the flags were
part of Xcode's project creation wizard.  However, they are not
appropriate for CMake-based projects because we already have our own
mechanisms for specifying flags desired by the project or user.
Simply drop the flags.

Fixes: #13516
2020-01-13 11:45:23 -05:00
Marc Chevrier
a00960288b GlobalGenerator family: modernize memory management 2020-01-07 11:03:11 +01:00