Commit Graph

539 Commits

Author SHA1 Message Date
Stephen Kelly 12cb3bdce4 cmLocalGenerator: Add Home directory accessors.
Reduce reasons for cmLocalGenerator to have a cmMakefile.
2015-10-09 00:00:19 +02:00
Stephen Kelly 4ab2750c54 cmLocalGenerator: Add GetProjectName method. 2015-10-09 00:00:18 +02:00
Stephen Kelly af71c7b479 cmTarget: Remove Compute method. 2015-10-07 20:17:55 +02:00
Stephen Kelly 776ff8eb0b cmTarget: Add Compute API for sources.
This method is a refactoring artifact.  It will be removed in a
follow-up.
2015-10-07 08:37:57 +02:00
Stephen Kelly c38e30f68c cmGeneratorTarget: Add methods for generate-time source addition. 2015-10-07 08:37:57 +02:00
Stephen Kelly 156bd2c983 Xcode: Port away from unnecessary CMP0049 compatibility.
The input does not need the conversion.
2015-10-06 20:16:21 +02:00
Stephen Kelly 4407eee013 cmGlobalGenerator: Call AddExtraIDETargets as a hook of Compute().
Relieve the Xcode generator of having to reimplement Compute().
2015-10-05 18:43:17 +02:00
Stephen Kelly a09c545d3a Xcode: Extract a AddExtraIDETargets method. 2015-10-05 18:43:17 +02:00
Stephen Kelly ff8ac8ee6a cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
2015-08-28 18:44:39 +02:00
Stephen Kelly 9b6a743b80 cmLocalGenerator: Remove Parent pointer. 2015-08-28 18:44:38 +02:00
Stephen Kelly c2b7336ff3 cmGeneratorTarget: Move GetConfigCommonSourceFiles from cmTarget. 2015-08-26 19:46:33 +02:00
Stephen Kelly 69329fff70 cmGeneratorTarget: Move GetLanguages from cmTarget. 2015-08-26 19:46:32 +02:00
Stephen Kelly d4a24c0e95 cmGeneratorTarget: Move GetLinkImplementation from cmTarget. 2015-08-26 19:46:32 +02:00
Stephen Kelly 3846ebcf2b cmLinkItem: Add cmLinkImplementation type. 2015-08-26 19:46:31 +02:00
Stephen Kelly a7f5d70dde cmGeneratorTarget: Move compile defintions processing from cmTarget. 2015-08-26 19:46:30 +02:00
Stephen Kelly 44ffb9cdb4 Replace foo.size() pattern with !foo.empty(). 2015-08-24 20:47:18 +02:00
Stephen Kelly 1f54bc1cf3 cmTarget: Split storage of include directories from genexes. 2015-08-07 17:06:15 +02:00
Stephen Kelly 7c809fa2a6 cmGeneratorTarget: Move GetLinkerLanguage from cmTarget. 2015-08-05 18:20:48 +02:00
Stephen Kelly d6bb319b09 cmGeneratorTarget: Move GetFullName from cmTarget.
Bring GetFullNameInternal with it.
2015-08-05 18:20:48 +02:00
Stephen Kelly d560bfd273 cmGeneratorTarget: Move GetInstallNameDir* from cmTarget. 2015-08-05 18:20:47 +02:00
Stephen Kelly 62720e44be cmGeneratorTarget: Move GetFullNameComponents from cmTarget. 2015-08-05 18:20:47 +02:00
Stephen Kelly f0aa660772 cmGeneratorTarget: Move HasSOName from cmTarget. 2015-08-05 18:20:46 +02:00
Stephen Kelly 803a7982b4 cmGeneratorTarget: Move GetLinkInformation from cmTarget 2015-08-05 18:20:44 +02:00
Stephen Kelly 41abdc17df cmGeneratorTarget: Move GetSOName from cmTarget.. 2015-08-05 18:20:43 +02:00
Stephen Kelly 5edb335485 cmGlobalGenerator: Virtualize the Compute step and override it. 2015-07-30 08:28:31 +02:00
Stephen Kelly ff1019bfac cmGlobalGenerator: Move generation object creation to Compute(). 2015-07-30 08:28:30 +02:00
Stephen Kelly aa2407d84d Xcode: Use allBuild target return value. 2015-07-29 10:43:34 -04:00
Stephen Kelly 32e4f6beca Xcode: Skip Global targets when processing. 2015-07-29 10:43:32 -04:00
Stephen Kelly ec38e4c84f Move GetFullPath to cmGeneratorTarget 2015-07-27 21:59:02 +02:00
Stephen Kelly d568eefe10 cmCustomCommandGenerator: Require cmLocalGenerator in API. 2015-07-27 20:09:38 +02:00
Brad King bf11253163 Add rudimentary support for the Apple Swift language with Xcode
Allow the `Swift` language to be enabled with the Xcode generator for
Xcode >= 6.1.  Reject it on other generators and with older Xcode
versions.  Since Apple is the only vendor implementing the language
right now, the compiler id can be just `Apple`.
2015-07-06 16:15:49 -04:00
Stephen Kelly faec4e611d cmComputeTargetDepends: Change API to use cmGeneratorTarget. 2015-07-01 19:46:19 +02:00
Stephen Kelly 1335992c8f Remove CMAKE_USE_RELATIVE_PATHS variable.
The test for this variable was removed in commit v2.8.8~330^2~7 (complex:
Remove ancient unused ComplexRelativePaths test, 2011-12-23).

