Commit Graph

1018 Commits

Author SHA1 Message Date
Brad King b3b44d138e cmTarget: Rename old-style link dependencies code as "ForVS6"
The old link dependency analysis is now needed only for the VS 6
generator code delimited by CM_USE_OLD_VS6 to support project-provided
project templates.  Rename the related cmTarget members to be "ForVS6".
2014-07-14 14:37:04 -04:00
Brad King 1ca0c0e94a cmTarget: Refactor internal imported LinkInterface map
Create the map entry up front and store in it a boolean value indicating
whether the LinkInterface structure has been populated.  This approach
leads to shorter code that is easier to follow too.
2014-07-14 10:21:46 -04:00
Brad King 102eea60cd cmTarget: Simplify internal ComputeLinkInterfaceLibraries method
Now that the method can see the full OptionalLinkInterface structure,
store information there instead of passing it through arguments.
2014-07-14 10:00:51 -04:00
Brad King b0f5740851 cmTarget: Move ComputeLinkInterfaceLibraries to internals
There are no external callers, and this will allow the method to see
the full OptionalLinkInterface internal structure.
2014-07-14 09:55:52 -04:00
Brad King c69e8a5580 cmTarget: Refactor internal LinkInterface map
Create the map entry up front and store in it boolean values indicating
which pieces of the LinkInterface structure have been populated.
This approach leads to shorter code that is easier to follow too.
2014-07-14 09:51:51 -04:00
Brad King 4db3990e9f cmTarget: Drop 'head' argument from processSources
No call sites need it to be anything but 'this'.
2014-07-14 09:46:53 -04:00
Brad King 4b8130b8de cmTarget: Drop 'head' argument from GetSourceFiles
No call sites need it to be anything but 'this'.
2014-07-14 09:46:53 -04:00
Brad King 4c763dd1f1 cmTarget: Drop 'head' argument from GetLanguages
No call sites need it to be anything but 'this'.
2014-07-14 09:46:53 -04:00
Brad King 190cabe7c1 cmTarget: Drop 'head' argument from ComputeLinkImplementationLanguages
No call sites need it to be anything but 'this'.
2014-07-14 09:46:53 -04:00
Brad King 5ba3cbbd24 Merge topic 'refactor-link-internals'
f45ede61 cmTarget: Fix CMP0022 OLD breakage from recent refactoring
2014-07-14 09:38:00 -04:00
Brad King affe9d56a2 Allow INTERFACE_SOURCES to specify $<TARGET_OBJECTS> (#14970)
Fix cmTarget::GetSourceFiles to set EvaluateForBuildsystem on the
$<TARGET_PROPERTY:...,INTERFACE_SOURCES> generator expression so that
the $<TARGET_OBJECTS> generator expression is allowed within an
INTERFACE_SOURCES value.

Extend the InterfaceLibrary test to cover this case.  Extend the
RunCMake.TargetObjects test to cover failure of $<TARGET_OBJECTS>
when used through $<TARGET_PROPERTY:...,INTERFACE_SOURCES> in a
non-buildsystem context.
2014-07-14 09:09:32 -04:00
Brad King f45ede61a1 cmTarget: Fix CMP0022 OLD breakage from recent refactoring
In commit 7b0834e9 (cmTarget: Refactor internal LinkImplementation map,
2014-06-19) cmTarget::GetLinkImplementationLibrariesInternal was changed
accidentally to pass "this" to ComputeLinkImplementation instead of
"head".  Change it back.
2014-07-10 16:01:04 -04:00
Brad King 93790506f5 cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication.  In
TargetPropertyEntry, replace the TargetName string member with a
reference to the full cmLinkImplItem that produced the entry.  This is
possible because the cmLinkImplItem is available in AddInterfaceEntries
(it was not available in GetIncludeDirectories).  Having the full
cmLinkImplItem allows processIncludeDirectories to implement CMP0027 OLD
behavior without repeating the target name lookup.

Update the RunCMake.CompatibleInterface test DebugProperties case
expected output for the new order of the messages.
2014-07-07 08:52:42 -04:00
Brad King b5b098ebb3 cmTarget: Simplify CMP0027 logic in processIncludeDirectories
Evaluate and lookup the target name only once per TargetPropertyEntry
instead of repeating it for each include directory entry.  Use a local
checkCMP0027 variable to record whether the policy should be checked.
Evaluate the target name as a generator expression only if it looks like
one.  Lookup the target by name only after evaluation of generator
expressions.
2014-07-07 08:52:41 -04:00
Brad King 5e07dcf7c8 cmTarget: Add to LinkImplementation whether each library was a genex
Implementation of CMP0027 OLD behavior needs to know whether each entry
in LinkImplementation::Libraries came from a generator expression or
not.  Add a FromGenex member to cmLinkImplItem to record this.
2014-07-07 08:52:41 -04:00
Brad King f77b384cf6 cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication.
2014-07-07 08:52:41 -04:00
Brad King 61ef8daad5 cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication.
2014-07-07 08:52:41 -04:00
Brad King d9586f83f1 cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication.
2014-07-07 08:52:40 -04:00
Brad King 3156275bc7 cmTarget: Simplify INTERFACE_SOURCES usage requirement lookup
Use the AddInterfaceEntries helper to avoid duplication.
2014-07-07 08:52:40 -04:00
Brad King 363cd33ebe cmTarget: Add method to add usage requirements from linked interfaces
Create a cmTargetInternals::AddInterfaceEntries method to construct a
$<TARGET_PROPERTY:tgt,INTERFACE_XYZ> generator expression and evaluate
it for every target in the link implementation.  This will be useful to
de-duplicate such evaluation for each usage requirement separately.

The new method will soon be used in the implementation of the
INTERFACE_* usage requirement lookup methods (GetSourceFiles,
GetCompileOptions, GetCompileDefinitions, GetCompileFeatures,
GetIncludeDirectories).  It is necessary for these methods to determine
whether an expression in LinkImplementationPropertyEntries evaluates to
a target or not because generator expression evaluation reports an error
for non-targets and we construct a $<TARGET_PROPERTY:tgt,INTERFACE_XYZ>
expression for each entry that is a target.

The implementation of each usage requirement currently processes the
LinkImplementationPropertyEntries and evaluates all generator
expressions to determine targets.  That is no longer necessary because
GetLinkImplementationLibraries now returns resolved and cached targets
together with their name.  Use it to implement AddInterfaceEntries.
2014-07-07 08:52:40 -04:00
Brad King 251e835b3f cmTarget: Add to LinkImplementation a backtrace for each library
Allow clients to provide backtrace context on evaluation diagnostics.
2014-07-07 08:52:40 -04:00
Brad King 848c8ccf18 cmTarget: Refactor LinkImplementation to allow more information
Create a cmLinkImplItem class derived from cmLinkItem so more
information can be added to link implementation entries than link
interface entries.  Convert the LinkImplementation Libraries member to
hold it.  Update client sites accordingly.
2014-07-07 08:52:39 -04:00
Stephen Kelly 65aa5442b7 Target: Return null when a transitive property is not defined.
Commit v2.8.11~310^2~1 (Keep track of INCLUDE_DIRECTORIES as a vector of
structs., 2012-11-19) added special case of INCLUDE_DIRECTORIES
for the purpose of origin-tracking of individual entries in the property. It
introduced a bug in that it returned an empty string instead of '0' in the
case that no includes have been set.

Commit v2.8.11~289^2~2 (Handle INTERFACE properties transitively for includes
and defines., 2012-09-23) introduced transitive handling of the property
through the link implementation, together with a whitelist of properties
which would be evaluated transitively. Because of the bug introduced
previously, the 'prop' in TargetPropertyNode is non-null,
meaning that the content (the empty string) would be evaluated as a generator
expression.  This was harmless as the follow-up code was only for 'INTERFACE_'
variants of target properties, so the effect was the same.

Commits v2.8.11~280^2~2 (Keep track of properties used to determine linker
libraries., 2012-11-05) and v2.8.11~280^2~1 (Add API to calculate
link-interface-dependent bool properties or error., 2013-01-06) added a way
to track and report errors on properties which both determine and are
determined by the link implementation.  This was later used in generator
expression evaluation by commit v2.8.11~252^2~2 (Make INTERFACE determined
properties readable in generator expressions., 2013-01-19).  If a property
is unset (null), and the link implementation of the target was not being
evaluated, this commit made it possible to evaluate the property from the
link implementation instead.  If the link implementation was being evaluated,
an empty string was returned from the generator expression evaluation, which
might be later reported as an error.

The above logic was written for 'compatible interface' properties, but in
fact it should have also included other properties.  Because of the
empty-string-instead-of-null bug, this code block is not entered for the
INCLUDE_DIRECTORIES property.  At this point, however, the bug still does
not significantly affect behavior, because the follow-up code is still a
no-op for the INCLUDE_DIRECTORIES property, and an empty string is returned
regardless. Commit v2.8.11~189^2~6 (Use the link information as a source of
compile definitions and includes., 2013-02-12) refactored the logic, but also
without a change in behavior.

Commit v2.8.11~156^2~2 (Expand includes and defines transitively
in 'external' genexes., 2013-02-13) refactored the logic again, this time with
a change of behavior. The INCLUDE_DIRECTORIES property was then mapped to
INTERFACE_INCLUDE_DIRECTORIES during transitive generator expression
evaluation.  Because the transitive evaluation involved evaluation of the
link implementation, this introduced a recursive loop and a segfault with
code like:

  add_library(empty1 ...)
  add_library(empty2 ...)
  target_link_libraries(empty1
    PRIVATE
      $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
  )

As there is no real use-case for reading a target property like that while
evaluating the link implementation, this went unnoticed.  The same pattern
was followed for other special-cased reads of transitive target properties
such as COMPILE_DEFINITIONS.

The segfault was fixed in the parent commit, but change the property to
return null when appropriate for other future uses.
2014-07-02 00:10:58 +02:00
Brad King 2463797996 cmTarget: Refactor ComputeLinkImplementation
Use LinkImplementationPropertyEntries directly instead of asking
GetProperty to construct a string for LINK_LIBRARIES.  This gives us
access to the entry backtraces.
2014-06-25 10:33:36 -04:00
Brad King 7812d2a912 cmTarget: Pre-indent a block in ComputeLinkImplementation
Prepare to move it into another block without extra whitespace changes.
2014-06-25 10:33:36 -04:00
Brad King f48d8bd6f6 cmTarget: Shorten a long line in ComputeLinkImplementation
Prepare to change its indentation without exceeding line length limit.
2014-06-25 10:33:36 -04:00
Brad King 7b0834e9bb cmTarget: Refactor internal LinkImplementation map
If ComputeLinkImplementationLanguages were ever to cause
GetLinkImplementationLibraries to be invoked then a LinkImplMap entry
may appear in the middle of computing it in GetLinkInformation.  Instead
create the map entry up front and store in it boolean values indicating
which pieces of the LinkImplementation structure have been populated.
This approach leads to shorter code that is easier to follow too.
2014-06-25 10:33:36 -04:00
Brad King b8651d970d cmTarget: Remove unnecessary 'mutable' markup
Members of the cmTargetInternals structure do not need to be made
'mutable' even to cache data because there is no reason for the
internal methods to be 'const'.
2014-06-25 10:33:36 -04:00
Brad King 0192be5181 cmTarget: De-duplicate link interface evaluation for $<LINK_ONLY>
Teach GetTransitivePropertyTargets to use the GetLinkInterfaceLibraries
method with usage_requirements_only==true instead of evaluating the
INTERFACE_LINK_LIBRARIES property directly.  This avoids duplicate
evaluations and makes use of the caching done by
GetLinkInterfaceLibraries.
2014-06-25 10:20:52 -04:00
Brad King 6ead631bf9 cmTarget: Teach GetLinkInterfaceLibraries to support $<LINK_ONLY>
Add a 'usage_requirements_only' parameter to GetLinkInterfaceLibraries
and supporting internal APIs to pass through to ExpandLinkItems so it
knows whether to use SetTransitivePropertiesOnly while evaluating
generator expressions.
2014-06-25 10:01:56 -04:00
Brad King b030a7f1ca cmTarget: De-duplicate link interface genex code for $<LINK_ONLY>
Simplify the implementation of GetTransitivePropertyTargets by using
ExpandLinkItems with usage_requirements_only==true to evaluate the
generator expressions in the link interface for us.
2014-06-25 09:32:38 -04:00
Brad King 1001490df2 cmTarget: Teach ExpandLinkItems how to support $<LINK_ONLY>
Add a 'usage_requirements_only' parameter to ExpandLinkItems so that it
knows whether to use SetTransitivePropertiesOnly while evaluating
generator expressions.  Update existing call sites to pass 'false' since
they are for linking and not usage requirements.
2014-06-25 09:32:21 -04:00
Brad King f5c18c9c1c cmTarget: Drop GetDirectLinkLibraries methods
Inline the implementation in the last remaining caller and drop the
methods.
2014-06-23 09:22:08 -04:00
Brad King 281eb3d8a6 cmTarget: Improve HaveBuildTreeRPATH implementation
Use GetLinkImplementationLibraries instead of GetDirectLinkLibraries
because it tells us whether there will be any libraries to link after
evaluating generator expressions.  Also GetDirectLinkLibraries will be
dropped soon.
2014-06-23 09:22:08 -04:00
Brad King d912220eaa cmTarget: Lookup targets in LinkInterface and LinkImplementation
Instead of storing just the string names in these structures, lookup any
target associated with each item and store its cmTarget pointer.  Use
the cmLinkItem class to hold the name and pointer together.  Update
client sites to use the pre-stored lookup result instead of looking up
the target name again.

Create a cmTarget::LookupLinkItems helper method to handle the lookup.
Since lookups are now moving from cmComputeLinkDepends::AddLinkEntries
to cmTarget::LookupLinkItems, move use of CheckCMP0004 to the latter.
This drops use of CheckCMP0004 from entries added for _LIB_DEPENDS
variables by cmComputeLinkDepends::AddVarLinkEntries, but I do not
think that use was intentional originally anyway.
2014-06-23 09:22:07 -04:00
Brad King 097be4139d cmTarget: Add GetUtilityItems to get target ordering dependencies
Add a method like GetUtilities but that provides the target names
already looked up and resolved to cmTarget pointers internally.  Update
call site in cmComputeTargetDepends::AddTargetDepend to use the
already-found target instead of looking it up again.
2014-06-23 09:21:56 -04:00
Brad King a272344228 Fix scope of transitive target name lookups
In cmTarget, cmGeneratorTarget, and cmGeneratorExpressionEvaluator, fix
target name lookups to occur in the cmMakefile context of the target
that referenced the name, not the current 'head' target.  The context
matters for imported targets because they are directory-scoped instead
of globally unique.  We already do this in cmComputeLinkDepends and
cmComputeTargetDepends.

Extend the InterfaceLibrary test with an example covering this behavior.
2014-06-23 09:17:07 -04:00
Brad King 069d60fe03 cmTarget: Add method to lookup other targets in a target's scope
Move the main implementation of cmComputeLinkDepends::FindTargetToLink
into cmTarget.
2014-06-23 09:17:06 -04:00
Brad King 47ab3ca641 cmTarget: Constify GetLinkImplementationClosure results
Populate a vector of "cmTarget const*" instead of "cmTarget*".
2014-06-23 09:17:06 -04:00
Brad King 9f3ed029ce cmTarget: Constify GetTransitivePropertyTargets results
Populate a vector of "cmTarget const*" instead of "cmTarget*".
2014-06-23 09:17:06 -04:00
Brad King 6f0951af01 cmTarget: Drop 'head' target from GetImportInfo
Move generator expression evaluation for imported library lists out of
GetImportInfo and into a new GetImportLinkInterface helper.  This avoids
duplicating the computation and storage of all imported target info just
because some of it is parameterized on the 'head' target.
2014-06-23 09:17:06 -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 4ac72455fd cmTarget: Drop 'head' argument from GetLinkClosure
It is only ever passed the 'this' target itself.
2014-06-23 09:14:45 -04:00
Brad King bcdb7ff9df cmTarget: Remove 'head' argument from GetLinkerLanguage
It is only ever called with the 'this' target as the head.

Co-Author: Stephen Kelly <steveire@gmail.com>
2014-06-23 09:14:45 -04:00
Brad King bd9b667bbe cmComputeLinkInformation: Remove 'head' argument
It is only ever constructed with the current target as its own 'head'.

Co-Author: Stephen Kelly <steveire@gmail.com>
2014-06-23 09:14:45 -04:00
Brad King 06328dd58e cmTarget: Remove 'head' argument from GetLinkInformation
No call sites use it anyway.

Co-Author: Stephen Kelly <steveire@gmail.com>
2014-06-23 09:14:45 -04:00
Brad King 56aed7005a cmTarget: Cache GetLinkImplementationClosure results
Store them internally and return by reference to avoid duplicate
computation.
2014-06-23 09:14:44 -04:00
Brad King cbf689c7dd cmTarget: Rename Get{TransitiveTarget => LinkImplementation}Closure
The method computes the transitive closure of targets starting with
the current target link implementation libraries.  Clarify the name.
2014-06-23 09:14:44 -04:00
Brad King 2f0004c143 cmTarget: Remove 'head' argument from GetTransitiveTargetClosure
The method is never called with any headTarget besides "this".
2014-06-23 09:14:44 -04:00
Brad King e838e0a977 cmTarget: Simplify processILibs implementation
Combine the outer two if() conditions into a single one with &&.
Scope inner lookup result inside its condition.
2014-06-23 09:14:43 -04:00
Brad King 8d15a1bbfb cmTarget: De-duplicate library list expansion
Create an ExpandLinkItems method to handle evaluation of generator
expressions in a library list and expansion of the ;-list into a vector.
Replace some duplicate copies of the implementation with calls to the
new helper.
2014-06-23 08:50:08 -04:00
Brad King 6354df92b1 cmTarget: Remove unused GetInterfaceLinkLibraries method 2014-06-23 08:50:08 -04:00
Brad King 2944bf164e Merge topic 'android-platform'
42f74df6 Add basic Android platform module
2014-06-10 09:17:39 -04:00
Ben Boeckel 1b003c1f95 cmTarget: Remove an unused variable 2014-06-09 14:45:35 -04:00
Brad King 42f74df6d4 Add basic Android platform module
Create a Platform/Android module that includes Platform/Linux since
Android is based on Linux.  Provide only the minimal settings needed to
get builds with Android NDK toolchains to work.

Disable use of RPATH since the Android loader ignores it and we cannot
predict the install destination anyway.

Android supports soname but shared library names must end in ".so" and
we cannot represent the versioned names with associated symlinks on all
host operating systems anyway.  However, we do want the SONAME of
library files to be set so that linking to them by path to the library
file produces NEEDED entries with the soname and not the path.  Add a
new CMAKE_PLATFORM_NO_VERSIONED_SONAME setting to tell the
cmTarget::GetLibraryNames method that not to use the VERSION or
SOVERSION target properties in the soname.
2014-06-06 14:03:42 -04:00
Ben Boeckel 2a1b2d8486 backtrace: Convert to local paths in IssueMessage
This is the only place we care show the FilePath to the user, so defer
the expensive relative path calculation until here.
2014-06-05 12:44:19 -04:00
Ben Boeckel a08292059e genex: remove the need for backtraces
Rather than making dummy backtraces and passing them around, just make
backtraces optional.
2014-06-05 12:44:18 -04:00
Ben Boeckel efc205695d cmake: remove dummy backtraces for IssueMessage 2014-06-05 12:44:17 -04:00
Ben Boeckel d46c650d67 cmMakefile: return a backtrace
This allows backtraces to be fully controlled by the makefile rather
than externally (and makes changing how they are manipulated easier).
2014-06-05 12:44:04 -04:00
Brad King 3ea9bde845 Merge topic 'ninja-intel-ipo'
b6e2e0d1 Ninja: Fix Intel interprocedural optimization with static libraries
5d12b87b cmGeneratorTarget: Improve GetCreateRuleVariable API
c2eeb08b cmTarget: Add GetFeatureAsBool method
2014-05-22 10:37:50 -04:00
Brad King 5ce40619db Merge topic 'COMPILE_FEATURES-genex'
0dfe395e Features: Add COMPILE_FEATURES generator expression.
aa8a6fce cmMakefile: Add methods for checking availability of a feature.
b6dedf03 cmMakefile: Extract CheckNeeded{C,Cxx}Language methods.
8dd129df cmMakefile: Extract CompileFeaturesAvailable method.
6b9b2fff cmMakefile: Extract CompileFeatureKnown method.
2014-05-22 10:37:48 -04:00
Stephen Kelly 0dfe395e3c Features: Add COMPILE_FEATURES generator expression.
Allow setting build properties based on the features available
for a target.  The availability of features is determined at
generate-time by evaluating the link implementation.

Ensure that the <LANG>_STANDARD determined while evaluating
COMPILE_FEATURES in the link implementation is not lower than that
provided by the INTERFACE of the link implementation.  This is
similar to handling of transitive properties such as
POSITION_INDEPENDENT_CODE.
2014-05-21 17:22:32 +02:00
Brad King c2eeb08b06 cmTarget: Add GetFeatureAsBool method
Return the GetFeature method result converted to a boolean value.
2014-05-21 09:38:22 -04:00
Stephen Kelly d1035bd5a5 cmTarget: Avoid copying container we don't need to copy. 2014-05-20 16:45:29 +02:00
Brad King c1edede31f Merge topic 'compile-features-C-language'
e0890d03 Features: Extend concept to C language.
2014-05-20 09:40:14 -04:00
Brad King 42bbf1307a CMP0022: Fix link language propagation in NEW behavior
The languages used in compiling STATIC libraries need to be propagated
to dependents regardless of the settings of INTERFACE_LINK_LIBRARIES or
CMP0022.  They are independent of the libraries in the link interface.

Prior to commit v2.8.12~192^2~2 (Introduce the INTERFACE_LINK_LIBRARIES
property, 2013-06-04) the cmTarget::ComputeLinkInterface code path for
"explicitLibraries" could never be taken for STATIC libraries, so the
logic to propagate languages existed only in the non-explicitLibraries
code path.  After that commit, INTERFACE_LINK_LIBRARIES could be set for
STATIC libraries to cause the "explicitLibraries" code path to be taken.
The commit also left the old non-explicitLibraries code path conditional
on CMP0022 not being set to NEW.  Thus link language propagation was
left missing from two cases by that commit.

The explicitLibraries code path was fixed to propagate languages by
commit v2.8.12~149^2~1 (cmTarget: Fix iface libraries and languages for
static libraries, 2013-07-26).  However, the non-explicitLibraries case
was never taught to propagate languages when CMP0022 is set to NEW.  Fix
that now.  Factor the logic to propagate link languages out of the link
interface libraries conditions so that it always occurs.  Update
Tests/Fortran to set CMP0022 to NEW to test this case (because the test
passes only if link language propagation works).
2014-05-19 09:06:20 -04:00
Stephen Kelly e0890d03a4 Features: Extend concept to C language.
Add properties and variables corresponding to CXX equivalents.

Add features for c_function_prototypes (C90), c_restrict (C99),
c_variadic_macros (C99) and c_static_assert (C11). This feature
set can be extended later.

Add a <PREFIX>_RESTRICT symbol define to WriteCompilerDetectionHeader
to conditionally represent the c_restrict feature.
2014-05-15 00:15:18 +02:00
Brad King 911cc9a39e cmTarget: Evaluate CMP0026 and CMP0051 in calling context
These policies should be checked at the call site that tries to access
the LOCATION or SOURCES property, not the directory scope containing the
target.  Thread the caller context through cmTarget::GetProperty to use
for checking the policy setting and emitting a diagnostic with proper
backtrace.

Extend the RunCMake.CMP0026 and RunCMake.CMP0051 tests with
cross-directory cases.
2014-05-09 11:24:15 -04:00
Brad King cb810abe6d cmTarget: Drop unused GetProperty signature
No callers use the second "scope" argument.  Drop this signature and
hard-code the default parameter value internally.
2014-05-09 11:17:32 -04:00
Brad King 7b3def93b6 Merge topic 'decay-language-version'
205215fb cmTarget: Add CXX_STANDARD_REQUIRED to control decay.
1df2116b Features: Decay language flag if requested is not available.
c4f4dac2 Project: Fix exit-on-error with compile feature tests.
5bb7ce72 Project: Use nullary form of main for compile feature tests.
64254e7a Project: Remove extern from static string in feature tests.
0d9c99bf Help: Fix order of help entries.
dc7639bd Tests: Fix name of cache variable.
2014-05-08 11:27:53 -04:00
Brad King 295cf31ca6 Merge topic 'no-assert-missing-objlib'
d648c476 cmTarget: Don't assert on object libraries for configure-time location.
2014-05-07 09:18:35 -04:00
Stephen Kelly 205215fb8a cmTarget: Add CXX_STANDARD_REQUIRED to control decay. 2014-05-07 12:17:49 +02:00
Stephen Kelly d648c4766f cmTarget: Don't assert on object libraries for configure-time location.
Commit b8af2011 (cmTarget: Fix listing of source files at
configure-time., 2014-04-13) refactored a GetObjectLibrariesCMP0026
method out of GetLanguages.  In flight, a conditional use of a target
if available was changed to an assert-available.

This code is only used to read the LOCATION property at configure
time, when the link information is incomplete, and not all targets
are defined, so the assert is inappropriate, even though it can lead
to incorrect information being generated.  CMP0026 warns about the
potentially incorrect information anyway.
2014-05-06 21:07:40 +02:00
Brad King b56a9ae7f1 Merge topic 'target_compile_features'
9eaf3755 Export: Populate INTERFACE_COMPILE_FEATURES property.
8ed59fc2 Add target_compile_features command.
4e6ca504 cmTargetPropCommandBase: Change the interface to return bool.
5412dede cmTarget: Transitively evaluate compiler features.
baff4434 cmTarget: Allow populating COMPILE_FEATURES using generator expressions.
f97bf437 Features: Add cxx_auto_type.
03355d6b cmTarget: Add COMPILE_FEATURES target property.
faeddf64 project: Add infrastructure for recording CXX compiler features
913394af cmTarget: Add CXX_STANDARD and CXX_EXTENSION target properties.
8238a6cd Add some COMPILE_OPTIONS for specifying C++ dialect.
892243fc Tests: Require CMake 3.0 for the SystemInformation test.
59b5fdd3 Don't load Clang-CXX from AppleClang-CXX.
2014-04-15 10:32:11 -04:00
Stephen Kelly b8af201168 cmTarget: Fix listing of source files at configure-time.
Since commit e5da9e51 (cmTarget: Allow any generator expression in
SOURCES property., 2014-03-18), source files are computed by
true evaluation of generator expressions, including TARGET_OBJECTS.
This evaluation requires the presence of cmGeneratorTarget objects
since commit bf98cc25 (Genex: Evaluate TARGET_OBJECTS as a normal
expression., 2014-02-26).

Ensure that we don't attempt to evaluate the TARGET_OBJECTS generator
expression at configure-time, as can happen if CMP0024 or CMP0026
are OLD.  Use old-style parsing of the source item to extract
object target names in that case.

Avoid calling GetProperty("SOURCES") to bypass warnings from CMP0051.
Refactor existing logic in GetLanguages which is similar in intent to
the new GetSourceFiles code.
2014-04-13 10:59:50 +02:00
Stephen Kelly 4f1c71fdd2 cmTarget: Add all sources traced from custom commands at once.
The AddSource method accepts one file and tries to avoiding adding
it to the sources-list of the target if it already exists.  This
involves creating many cmSourceFileLocation objects for matching
on existing files, which is an expensive operation.

Avoid the searching algorithm by appending the new sources as one
group.  Generate-time processing of source files will ensure
uniqueness.

Add a new AddTracedSources for this purpose.  The existing
AddSources method must process the input for policy CMP0049, but
as these source filenames come from cmSourceFile::GetFullPath(),
we can forego that extra processing.
2014-04-09 10:37:00 +02:00
Stephen Kelly b1c3ae33ea cmTarget: Short-circuit language computation if context independent.
Computing the language involves computing the source files, which
is an expensive operation.  It requires calling
cmMakefile::GetOrCreateSource many times, which involves creating
and matching on many cmSourceFileLocation objects.

Source files of a target may depend on the head-target and the
config as of commit e6971df6 (cmTarget: Make the source files depend
on the config., 2014-02-13).  The results are cached for each context
as of commit c5b26f3b (cmTarget: Cache the cmSourceFiles in
GetSourceFiles., 2014-04-05).

Each target in the build graph causes language computation of all
of its dependents with itself as the head-target.  This means that
for 'core' libraries on which everything depends, the source files
are computed once for every transitive target-level-dependee and
the result is not cached because the head-target is different. This
was observed in the VTK buildsystem.

Short circuit the computation for targets which have a source-list
that is independent of the head-target.  If the source-list has
already been computed and the generator expression evaluation
reports that it was context-independent, return the only source-list
already cached for the target.  Reset the short-circuit logic when
sources are added and when the link libraries are re-computed.
2014-04-09 10:37:00 +02:00
Stephen Kelly 5412deded1 cmTarget: Transitively evaluate compiler features.
Extend the interface of the target_compile_features command with
PUBLIC and INTERFACE keywords. Populate the INTERFACE_COMPILER_FEATURES
target property if they are set. Consume the INTERFACE_COMPILER_FEATURES
target property from linked dependent targets to determine the final
required compiler features and the compile flag, if needed.

Use the same pattern of origin-debugging which is used for other
build properties.
2014-04-07 18:11:18 +02:00
Stephen Kelly baff44345c cmTarget: Allow populating COMPILE_FEATURES using generator expressions.
Delay validation of the content as a feature if it contains a
generator expression. It will be checked again at generate-time
after evaluation.
2014-04-07 18:11:18 +02:00
Stephen Kelly 03355d6b5b cmTarget: Add COMPILE_FEATURES target property.
Use the contents of it to upgrade the CXX_STANDARD target property,
if appropriate.  This will have the effect of adding the -std=c++11
compile flag or other language specification on GNU when that is
needed for the feature.
2014-04-07 16:52:22 +02:00
Stephen Kelly 913394af24 cmTarget: Add CXX_STANDARD and CXX_EXTENSION target properties.
These are used to determine whether to add -std=c++11, -std=gnu++11
etc flags on the compile line.
2014-04-07 16:48:44 +02:00
Stephen Kelly c5b26f3bec cmTarget: Cache the cmSourceFiles in GetSourceFiles.
Avoid calling GetSourceFiles with the same result container multiple
times when tracing target dependencies.  The result from the previous
configuration is cached and used later otherwise.
2014-04-06 10:02:34 +02:00
Stephen Kelly eb163f37d4 cmTarget: Extract a ProcessSourceItemCMP0049 method.
Avoid calling AddSource for each src filename.  That involves
checking each entry for uniqueness and creating a separate
generator expression for each one.

Instead, add a single entry for the list of sources.  The source
files are passed through a uniqueness filter at generate-time, so
duplicates don't matter so much.
2014-04-06 10:02:34 +02:00
Brad King c4059a21a9 cmTarget: Remove abort() after INTERNAL_ERROR reports
After reporting an internal error we should continue rather than
aborting.  Remove such statements that are left from debugging.
2014-04-03 14:05:03 -04:00
Brad King 5376151aa1 Merge topic 'target-transitive-sources'
9407174b target_sources: New command to add sources to target.
81ad69e0 Make the SOURCES target property writable.
6e636f2e cmTarget: Make the SOURCES origin tracable.
3676fb49 cmTarget: Allow transitive evaluation of SOURCES property.
e6971df6 cmTarget: Make the source files depend on the config.
df753df9 cmGeneratorTarget: Don't add computed sources to the target.
869328aa cmComputeTargetDepends: Use valid config to compute target depends.
2014-04-03 12:51:53 -04:00
Brad King 93054aa84f Merge topic 'target-sources-refactor'
5de63265 Genex: Only evaluate TARGET_OBJECTS to determine target sources.
aa0a3562 cmGeneratorTarget: Compute target objects on demand
042c1c83 cmTarget: Compute languages from object libraries on demand.
fdcefe3c cmGeneratorTarget: Compute consumed object libraries on demand.
c355d108 cmComputeTargetDepends: Track object library depends.
e5da9e51 cmTarget: Allow any generator expression in SOURCES property.
5702e106 cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
857d30b5 cmGlobalGenerator: Add interface to call ForceLinkerLanguages
28e1d2f8 cmStringCommand: Add GENEX_STRIP subcommand.
bf98cc25 Genex: Evaluate TARGET_OBJECTS as a normal expression.
8cd113ad cmTarget: Store strings instead of cmSourceFile* to represent SOURCES.
4959f341 cmSourceFileLocation: Collapse full path for directory comparisons.
fcc92878 cmSourceFileLocation: Remove unused Update method.
59e8740a cmTarget: Remove AddSourceFile method
26d494ba cmTarget: Use string API to add sources to cmTarget objects.
d38423ec cmTarget: Add a method to obtain list of filenames for sources.
...
2014-04-03 12:51:51 -04:00
Stephen Kelly 81ad69e056 Make the SOURCES target property writable. 2014-04-02 23:14:02 +02:00
Stephen Kelly 6e636f2eba cmTarget: Make the SOURCES origin tracable. 2014-04-02 23:14:02 +02:00
Stephen Kelly 3676fb4963 cmTarget: Allow transitive evaluation of SOURCES property.
Extend the cmGeneratorExpressionDAGChecker with an interface
returning the name of the top target.  Use that to determine
when there is a DAG violation, as required by the RunCMake.Languages
tests.
2014-04-02 23:14:02 +02: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 5de63265e3 Genex: Only evaluate TARGET_OBJECTS to determine target sources.
The output of this expression may contain macros for IDEs to replace
such as $(Configuration), $(CURRENT_ARCH) etc.  To avoid generating
content which is not usable in other contexts, report an error if
there is an attempt to use it in other contexts.

This commit may be reverted in the future if a solution to the
above difference is implemented.
2014-04-02 23:12:57 +02:00
Stephen Kelly 042c1c834e cmTarget: Compute languages from object libraries on demand. 2014-04-02 23:12:56 +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 5702e10677 cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
Add policy CMP0051 to control this behavior.
2014-04-02 23:12:56 +02:00
Brad King f70b2253f6 Merge topic 'fix_policy_diagnostics'
77b581c2 Policies: omit warnings about unset policies when they are actually set to NEW
2014-04-01 11:06:17 -04:00
Stephen Kelly 8cd113ad1d cmTarget: Store strings instead of cmSourceFile* to represent SOURCES.
This will allow the strings to contain generator expressions.

At this point, generator expressions are still not part of the
SOURCES property when it is read.
2014-03-31 23:18:44 +02:00
Stephen Kelly 59e8740aca cmTarget: Remove AddSourceFile method
It is no longer used.
2014-03-31 23:18:43 +02:00
Stephen Kelly d38423ecc4 cmTarget: Add a method to obtain list of filenames for sources. 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 99a9c51f1a cmTarget: Use GetSourceFiles for languages. 2014-03-31 23:18:43 +02:00
Nils Gladitz 77b581c2f0 Policies: omit warnings about unset policies when they are actually set to NEW 2014-03-31 09:45:10 -04:00
Stephen Kelly ea17a03be5 cmTarget: Port <CONFIG>_LOCATION support to updated string APIs 2014-03-17 09:31:58 -04:00
Brad King 6e466c6f2e Merge branch 'master' into CONFIG-LOCATION-CMP0026 2014-03-17 09:31:21 -04:00
Stephen Kelly c903b5319b cmTarget: Restore <CONFIG>_LOCATION to CMP0026 OLD behavior (#14808)
Restore support for the undocumented <CONFIG>_LOCATION target property
removed by commit v3.0.0-rc1~175^2 (cmTarget: Remove support for
<CONFIG>_LOCATION property, 2013-12-30) as part of the CMP0026 OLD
behavior.
2014-03-17 09:30:39 -04:00
Brad King e1a671c7d8 Merge topic 'fix-CMP0046-warning'
d83245a3 cmTarget: Don't create duplicate backtraces in CMP0046 warning
2014-03-13 09:36:06 -04:00
Stephen Kelly d83245a34f cmTarget: Don't create duplicate backtraces in CMP0046 warning 2014-03-12 18:01:26 +01:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Brad King 7b0efcded3 Merge topic 'fix-policy-scopes'
50fd0a33 Tests: Simplify and document policy scopes in RunCMake.CMP* tests
b1bbee3e Record more policies on targets when created
2014-03-10 09:33:25 -04:00
Ben Boeckel b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel 3def29da3c stringapi: Use strings for feature arguments 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
Brad King f154475b65 cmTarget: Refactor GetLocation API
When given a non-NULL configuration the GetLocation returned the
location for the given configuration.  When given a NULL configuration
the GetLocation method returned a location with the build-system
placeholder for the configuration name.  Split the latter use case out
into a separate GetLocationForBuild method and update call sites
accordingly.
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 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 310ef08fed stringapi: Use strings for source names 2014-03-08 13:05:29 -05:00
Ben Boeckel 381d50c149 stringapi: Accept strings in cmStrCmp 2014-03-08 13:05:28 -05:00
Ben Boeckel ec97ed7d0c stringapi: Use strings for property names
Property names are always generated by CMake and should never be NULL.
2014-03-08 13:05:28 -05:00
Brad King b1bbee3e9a Record more policies on targets when created
Policies CMP0027, CMP0038, and CMP0046 have per-target meaning so
record the policy settings on targets as they are created.
2014-03-06 11:05:47 -05:00
Brad King 6223621e9a Merge topic 'msvc-compiler-pdb-files'
fba51b09 MSVC: Add properties to configure compiler PDB files (#14762)
3737860a cmTarget: Add per-config compilation info
718a9532 cmTarget: Refactor ComputePDBOutputDir interface
aae5184c Help: Refactor PDB_NAME and PDB_OUTPUT_DIRECTORY docs
b4aac0ca Makefile: Fix per-config linker PDB output directory
2014-02-26 09:38:51 -05:00
Brad King fba51b096e MSVC: Add properties to configure compiler PDB files (#14762)
Since commit v2.8.12~437^2~2 (VS: Separate compiler and linker PDB files
2013-04-05) we no longer set /Fd with the PDB_NAME or PDB_OUTPUT_DIRECTORY
properties.  Those properties now exclusively handle linker PDB files.
Since STATIC libraries do not link their compiler PDB file becomes more
important.  Add new target properties "COMPILE_PDB_NAME[_<CONFIG>]" and
"COMPILE_PDB_OUTPUT_DIRECTORY[_<CONFIG>]" to specify the compiler PDB
file location and pass the value to the MSVC /Fd option.
2014-02-26 09:34:38 -05:00
Brad King 3737860a38 cmTarget: Add per-config compilation info
Add a cmTarget::CompileInfo struct to hold per-configuration information
about the compilation settings in a target.  This is different than
cmTarget::OutputInfo because it applies to any targets that can compile
sources even if they do not link or archive.
2014-02-24 14:14:37 -05:00
Brad King 718a9532c6 cmTarget: Refactor ComputePDBOutputDir interface
Add a runtime parameter to specify the property name prefix.
Update the call site to pass "PDB" to preserve the existing
name for that call path.
2014-02-24 14:12:31 -05:00
Stephen Kelly 5771f81d91 cmTarget: Add GetTransitiveTargetClosure method.
Replace calls to GetLinkInformation with calls to a method to get only
the target closure, not the link languages etc.  The replaced calls
are used while evaluating generator expressions only.  This makes
transitive generator expression evaluation independent from
the languages of a target.  In a follow-up topic, it will be possible
to make the languages depend on generator expression evaluation, via
evaluation of the SOURCES and INTERFACE_SOURCES target properties.

Because the order of entries is not the same as the final link line,
the order of debug output is different in the RunCMake.CompatibleInterface
test, because the BOOL_PROP7 target property is evaluated first. Adjust
the test to account for that new order.
2014-02-24 16:43:24 +01:00
Stephen Kelly a6dd4990db cmTarget: Create a temporary cmTarget in checkInterfacePropertyCompatibility
This simplifies further refactoring.
2014-02-24 16:43:24 +01:00
Stephen Kelly b8b99cc1e5 cmTarget: Avoid computing languages when computing transitive targets.
For the OLD CMP0022 behavior, we need to treat the implementation
as the interface when computing the interface libraries.  Make it
possible to do that without computing the link languages by adding
a new GetLinkImplementationLibraries method.  Extend the existing
GetLinkImplementation method to populate the languages if the
libraries have already been computed and cached.

Change GetTransitivePropertyTargets to invoke GetLinkInterfaceLibraries
instead of GetLinkInterface.  This is key, as it is a method called
by cmGeneratorExpressionEvaluator.

Change the cmGeneratorExpressionEvaluator to invoke
GetLinkImplementationLibraries instead of GetLinkImplementation.
2014-02-24 16:43:24 +01:00
Stephen Kelly 01bca553b8 cmTarget: Move ComputeLinkInterface to the internal class.
In a follow-up, this will use the OptionalLinkInterface in its
API. That class is in the cmTargetInternals class.
2014-02-24 16:43:24 +01:00
Stephen Kelly d93e1af292 cmTarget: Extract a ComputeLinkInterfaceLibraries method.
When evaluating the SOURCES property, we will need to be able to access
the link libraries without accessing the link languages, as the languages
depend on the SOURCES.
2014-02-24 16:43:24 +01:00
Stephen Kelly 3bcb197c11 cmTarget: Re-arrange the ComputeLinkInterface method.
Arrange the logic so that the part which deals with libraries only is
at the top.  In a follow-up commit, this will be split into two methods.

Ensure that the explanatory CMP0022 comment is only present in one
location.
2014-02-24 16:43:24 +01:00
Stephen Kelly 326d07d27e cmTarget: Extract a ComputeLinkImplementationLanguages method. 2014-02-24 16:43:23 +01:00
Stephen Kelly 21e91350b0 cmTarget: Change GetTransitivePropertyLinkLibraries to output targets.
The callers already skip non-targets, so unify the target search.

Change supporting functions to accept a container of targets instead
of strings where possible.
2014-02-24 16:43:23 +01:00
Stephen Kelly f81eb49e8b cmTarget: Find source files on request.
In a follow-up, the list of sources will become dependent on
the config, so check for existence in cmTarget::GetSourceFiles
instead of up-front with cmGlobalGenerator::CheckTargets().
2014-02-24 16:43:23 +01:00
Stephen Kelly 84e5f5a004 cmTarget: Move SourceFileFlags to cmGeneratorTarget. 2014-02-24 16:43:23 +01:00
Stephen Kelly 9db9c1fc8b cmTarget: Don't try to get sources of an INTERFACE_LIBRARY.
An an assert to ensure this.
2014-02-14 13:53:14 +01:00
Stephen Kelly c248a437c4 Add policy CMP0049 to avoid variable expansion in source lists 2014-02-12 11:17:38 -05:00
Stephen Kelly 37e1894d32 cmTarget: Remove TODO comment.
The current behavior is desirable because while it is common to
set a per-config suffix on libraries, it is not common for exexutables.
2014-02-11 11:05:01 +01:00
Stephen Kelly b29152387d CMP0028: Trigger on libraries from INTERFACE of dependencies. 2014-02-09 15:35:28 +01:00
Stephen Kelly dcd443d4aa cmTarget: Clean up the InsertCompileDefinition implementation.
It accepts a before parameter but is never called with before=true.

compile definitions are sorted by std::set, so it wouldn't make sense
to allow user sorting.
2014-02-02 22:15:07 +01:00
Rolf Eike Beer c768e398f9 cmMakefile: make some methods take const std::string& instead of const char*
Most callers already have a std::string, on which they called c_str() to pass it
into these methods, which internally converted it back to std::string. Pass a
std::string directly to these methods now, avoiding all these conversions.
Those methods that only pass in a const char* will get the conversion to
std::string now only once.
2014-01-16 09:28:29 -05:00
Nils Gladitz 0bf6f13b1d AddDependencies: new policy requires dependencies to exist
Added new policy CMP0046 which requires dependencies added by
add_dependencies() to actually exist.
2014-01-12 12:58:04 +01:00
Brad King e56530f612 Merge topic 'minor-cleanups'
531e40b cmTarget: Make GetSourceFiles populate an out-vector parameter.
38de54c cmGeneratorTarget: Add methods to access source file groups.
f579fe0 Help: Fix link to MAP_IMPORTED_CONFIG_<CONFIG>
590d238 cmTarget: Handle NO_SYSTEM_FROM_IMPORTED.
2014-01-09 13:54:23 -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 5bb53f6b73 cmTarget: Deprecate COMPILE_DEFINITIONS_ properties with a policy. 2014-01-08 16:41:34 +01:00
Stephen Kelly faedd2bea9 cmTarget: Fix system include annotation propagation.
Direct users of IMPORTED targets treat INTERFACE_INCLUDE_DIRECTORIES
as SYSTEM, after commit a63fcbcb (Always consider includes from IMPORTED
targets to be SYSTEM., 2013-08-29).  It was intended that transitive
use of an IMPORTED target would have the same behavior, but that
did not work.  The implementation processed only direct dependencies
in cmTarget::FinalizeSystemIncludeDirectories.

Implement transitive evaluation of dependencies by traversing the
link interface of each target in the link implementation.
2014-01-06 17:25:10 +01:00
Stephen Kelly 10d65d5019 cmTarget: Move a variable initialization closer to where it is used.
This is more readable and easier to reason about.
2014-01-06 17:25:10 +01: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 7461d67cf3 cmTarget: Enable convenient include dir handling for INTERFACE_LIBRARY.
Make the CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE variable affect
INTERFACE_LIBRARY targets.
2014-01-06 17:25:10 +01:00
Stephen Kelly 7fc6e3d607 cmTarget: Remove dead code.
Whitelisting of properties already ensures that the LOCATION
property will not be read from an INTERFACE_LIBRARY.
2014-01-06 17:25:09 +01:00
Stephen Kelly 2d6638008c cmTarget: Use strtol for numeric parsing.
On Windows apparently sscanf can not handle hex numbers.

Test that numeric comparison works with hex numbers.
2014-01-06 17:25:09 +01:00
Stephen Kelly a55c70de78 cmTarget: Remove support for <CONFIG>_LOCATION property.
It is not documented, is very old, is compatibility code,
is non-uniform and is not needed.
2014-01-04 11:28:58 +01:00
Stephen Kelly fbe1fa722f cmTarget: Don't repeat property origin debug information. 2014-01-04 11:28:58 +01:00
Stephen Kelly 01c545c596 cmTarget: Fix debug report for interface-set compatibility types.
If the dependent target sets the property to boolean false, ensure
that that appears in the debug report.  Previously, the report
output contained whether the property was consistent among dependencies,
displaying 'TRUE', instead of the content of the property, which may
be 'FALSE'.

Return a std::pair from the consistentProperty method.  This makes
it possible to make the return value for string types easier to
reason about.  The return value of consistentProperty was previously
set to an empty static string to emulate a 'true' value for the caller
in commit 816b4a8a (cmTarget: Make consistentProperty
return consistent content., 2013-10-22).  The pair makes the
consistency result properly typed.
2014-01-04 11:28:58 +01:00
Stephen Kelly c67e1a6aac cmTarget: Fix reporting interface-set properties which are FALSE. 2014-01-04 11:28:58 +01:00
Stephen Kelly 79db8ef78d cmTarget: Fix the property compatibility error message
Don't refer to 'both', but a 'mixture'. List all compatible interface
property types possible.

Add another test for a mixture of three compatibilities.
2014-01-04 11:28:57 +01:00
Stephen Kelly 272a20f8e5 cmTarget: Don't update IMPORTED target compilation properties
The include_directories() and add_compile_options() commands
should not append to the corresponding target property for IMPORTED
targets.  This is already the case for add_definitions().
2014-01-04 11:28:57 +01:00
Stephen Kelly 5c0a06ab84 cmTarget: Rename container holding link implementation objects.
Don't erroneously name it for the link implementation. That's
something different.
2014-01-04 11:28:56 +01:00
Brad King 0d63bdd2d9 Merge topic 'rpath-default'
d25ad48 OS X: Add CMP0042 to enable MACOSX_RPATH by default
2014-01-02 14:23:09 -05:00
Clinton Stimpson d25ad482e9 OS X: Add CMP0042 to enable MACOSX_RPATH by default
Also adding documentation for CMAKE_MACOSX_RPATH, and improving
documentation for MACOSX_RPATH.
2014-01-02 13:41:49 -05:00
Stephen Kelly cad5c79e6c cmTarget: Fix typo
'a ALIAS' -> 'an ALIAS'
2013-12-19 16:17:59 +01:00
Brad King 2e075b48e8 Merge topic 'constify'
c62cd3e Constify autogen handling.
035b690 Autogen: Split AutoRcc handling into two methods
2fcafbf cmLocalGenerator: Constify target definitions access
a54eedd Constify cmGeneratorTarget access.
9edee62 Constify handling of link targets.
ef25ba8 Constify handling of target dependencies.
2013-12-19 10:13:18 -05:00
Stephen Kelly 9edee62f28 Constify handling of link targets. 2013-12-11 15:30:11 +01:00
Stephen Kelly ef25ba8d06 Constify handling of target dependencies. 2013-12-11 15:30:11 +01:00
Stephen Kelly 3b8e56a50f Don't search for IMPORTED_LOCATION of INTERFACE_LIBRARY (14636)
The INTERFACE_LIBRARY type does not have any LOCATION at all, so
return early from GetMappedConfig. GetMappedConfig is called from
two locations, one of which already pre-checks the INTERFACE_LIBRARY
case. Remove that pre-check and handle that case inside the method
instead.
2013-12-09 20:52:52 +01:00
Brad King 5026696fcc Merge topic 'INTERFACE_AUTOUIC_OPTIONS'
77f3772 cmTarget: Require a compatible INTERFACE_AUTOUIC_OPTIONS from dependencies.
2e60b5f cmTarget: Report origin of COMPATIBLE_INTERFACE properties.
2013-12-09 10:33:30 -05:00
Stephen Kelly 77f3772784 cmTarget: Require a compatible INTERFACE_AUTOUIC_OPTIONS from dependencies.
Revert the origin-tracking infrastructure from commit 98093c45 (QtAutoUic:
Add INTERFACE_AUTOUIC_OPTIONS target property., 2013-11-20). Use the
compatibility-tracking for compatible strings instead.

If two different dependencies require different AUTOUIC_OPTIONS,
cmake will now appropriately issue an error.
2013-12-08 07:03:29 +01:00
Stephen Kelly 2e60b5fcf7 cmTarget: Report origin of COMPATIBLE_INTERFACE properties. 2013-12-08 07:03:29 +01:00
Stephen Kelly 1396ab8009 Don't generate self-references for system include directories.
Targets which link directly to themselves should not result in
generate-time errors (reported by the DAG checker).

Self-links are handled separately with policy CMP0038.
2013-12-03 11:13:42 +01:00
Stephen Kelly 98093c45db QtAutoUic: Add INTERFACE_AUTOUIC_OPTIONS target property.
Transitively consume the property from linked dependents.

Implement configuration-specific support by following the pattern
set out for compile definitions and includes in cmQtAutoGenerators.

Implement support for origin-tracking with CMAKE_DEBUG_TARGET_PROPERTIES.

This is motivated by the needs of KDE, which provides a separate
translation system based on gettext instead of the Qt linguist
translation system. The Qt uic tool provides command line options
for configuring the method used to translate text, and to add an
include directive to the generated file to provide the method.

 http://thread.gmane.org/gmane.comp.kde.devel.frameworks/7930/focus=7992

Implement the interface to provide the uic options as a usage-requirement
on the KI18n target, as designed for KDE.
2013-11-27 19:06:12 +01:00
Brad King b80ef72b4d Merge topic 'ninja-compile-link-pool'
7605e37 Ninja: job pool support for compiling and linking
2013-11-26 09:52:35 -05:00
Peter Kümmel 7605e37aab Ninja: job pool support for compiling and linking
Could be tested by setting the environment
variable NINJA_STATUS=[%r]
2013-11-25 22:23:24 +01:00
Stephen Kelly 5ee9e6bc11 cmTarget: Add whitelist of properties on INTERFACE_LIBRARY. 2013-11-25 16:23:11 +01:00
Stephen Kelly 0bfcb450e6 INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties.
As an INTERFACE_LIBRARY has no direct link dependencies, we can
short-circuit in cmGeneratorExpressionEvaluator and
in cmGlobalGenerator::CheckLocalGenerators.

As they do not generate any output directly, any generate- or install-
related code acn also be short-circuited. Many of the local generators
already do this.

Because only INTERFACE related properties make sense on INTERFACE_LIBRARY
targets, avoid setting other properties, for example via defaults.
2013-11-25 16:17:50 +01:00
Brad King 1744ad9257 Merge topic 'add-cmHasLiteralPrefix'
4fe963f Use new cmHasLiteralPrefix function
7d4b2b2 cmStandardIncludes: Add new cmHasLiteralPrefix function.
2013-11-22 08:41:30 -05:00
Stephen Kelly 4fe963f656 Use new cmHasLiteralPrefix function 2013-11-21 20:53:15 +01:00
Stephen Kelly 15eeacefc5 cmTarget: Trivially make more API const. 2013-11-19 20:40:32 +01:00
Stephen Kelly be9dfb6b2e cmTarget: Make GetExportMacro const.
The std::string member is only used for memory management.
2013-11-19 20:40:32 +01:00
Stephen Kelly 0794c1360d cmTarget: Make NameResolvesToFramework const. 2013-11-19 20:40:32 +01:00
Stephen Kelly 36e31cd127 cmTarget: Make GetInterfaceLinkLibraries const. 2013-11-19 20:40:31 +01:00
Stephen Kelly 04d398d356 cmTarget: Make GetTargetSourceFileFlags const. 2013-11-19 20:40:31 +01:00
Brad King a4b9adec89 Merge topic 'constify'
dcac9be Make accessors for compile-related information const.
19a8a3c cmTarget: Don't finalize include directories in GetIncludeDirectories.
3305364 cmGlobalGenerator: Rename the FinalizeCompileDefinitions method.
2013-11-12 08:32:08 -05:00
Stephen Kelly dcac9be6aa Make accessors for compile-related information const.
These can be moved to cmGeneratorTarget in CMake 4.0.
2013-11-09 20:30:46 +01:00
Stephen Kelly 19a8a3c4c8 cmTarget: Don't finalize include directories in GetIncludeDirectories.
Rely on that having been done by the cmGlobalGenerator.
2013-11-07 14:11:31 +01:00
Stephen Kelly 301bb5cdda Disallow link-to-self (#13947). 2013-11-07 11:06:39 +01:00
Brad King b4a1f442bb Merge topic 'policy-CMP0022-fixes-for-master'
b51696f CMP0022: Update target_link_libraries plain signature documentation
25b7f87 Merge branch 'policy-CMP0022-fixes' into policy-CMP0022-fixes-for-master
0a561a0 CMP0022: Warn about a given target at most once
23d21b7 Do not export INTERFACE_LINK_LIBRARIES from non-linkable targets
ef10b87 CMP0022: Plain target_link_libraries must populate link interface
0e06788 CMP0022: Add test for target_link_libraries plain signature
c0f4a61 CMP0022: Add unit test for null pointer check and message.
4b0cfa7 Merge branch 'output-CMP0022-entries' into policy-CMP0022-fixes
2013-11-04 07:54:20 -05:00
Stephen Kelly 6bdea066e6 cmTarget: Make some accessors const. 2013-11-03 22:27:28 +01:00
Brad King 25b7f87eca Merge branch 'policy-CMP0022-fixes' into policy-CMP0022-fixes-for-master
Resolve conflict in Source/cmTarget.cxx by integrating the changes to
the internal copy constructor from both sides.  Also resolve a logical
conflict by dropping the special case for INTERFACE_LIBRARY targets.
Since cmTarget::SetMakefile already forces CMP0022 to NEW for such
targets we need no special handling.

Resolve conflict in Source/cmTargetLinkLibrariesCommand.h by dropping
the documentation change.  We will make the same change in the new
location of the same documentation in a separate commit.

Resolve conflicts in

 Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt
 Tests/RunCMake/CMP0022/RunCMakeTest.cmake

by taking the side from the 'policy-CMP0022-fixes' branch.
2013-11-03 09:20:47 -05:00
Brad King 0a561a0347 CMP0022: Warn about a given target at most once
Since cmTarget::ComputeLinkInterface is called separately for each
"head" target that links a target, the warning we produce when
CMP0022 is not set could be repeated.  Add explicit logic to allow
the warning to appear at most once.  Multiple copies of the warning
for the same target are almost always identical and therefore
redundant.  In the rare case that two copies of the warning are
different, the second can appear in a future run after the first
is fixed.
2013-11-03 09:14:54 -05:00
Brad King ef10b87cc1 CMP0022: Plain target_link_libraries must populate link interface
The CMP0022 NEW behavior is that the INTERFACE_LINK_LIBRARIES property
exactly defines the link interface.  The plain target_link_libraries
signature says linking is transitive by default, so it should populate
the property.

Teach the target_link_libraries plain signature to populate the
INTERFACE_LINK_LIBRARIES regardless of the CMP0022 setting.  Refactor
the cmTarget::ComputeLinkInterface checks that warn when the policy is
not set to compare the new property to either the explicitly set old
link interface properties or the link implementation fallback for all
linkable target types, not just static libraries.

This fixes a regression in 2.8.12.0 that caused target_link_libraries to
not implement transitive linking in the plain signature once the policy
CMP0022 is set to NEW.
2013-11-02 12:55:17 -04:00
Brad King 4b0cfa7004 Merge branch 'output-CMP0022-entries' into policy-CMP0022-fixes 2013-11-02 12:47:45 -04:00
Brad King de5c29890f Merge topic 'constify'
c4373b3 cmTarget: Make GetProperty() const.
cfb6661 Don't call SetProperty from GetProperty.
2013-11-01 09:40:05 -04:00
Stephen Kelly c4373b33b2 cmTarget: Make GetProperty() const.
This has follow-on effects for other methods and classes. Further
work on making the use of const cmTarget pointers common can be
done, particularly with a view to generate-time methods.
2013-10-31 14:52:11 +01:00
Brad King 7a616e75b8 Merge topic 'use-generator-target'
07f5788 Move TraceDependencies to cmGeneratorTarget.
fa03777 Do not populate SourceEntries in AddSourceFile.
2013-10-31 09:40:13 -04:00
Stephen Kelly cfb6661333 Don't call SetProperty from GetProperty.
Memoize with the internal container directly instead.
2013-10-30 22:41:51 +01:00
Stephen Kelly 07f5788385 Move TraceDependencies to cmGeneratorTarget. 2013-10-30 21:29:45 +01:00
Stephen Kelly fa03777626 Do not populate SourceEntries in AddSourceFile.
It only generates a default constructed SourceEntry for each
cmSourceFile.

  this->Internal->SourceEntries[sf];

in cmTargetTraceDependencies::Trace has the same effect, and is called
early in generation-time for each source file anyway.
2013-10-30 21:16:29 +01:00
Brad King 8a6e82724c Merge topic 'use-generator-target'
638843a Remove the Location member from cmTarget.
90ef1cf Move GenerateTargetManifest to cmGeneratorTarget.
25f1df3 Split CreateGeneratorTargets into two methods.
2013-10-30 14:55:35 -04:00
Stephen Kelly 638843af98 Remove the Location member from cmTarget.
It is never used. Presumably it only exists so that a const char * can
be returned from GetLocation. However, that is getting in the way
now, so use a static std::string instead, which is already a common
pattern in cmake.
2013-10-29 15:42:42 +01:00
Brad King fcbe435c23 Merge topic 'Qt-auto-generators'
9c87d9c Add automatic rcc invocation for Qt.
84218e1 Add automatic uic invocation for Qt.
94a0ca6 Record which files are skipped by automoc.
18fb758 Run the main executable created in the autogen tests.
e485ba1 Rename the QtAutomoc tests to QtAutogen.
7ce65c3 Add extra checks for the AUTOMOC target property.
32771fc Update output messages for generic use.
f371ab5 Rename RunAutomoc to RunAutogen.
85b3d6e Extract an SetupAutoMocTarget method.
ca124a1 Rename the AutomocInfo.cmake file to be more generic.
a342c9f Move some makefile definitions up away from moc-specific code.
98632ef Add the AUTOGEN_TARGETS_FOLDER and obsolete AUTOMOC_TARGETS_FOLDER.
63378ba Rename some variables to reflect broader scope.
97f1aa3 Rename method to reflect generic use.
4abb111 Rename local variable to reflect generic use.
03878c9 Move variable set to where it is used.
...
2013-10-28 15:23:09 -04:00
Stephen Kelly 90ef1cfe48 Move GenerateTargetManifest to cmGeneratorTarget. 2013-10-27 20:29:45 +01:00
Brad King 4025013dd7 Merge topic 'compatible-interface-numbers'
ff6c401 cmTarget: Add interface for compatible numeric properties
e4e20c1 cmTarget: Add enumeration for consistency to expect from properties.
9877769 cmTarget: Assign consistent content back to the property being evaluated.
816b4a8 cmTarget: Make consistentProperty return consistent content.
030800a cmTarget: Add a template to create correct implied content.
2013-10-26 10:28:30 -04:00
Brad King bb21e17fb7 Merge topic 'remove-pre-2.4-compatibility'
7d47c69 Drop compatibility with CMake < 2.4
c7c44fc CTestTest*: Update minimum required CMake to 2.4
2013-10-26 10:28:09 -04:00
Brad King 1b21ac405f Merge topic 'fix-tll-static-private'
239b0c6 Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.
2013-10-26 10:28:02 -04:00
Stephen Kelly 239b0c6b0e Don't add invalid content to static lib INTERFACE_LINK_LIBRARIES.
Only valid target names or generator expressions may appear in
the target field of a LINK_ONLY expression.

Other content like link flags should still be added to that property
(wrapped in config-specific generator expressions), but not wrapped
in LINK_ONLY. Otherwise undue warnings would be issued for the
policy CMP0022.

The LINK_ONLY expression only has an effect for actual target
names anyway, so there is no logical deficit.
2013-10-26 10:10:20 -04:00
Stephen Kelly 9c87d9cc3e Add automatic rcc invocation for Qt.
This replaces the need to invoke qt4_add_resources by allowing
adding the source .qrc file directly to the target sources.
2013-10-24 12:30:41 +02:00
Stephen Kelly 84218e1870 Add automatic uic invocation for Qt.
The source files are already processed by cmQtAutomoc to look for
moc includes, so extend that to also look for ui_ includes and
find corresponding .ui files to process.

This replaces the need to invoke qt4_wrap_ui().

As the ui files are not likely to be part of the SOURCES of the
target, store the options associated with them separately in the
cmMakefile for querying during the autogen run.
2013-10-24 12:30:38 +02:00
Stephen Kelly ff6c401309 cmTarget: Add interface for compatible numeric properties
When using the boost MPL library, one can set a define to increase
the limit of how many variadic elements should be supported. The
default for BOOST_MPL_LIMIT_VECTOR_SIZE is 20:

 http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/limit-vector-size.html

If the foo library requires that to be set to 30, and the independent
bar library requires it to be set to 40, consumers of both need to set
it to 40.

 add_library(foo INTERFACE)
 set_property(TARGET foo PROPERTY INTERFACE_boost_mpl_vector_size 30)
 set_property(TARGET foo PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX boost_mpl_vector_size)
 target_compile_definitions(foo INTERFACE BOOST_MPL_LIMIT_VECTOR_SIZE=$<TARGET_PROPERTY:boost_mpl_vector_size>)

 add_library(bar INTERFACE)
 set_property(TARGET bar PROPERTY INTERFACE_boost_mpl_vector_size 40)
 # Technically the next two lines are redundant, but as foo and bar are
 # independent, they both set these interfaces.
 set_property(TARGET bar PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX boost_mpl_vector_size)
 target_compile_definitions(bar INTERFACE BOOST_MPL_LIMIT_VECTOR_SIZE=$<TARGET_PROPERTY:boost_mpl_vector_size>)

 add_executable(user)
 target_link_libraries(user foo bar)

Because the TARGET_PROPERTY reads the boost_mpl_vector_size property
from the HEAD of the dependency graph (the user target), and because
that property appears in the COMPATIBLE_INTERFACE_NUMBER_MAX of
the dependencies of the user target, the maximum value for it is
chosen for the compile definition, ie, 40.

There are also use-cases for choosing the minimum value of a number.
In Qt, deprecated API can be disabled by version. Setting the
definition QT_DISABLE_DEPRECATED_BEFORE=0 disables no deprecated
API. Setting it to 0x501000 disables API which was deprecated before
Qt 5.1 etc.

If two dependencies require the use of API which was deprecated in
different Qt versions, then COMPATIBLE_INTERFACE_NUMBER_MIN can be
used to ensure that both can compile.
2013-10-24 08:42:05 +02:00
Stephen Kelly e4e20c1d19 cmTarget: Add enumeration for consistency to expect from properties.
The type of consistency to be expected will be extended to cover
numeric minimum and maximum.
2013-10-24 08:42:04 +02:00
Stephen Kelly 98777694b9 cmTarget: Assign consistent content back to the property being evaluated.
Currently, 'consistent' means the same or not set. Soon though,
it will be possible to choose a minimum number from an interface
for example.
2013-10-24 08:42:04 +02:00
Stephen Kelly 816b4a8a18 cmTarget: Make consistentProperty return consistent content.
Upcoming features will make use of that.
2013-10-24 08:42:04 +02:00
Stephen Kelly 030800a78a cmTarget: Add a template to create correct implied content.
Otherwise, in the string case, we would get a null pointer instead
of the implied empty string. That will become relevant when the
comparison result is used.
2013-10-24 08:42:04 +02:00
Brad King 7d47c69365 Drop compatibility with CMake < 2.4
Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to
a value lower than 2.4, and generate an error when projects or the user
attempt to do so.  In the error suggest using a CMake 2.8.x release.

Teach cmake_minimum_required to warn about projects that do not require
at least CMake 2.4.  They are not supported by CMake >= 3.0.

Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a
reference to policy CMP0001.
2013-10-23 08:54:31 -04:00
Brad King d67286ff9b Merge topic 'output-CMP0022-entries'
0b3b336 CMP0022: Output link interface mismatch for static library warning
2013-10-23 08:20:14 -04:00
Stephen Kelly 0b3b3368fb CMP0022: Output link interface mismatch for static library warning
Other warnings for the same policy already have similar output since
commit 81d2793e (Add differing target property content to policy CMP0022
warning, 2013-09-11).
2013-10-23 08:18:02 -04:00
Brad King 0d9e8b1ab9 Merge topic 'double-colon-is-imported'
f063c45 Consider targets with double colons to be IMPORTED or ALIAS targets.
2013-10-22 09:07:40 -04:00
Stephen Kelly f063c45589 Consider targets with double colons to be IMPORTED or ALIAS targets.
Introduce a policy to control the behavior.

The AliasTargets unit test already tests that using a
double-semicolon in the name is not an error. Change the ExportImport
test to use a namespace with a double-semicolon too.
2013-10-21 15:56:31 +02:00
Brad King bf02e75079 Merge topic 'INTERFACE_LIBRARY-build-targets'
b04f3b9 Create make rules for INTERFACE_LIBRARY targets.
dba4962 Makefile: Always create clean target command
2013-10-21 09:48:04 -04:00
Stephen Kelly b04f3b9a2a Create make rules for INTERFACE_LIBRARY targets.
The result is that the depends of the target are created.

So,

 add_library(somelib foo.cpp)
 add_library(anotherlib EXCLUDE_FROM_ALL foo.cpp)
 add_library(extra EXCLUDE_FROM_ALL foo.cpp)
 target_link_libraries(anotherlib extra)

 add_library(iface INTERFACE)
 target_link_libraries(iface INTERFACE anotherlib)

Executing 'make iface' will result in the anotherlib and extra targets
being made.

Adding a regular executable to the INTERFACE of an INTERFACE_LIBRARY
will not result in the executable being built with 'make iface' because
of the logic in cmComputeTargetDepends::AddTargetDepend.

So far, this is implemented only for the Makefile generator. Other
generators will follow if this feature is possible for them.

Make INTERFACE_LIBRARY targets part of the all target by default.
Test this by building the all target and making the expected library
EXCLUDE_FROM_ALL.
2013-10-21 09:46:27 -04:00
Stephen Kelly af2a3ab691 cmTarget: Remove unused variable. 2013-10-18 18:58:02 +02:00
Stephen Kelly 70ae6dfd92 Handle genexes when evaluating INTERFACE_INCLUDE_DIRECTORIES errors. 2013-10-18 10:11:49 -04:00
Brad King 399e9c46d8 Drop builtin property documentation
Drop all DefineProperty calls for non-chained properties.  Drop the
documentation from the chained ones.  The documentation for all
properties is now in Help/prop_*/*.rst files.
2013-10-16 09:22:36 -04:00
Brad King b336a1ebe4 Teach COMPATIBLE_INTERFACE_* checks to use Help .rst documents
These checks want to know if named target properties are builtin, which
is now known by checking the Help/prop_tgt directory.  (Previously the
check could be confused by a define_property call in the project.)
2013-10-16 09:22:35 -04:00
Brad King b31ca93ba2 Merge topic 'target-LOCATION-policy'
e4e5b28 cmTarget: Deprecate the LOCATION target property with a policy.
2013-10-15 09:33:05 -04:00
Stephen Kelly e4e5b28c27 cmTarget: Deprecate the LOCATION target property with a policy.
The final location and name of a build-target is not determined
until generate-time. However, reading the LOCATION property from
a target is currently allowed at configure time. Apart from creating
possibly-erroneous results, this has an impact on the implementation
of cmake itself, and prevents some major cleanups from being made.

Disallow reading LOCATION from build-targets with a policy. Port some
existing uses of it in CMake itself to use the TARGET_FILE generator
expression.
2013-10-11 21:17:27 +02:00
Stephen Kelly 3507d5afdd Deprecate COMPILE_FLAGS target property.
It is succeeded by COMPILE_OPTIONS, which supports generator
expressions, is a list rather than a string, and is properly
escaped.
2013-10-11 13:40:29 +02:00
Brad King f8241136b4 Merge topic 'INTERFACE_LIBRARY-target-type'
ce0c303 install: Teach EXPORT option to handle INTERFACE_LIBRARY targets
435c912 export: Add support for INTERFACE_LIBRARY targets
fe73226 Add the INTERFACE_LIBRARY target type.
2013-10-08 10:58:40 -04:00
Stephen Kelly 435c912848 export: Add support for INTERFACE_LIBRARY targets 2013-10-07 20:07:27 -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 4e1368c1a0 Merge topic 'IMPORTED-target-SYSTEM-includes'
a63fcbc Always consider includes from IMPORTED targets to be SYSTEM.
2013-10-07 15:45:05 -04:00
Brad King e00089388c Merge topic 'cleanup-properties'
b78bc33 Cleanup some variable documentation names
bbfff52 Remove redundant cmake::GetIsPropertyDefined method
2013-10-07 15:43:55 -04:00
Brad King 2e7ba290a5 Merge topic 'minor_cleanup'
6931999 VS6: Add some delimiting between error message and content.
d1a5f12 cmTarget: Fix typo in comment.
961c0ba Fix comments to match the code.
7cca50c Remove unused include.
2013-10-07 15:43:23 -04:00
Brad King 31e6ee502e Merge topic 'authorative-LINK_LIBRARIES'
f01dc72 Use one authorative source of the LINK_LIBRARIES property.
2013-10-07 15:42:55 -04:00
Brad King 1e54b380cb Merge topic 'MAP_IMPORTED_CONFIG-property-default'
fb1294c cmTarget: Add initializer for MAP_IMPORTED_CONFIG_<CONFIG>
2013-10-07 15:41:49 -04:00
Stephen Kelly a63fcbcb9f Always consider includes from IMPORTED targets to be SYSTEM.
Introduce a target property to control this behavior variable
to set the default value for the target property.

This does not affect try_compile runs.
2013-09-24 20:00:31 +02:00
Brad King bbfff5233d Remove redundant cmake::GetIsPropertyDefined method
We already have cmake::IsPropertyDefined for the same reason.
2013-09-17 09:10:31 -04:00
Stephen Kelly 271bf10263 Fix CMP0022 warning when no old-style property is set
The string could be null at this point.
2013-09-13 11:34:08 -04:00
Stephen Kelly d1a5f1241d cmTarget: Fix typo in comment.
compatiblity -> compatibility
2013-09-12 16:43:05 +02:00
Stephen Kelly 81d2793e92 Add differing target property content to policy CMP0022 warning
List the contents of the INTERFACE_LINK_LIBRARIES and the old-style
property.
2013-09-11 22:28:32 +02:00
Stephen Kelly f01dc72c58 Use one authorative source of the LINK_LIBRARIES property.
We populate and maintain a vector of structs to keep track of
backtraces already, so no need to populate the Properties container
additionally.

For completeness, it is necessary to remove the condition for
populating the vector for only valid library names and generator
expressions. That condition is now determined when evaluating the
generator expressions.
2013-09-09 21:08:34 +02:00
Stephen Kelly fb1294c3a9 cmTarget: Add initializer for MAP_IMPORTED_CONFIG_<CONFIG> 2013-08-28 17:41:18 +02:00
Brad King 4923c6c724 Merge topic 'rpath-on-mac'
78cd884 OSX: Allow an empty INSTALL_NAME_DIR to override MACOSX_RPATH.
2013-08-26 10:28:10 -04:00
Stephen Kelly eef6df5c7d Fix OLD behavior of CMP0021.
Exclude Ninja and Xcode from the CMP0021 test

They do not behave the same as the makefile generator with
relative paths.

Don't overwrite the header file for in-source builds.
2013-08-24 15:14:56 +02:00
Clinton Stimpson 78cd884296 OSX: Allow an empty INSTALL_NAME_DIR to override MACOSX_RPATH.
With this, projects can enable MACOSX_RPATH by default, but still have
a way to install libraries with no install name dirs into locations
such as /usr/local/lib by setting INSTALL_NAME_DIR="".
2013-08-21 21:09:51 -06:00
Stephen Kelly 370bf55415 Add the ALIAS target concept for libraries and executables.
* The ALIAS name must match a validity regex.
* Executables and libraries may be aliased.
* An ALIAS acts immutable. It can not be used as the lhs
  of target_link_libraries or other commands.
* An ALIAS can be used with add_custom_command, add_custom_target,
  and add_test in the same way regular targets can.
* The target of an ALIAS can be retrieved with the ALIASED_TARGET
  target property.
* An ALIAS does not appear in the generated buildsystem. It
  is kept separate from cmMakefile::Targets for that reason.
* A target may have multiple aliases.
* An ALIAS target may not itself have an alias.
* An IMPORTED target may not have an alias.
* An ALIAS may not be exported or imported.
2013-08-02 15:21:00 +02:00
Stephen Kelly 43558156d4 cmTarget: Add NAME property
In generator expression contexts, this can be used to determine the
name of the head target in the evaluation.
2013-08-01 00:36:11 +02:00
Brad King 3dace78c2c Merge topic 'minor-cleanups'
b8dc7fa Genex: Disallow LINKER_LANGUAGE only when used on a static library.
c8a10ba cmTarget: Fix iface libraries and languages for static libraries.
f94bdb3 cmTarget: Remove duplicates when printing traces of tll signatures
ff3d5fa Export: Fix typo of LINK_INTERFACE_LIBRARIES.
79a7a81 Docs: Document variables for default visibility values.
6f6391b Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs.
d8cb47f Docs: Trim trailing whitespace in generated doc.
f10e648 Docs: Document existing target property debugging options.
4f4d69f Qt4Macros: Simplify some variable population.
a413a40 Qt4Macros: Remove undefined varible use.
b60a29e Qt4Macros: Remove unneeded generate CONDITION.
e454cba Docs: Document file(GENERATE) CONDITION as optional.
2013-07-29 09:54:34 -04:00
Stephen Kelly b8dc7fad23 Genex: Disallow LINKER_LANGUAGE only when used on a static library.
For shared libraries and executables, the linker_language is
indepenedent of the linked libraries.
2013-07-26 16:58:25 +02:00
Stephen Kelly c8a10ba9ad cmTarget: Fix iface libraries and languages for static libraries. 2013-07-26 15:15:42 +02:00
Brad King 87402c995e Merge topic 'tid-system-argument'
9b9a596 cmTarget: Fix property name typo in docs.
2013-07-26 09:01:22 -04:00
Stephen Kelly f94bdb3deb cmTarget: Remove duplicates when printing traces of tll signatures 2013-07-26 14:05:25 +02:00
Stephen Kelly 6f6391b771 Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs. 2013-07-26 09:37:12 +02:00
Stephen Kelly d8cb47f23c Docs: Trim trailing whitespace in generated doc. 2013-07-26 09:37:12 +02:00
Stephen Kelly 9b9a596004 cmTarget: Fix property name typo in docs. 2013-07-25 15:06:02 +02:00
Stephen Kelly b655865bbf target_link_libraries: Add PUBLIC/PRIVATE/INTERFACE keyword signature
Add a new signature to help populate INTERFACE_LINK_LIBRARIES and
LINK_LIBRARIES cleanly in a single call.  Add policy CMP0023 to control
whether the keyword signatures can be mixed with uses of the plain
signatures on the same target.
2013-07-24 11:52:44 -04:00
Brad King 828ddb6813 Merge topic 'framework-interface-includes'
f5ca872 Use linked frameworks as a source of include directories.
2013-07-24 11:50:49 -04:00
Stephen Kelly f5ca872e8b Use linked frameworks as a source of include directories. 2013-07-24 11:49:06 -04:00
Brad King a52f00e07c Merge topic 'minor-cleanups'
8f5b402 Remove TODO to uniq COMPILE_OPTIONS
5fb58b8 Don't add trailing whitespace to error message.
2013-07-24 11:02:24 -04:00
Stephen Kelly 4f6bd7022b Remove the LINK_LANGUAGE generator expression.
It accepted an optional argument to test for equality, but no way
to get the linker language of a particular target.

TARGET_PROPERTY provides this flexibility and STREQUAL provides
the necessary API for equality test.

Extend the CompileDefinitions test to cover accessing the
property of another target.
2013-07-24 10:40:00 -04:00
Stephen Kelly 5fb58b8686 Don't add trailing whitespace to error message. 2013-07-18 11:46:50 +02:00
Brad King ff6de6d325 Merge topic 'drop-old-vs-dependency'
4bb6e24 VS,Xcode: Drop incorrect legacy dependency trace (#14291)
2013-07-16 13:59:35 -04:00
Brad King 41a2fb5ba0 Merge topic 'tid-system-argument'
9cf3547 Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
1925cff Add a SYSTEM parameter to target_include_directories (#14180)
286f227 Extend the cmTargetPropCommandBase interface property handling.
83498d4 Store system include directories in the cmTarget.
f1fcbe3 Add Target API to determine if an include is a system include.
2679a34 Remove unused variable.
2013-07-16 13:59:07 -04:00
Stephen Kelly 9cf3547e1c Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property.
Unlike other target properties, this does not have a corresponding
non-INTERFACE variant.

This allows propagation of system attribute on include directories
from link dependents.
2013-07-16 13:44:57 -04:00
Brad King 4bb6e24809 VS,Xcode: Drop incorrect legacy dependency trace (#14291)
Drop the "vsProjectFile" argument from cmTarget::TraceDependencies.  It
appears to be the modern equivalent to a hunk added in commit ba68f771
(...added new custom command support, 2003-06-03):

 +  name = libName;
 +  name += ".dsp.cmake";
 +  srcFilesToProcess.push(name);

but was broken by refactoring at some point.  The current behavior tries
to trace dependencies on a source file named the same as a target, which
makes no sense.  Furthermore, in code of the form

 add_executable(foo foo.c)
 add_custom_command(OUTPUT "${somewhere}/foo" ... DEPENDS foo)

the "vsProjectFile" value "foo" matches source "${somewhere}/foo.rule"
generated to hold the custom command and causes the command to be added
to the "foo" target incorrectly.

Simply drop the incorrect source file trace and supporting logic.
2013-07-15 13:17:29 -04:00
Brad King d5d54b4629 Merge topic 'compile-defs-debugging'
d7dd010 Add target property debugging for COMPILE_DEFINITIONS
1841215 Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string.
afc9243 Add an overload of cmIDEOptions::AddDefines taking a vector of strings.
d95651e Overload cmLocalGenerator::AppendDefines to add a list.
2013-07-15 09:34:00 -04:00
Stephen Kelly d7dd01083a Add target property debugging for COMPILE_DEFINITIONS
Use constructs similar to those for COMPILE_OPTIONS. This is a little
different because there is a command to remove_definitions(), so
we can't populate the equivalent target property until generate-time
in cmGlobalGenerator.
2013-07-12 16:57:36 +02:00
Stephen Kelly 484bb888a0 Genex: Make CMP0021 and CMP0022 usable with TARGET_POLICY
Use preprocessor loops and add a unit test for the appropriate
policies. All policies whose value is recorded at target creation
time should be part of this list.
2013-07-11 11:56:14 +02: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
Stephen Kelly 3e30d9ed67 TLL: Don't populate old link interface if CMP0022 is NEW.
Always populate the INTERFACE_LINK_LIBRARIES for interface
entries. Don't populate the old interface properties
matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?
if CMP0022 is NEW.

Because the INTERFACE_LINK_LIBRARIES property is now populated by
the target_link_libraries when operating on a static library,
make an equivalent change which populates the property with
the same value when the old link_libraries() command is used. This
silences the policy warning in that case.
2013-07-08 22:39:58 +02:00
Stephen Kelly 574fec97fd Export: Generate INTERFACE_LINK_LIBRARIES property on targets.
This property is generated only for targets which have recorded
policy CMP0022 as NEW, and a compatibility mode is added to
additionally export the old interfaces in that case too.

If the old interfaces are not exported, the generated export files
require CMake 2.8.12. Because the unit tests use a version which
is not yet called 2.8.12, temporarily require a lower version.
2013-07-08 22:39:57 +02:00
Stephen Kelly d0a76ea07c Introduce the INTERFACE_LINK_LIBRARIES property.
This property replaces the properties which
match (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?, and is enabled
for IMPORTED targets, and for non-IMPORTED targets only with a policy.

For static libraries, the INTERFACE_LINK_LIBRARIES property is
also used as the source of transitive usage requirements content.
Static libraries still require users to link to all entries in
their LINK_LIBRARIES, but usage requirements such as INCLUDE_DIRECTORIES
COMPILE_DEFINITIONS and COMPILE_OPTIONS can be restricted to only
certain interface libraries.

Because the INTERFACE_LINK_LIBRARIES property is populated unconditionally,
we need to compare the evaluated result of it with the link implementation
to determine whether to issue the policy warning for static libraries. For
shared libraries, the policy warning is issued if the contents of
the INTERFACE_LINK_LIBRARIES property differs from the contents of the
relevant config-specific old LINK_INTERFACE_LIBRARIES property.
2013-07-08 22:39:09 +02:00
Stephen Kelly 5aa9731c9f GenexEval: Add abstracted access to link interface for a target.
This can be extended with special handling for static libraries
so that we can process the link dependencies separately from the
usage dependencies.
2013-07-08 00:00:17 +02:00
Stephen Kelly 83498d4135 Store system include directories in the cmTarget.
Entries from the cmMakefile are processed and maintained similarly
to other include directories. The include_directories(SYSTEM)
signature affects all following targets, and all prior targets
in the same makefile.
2013-07-02 16:40:02 +02:00
Alex Neundorf ba0e06f250 automoc: add a global AUTOMOC_TARGETS_FOLDER property
This has been requested, along with a patch, by Shaun Williams
 in http://public.kitware.com/Bug/view.php?id=13788 .
It adds a global property AUTOMOC_TARGETS_FOLDER, which can
be used to group the automoc targets together in a folder e.g.
in Visual Studio.

Alex
2013-06-28 21:40:16 +02:00
Christian Maaser cfe6300a41 VS: Add support for .NET target framework version
Teach CMake to generate the TargetFrameworkVersion XML node as
documented at

 http://msdn.microsoft.com/en-us/library/vstudio/ff770576.aspx

from target property VS_DOTNET_TARGET_FRAMEWORK_VERSION.
2013-06-14 08:09:00 -04:00
Brad King 93317839b0 Merge topic 'add_compile_options-command'
a984f32 Introduce add_compile_options command.
2013-06-05 09:39:05 -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 05e47f2122 Merge topic 'cfbundle-location'
483e208 OS X:  Fix getting of CFBundle LOCATION property.
2013-06-04 09:02:46 -04:00
Stephen Kelly a984f3257e Introduce add_compile_options command.
This command is similar to add_definitions, in that it affects
the compile options of all targets which follow it. The implementation
is similar to the implementation of the include_directories command,
in that it is based on populating a COMPILE_OPTIONS directory property
and using that to initialize the same property on targets.

Unlike the include_directories command however, the add_compile_options
command does not affect previously defined targets. That is, in
the following code, foo will not be compiled with -Wall, but bar
will be:

 add_library(foo ...)
 add_compile_options(-Wall)
 add_library(bar ...)
2013-06-04 11:36:55 +02: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 90441b289d Merge topic 'vs-RootNamespace'
cca955a VS: Add VS_GLOBAL_ROOTNAMESPACE target property
2013-06-03 09:57:32 -04:00
Brad King db5f5243b5 Merge topic 'fix-style'
e162326 Fix indentation.
2013-06-03 09:57:27 -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 b0759da303 Merge topic 'framework-refactor'
373faae Refactor how bundles and frameworks are supported.
2013-06-03 09:56:32 -04:00
Clinton Stimpson 8576b3f978 OS X: Add support for @rpath in export files.
Also expand the IMPORTED_SONAME property for targets
to match the install_name.
2013-06-03 09:42:05 -04:00
Clinton Stimpson 94e7fef226 OS X: Add RPATH support for Mac.
RPATH support is activated on targets that have the MACOSX_RPATH
property turned on.
For install time, it is also useful to set INSTALL_RPATH to help
find dependent libraries with an @rpath in their install name.

Also adding detection of rpath conflicts when using frameworks.
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 cd1fa537a0 Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.
This corresponds to the g++ and clang++
option -fvisibility-inlines-hidden on linux. On Windows with MinGW,
this corresponds to -fno-keep-inline-dllexport. That option is
not supported by clang currently.
2013-06-02 12:00:51 +02: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 24466f22c0 Add target_compile_options command.
This command populates the COMPILE_OPTIONS target property.
2013-06-02 11:56:37 +02:00
Stephen Kelly 80ca9c4b41 Add COMPILE_OPTIONS target property.
This method reads generator expressions from the COMPILE_OPTIONS
target property, as well as INTERFACE_COMPILE_OPTIONS from linked
dependents.
2013-06-02 11:56:37 +02:00
Stephen Kelly 7cb23084b2 cmTarget: Rename LinkInterfaceIncludeDirectoriesEntries
This can be used for COMPILE_OPTIONS too.
2013-06-02 11:56:37 +02:00
Stephen Kelly 47f80d9c43 cmTarget: Rename struct to be more re-usable.
The same struct can be used to represent COMPILE_OPTIONS content.
2013-06-02 11:56:36 +02:00
John Farrier cca955a27c VS: Add VS_GLOBAL_ROOTNAMESPACE target property
Add a setting for Visual Studio projects for the root namespace in the
"Globals" PropertyGroup section of the project file.
2013-05-31 09:15:30 -04:00
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