Commit Graph

526 Commits

Author SHA1 Message Date
Stephen Kelly e162326128 Fix indentation. 2013-05-29 08:40:00 +02:00
Brad King 14d90d81de Merge topic 'language-generator-expressions'
3241014 Add $<LINK_LANGUAGE> generator expression
2013-05-24 09:19:15 -04:00
Stephen Kelly 32410140a7 Add $<LINK_LANGUAGE> generator expression
They can't be used when evaluating link libraries, but they can be
used for include directories and compile definitions. Later they can
be used for compile options.
2013-05-24 09:06:53 -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
Brad King ee334b6a0a Merge topic 'LinkLine-typedef'
776225d cmTarget: drop the unused local typedef LinkLine
2013-05-22 13:06:21 -04:00
Brad King fe4c1fb32e Merge topic 'add-EXPORT_NAME-property'
b5d6f5d Add EXPORT_NAME property.
2013-05-22 13:05:17 -04:00
Rolf Eike Beer 776225d379 cmTarget: drop the unused local typedef LinkLine 2013-05-22 12:54:57 -04:00
Brad King e41ef3d339 Merge topic 'unused-cleanup'
994dc70 Remove unused vector population.
44258cc Remove unused typedef.
0a4d7d8 Remove unused marker for a variable which is now used.
2013-05-21 15:19:22 -04:00
Brad King 1dbf0aac1b Merge topic 'fix-style'
3c7c332 Fix brace indentation.
c70b9b5 Fix style.
2013-05-21 15:13:49 -04:00
Brad King 5947d03987 Merge topic 'error-on-exported-missing-include-dir'
eabefa8 Error on relative path in INCLUDE_DIRECTORIES target property.
2013-05-21 15:13:26 -04:00
Stephen Kelly eabefa8b02 Error on relative path in INCLUDE_DIRECTORIES target property.
Add policy CMP0021 to preserve existing behavior in projects expecting
it from earlier CMake versions.
2013-05-21 14:59:17 -04:00
Stephen Kelly b5d6f5dd5b Add EXPORT_NAME property.
This allows for example, the buildsystem to use names like 'boost_any'
instead of the overly generic 'any', and still be able to generate
IMPORTED targets called 'boost::any'.
2013-05-18 10:00:48 +02:00
Brad King 0dc0e7d885 Merge topic 'doc-improvements'
7cc2805 Docs: Clarify wording "flag used" => "flag (to|will) be used"
2378a69 Docs: Clarify that CMAKE_*_(PREFIX|SUFFIX) affect filenames
56ca34d Docs: Update description of CMAKE_(BUILD_TYPE|CONFIGURATION_TYPES)
2bab472 VS10: add detailed comment about MIDL processing
e619111 Explain distribution of Win9x binary on all Windows versions.
5ca4336 FindwxWidgets: add DOC strings with usual style
f57800d Fix spelling and typos (product names)
bf019d7 Fix spelling and typos (non-binary)
ddac8d3 Fix spelling and typos (affecting binary data / module messages)
86832ce Fix spelling and typos (affecting users)
2013-05-16 14:38:07 -04:00
Brad King 1b4b64cd3c Merge topic 'vs-no-compiler-pdb-setting'
87c0d16 Ninja: Fix OBJECT_DIR placeholder path conversion
fb9f73d MSVC: Invoke 'link' directly for executables
42ba1b0 VS: Separate compiler and linker PDB files (#11899, #14062)
2013-05-16 14:36:11 -04:00
Stephen Kelly 0a4d7d883c Remove unused marker for a variable which is now used. 2013-05-16 19:34:21 +02:00
Stephen Kelly c70b9b51d9 Fix style. 2013-05-16 19:33:13 +02:00
Andreas Mohr f57800d6f5 Fix spelling and typos (product names)
API, Borland, MinGW, UNIX, Mac OS X.
2013-05-07 08:42:20 -04:00
Andreas Mohr ddac8d3d2d Fix spelling and typos (affecting binary data / module messages) 2013-05-07 08:39:19 -04:00
Stephen Kelly dea1df4e5e Memoize usage requirement include directories in a config-specific map
Commit 42ebb188 (Memoize includes and defines from interface libraries.,
2013-02-22) introduced caching of the includes.  Fix the memoization to
be configuration-specific so that we do not accumulate entries across
multiple evaluations in a multi-config generator.
2013-05-06 09:59:28 -04:00
Stephen Kelly 26dba6a162 Fix include dir propagation from conditionally linked targets
Generator expressions, including configuration-specific expressions may
be used as link libraries of targets.  The old-style keywords of
target_link_libraries are handled in terms of new generator expressions.
However, the generator expressions expect target names to be valid
against a regular expression, whereas target_link_libraries does not
require validation.  In generator expression constructed without any
action from the user we need to ensure that only valid expressions are
generated.  Ensure that strings which are not valid target names are not
used in generator expressions which validate the argument.

Code like

 target_link_libraries(B debug A)

generates usage requirement references such as "$<$<CONFIG:DEBUG>:A>".
When cmTarget::GetIncludeDirectories uses such references it generates
expressions like:

 $<TARGET_PROPERTY:$<$<CONFIG:DEBUG>:A>,INTERFACE_INCLUDE_DIRECTORIES>

When the conditions are false such references evaluate as an empty
string and the expression fails with an error such as:

 $<TARGET_PROPERTY:tgt,prop> expression requires a non-empty target name.

Fix this by teaching cmTarget::GetIncludeDirectories to wrap the above
expression inside a conditional:

 $<$<BOOL:$<$<CONFIG:DEBUG>:A>>:...>

so that $<TARGET_PROPERTY:...> will not be evaluated with an empty
target.
2013-05-06 09:55:45 -04:00
Stephen Kelly b8259c3d69 Centralize maintenance of usage requirement include directories
Maintain a target's internal list of usage requirement include
directories whenever the LINK_LIBRARIES property is set by either
target_link_libraries or set_property.
2013-05-06 09:54:11 -04:00
Brad King 42ba1b08f3 VS: Separate compiler and linker PDB files (#11899, #14062)
The MS tools create two types of PDB files as explained here:

 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.71%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.80%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.90%29.aspx
 http://msdn.microsoft.com/en-us/library/yd4f8bd1%28v=vs.100%29.aspx

One is created by the compiler (/Fd) and the other by the linker (/pdb).
The two options should not specify the same file.  Split them up.

In the VS IDE generators, simply drop ProgramDataBaseFileName to
take the VS default "/Fd$(IntDir)vc$(PlatformToolsetVersion).pdb".

In the Makefile generators, set "/Fd" on the compile line to be
the directory containing object files (with a trailing slash the
compiler will add the "vc$(PlatformToolsetVersion).pdb" filename
automatically).  Drop the /Fd option from the exe link command
line and add "/pdb" instead (already done for dll linking).
Update these rules for both MSVC and Intel tools.

Drop support for PDB_OUTPUT_DIRECTORY and PDB_NAME in STATIC
libraries because the generated .pdb files are only from /Fd
and not real linker-generated .pdb files.  Update documentation to
clarify that the PDB_* properties are only for linker .pdb files.

This regresses the PDBDirectoryAndName test for STATIC libraries.
Since it is not clear at this time what should be done for STATIC
library .pdb files, comment out the relevant portion of the test
and leave a TODO comment.
2013-04-05 11:25:09 -04:00
Brad King 2afcbe3090 Merge topic 'error-on-exported-missing-include-dir'
634bb33 Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
2013-03-28 10:42:42 -04:00
Stephen Kelly 634bb33f3a Error if linked target has relative paths in INTERFACE_INCLUDE_DIRECTORIES
We can do this check only if the TargetName is non-empty, which means
that we're evaluating INTERFACE_INCLUDE_DIRECTORIES from a linked
dependency which was set using target_link_libraries.

It is possible to have relative paths in INCLUDE_DIRECTORIES already
in CMake 2.8.10.2, so that part will require a policy to fix.
2013-03-26 19:56:10 +01:00
Brad King b9e4a5abb4 Merge topic 'error-on-exported-missing-include-dir'
28051f1 Report an error on IMPORTED targets with a faulty INTERFACE
af81a3c install(EXPORT): Ensure clean INTERFACE_INCLUDE_DIRECTORIES
2013-03-26 14:36:45 -04:00
Brad King 0261bdfc1d Merge topic 'fix-COMPILE_DEFINITIONS-config'
1703b00 Test evaluation of per-config COMPILE_DEFINITIONS (#14037)
a6286e9 Fix the evaluation of per-config COMPILE_DEFINITIONS (#14037)
2013-03-26 14:36:07 -04:00
Stephen Kelly 28051f1150 Report an error on IMPORTED targets with a faulty INTERFACE
It is considered an error if the INTERFACE_INCLUDE_DIRECTORIES contains
a directory which does not exist, which indicates a programmer error
by the upstream, or a packaging error.

One of the RunCMake.CompatibleInterface tests also needs to be updated
due to this change. Non-existant includes were used in the test, but
are not needed.
2013-03-26 10:45:28 -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 fc43477de0 Rename variable for including current directory in interfaces
Rename the variable added by commit 9ce1b9ef (Add
CMAKE_BUILD_INTERFACE_INCLUDES build-variable, 2012-11-25) to
CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE to be more consistent with the
existing CMAKE_INCLUDE_CURRENT_DIR variable.

Suggested-by: Alex Neundorf <neundorf@kde.org>
2013-03-19 16:44:17 -04:00
Stephen Kelly 1b386b3407 Document that CMAKE_AUTOMOC works with Qt 5. 2013-03-16 19:31:04 +01:00
Brad King 9a02a26702 Merge topic 'property-link-depends-no-crash'
ab079ee Avoid crash when checking property compatibility without link info
92a2ab7 Avoid crash when checking property link dependencies without link info
2013-03-13 13:34:20 -04:00
Brad King 26436346fb Merge topic 'doc-fixes'
3cf2f67 Documentation: Clarify a few subtleties
2013-03-13 13:33:53 -04:00
Brad King ab079ee682 Avoid crash when checking property compatibility without link info
Teach the compatibility check added by commit 042ecf04 (Add API to
calculate link-interface-dependent bool properties or error, 2013-01-06)
to return early if no link information is available.  This avoids
crashing in a case that should fail with an error message.
2013-03-12 17:25:59 -04:00
Brad King 92a2ab70b6 Avoid crash when checking property link dependencies without link info
Teach the isLinkDependentProperty helper added by commit e9879910 (Make
INTERFACE determined properties readable in generator expressions,
2013-01-19) to return early if no link information is available.
2013-03-12 17:17:24 -04:00
Petr Kmoch 3cf2f67adc Documentation: Clarify a few subtleties
* Clarify accepted values of <LANG> suffix in CMAKE_COMPILER_IS_GNU<LANG>.

* Clarify fact that target property GENERATOR_FILE_NAME usually cannot be
  used at configure time.

* Clarify that enable_language() can only be used in global scope of
  top-level project using language.

* State that enable_language(... OPTIONAL) currently doesn't work.

* Document regular expression operator precedence.
2013-03-12 09:29:55 -04:00
Stephen Kelly 254687d31f Only process transitive interface properties for valid target names.
Commit a1c4905f (Use the link information as a source of compile
definitions and includes., 2013-02-12) introduced the use of link
information as the source of target properties via the TARGET_PROPERTY
generator expression. This generator expression has a strict
interpretation of a valid target name and emits a fatal error for
invalid names.

Ensure that only targets with names valid for use with TARGET_PROPERTY
or targets which are determined by generator expressions are processed
by it. This means that at worst, invalid target names do not participate
in the transitive evaluation of properties, but the validation
generator expression can be extended where needed to resolve that.
2013-03-06 17:42:08 +01:00
Stephen Kelly dcb5907ed6 Fix RPATH information when only a genex is used as a link library.
As of commit 1da75022 (Don't include generator expressions in
old-style link handling., 2012-12-23), such entries are not
included in the LinkLibraries member. Generator expressions in
LinkLibraries are not processed anyway, so port to the new way
of getting link information.
2013-02-28 18:25:33 +01:00
Stephen Kelly 42ebb1886f Memoize includes and defines from interface libraries.
This is similar in spirit to commit e48d8420 (Cache context-independent
includes on evaluation., 2013-02-03), but it is needed since commit
a1c4905f (Use the link information as a source of compile definitions
and includes., 2013-02-12), which changed how includes and defines
are determined. As they are now determined through the link interface,
we need to cache the result of evaluating them through that.

In the case of the includes, the result was already being cached
and then immediately disposed. Store the result as a member variable
instead to make use of the caching.
2013-02-24 22:04:20 +01:00
Stephen Kelly a1c4905f72 Use the link information as a source of compile definitions and includes.
After evaluating the INTERFACE_INCLUDE_DIRECTORIES, of a target in a
generator expression, also read the INTERFACE_INCLUDE_DIRECTORIES of
its link interface dependencies.

That means that code such as this will result in the 'user' target
using /bar/include and /foo/include:

 add_library(foo ...)
 target_include_directories(foo INTERFACE /foo/include)
 add_library(bar ...)
 target_include_directories(bar INTERFACE /bar/include)
 target_link_libraries(bar LINK_PUBLIC foo)

 add_executable(user ...)
 target_include_directories(user PRIVATE
    $<TARGET_PROPERTY:bar,INTERFACE_INCLUDE_DIRECTORIES>)

Also process the interface include directories from direct link
dependencies for in-build targets.

The situation is similar for the INTERFACE_COMPILE_DEFINITIONS. The
include directories related code is currently more complex because
we also need to store a backtrace at configure-time for the purpose
of debugging includes. The compile definitions related code will use
the same pattern in the future.

This is not a change in behavior, as existing code has the same effect,
but that existing code will be removed in follow-up commits.
2013-02-13 15:12:30 +01:00
Stephen Kelly 5b88504f65 Rename the IncludeDirectoriesEntry to be more generic. 2013-02-12 10:39:35 +01:00
Stephen Kelly faa927e273 Make sure INTERFACE properties work with OBJECT libraries. 2013-02-08 20:10:22 +01:00
Stephen Kelly 4de71786e8 Ensure that the build interface includes have been added.
This is needed in the case that Automoc is used, as that calls
GetIncludeDirectories, which may cache the resulting include dirs
too early in the generate step.

Also, because the automoc step is so early, we can't cache the
include directories at that point. At that point the build interface
of all dependencies are not populated yet, so we'd be caching the
includes before appending the build interface. Only start caching
when we're definitely generating the buildsystem. At that point, the
includes should be stable.

We still need to invoke AppendBuildInterfaceIncludes
in the GlobalGenerator because the build interface includes affect
mostly the dependencies of targets (such as the automoc targets),
rather than the targets themselves, so the build interface needs
to be appended for all targets before generation is done.
2013-02-08 12:54:27 +01:00
Stephen Kelly df74bc34d4 Only append build interface include dirs to particular targets.
We shouldn't set the property on all custom targets.
2013-02-07 21:57:35 +01:00
Stephen Kelly d4e5c6787c Don't keep track of content determined by target property values.
This tracking was added during the development of commit 042ecf04
(Add API to calculate link-interface-dependent bool properties
or error., 2013-01-06), but was never used.

It was not necessary to use the content because what is really
useful in that logic is to determine if a property has been implied
to be null by appearing in a LINK_LIBRARIES genex.

I think the motivating usecase for developing the feature of
keeping track of the targets relevant to a property was that I
thought it would  make it possible to allow requiring granular
compatibility of interface properties only for targets which
depended on the interface property. Eg:

 add_library(foo ...)
 add_library(bar ...)

 add_executable(user ...)
 # Read the INTERFACE_POSITION_INDEPENDENT_CODE from bar, but not
 # from foo:
 target_link_libraries(user foo $<$<TARGET_PROPERTY:POSTITION_INDEPENDENT_CODE>:bar>)

This obviously doesn't make sense. We require that INTERFACE
properties are consistent across all linked targets instead.
2013-02-07 16:21:09 +01:00
Stephen Kelly 1fb545ad3a Move a special case for PIC from the genex to the cmTarget code. 2013-02-07 16:21:09 +01:00
Stephen Kelly 655e98bf71 Ensure type specific compatible interface properties do not intersect.
Before, the boolean version would always win, and the string one would
be ignored.
2013-02-07 16:21:09 +01:00
Stephen Kelly 46e28960a5 The COMPATIBLE_INTERFACE does not affect the target it is set on.
Test and document this.
2013-02-07 16:21:09 +01:00
Stephen Kelly 92e98dd909 Deduplicate the isGeneratorExpression method.
This API seems like the most appropriate.
2013-02-07 16:21:08 +01:00
Brad King ec85306025 Merge topic 'tll-includes-defines'
e48d842 Cache context-independent includes on evaluation.
089fe1c Optimize genex evaluation for includes and defines.
179f495 find_package: Reword <package>_NO_INTERFACES documentation
e7b579b Test workaround of bad interface include directories from depends.
77cecb7 Add includes and compile definitions with target_link_libraries.
0b92602 Add the $<LINKED:...> generator expression.
0fa7f69 Add API to check if we're reading a includes or defines property.
2c3654c Add a way to exclude INTERFACE properties from exported targets.
d4297d5 Export targets to a targets file, not a Config file.
df4d2b2 Make it an error for INSTALL_PREFIX to be evaluated.
7ceeba9 Advance more when preprocessing exported strings.
30268b4 Handle reading empty properties defined by the link interface.
2013-02-05 14:46:43 -05:00
Stephen Kelly b6f6654267 Use the result of converting to a unix path.
The commit 18a3195a ('Keep track of INCLUDE_DIRECTORIES as a vector
of structs.', 2012-11-19) moved the handling of includes from
cmGeneratorTarget to cmTarget, but in the process introduced this
bug.
2013-02-05 09:19:27 +01:00
Stephen Kelly e48d84209c Cache context-independent includes on evaluation.
Generator expressions whose output depends on the configuration
now record that fact. The GetIncludeDirectories method can use
that result to cache the include directories for later calls.

GetIncludeDirectories is called multiple times for a target
for each configuration, so this should restore performance for
multi-config generators.
2013-02-03 23:04:03 +01:00
Brad King 3e7bba3fb2 Merge topic 'fix-automoc-compile-defs'
429e369 Process COMPILE_DEFINITIONS as generator expressions in QtAutomoc.
0e10782 Move GetCompileDefinitions to cmTarget.
2013-01-29 14:52:13 -05:00
Stephen Kelly 0e10782ba7 Move GetCompileDefinitions to cmTarget. 2013-01-29 14:11:49 -05:00
Stephen Kelly 2fb2c32f9b Add the COMPATIBLE_INTERFACE_STRING property. 2013-01-24 20:36:04 +01:00
Stephen Kelly cd66b9131d Make calculation of link-interface-dependent properties type-sensitive. 2013-01-24 20:36:04 +01:00
Brad King 7db963a017 Merge topic 'clean-include-dirs-debugging'
6063fef Output include directories as LOG messages, not warnings.
aa66748 Specify the target whose includes are being listed.
d70204a Only output includes once after the start of 'generate-time' when debugging.
0d46e9a Store includes from the same include_directories call together.
2013-01-23 15:11:36 -05:00
Brad King 7a336d2e31 Merge topic 'fix-LINK_LIBRARIES-population'
d7f1520 Don't wrap all targets in LINK_LIBRARIES in a TARGET_NAME genex.
2013-01-23 15:11:28 -05:00
Brad King a37b0e3ebf Merge topic 'qt4-autolink-qtmain'
e3b5eb6 Automatically link to the qtmain library when linking to QtCore.
6c8d8af Add the $<TARGET_POLICY> expression
2013-01-23 15:11:24 -05:00
Stephen Kelly e3b5eb6b23 Automatically link to the qtmain library when linking to QtCore.
When using QAxServer, ensure that the qtmain library is excluded
by reporting an error at CMake time if it is not.
2013-01-23 14:15:41 -05:00
Stephen Kelly aa6674831c Specify the target whose includes are being listed. 2013-01-21 09:12:22 +01:00
Stephen Kelly d70204a86a Only output includes once after the start of 'generate-time' when debugging.
During configure-time, GetIncludeDirectories may be called too, for example
if using the export() command. As the content can be different, it should
be output each time then.
2013-01-21 09:12:22 +01:00
Stephen Kelly bd82bb4787 Clear the link information in ClearLinkMaps.
The cache here needs to be cleared if GetLinkInformation is called
at configure-time, such as during an export().

The next commit does exactly that, and without this patch,
the LinkLanguage test would fail.
2013-01-21 09:05:03 +01:00
Stephen Kelly e98799105b Make INTERFACE determined properties readable in generator expressions.
The properties are evaluated as link-dependent interface properties when
evaluating the generator expressions.
2013-01-20 17:06:47 +01:00
Stephen Kelly d7f1520938 Don't wrap all targets in LINK_LIBRARIES in a TARGET_NAME genex.
It is not necessary and the current state is unintentional. Before
this patch,

 target_link_libraries(foo bar)

causes the LINK_LIBRARIES property of foo to contain

 $<TARGET_NAME:bar>

instead of just

 bar
2013-01-20 11:25:35 +01:00
Stephen Kelly d9afacced3 Exit early if we find an inconsistent property.
Further messages about inconsistency are distracting.
2013-01-18 16:10:37 +01:00
Stephen Kelly 1800f702a0 Populate the link information cache before checking dependent properties.
The dependent properties check can require the link information.
2013-01-16 22:43:49 +01:00
Brad King 3a7d1ce3ff Merge topic 'test-export-iface-genex'
1d74ba2 Test evaluation target via export for generator expressions
522bdac Export the INTERFACE_PIC property.
4ee872c Make the BUILD_INTERFACE of export()ed targets work.
1d47cd9 Add a test for the interfaces in targets exported from the build tree.
6c828f9 Move the exported check for file existence.
cfd4f0a Move the exported check for dependencies of targets
d8fe1fc Only generate one check per missing target.
f623d37 Don't write a comment in the export file without the code.
b279f2b Strip consecutive semicolons when preprocessing genex strings.
2013-01-15 14:43:05 -05:00
Stephen Kelly 4ee872cb99 Make the BUILD_INTERFACE of export()ed targets work.
The existing BUILD_INTERFACE code is executed at generate time, which
is too late for export().
2013-01-15 14:36:22 -05:00
Brad King 8d91e23565 Merge topic 'tll-allow-genex'
1da7502 Don't include generator expressions in old-style link handling.
2013-01-15 14:34:29 -05:00
Stephen Kelly 7171fd0a90 Add a way to check INTERFACE user property compatibility. 2013-01-15 14:33:45 -05:00
Stephen Kelly 1da75022bb Don't include generator expressions in old-style link handling.
Don't add generator expressions to variables which are used
for CMP0003, CMP0004, and the old-style _LIB_DEPENDS content. They
will not be evaluated when read anyway and would probably confuse
the code reading them.

This makes it legitimate to use target_link_libraries with generator
expressions as arguments.
2013-01-13 09:59:42 +01:00
Stephen Kelly 77d2646784 Allow generator expressions in LINK_INTERFACE_LIBRARIES.
The Config and IMPORTED_ variants may also contain generator
expressions.

If 'the implementation is the interface', then the result of
evaluating the expressions at generate time is used to populate
the IMPORTED_LINK_INTERFACE_LIBRARIES property.

1) In the case of non-static libraries, this is fine because the
  user still has the option to populate the LINK_INTERFACE_LIBRARIES
  with generator expressions if that is what is wanted.

2) In the case of static libraries, this prevents a footgun,
  enforcing that the interface and the implementation are really
  the same.

  Otherwise, the LINK_LIBRARIES could contain a generator
  expression which is evaluated with a different context at build
  time, and when used as an imported target. That would mean that the
  result of evaluating the INTERFACE_LINK_LIBRARIES property for
  a static library would not necessarily be the 'link implementation'.

  For example:

    add_library(libone STATIC libone.cpp)
    add_library(libtwo STATIC libtwo.cpp)
    add_library(libthree STATIC libthree.cpp)

    target_link_libraries(libtwo
      $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>:libone>)
    target_link_libraries(libthree libtwo)

  If the LINK_LIBRARIES content was simply copied to the
  IMPORTED_LINK_INTERFACE_LIBRARIES, then libthree links to libone, but
  executables linking to libthree will not link to libone.

3) As the 'implementation is the interface' concept is to be
  deprecated in the future anyway, this should be fine.
2013-01-10 23:04:06 +01: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 042ecf0471 Add API to calculate link-interface-dependent bool properties or error.
This new method checks that the property FOO on a target is consistent
with the INTERFACE_FOO properties of its dependees. If they are not the
consistent, an error is reported. 'Consistent' means that iff the
property is set, it must have the same boolean value as all other
related properties.
2013-01-08 20:38:16 +01:00
Stephen Kelly bf5ece51c3 Keep track of properties used to determine linker libraries.
Those properties can't later be implicitly defined by the interface
of those link libraries.
2013-01-08 20:38:16 +01:00
Stephen Kelly 7653862798 Add LINK_LIBRARIES property for direct target link dependencies
Previously we kept direct link dependencies in OriginalLinkLibraries.
The property exposes the information in the CMake language through the
get/set_property commands.  We preserve the OriginalLinkLibraries value
internally to support old APIs like that for CMP0003's OLD behavior, but
the property is now authoritative.  This follows up from commit d5cf644a
(Split link information processing into two steps, 2012-11-01).

This will be used later to populate the link interface properties when
exporting targets, and will later allow use of generator expressions
when linking to libraries with target_link_libraries.

Also make targets depend on the (config-specific) union of dependencies.
CMake now allows linking to dependencies or not depending on the config.
However, generated build systems are not all capable of processing
config-specific dependencies, so the targets depend on the union of
dependencies for all configs.
2013-01-08 09:02:43 -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
Stephen Kelly 894f52f32d Handle INTERFACE properties transitively for includes and defines.
Contextually, the behavior is as if the properties content from another
target is included in the string and then the result is evaluated.
2013-01-05 01:18:37 +01:00
Stephen Kelly d0f950fdba Use mapped config properties to evaluate $<CONFIG> 2013-01-05 01:18:36 +01:00
Stephen Kelly 0941d6232a Add a way to print the origins of used include directories. 2013-01-03 13:45:40 -05:00
Stephen Kelly 18a3195ad5 Keep track of INCLUDE_DIRECTORIES as a vector of structs.
The struct can keep track of where the include came from, which gives
us proper backtraces.
2013-01-03 13:45:40 -05:00
Stephen Kelly 76ea420fb9 Use cmsys::auto_ptr to manage cmCompiledGeneratorExpressions
The compiled generator expressions need to outlive the creating
type. For the same reason, store the input string in a std::string.
2012-12-20 12:17:37 +01:00
Brad King f0d938549e Makefile: Use modern link information for framework search paths
Use cmComputeLinkInformation::GetFrameworkPaths to get the list of
framework paths needed by the linker.  Drop the now unused framework
information from the old-style cmTarget link dependency analysis.
2012-12-07 15:29:21 -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
Stephen Kelly d5cf644ac2 Split link information processing into two steps.
The first step can be ported to use the generator expression API,
while the second can not. This is for compatibility with CMP0003.
2012-11-21 15:49:36 +01:00
Brad King 508504ab6f Merge topic 'per-config-EXCLUDE_FROM_DEFAULT_BUILD'
739f166 Serialize tests for EXCLUDE_FROM_DEFAULT_BUILD
e31d83b Define property EXCLUDE_FROM_DEFAULT_BUILD
d1f8828 Add property EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>
b777272 Add tests for EXCLUDE_FROM_DEFAULT_BUILD
2012-11-20 11:47:35 -05:00
Brad King 035c29fee4 Merge topic 'link-depends-no-shared'
306796e Teach BuildDepends test to cover LINK_DEPENDS_NO_SHARED
ed97631 Optionally skip link dependencies on shared library files
2012-11-13 14:31:54 -05:00
Petr Kmoch e31d83b3b8 Define property EXCLUDE_FROM_DEFAULT_BUILD
Add definition and documentation of properties EXLCUDE_FROM_DEFAULT_BUILD
and EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>.
2012-11-13 09:08:46 -05:00
Brad King f309366873 Fix default PDB output directory (#13644)
The ComputePDBOutputDir added by commit 3f60dbf1 (Add
PDB_OUTPUT_DIRECTORY and PDB_NAME target properties, 2012-09-25) falls
back to the current binary directory instead of the target output
directory as before.  When no PDB_OUTPUT_DIRECTORY property is set we
instead should fall back to the target output directory where .pdb files
used to go before the new property was added.
2012-11-02 12:49:44 -04:00
Brad King ed9763136a Optionally skip link dependencies on shared library files
Add target property LINK_DEPENDS_NO_SHARED and initialization variable
CMAKE_LINK_DEPENDS_NO_SHARED to enable this behavior.

Suggested-by: Leif Walsh <leif.walsh@gmail.com>
2012-10-26 08:28:16 -04:00
Brad King 15cc55fe08 Merge topic 'documentation-cleanup'
4ad0233 Remove period at the end of the check message.
50b1ea5 Fix minor typos.
19c3206 Remove unused parameter marker and the unused parameter.
9d462b2 Document that generator expressions can be used in target properties.
daf88c3 Fix punctuation in some variables documentation.
3172cde Fix the layout of the generator expression documentation.
2012-10-01 14:05:44 -04:00
Brad King 7dce31f3d0 Merge topic 'vs-pdb-output'
2ccca05 Run PDBDirectoryAndName test on MSVC and Intel
efc83b3 Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6
b294457 Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test
3f60dbf Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
2012-10-01 14:05:11 -04:00
Stephen Kelly 50b1ea5bed Fix minor typos.
nothe -> note
than -> that
duplicat -> duplicate
directory -> directly
Wipe wipe -> Wipe
2012-09-29 18:44:10 +02:00
Stephen Kelly 19c3206bdc Remove unused parameter marker and the unused parameter. 2012-09-29 18:42:56 +02:00
Stephen Kelly 9d462b22a3 Document that generator expressions can be used in target properties. 2012-09-29 18:42:56 +02:00
Brad King efc83b369b Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6 2012-09-25 15:23:35 -04:00
Yuchen Deng 3f60dbf148 Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
This enables changing the name and output folder of the debug symbol
files produced by MS compilers.

Inspired-by: Thomas Bernard <thomas.bernard@ipetronik.com>
2012-09-25 15:23:35 -04:00
Stephen Kelly 879fd354c1 Revert "Move GenerateTargetManifest to cmGeneratorTarget."
This reverts commit 987e12e2f9.

GenerateTargetManifest is called by the global generator before it
creates the generator targets, so we can't move it to cmGeneratorTarget
yet.
2012-09-20 08:34:30 +02:00
Stephen Kelly 290e92ada8 Move GetIncludeDirectories to cmGeneratorTarget. 2012-09-19 15:32:09 +02:00
Stephen Kelly 9facfd1336 Move GetCreateRuleVariable to cmGeneratorTarget. 2012-09-19 15:31:32 +02:00