Commit v3.1.0-rc1~425^2~2 (backtrace: Convert to local paths in
IssueMessage, 2014-03-12) appears to have accidentally made some backtraces
print relative paths with the variable because conversions which used to be
done at configure time, before the variable had an effect are now potentially
done at generate time.

The documentation of the variable says not to use it, and the docs are wrong in
that the variable actually applies in per-directory scope.

The read of the variable makes it harder to split conversion methods from
cmLocalGenerator where they don't belong.  Remove it now.
2015-06-03 11:43:31 -04:00
Stephen Kelly 3b880a0741 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a
cmState::Snapshot.  Adjust MakeLocalGenerator to use the 'current'
snapshot in cases where there is no parent.  Create the snapshot
for subdirectories in cmMakefile::AddSubdirectory.

This means that snapshots are now created at the point of extending the tree,
as appropriate, and independently of the cmLocalGenerator and cmMakefile they
represent the state for.
2015-05-27 09:18:32 -04:00
Stephen Kelly c7b79aa16a cmGlobalGenerator: Require a cmake instance in ctor.
It is required anyway, so this makes it explicit.
2015-05-27 09:18:31 -04:00
Brad King 6fbd4cae0d Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND"
everywhere.
2015-05-20 11:20:42 -04:00
Stephen Kelly 34c9ee2ed7 cmLocalGenerator: Require a global generator in the constructor.
Port generator factory methods to pass it.
2015-05-14 20:36:27 +02:00
Stephen Kelly a48aebcb67 cmLocalGenerator: Require a parent in the constructor.
Pass the parent though cmGlobalGenerator::CreateLocalGenerator.

