Commit Graph

459 Commits

Author SHA1 Message Date
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
Brad King d45e7f3461 cmCustomCommand: Return std::string from GetWorkingDirectory 2014-03-12 10:44:00 -04:00
Ben Boeckel 6557382dcf stringapi: Use strings for program paths 2014-03-08 13:05:38 -05:00
Ben Boeckel 1a1b737c99 stringapi: Use strings for generator names 2014-03-08 13:05:38 -05:00
Ben Boeckel 24b5e93de2 stringapi: Use strings for directories 2014-03-08 13:05:38 -05:00
Ben Boeckel b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel 84fdc9921c stringapi: Pass configuration names as strings 2014-03-08 13:05:36 -05:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Ben Boeckel c3833c7da4 stringapi: Use strings for VS project names 2014-03-08 13:05:33 -05:00
Ben Boeckel fabf1fbabb stringapi: Use strings in target name 2014-03-08 13:05:31 -05:00
Ben Boeckel ce5114354c stringapi: Use strings for the languages 2014-03-08 13:05:30 -05:00
Ben Boeckel b26c70cc9a stringapi: Use strings for AddString methods
It gets turned into a string anyways, so pass them in.
2014-03-08 13:05:30 -05:00
Stephen Kelly 84e5f5a004 cmTarget: Move SourceFileFlags to cmGeneratorTarget. 2014-02-24 16:43:23 +01:00
Clinton Stimpson 028a5285d8 OS X: Make sure RPATHs are unique to avoid possible corruption.
When using link_directories() and including CMAKE_CFG_INTDIR,
one can end up with duplicate RPATHs in the binary which
install_name_tool cannot fix without corrupting the binary.
Also, the cmake_install.cmake file has been fixed to correctly
handle these generator specific variables.
2014-02-03 07:04:54 -07:00
Stephen Kelly bf1e1bf1d0 cmMakefile: Make FindSourceGroup const.
Return a pointer instead of a reference.  This allows making the accessor
const with the least impact.
2014-01-22 21:28:41 +01:00
Ruslan Baratov 1ce02ebfd5 Xcode: Fix storyboard view
Images and xib files must have 'lastKnownFileType' attribute to be
displayed correctly. If xib file has attribute 'explicitFileType' it is
displayed as raw xml. If static image has attribute 'explicitFileType'
it is displayed as question mark on storyboard.
2014-01-16 13:46:21 -05:00
Ruslan Baratov d9f1f917c4 Xcode: Remove dead code
Variable 'ext' already checked for equality to "xib" so remove the
branch that will never be executed.
2014-01-16 13:43:47 -05:00
Stephen Kelly 531e40b95e cmTarget: Make GetSourceFiles populate an out-vector parameter.
In a future patch, this will also be populated with extra
sources from the linked dependencies.
2014-01-09 19:38:08 +01:00
Stephen Kelly 38de54cf6f cmGeneratorTarget: Add methods to access source file groups.
These methods and others will be able to get a config parameter
later to implement the INTERFACE_SOURCES feature.
2014-01-09 19:38:07 +01:00
Ruslan Baratov 2d23c1f177 Xcode: Fix storyboard view
Since commit 56831461 (Xcode: Use explicitFileType to mark source types,
2013-04-16) the Xcode generator prefers to use explicitFileType to tell
Xcode about each source file type.  This works better than
lastKnownFileType for some file types, but not for "file.storyboard".

If storyboard file has attribute 'explicitFileType' it is displayed
incorrectly (as raw xml).  Switch it back to 'lastKnownFileType'.
2014-01-07 14:07:32 -05:00
Stephen Kelly fa651c7a19 cmTarget: Remove some of the INTERFACE_LIBRARY whitelisted properties.
There is no need to allow EXCLUDE_* properties, because an
INTERFACE_LIBRARY has no direct build output.

IMPORTED_LINK_INTERFACE_LANGUAGES are relevant only to static
libraries.