This will make it easy to initialize state scopes independent of
cmMakefile.
2015-04-28 07:50:52 +02:00
Brad King 5a5ef00106 Merge topic 'clean-up-cmMakefile'
8dc3a67c cmMakefile: Out-of-line the directory methods.
0f3c8cfa cmMakefile: Use method abstraction to access directories.
b288a997 cmMakefile: Rename SetStart* directory API to SetCurrent*.
932d53bc cmMakefile: Remove redundant method duplication.
32b8f03a cmMakefile: Port users of GetStart* methods to new names.
54d6a918 cmMakefile: Rename GetCurrent{Output,Binary}Directory.
55d80d0a cmMakefile: Rename GetCurrent{,Source}Directory.
b23cf06f cmake: Remove redundant start directories.
fcf246ac cmMakefile: Populate Home directories on initialize.
8878bea7 cmake: Initialize Home directories on cmake for find-package mode.
044dc815 Use the Home directories from the cmake class where intended.
d67e8f24 cmake: Fix directory used to find the cache
1ea085d1 cmMakefile: Initialize dir definitions early.
f034bb2f Remove redundant calls to MakeStartDirectoriesCurrent.
3a68c323 cmMakefile: Fix wrong parameter names.
2015-04-21 09:42:07 -04:00
Stephen Kelly 32b8f03acc cmMakefile: Port users of GetStart* methods to new names. 2015-04-21 00:15:20 +02:00
Stephen Kelly 54d6a9187f cmMakefile: Rename GetCurrent{Output,Binary}Directory.
Match names used in CMake code.
2015-04-21 00:12:52 +02:00
Stephen Kelly 55d80d0a85 cmMakefile: Rename GetCurrent{,Source}Directory.
Match the names used in cmake code.
2015-04-21 00:12:52 +02:00
Brad King 356c26ebdf cmSystemTools: Teach RunSingleCommand to separate stdout and stderr
Extend the RunSingleCommand signature to capture stdout and stderr
separately.  Allow both to be captured to the same std::string
to preserve existing behavior.  Update all call sites to do this
so that this refactoring does not introduce functional changes.
2015-04-20 15:47:50 -04:00
Brad King da65528c36 Merge topic 'stable-xcode-projects'
6693590f Xcode: Refine quoting rules for Strings
a6331eb8 Xcode: Let PrintComment decide if the comment is non-empty
6e8952c1 Xcode: PrintComment will prepend a whitespace itself before the comment
4bd2544b Xcode: Do not add whitespace after attribute group opening brace
5cb4c838 Xcode: Properly indent PBXFileReference and PBXBuildFile
a723427b Xcode: Remove extra space in PBXProject comment
2fe8bca5 Xcode: Add comment after root object
2e0e205e Xcode: Indent using tabs
7b68c8df Xcode: Sort Xcode objects by Id
2015-04-20 14:02:48 -04:00
Gregor Jasny a723427b64 Xcode: Remove extra space in PBXProject comment 2015-04-17 21:50:04 +02:00
Gregor Jasny 2fe8bca580 Xcode: Add comment after root object 2015-04-17 21:50:04 +02:00
Gregor Jasny 7b68c8df6b Xcode: Sort Xcode objects by Id
this patch series aims to minimize deltas between the CMake Xcode
generator and Xcode itself. It was started by the observation that
if one makes any change to the project within Xcode (e.g. to see
how a variable is called internally) the user cannot diff the CMake
project and the one stored by Xcode afterwards.

Xcode keeps the objects ordered by the object id.
Because cmake stores them into an unordered container
at creation time they must be sorted before writing the
pbxproj file.

I tested this series with Xcode 6.3 and Xcode 3.2. Both show a
reduced diff after this series was applied.
2015-04-17 21:49:05 +02:00
Stephen Kelly f081c5bddd cmState: Move CacheEntryType enum from cmCacheManager. 2015-04-13 11:44:16 -04:00
Stephen Kelly 14973054a2 Add API for cache loading, deleting and saving to the cmake class.
Migrate existing users of the CacheManager API to use the new
API.  The CacheManager will be going away soon.
2015-04-07 23:25:39 +02:00
Brad King 3347c5e4f9 Revert topic 'refactor-cache-api'
This topic was never tested without some follow-up commits.  The
GetCacheEntryValue API returns a pointer to memory freed on return.
It will have to be revised along with the rest of the original topic.
2015-04-07 17:15:04 -04:00
Stephen Kelly 1fe7f24c2b Add API for cache loading, deleting and saving to the cmake class.
Migrate existing users of the CacheManager API to use the new
API.  The CacheManager will be going away soon.
2015-04-06 17:58:55 +02:00
Sean James 078c732185 Xcode: Add file type for Metal shader files 2015-04-01 15:15:22 -04:00
Brad King b76b52c0b4 Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736)
Teach the Xcode generator that ONLY_ACTIVE_ARCH=YES means to use ARCHS,
and that the default of ONLY_ACTIVE_ARCH=NO means to use NATIVE_ARCH and
ignore ARCHS.  In the latter case there is no reason to generate ARCHS.
2015-03-27 10:52:32 -04:00
Brad King 9e14a5dee2 cmGlobalXCodeGenerator: Simplify ARCHS list with cmJoin 2015-03-27 09:50:14 -04:00
Gregor Jasny 3714955b9c OS X: Add handling for XCTest bundles
An XCTest bundle is a CFBundle with a special product-type and bundle
extension.  For more information about XCTest visit the Mac Developer
library at:

  http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-03-23 09:12:18 -04:00
Stephen Kelly 0b945ea9a6 Genex: Allow COMPILE_LANGUAGE when processing compile definitions.
Issue an error if this is encountered by an IDE generator.
2015-03-09 20:49:16 +01:00
Gregor Jasny ce935ebe50 cmake: Teach --build to honor CMAKE_VERBOSE_MAKEFILE for Ninja
The Ninja build system does not support a in-file verbositiy switch.
Instead teach 'cmake --build' to extract the CMAKE_VERBOSE_MAKEFILE
setting and pass it as an optional '-v' argument to Ninja.  This can
serve as a reasonable fallback.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-02-26 09:51:11 -05:00
Gregor Jasny bf8f9c29e7 Xcode: Teach XCODE_ATTRIBUTE target properties about generator expressions
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-02-12 13:35:31 -05:00
Brad King d2fe4c4203 cmGlobalXCodeGenerator: Rename variable 'lang' => 'llang'
In CreateBuildSettings the variable holds the linker language.
Use a more distinctive variable name.
2015-02-06 11:46:03 -05:00
Brad King de63ff489d Xcode: Generate Intel Fortran compiler flags in project files 2015-02-06 11:45:28 -05:00
Brad King 9924486f8a Xcode: Refactor generation of per-language compiler flags 2015-02-06 11:44:41 -05:00
Brad King ab9fa54d48 Xcode: Switch to internal CMAKE_MAKE_PROGRAM lookup by generator (#15324)
The "cmakexbuild" wrapper is not needed for Xcode 4 and above, and the
path to it may change when CMake moves.  Avoid storing a specific path
to a build program in CMakeCache.txt and instead compute the value for
CMAKE_MAKE_PROGRAM on demand.  However, if a user does set the value
explicitly then honor it.

This does for Xcode what commit v3.0.0-rc1~260^2~4 (VS: Switch to
internal CMAKE_MAKE_PROGRAM lookup by generators, 2013-11-15) did for
Visual Studio generators.
2015-01-29 09:11:11 -05:00
Brad King 11e2e6cadf Xcode: Select make program at build time
Extend the change made in commit v3.0.0-rc1~260^2~16 (Teach
GenerateBuildCommand to find its own make program, 2013-11-13) to have
the Xcode generator pick between "xcodebuild" and CMake's own copy of
"cmakexbuild" at build time based on the version of Xcode.
2015-01-28 14:01:55 -05:00
Brad King e4055a6144 Xcode: Add internal API to find xcodebuild
Teach the Xcode generator to compute the location of this tool or the
cmakexbuild wrapper.  Add internal APIs to get the locations on demand.

Use the "cmakexbuild" wrapper for Xcode < 4, and "xcodebuild" for modern
Xcode.
2015-01-28 13:41:55 -05:00
Brad King 4970ac3d5f Merge topic 'xcode-target-sort'
9e0176e2 Xcode: Sort targets deterministically and with ALL_BUILD first (#15346)
c0ff542c Xcode: Fix early termination on per-config source file error
2015-01-20 09:19:55 -05:00
Ben Boeckel 9e0176e2b3 Xcode: Sort targets deterministically and with ALL_BUILD first (#15346)
The default target in XCode is the first one in the file.

In commit v3.1.0-rc1~286^2 (cmTarget: use a hash_map for cmTargets
typedef, 2014-06-10) the order of the targets stored in cmMakefile was
made non-deterministic instead of lexicographic.  Teach the Xcode
generator to do its own sorting to restore a predictable order.

While at it, place ALL_BUILD first (as is done in VS IDE generators)
explicitly in the comparison function so that it is the default target
even if other targets sort earlier lexicographically (e.g. "AAA").
2015-01-19 08:36:45 -05:00
Brad King c0ff542c58 Xcode: Fix early termination on per-config source file error
In commit v3.1.0-rc1~687^2~4 (cmTarget: Make the source files depend on
the config, 2014-02-13) an early termination case was added to the Xcode
generator.  Fix handling of this case to actually abort all the
generation steps.  Otherwise some of the later steps are attempted
without the preconditions normally established by earlier steps,
possibly leading to a crash.
2015-01-19 08:34:32 -05:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Gregor Jasny 3a605693a5 Xcode: Call IsCFBundleOnApple to decide if bundle is being built
Narrow down the decision if a CFBundle is built to one place.
This is a preparation patch to add another target property
which, if set, will imply BUNDLE.  Having only one function
which will have to look at both properties helps to keep code
clean.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-12-17 11:26:10 -05:00
Brad King 8a4c6d2d2e Xcode: Fix rebuild with multiple custom command outputs (#15116)
The Xcode generator uses Makefiles under a run-script build-phase to
drive custom commands.  Fix the generated makefiles for custom commands
with multiple outputs to list all the outputs on the left hand side of
the build rule.  This is much simpler and more reliable than the old
multiple-output-pair infrastructure.
2014-12-05 09:52:09 -05:00
Ben Boeckel 48f78f5f9e Xcode: use a map to look up target pointers (#15201)
Use an efficient internal lookup to associate cmTarget and cmXCodeObject
instances.
2014-12-02 10:51:15 -05:00
Brad King e15a7075b5 Add an option for explicit BYPRODUCTS of custom commands (#14963)
A common idiom in CMake-based build systems is to have custom commands
that generate files not listed explicitly as outputs so that these
files do not have to be newer than the inputs.  The file modification
times of such "byproducts" are updated only when their content changes.
Then other build rules can depend on the byproducts explicitly so that
their dependents rebuild when the content of the original byproducts
really does change.

This "undeclared byproduct" approach is necessary for Makefile, VS, and
Xcode build tools because if a byproduct were listed as an output of a
rule then the rule would always rerun when the input is newer than the
byproduct but the byproduct may never be updated.

Ninja solves this problem by offering a 'restat' feature to check
whether an output was really modified after running a rule and tracking
the fact that it is up to date separately from its timestamp.  However,
Ninja also stats all dependencies up front and will only restat files
that are listed as outputs of rules with the 'restat' option enabled.
Therefore an undeclared byproduct that does not exist at the start of
the build will be considered missing and the build will fail even if
other dependencies would cause the byproduct to be available before its
dependents build.

CMake works around this limitation by adding 'phony' build rules for
custom command dependencies in the build tree that do not have any
explicit specification of what produces them.  This is not optimal
because it prevents Ninja from reporting an error when an input to a
rule really is missing.  A better approach is to allow projects to
explicitly specify the byproducts of their custom commands so that no
phony rules are needed for them.  In order to work with the non-Ninja
generators, the byproducts must be known separately from the outputs.

Add a new "BYPRODUCTS" option to the add_custom_command and
add_custom_target commands to specify byproducts explicitly.  Teach the
Ninja generator to specify byproducts as outputs of the custom commands.
In the case of POST_BUILD, PRE_LINK, and PRE_BUILD events on targets
that link, the byproducts must be specified as outputs of the link rule
that runs the commands.  Activate 'restat' for such rules so that Ninja
knows it needs to check the byproducts, but not for link rules that have
no byproducts.
2014-11-14 16:16:00 -05:00
Brad King 820e95d000 Xcode: Inherit global settings in per-target WARNING_CFLAGS (#15224)
Allow projects to use CMAKE_CODE_ATTRIBUTE_WARNING_CFLAGS to add their
own warning flags and have them used by the targets.
2014-10-31 11:29:53 -04:00
Brad King 03b7b6cda1 cmGlobalGenerator: Call SetGeneratorToolset even for empty toolset
Move handling of an empty toolset name into the implementation of the
method.  This simplifies the VS 10 implementation of default toolset
selection because it has one code path that is always called.
2014-09-05 13:41:54 -04:00
Brad King f7c44eac4c Merge topic 'xcode-duplicate-file-refs'
d73f8828 Merge branch 'backport-xcode-duplicate-file-refs' into xcode-duplicate-file-refs
cf92fe2d Xcode: Generate per-target file references (#15111)
e7114226 Xcode: Generate per-target file references (#15111)
2014-09-04 09:48:27 -04:00
Brad King cf92fe2d84 Xcode: Generate per-target file references (#15111)
Xcode requires a separate PBXFileReference for each target source group
that references a source file.  Xcode 6 now diagnoses re-use of the same
PBXFileReference from multiple source groups.  Add the referencing
target name to our internal map key so we use a per-target reference.
2014-09-03 12:48:53 -04:00
Brad King 8eacc3390a Xcode: Reference '.xcassets' folders as assetcatalog (#15125) 2014-09-03 10:33:50 -04:00
Brad King 02aa5965e6 Xcode: Refactor internal file type extension extraction
Move it earlier so it can be used for directories too.
2014-09-03 10:33:12 -04:00
Brad King 05d064fec3 Merge topic 'xcode-6-librarian-flags'
608cf814 Xcode: Fix static library creation for Xcode 6 (#15038)
2014-07-29 08:52:17 -04:00
Brad King 608cf8149c Xcode: Fix static library creation for Xcode 6 (#15038)
Xcode 6 introduced an 'OTHER_LIBTOOLFLAGS' setting for the "Other
Librarian Flags" of a static library.  Now 'OTHER_LDFLAGS' are ignored.
Teach the Xcode generator to choose the correct name for the build
setting based on the type of target and the version of Xcode.

Inspired-by: Jamie Kirkpatrick <jkp@spotify.com>
2014-07-28 13:06:33 -04:00
Brad King 0dc9e88d76 cmTarget: Remove 'head' argument from GetLinkImplementation
Many of the 'head' arguments added by commit v2.8.11~289^2~1 (Make
linking APIs aware of 'head' target, 2013-01-04) turned out not to be
needed.  The "link implementation" of a target never needs to be
computed with anything but itself as the 'head' target (except for
CMP0022 OLD behavior because then it is the link interface).

Remove the unused 'head' target paths.  Add "internal" versions of
cmTarget::GetDirectLinkLibraries and GetLinkImplementationLibraries
to support the CMP0022 OLD behavior without otherwise exposing the
'head' target option of these methods.
2014-06-23 09:17:00 -04:00
Brad King c6e7c18bcc Merge topic 'xcode-15-string-apis'
23dc6aa1 Xcode: Fix single-configuration generation for version 1.5
2014-06-06 09:44:55 -04:00
Brad King 23dc6aa194 Xcode: Fix single-configuration generation for version 1.5
In commit 84fdc992 (stringapi: Pass configuration names as strings,
2014-02-09) a few code paths for the Xcode 1.5 single-configuration
generator were not updated to use an empty configuration name instead of
a NULL pointer when no configuration is specified in CMAKE_BUILD_TYPE.
Fix them now.
2014-06-05 09:43:13 -04:00
Brad King 528e8af19f Allow a toolchain file to specify a generator toolset
Delay use of CMAKE_GENERATOR_TOOLSET until the CMakeSystem.cmake
file has been configured and loaded during the first project() or
enable_language() command.  This gives the toolchain file named by
CMAKE_TOOLCHAIN_FILE a chance to set CMAKE_GENERATOR_TOOLSET.  This
point is still early enough to set the generator toolset prior to
the initialization of any languages that might use the toolset.

The cmake::GeneratorToolset member variable remains an indication
of what was specified by the -T option or loaded from the cache.
It does not need to be updated based on the toolchain file setting.
The cmMakefile::TryCompile can still pass cmake::GeneratorToolset
into the inner instance because the try-compiled project will do
platform and language initialization using the CMakeSystem module
configured for the outer project.

Extend the RunCMake.GeneratorToolset test with cases that use a
toolchain file to set CMAKE_GENERATOR_TOOLSET.
2014-06-04 14:27:02 -04:00
Brad King 3e9f6e36f3 Xcode: Rename internal variable {Platform => Generator}Toolset
The latter matches with CMAKE_GENERATOR_TOOLSET better.
2014-06-04 13:16:37 -04:00
Brad King a339ea6529 Xcode: Add source file property to control file type (#14854)
Add source file properties to control Xcode file type attributes:

  XCODE_EXPLICIT_FILE_TYPE   => explicitFileType
  XCODE_LAST_KNOWN_FILE_TYPE => lastKnownFileType

Add a RunCMake.XcodeProject test to verify generated project content.
2014-05-15 14:34:52 -04:00
Brad King ae80cb9f28 Xcode: Refactor internal source file type selection
Choose the attribute name and file type and send them through a single
attribute generation code path.  Compute the file extension only when
needed.  Leave the file type selection logic indented in a block so it
can be made conditional later.
2014-05-15 14:01:16 -04:00
Ben Boeckel 325599caa2 cmGlobalGenerator: Store targets in hash maps 2014-05-07 15:48:32 -04:00
Stephen Kelly e6971df6ab cmTarget: Make the source files depend on the config.
Disallow the use of config-specific source files with
the Visual Studio and Xcode generators. They don't have
any way to represent the condition currently.

Use the same common-config API in cmQtAutoGenerators. While
it accepts config-specific files, it doesn't have to support
multiple configurations yet.

Loop over the configs in cmTargetTraceDependencies
and cmGlobalGenerator::WriteSummary and consume all source
files.

Loop over the configs in cmComputeTargetDepends and compute the
object library dependencies for each config.
2014-04-02 23:14:02 +02:00
Stephen Kelly aa0a3562dd cmGeneratorTarget: Compute target objects on demand
Add a ComputeObjectMapping method to compute the object
names.  It takes mapping to populate as an out-parameter so
that it can be extended in the future with parameters
relevant to generator expression evaluation.

Remove the supporting cmGeneratorTarget::AddObject method. It is
no longer needed as the container member is populated directly.

The ComputeObjectMapping method is called whenever objects are
requested from the cmGeneratorTarget.  Because the Xcode generator
makes no such request, explicitly invoke the method from that
generator so that the logic of checking for bad sources in object
libraries is executed.

In a follow-up, the UseObjectLibraries usage may be replaced by a
true generator expression evaluator for TARGET_OBJECTS. That
will require generators to use cmGeneratorTarget::GetExternalObjects
which is not currently the case for Xcode and VS generators.
2014-04-02 23:12:57 +02:00
Stephen Kelly e5da9e51d0 cmTarget: Allow any generator expression in SOURCES property.
Remove use of UseObjectLibraries from Makefile and Ninja generators. It
is not needed now because those generators use GetExternalObjects
which already contains the objects from object libraries.

The VS10 generator calls both the UseObjectLibraries and the GetExternalObjects
methods. Ensure that duplicates are not created by skipping objects
from object libraries in handling of GetExternalObjects.

Similarly, fix VS6, VS7 and Xcode object handling by skipping
external objects from OBJECT_LIBRARY usage as appropriate.

The error message in the BadSourceExpression1 test is now reported
by the generator expression evaluator, so it has different text.
2014-04-02 23:12:56 +02:00
Stephen Kelly 857d30b52e cmGlobalGenerator: Add interface to call ForceLinkerLanguages
Avoid calling it too early when cmGeneratorTarget instances don't
yet exist.
2014-03-31 23:18:44 +02:00
Stephen Kelly 26d494ba01 cmTarget: Use string API to add sources to cmTarget objects.
Continue to call GetOrCreateSource where necessary to create
cmSourceFile objects which have the GENERATED attribute set.
2014-03-31 23:18:43 +02:00
Stephen Kelly 0ed5ce4cd8 cmTarget: Rename AddSource method for backward compatibility.
Add a new AddSource method for future use.
2014-03-31 23:18:43 +02:00
Stephen Kelly 6c9dd0ec7b cmGlobalGenerator: Make ComputeTargetObjects non-virtual
Implement it in terms of the ComputeObjectFilenames virtual method
on the local generators.

Remove the reimplementation from the global generators which are
now all functionally identical.
2014-03-15 09:30:24 +01:00
Stephen Kelly f6da044080 cmLocalGenerator: Add ComputeObjectFilenames interface.
Implement it in the local generators and use it in the global
generators.
2014-03-13 15:28:02 +01:00
Stephen Kelly 9ad804ac7b cmGeneratorTarget: Constify cmSourceFile* in containers.
Some of them will be used with other APIs which require value_type
to be cmSourceFile const*.
2014-03-13 15:27:23 +01:00
Stephen Kelly cd43433de5 cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface.
Make it public for future external calls.
2014-03-13 15:27:23 +01:00
Brad King bc993f277e Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the
command lines of a custom command.  Generalize it to get the comment,
working directory, dependencies, and outputs of custom commands.  Update
use in all generators to support this.
2014-03-12 10:44:01 -04:00
Brad King 9a5c554414 cmGlobalXCodeGenerator: Simplify handling of multiple outputs
Make the multiple output pair map more local.  Generate it where we
have the current configuration available.
2014-03-12 10:44:00 -04:00