VERSION is relevant only to the filename of direct build outputs,
which INTERFACE_LIBRARY does not have.
2014-01-06 17:25:10 +01:00
Stephen Kelly ef25ba8d06 Constify handling of target dependencies. 2013-12-11 15:30:11 +01:00
Stephan Tolksdorf 2dcb1dc9ca Xcode: Fix duplicate target subfolders (#14133)
Fix logic introduced by commit eeeeca10 (XCode: Support target folders
on XCode, 2011-02-20) to avoid duplicate subfolders.  The problem was
that no slash was appended to the curr_tgt_folder string on the it !=
this->TargetGroup.end() path.
2013-12-02 09:09:22 -05:00
Brad King 123a0608df Teach GenerateBuildCommand to find its own make program
Add a cmGlobalGenerator::SelectMakeProgram method to select a
caller-provided make program, the CMAKE_MAKE_PROGRAM cache entry, or a
generator-provided default.  Call it from all implementations of the
GenerateBuildCommand method with the corresponding generator's default,
if any.
2013-11-18 11:30:48 -05:00
Brad King 8904d1410b cmGlobalGenerator: Cleanup GenerateBuildCommand API
All cmGlobalGenerator::GenerateBuildCommand call sites that need to
produce a string now generate "cmake --build" commands.  The remaining
call sites immediately pass the result to cmSystemTools::RunSingleCommand.
Avoid the intermediate string and argument parsing by directly producing a
vector of strings.  Also drop the ignoreErrors argument because no call
sites remain that use it.
2013-11-18 08:26:21 -05:00
Michael Priestman e5ec8ad47d Xcode: Generate 'folder' source type for directories (#14498)
Teach the Xcode generator to set 'lastKnownFileType' to be 'folder' for
file references that are directories.  If you set 'explicitFileType' to
'sourcecode', then Xcode cannot browse the directory.
2013-10-21 11:09:59 -04:00
Brad King 0c39a757da Drop the 'Full' field from cmDocumentationEntry
We need only 'Brief' for usage documentation.  We no longer have builtin
'Full' documentation, which is now in Help/*/*.rst files.
2013-10-16 09:22:37 -04:00
Stephen Kelly fe732264e9 Add the INTERFACE_LIBRARY target type.
This target type only contains INTERFACE_* properties, so it can be
used as a structural node. The target-specific commands enforce
that they may only be used with the INTERFACE keyword when used
with INTERFACE_LIBRARY targets. The old-style target properties
matching LINK_INTERFACE_LIBRARIES_<CONFIG> are always ignored for
this target type.

The name of the INTERFACE_LIBRARY must match a validity generator
expression. The validity is similar to that of an ALIAS target,
but with the additional restriction that it may not contain
double colons. Double colons will carry the meaning of IMPORTED
or ALIAS targets in CMake 2.8.13.

An ALIAS target may be created for an INTERFACE library.

At this point it can not be exported and does not appear in the
buildsystem and project files are not created for them. That may
be added as a feature in a later commit.

The generators need some changes to handle the INTERFACE_LIBRARY
targets returned by cmComputeLinkInterface::GetItems. The Ninja
generator does not use that API, so it doesn't require changes
related to that.
2013-10-07 19:56:31 -04:00
Brad King a3194ff4a7 Xcode: Fix OBJECT library support for Xcode 5 (#14254)
Xcode 2.1 through 4 supported $(CURRENT_ARCH) in a PBXFileReference
'path' value used in the "Link Binary with Libraries" build phase.
CMake uses this to reference object file locations on link lines to
bring in OBJECT library content.  However, Xcode 5 now evaluates the
$(CURRENT_ARCH) reference in this context as "undefined_arch" so the
wrong path is given to the linker.  There seems to be no alternative way
to produce an architecture-specific value in a PBXFileReference.

Fortunately Xcode 5 now also handles link dependencies for paths linked
through OTHER_LDFLAGS.  For Xcode >= 5, move the OBJECT library object
file references from the link build phase to OTHER_LDFLAGS.  We can
still show the object files in the source group listing in either case.
2013-10-02 13:03:21 -04:00
Brad King dff8d113b4 Xcode: Drop XCODE_DEPEND_HELPER for Xcode >= 5
Xcode 5.0 now computes dependencies from files linked through
OTHER_LDFLAGS, so we no longer need the XCODE_DEPEND_HELPER hack to
re-link dependents when targets change.
2013-10-02 12:49:09 -04:00
Patrick Gansterer 14bbf8340a Unify the way the flags of a static library are read
Introduce cmLocalGenerator::GetStaticLibraryFlags() to have a central
function for getting the linker flags for a given target.
2013-07-31 08:41:07 -04:00
Stephen Kelly 184121538c Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
Refactor to create AddCompileDefinitions.
2013-07-11 08:23:56 +02:00
Brad King d221eac812 Refactor target COMPILE_OPTIONS and COMPILE_FLAGS handling
Replace the cmLocalGenerator GetCompileOptions method with an
AddCompileOptions method since all call sites of the former simply
append the result to a flags string anyway.

Add a "lang" argument to AddCompileOptions and move the
CMAKE_<LANG>_FLAGS_REGEX filter into it.  Move the call sites in each
generator to a location that has both the language and configuration
available.  In the Makefile generator this also moves the flags from
build.make to flags.make where they belong.
2013-06-27 12:57:32 -04:00
Stephen Kelly 2331b57bec Add whitespace after colons in error messages. 2013-06-21 16:21:44 +02:00
Brad King aa025cc60a Merge topic 'xcode-framework-paths'
21a0bea Xcode: Fix framework search paths in STATIC library targets (#14191)
2013-06-05 09:39:52 -04:00
Brad King ff8917fdd2 Merge topic 'VISIBILITY_PRESET-property'
cd1fa53 Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.
0e9f4bc Introduce target property <LANG>_VISIBILITY_PRESET
2013-06-05 09:38:59 -04:00
Brad King 21a0beacc1 Xcode: Fix framework search paths in STATIC library targets (#14191)
In commit 2bc22bda (Xcode: Add frameworks search paths from link
dependeny closure, 2012-12-07) we made framework search paths from the
link closure conditional on target type, skipping it on STATIC and
OBJECT library targets that do not actually link.  However, the
framework search paths also influence the compile lines (-F options) so
we need them for all target types.  The Makefile generator already does
this, as did the Xcode generator prior to the above-mentioned commit.
2013-06-04 09:49:40 -04:00
Brad King 05e47f2122 Merge topic 'cfbundle-location'
483e208 OS X:  Fix getting of CFBundle LOCATION property.
2013-06-04 09:02:46 -04:00
Brad King e57b6a2521 Merge topic 'target-COMPILE_OPTIONS'
24466f2 Add target_compile_options command.
80ca9c4 Add COMPILE_OPTIONS target property.
7cb2308 cmTarget: Rename LinkInterfaceIncludeDirectoriesEntries
47f80d9 cmTarget: Rename struct to be more re-usable.
1319a14 Add <LANG>_COMPILER_ID generator expressions.
3549676 Add cmLocalGenerator::GetCompileOptions.
f3ad863 VS6: Rename some variables to correspond to config values.
2013-06-03 09:57:44 -04:00
Brad King 3caf565d07 Merge topic 'rpath-on-mac'
dc1d025 OS X: Add test for rpaths on Mac.
8576b3f OS X: Add support for @rpath in export files.
00d71bd Xcode: Add rpath support in Xcode generator.
94e7fef OS X: Add RPATH support for Mac.
2013-06-03 09:56:44 -04:00
Brad King d444fea163 Merge topic 'xcode-shlib-versioning'
cbe3f20 Xcode: Add support for shared library versioning
2013-06-03 09:56:37 -04:00
Brad King b0759da303 Merge topic 'framework-refactor'
373faae Refactor how bundles and frameworks are supported.
2013-06-03 09:56:32 -04:00
Clinton Stimpson 00d71bdd19 Xcode: Add rpath support in Xcode generator. 2013-06-03 09:42:05 -04:00
Clinton Stimpson 483e208482 OS X: Fix getting of CFBundle LOCATION property.
This fixes bug #13797.
The kinds of changes applied in 373faae5 for frameworks are now
applied to CFBundle.  The prefix and suffix for CFBundles are
now handled in cmTarget::GetFullNameInternal.
2013-06-03 06:29:33 -06:00
Stephen Kelly 0e9f4bc00c Introduce target property <LANG>_VISIBILITY_PRESET
This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target
property is used as the operand to the -fvisibility= compile option
with GNU compilers and clang.
2013-06-02 12:00:51 +02:00
Stephen Kelly 35496761a5 Add cmLocalGenerator::GetCompileOptions.
Currently it only adds the contents of the COMPILE_FLAGS target
property, but it can be extended to handle a new COMPILE_OPTIONS
generator expression enabled property.
2013-06-02 11:56:36 +02:00
Clinton Stimpson cbe3f2072b Xcode: Add support for shared library versioning
Add a post-build command to shared library targets to create the
versioning symbolic links.
2013-05-29 09:05:00 -04:00
Brad King 711073e8c6 Merge topic 'xcode-attributes-variant'
332350b Xcode: Support XCODE_ATTRIBUTE_ with [variant=<config>] (#12532)
2013-05-23 10:52:31 -04:00
Clinton Stimpson 373faae5e1 Refactor how bundles and frameworks are supported.
Make handling of directory separators consistent between
non-bundle and bundle code.

Remove xcode specific flag from cmTarget when getting install_name.

Add (more) consistent convenience functions in cmTarget to get
directories inside of bundles and frameworks to add files to.

This refactor also fixes bug #12263 where frameworks
had the wrong install name when SKIP_BUILD_RPATH.

Also make install_name for frameworks consistent between Makefile
and Xcode generator.
2013-05-23 10:42:49 -04:00
Cédric OCHS 332350b9c4 Xcode: Support XCODE_ATTRIBUTE_ with [variant=<config>] (#12532)
Since commit c519bb2b (XCode: Also qoute [] as needed to set
build-configurations, 2011-04-05) we escape "[]" conditions for
XCODE_ATTRIBUTE_ settings.  However, we need to handle the "variant"
condition with a special case to map it only into the settings for the
matching configuration.
2013-05-22 15:20:10 -04:00
Matthew Bentham bcda47d2a0 Xcode: Honor CMAKE_(MODULE|SHARED)_LINKER_FLAGS_<CONFIG> (#14161)
Refactor lookup of CMAKE_(EXE|MODULE|SHARED)_LINKER_FLAGS(|_<CONFIG>)
variables to ensure all combinations are handled.  Use the helper method
AddConfigVariableFlags to simplify the implementation.
2013-05-22 11:48:01 -04:00
Brad King d86d0e622a Merge topic 'xcode-explicitFileType'
5683146 Xcode: Use explicitFileType to mark source types (#14093)
2013-05-16 14:36:54 -04:00
Brad King 5683146185 Xcode: Use explicitFileType to mark source types (#14093)
Replace use of lastKnownFileType with explicitFileType to insist
that Xcode treat the file as we ask.
2013-04-16 15:44:48 -04:00
Petr Kmoch de8be9ef7d Add projectDir parameter to GenerateBuildCommand
Extend the cmGlobalGenerator::GenerateBuildCommand virtual method
signature with a "projectDir" parameter specifying the top of the
project build tree for which the build command will be generated.
Populate it from call sites in cmGlobalGenerator::Build where a
fully-generated build tree should be available.
2013-04-12 11:35:35 -04:00
Stephen Kelly a6286e92c9 Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
The API for retrieving per-config COMPILE_DEFINITIONS has long
existed because of the COMPILE_DEFINITIONS_<CONFIG> style
properties. Ensure that the provided configuration being generated
is also used to evaluate the generator expressions
in cmTarget::GetCompileDefinitions.

Both the generic COMPILE_DEFINITIONS and the config-specific
variant need to be evaluated with the requested configuration. This
has the side-effect that the COMPILE_DEFINITIONS does not need to
be additionally evaluated with no configuration, so the callers can
be cleaned up a bit too.
2013-03-25 10:49:22 -04:00
Brad King 10d7bf4e62 Xcode: Generate recommended artwork setting (#13954)
Add the COMBINE_HIDPI_IMAGES = YES setting to all Xcode project targets.
Otherwise Xcode may ask the user to "Update to recommended settings".
2013-02-26 12:54:01 -05:00
Brad King f7029572ca Merge topic 'xcode-target-depends'
b005140 Xcode: Each target dependency edge needs a unique object (#13935)
781ea6d Xcode: Drop check for circular target dependencies
2013-02-20 08:09:47 -05:00
Brad King f1cd42f818 Merge topic 'ide-compiler-vars-cleanup'
bed6c38 VS,Xcode: Remove unused CMAKE_GENERATOR_* variables
2013-02-20 08:09:34 -05:00
Brad King b005140451 Xcode: Each target dependency edge needs a unique object (#13935)
Generate a unique PBXTargetDependency and PBXContainerItemProxy for
every edge in the dependency graph as required by the Xcode format.
Xcode only accidentally loads project files that re-use the same
PBXTargetDependency for every edge leading to a single target.  If one
is removed by hand in the IDE then Xcode may crash due to dangling
references from the others.

Since cmGlobalXCodeGenerator::AddDependTarget is called exactly once for
every edge in the target dependency graph we do not need to keep track
of which edges have been visited to avoid generating duplicates.
2013-02-19 16:45:58 -05:00
Brad King 781ea6d1ca Xcode: Drop check for circular target dependencies
The modern cmComputeTargetDepends guarantees there will by no cycles.
Drop the Xcode generator's check which only handled length 1 and 2
cycles anyway.
2013-02-19 16:06:38 -05:00
Brad King bed6c38896 VS,Xcode: Remove unused CMAKE_GENERATOR_* variables
Since the topic merged to master by commit 34a02846 (Merge topic
'ide-compiler-id', 2012-08-24), these variables are not used by
CMakeDetermine*Compiler.cmake for VS and Xcode generators.  Drop the
code that sets them.
2013-02-19 09:29:11 -05:00
Alexander Chehovsky f6a8983db4 Xcode: Sort source files
Since Xcode doesn't sort the files on its own, let's sort them in our
generator to make navigation easier.  Visual Studio, QtCreator, and
kdevelop all display files sorted.
2013-02-18 08:47:14 -05:00
Alexander Chehovsky 0816caecac Xcode: Fix nested source group handling (#12943)
Teach the code path for nested sources build the group map key in the
same way as non-nested code path does.
2013-02-18 08:47:10 -05:00
Brad King c0debb1f89 Merge branch 'master' into generator-toolset
We need the latest Tests/CMakeLists.txt so we can refactor all tests.
2013-02-07 11:09:01 -05:00
Brad King f980a80495 Xcode: Implement generator toolset selection (#9831, #13802)
Implement generator toolset selection (cmake -T) for Xcode > 2.0 by
adding the GCC_VERSION build setting to project files.
2013-02-07 11:07:48 -05:00
Stephen Kelly 0e10782ba7 Move GetCompileDefinitions to cmTarget. 2013-01-29 14:11:49 -05:00
Robert Maynard f447db7f10 XCode generator won't infinitely parse compiler flags (bug #13354).
When parsing the compiler flag list we reduce the search space on
each iteration to be the subset of the string we hadn't searched
before.
2013-01-18 11:55:50 -05:00
Stephen Kelly 3581b96caa Process the INTERFACE_PIC property from linked dependencies
This allows a dependee to inform a target that it should have its
POSITION_INDEPENDENT_CODE property set to ON, or OFF. The value of
the POSITION_INDEPENDENT_CODE property, if set, must be consistent
with any INTERFACE_POSITION_INDEPENDENT_CODE properties on dependees.

Add a test covering the consistency checks on platforms where they run.
2013-01-10 09:54:52 -05:00
Stephen Kelly 40cf3fb95b Make linking APIs aware of 'head' target
The 'head' is the dependent target to be linked with the current target.
It will be used to evaluate generator expressions with proper handling
of mapped configurations and is used as the source target of properties.

This requires that memoization is done with a key of a pair of target
and config, instead of just config, because now the result also depends
on the target.  Removing the memoization entirely is not an option
because it slows cmake down considerably.
2013-01-08 08:53:25 -05:00
Brad King 2bc22bdaac Xcode: Add frameworks search paths from link dependeny closure (#13397)
The Xcode generator produces FRAMEWORK_SEARCH_PATHS from:

(1) Include directories of the form /path/to/Foo.framework become
    -F/path/to so '#include <Foo/H>' can find H in the framework.

(2) Linked frameworks of the form /path/to/Foo.framework become
    -F/path/to -framework Foo so the linker can find the framework.

Originally commit 82bb6fae (add framework support to FIND_FILE,
2005-12-27) added these and used the (then current) old-style link
dependency analysis results to get the frameworks.  Later a second
setting was added by commit 2ed6191f (add initial xcode framework stuff,
2007-05-08) to transform -F/path/to linker options produced by the old
link line generation into entries appended to FRAMEWORK_SEARCH_PATHS.
Then commit 96fd5909 (Implement linking with paths to library files,
2008-01-22) updated the second setting to directly use the results of
full modern link dependency analysis, but forgot to remove the use of
old-style link results from the original setting location.

The two settings worked together for a while, with the second one
appending to the first.  Then commit f33a27ab (Generate native Xcode 3.0
and 3.1 projects, 2009-06-29) changed the internal representation format
produced by the first setting but did not update the second setting to
append to the new representation.  As a result, if the first setting
added any paths (usually via the old-style link analysis) then the
second setting containing the modern link analysis results would not be
applied at all.

Fix this by removing use of the old-style link analysis results.
Replace it using the modern link dependencies and remove the second
setting altogether.  Now all values for FRAMEWORK_SEARCH_PATHS are
collected in one place so no special append logic is needed.
2012-12-07 15:14:19 -05:00
Stephen Kelly 0bbae6f95f Revert "Move GetLinkInformation to cmGeneratorTarget"
As we can't move all linking related code from cmTarget, it makes
sense to reverse the move in some cases.

This reverts commit 4f5384e75c.
2012-11-21 15:49:37 +01:00
Patrick Gansterer 5170a8800f Make cmGlobalGenerator::GetDocumentation() a static function
Making the function static allows us to call it directly,
without creating and removing an instance of the generator.
2012-11-19 12:54:50 -05:00
Patrick Gansterer 04ff866ca8 Allow a GeneratorFactory handling of more than one generator
Pass the name of the requested generator to the generator factory,
which is now responsible to check if it can create a matching
generator for the name. This allows us to add more logic to the
factory in a next step, so that not every possible generator needs
to get registered explicit in cmake::AddDefaultGenerators().
2012-11-19 12:54:35 -05:00
Patrick Gansterer 30a695021c Add cmGlobalGeneratorFactory::GetGenerators()
This allows cmGlobalGeneratorFactory to create more than
one type of cmGlobalGenerator in a next step.
2012-11-19 12:54:34 -05:00
Patrick Gansterer e8f841473b Introduce the abstract class cmGlobalGeneratorFactory
This new abstract class allows us move some logic from the
cmGlobalGenerator into its own layer in a next step.
2012-11-19 12:54:30 -05:00
Brad King 388a3216fc Xcode: Fix ReRunCMake.make path to cmake.check_cache (#13603)
The path must be either absolute or relative to the working directory
from which the makefile will be loaded.  In subprojects this is not
relative to the top of the build tree.

Reported-by: David Weese <tre@gmx.de>
2012-10-24 14:13:19 -04:00
Stephen Kelly 2a6bd96c13 Fix config-specific INCLUDE_DIRECTORIES in multi-config generators
Commit 08cb4fa4 (Process generator expressions in the
INCLUDE_DIRECTORIES property, 2012-09-18) contained an incorrect
assumption that CMAKE_BUILD_TYPE was set on the makefile for each
generated configuration in multi-config generators. Fix that by making
the GetIncludeDirectories API depend on the config.
2012-10-17 16:24:14 -04:00
Brad King 103d99338a Merge topic 'generator-expression-target-properties'
083de7e Process generator expressions in the COMPILE_DEFINITIONS target property.
08cb4fa Process generator expressions in the INCLUDE_DIRECTORIES property.
0ef091d Early return if there is no target.
eb250cd Add a self-reference check for target properties.
7e80747 Add API to check that dependent target properties form a DAG.
239ac84 Add a generator expression for target properties.
e028381 Extend the generator expression language with more logic.
b8e61d6 Refactor GetCompileDefinitions a bit.
2c2b25b Return a std::string from GetCompileDefinitions.
b7e48e0 Add an AppendDefines std::string overload.
9a16087 Convert paths in INCLUDE_DIRECTORIES property to Unix slashes.
4557c8d Don't prepend a path before generator expressions in include_directories.
c6abc41 Add include guard for cmGeneratorExpression.
0ff4e3f Port remaining code to GetCompileDefinitions().
f178d53 Fix indentation in the code blocks generator.
2012-09-28 17:15:03 -04:00
David Cole 3f3b731961 Merge topic 'use-generator-target'
879fd35 Revert "Move GenerateTargetManifest to cmGeneratorTarget."
6674583 Fix compiler warning with initialization order.
5285458 Add convenience for getting a cmGeneratorTarget to use.
c31f3d9 Add a wrapper for accessing config-specific compile-definitions.
d1446ca Append the COMPILE_DEFINITIONS from the Makefile to all targets.
290e92a Move GetIncludeDirectories to cmGeneratorTarget.
f9146f6 Port cmLocalGenerator::GetTargetFlags to cmGeneratorTarget.
9facfd1 Move GetCreateRuleVariable to cmGeneratorTarget.
78bfee3 Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget.
4f5384e Move GetLinkInformation to cmGeneratorTarget
987e12e Move GenerateTargetManifest to cmGeneratorTarget.
14bf778 Store cmGeneratorTargets with the makefile.
f428ca2 Add more forwarding API to cmGeneratorTarget.
2012-09-25 15:18:34 -04:00
Brad King 33a60e6bd1 Xcode: Remove unused code reading CMAKE_OSX_SYSROOT_DEFAULT
The condition for entering the block where the value is used
can never be true anymore.
2012-09-21 08:47:02 -04:00
Stephen Kelly 2c2b25b203 Return a std::string from GetCompileDefinitions. 2012-09-21 13:28:54 +02:00