Commit Graph

1026 Commits

Author SHA1 Message Date
Stephen Kelly 607e19384f Replace 'foo.size() != 0' pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly 681d965df1 Use the cmDeleteAll algorithm for types derived from std::map. 2015-01-17 16:22:58 +01:00
Brad King 4ecc392b42 Merge topic 'delete-algorithm'
65b81da4 cmVariableWatch: Use the cmDeleteAll algorithm with for_each.
30d2de9a cmGeneratorExpressionEvaluator: Replace own algorithm with cmDeleteAll.
4a6e795b Use the cmDeleteAll algorithm instead of trivial raw loops.
abb4a678 Add a generic algorithm for deleting items in a container.
2015-01-15 09:54:04 -05:00
Brad King 44612e7407 Merge topic 'fix-LOCATION-with-TARGET_OBJECTS'
23f3798c cmTarget: Compute link language of TARGET_OBJECTS with CMP0026 OLD (#15338)
2015-01-15 09:53:59 -05:00
Stephen Kelly 4a6e795b0c Use the cmDeleteAll algorithm instead of trivial raw loops. 2015-01-13 23:00:17 +01:00
Stephen Kelly 23f3798c7b cmTarget: Compute link language of TARGET_OBJECTS with CMP0026 OLD (#15338)
Commit v3.1.0-rc1~297^2~5 (cmTarget: Drop 'head' argument from
GetSourceFiles, 2014-07-10) exposed a dormant bug in source file computation,
causing the test case to regress.  After that commit, the source file
computation and caching finds an existing container of source files.  Prior to
that patch, the GetSourceFiles method was called with either a null pointer
for the head cmTarget, or it was called with the this pointer.  The
processSources method is eventually called, which normalizes the difference
between the null pointer and the this pointer for the head target.  However,
the cache key depends on the actual pre-normalized pointer.  The change in
that commit caused the entry to be found in the cache where it was not before,
which resulted in incorrect behavior.

Prior to that commit, the test case also fails if the GetSourceFiles overload
taking a vector<cmSourceFile*> is changed to normalize the head target at
the beginning of the method:

  cmTarget const* head = head_ ? head_ : this;

Such a construct was correctly used in other locations where similar caching
was in place, before being removed in commit v3.1.0-rc1~310^2~25 (cmTarget:
Remove 'head' argument from GetLinkInformation, 2014-06-12), but is not
neccessary anymore.

Commit v3.1.0-rc1~674^2~2 (cmTarget: Cache the cmSourceFiles in
GetSourceFiles., 2014-04-05) introduced the caching, but fails the test case
for an unrelated reason.  That unrelated error was introduced in
commit v3.1.0-rc1~688^2~5 (cmTarget: Allow any generator expression in
SOURCES property., 2014-03-18) and fixed in
commit v3.1.0-rc1~561^2~1 (cmTarget: Fix listing of source files at
configure-time., 2014-04-13).

All commits which fail the test case in the testable way do so when such a
cached version of the source files is found and returned at generate
time.  In the test case, the cached content is populated at configure-time
through the use of the deprecated LOCATION property with CMP0026 OLD.  The
cached content is an empty container for the bar target in the test case,
because its source file 'foo.cpp.o' is not known until generate-time.  That
means that no source files are available to compute the link language and
the reported error is issued.

The actual problem is that the SourceFilesMap should be cleared after
configure time by cmTarget::ClearLinkMaps.  Clear it there now.
2015-01-13 09:36:20 +01:00
Brad King dd6c596c12 Merge topic 'join-algorithm'
55a73e6b Use the cmJoin algorithm where possible.
8dc8d756 cmStandardIncludes: Add a join algorithm for string containers.
b5813cee cmInstallCommand: Remove unused variable.
2015-01-12 09:41:02 -05:00
Brad King b5a467262b Merge topic 'drop-ancient-workarounds'
0f7bdd61 Remove VS 6 special case.
5e92c826 Remove some obsolete stuff.
15e42bb2 cmStandardIncludes: Remove obsolete cmOStringStream.
931e055d Port all cmOStringStream to std::ostringstream.
f194a009 Remove unused cmIStringStream class.
3ec1bb15 cmStandardIncludes: Remove std namespace hack.
bb3bce70 cmStandardIncludes: Remove ANSI_FOR_SCOPE hack.
28fa4923 cmStandardIncludes: Remove iostreams workaround for obsolete Compaq compiler.
837a8a63 cmStandardIncludes: Drop Comeau-related workaround.
4030ddfd Remove Borland-related undef.
17d6a6fd cmStandardIncludes: Remove comment about Borland.
26fb5011 Drop SGI as a CMake host compiler.
2015-01-12 08:57:39 -05:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Stephen Kelly 3660d063bc cmTarget: Use insert instead of std::copy.
insert can reserve() memory in the container, and this is
more-consistent with the rest of CMake now.
2015-01-11 17:00:56 +01:00
Stephen Kelly 6162c9194b Use two-iterator std::set::insert where appropriate. 2015-01-11 17:00:55 +01:00
Stephen Kelly 238dd2fbab Use insert instead of a loop in some cases.
Limit this change to inserting into a vector from a vector.

A follow up change can use insert for inserting into a set.
2015-01-11 17:00:55 +01:00
Stephen Kelly 55a73e6b1f Use the cmJoin algorithm where possible. 2015-01-08 22:28:18 +01:00
Brad King ccd5822a83 Merge topic 'osx-cfbundle-tweaks'
b189c599 Tests: Run CFBundleTest only with valid configuration
3a605693 Xcode: Call IsCFBundleOnApple to decide if bundle is being built
207b7af0 cmTarget: Use GetCFBundleDirectory within GetFullNameInternal
2014-12-19 08:26:57 -05:00
Gregor Jasny 207b7af00b cmTarget: Use GetCFBundleDirectory within GetFullNameInternal
Replace duplicated code by call to GetCFBundleDirectory.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-12-17 11:24:02 -05:00
Dmitry Polyanitsa eeaa25e521 Add 'ANDROID_API_MIN' target property to set Android Target MIN API
Also add a 'CMAKE_ANDROID_API_MIN' variable to set the property
default.  Teach the VS generator to write the MIN API value into
Nsight Tegra project files.
2014-12-17 11:17:28 -05:00
Sean McBride 2e92570bda Fix some Clang -Wstring-conversion warnings
Some false positives, but some flagged faulty asserts
where the ! was inside the string instead of outside.
2014-12-12 14:38:23 -05:00
Brad King 8e75f1d2fa Merge topic 'target-sources-error-conditions'
8a75c7ef Help: Document the export limitation of INTERFACE_SOURCES.
e1348056 Export: Disallow export of targets with INTERFACE_SOURCES
bb5905bb cmTarget: Don't allow relative paths in INTERFACE_SOURCES
2014-12-01 08:57:34 -05:00
Stephen Kelly bb5905bb13 cmTarget: Don't allow relative paths in INTERFACE_SOURCES
Follow the pattern of checks that are made for INTERFACE_INCLUDE_DIRECTORIES.
Existence is already checked by cmSourceFile::GetFullPath.  Add a check
to disallow relative paths in source directories. Otherwise code such as

 target_sources(lib1 INTERFACE foo.cpp)

would fail if consumed by a target in a different directory.

Unlike the INTERFACE_INCLUDE_DIRECTORIES behavior, we don't care whether
the entry comes from an IMPORTED target or not.  In the include directories
case, the directory for a non-imported target might not exist yet but
might be created.  In the sources case, a file which does not yet
exist in the filesystem must be explicitly marked with the GENERATED
property.

Adjust existing tests and add a new test for the error.
2014-11-29 12:24:59 +01:00
Brad King c7b9fad117 Merge topic 'remove-ancient-msvc-workarounds'
12cb0b86 Help: Update developer manual with some C++ features now permitted.
ba74465f cmGeneratorTarget: Remove MSVC7 workaround
41363c0c VisualStudio: Remove MSVC6 compatibility macro.
4efcfe52 cmSystemTools: Remove MSVC6 compatibility define.
5f4695cd cmStandardIncludes: Remove MSVC6 condition for cmArrayBegin macro.
7a064337 cmFindCommon: Remove MSVC6 workaround for nested struct private access.
fdb73547 cmTarget: Remove std::min and std::max MSVC6 compatibility code.
2014-11-25 10:28:57 -05:00
Brad King 4987b37165 Merge topic 'remove-c_str'
5eb4d759 Remove some unneeded c_str calls.
2014-11-25 10:18:49 -05:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01:00
Stephen Kelly fdb7354722 cmTarget: Remove std::min and std::max MSVC6 compatibility code.
CMake is no longer required to build with MSVC6.
2014-11-20 22:17:16 +01:00
Brad King 32a191ce4b cmTarget: Use null_ptr code path on all platforms
This reduces conversions asked of the compiler.  Also drop 'static' from
the declaration of the local null_ptr helper.
2014-11-20 10:22:07 -05:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Brad King 34d035e70e Merge topic 'vs-nsight-tegra-generator'
df84281d Help: Add notes for topic 'vs-nsight-tegra-generator'
69e198dc VS: Generate Nsight Tegra project revision number
5365c9ac VS: Map Nsight Tegra file types in .vcxproj files
178f56a5 VS: Fix Tegra-Android platform linking of libraries by name
7115702f Tests: Add test for VS Nsight Tegra generator support
a6289499 VS: Generate ANDROID_GUI executables as app packages
c12e4699 Add 'ANDROID_API' target property to set Android Target API
9a4df52a Add 'ANDROID_GUI' target property to mark Android applications
16569abf cmTarget: Track internally whether platform is Android
ef0fd4f0 VS: Teach vcxproj generation about the Tegra-Android platform
d09b60f5 VS: Detect compiler id of Nsight Tegra-Android toolchains
2f071466 VS: Teach VS >= 10 to recognize CMAKE_SYSTEM_NAME 'Android'
2014-09-30 08:46:27 -04:00
Brad King c12e46991e Add 'ANDROID_API' target property to set Android Target API
Also add a 'CMAKE_ANDROID_API' variable to set the property default.
2014-09-30 08:45:34 -04:00
Brad King 9a4df52aa1 Add 'ANDROID_GUI' target property to mark Android applications
Also add a 'CMAKE_ANDROID_GUI' variable to set the property default
so a project can easily make all executables Android applications.
An Android application executable file has the same extension as a
shared library (.so).
2014-09-29 16:05:53 -04:00
Brad King 16569abfa8 cmTarget: Track internally whether platform is Android
Add an IsAndroid member to save whether CMAKE_SYSTEM_NAME is "Android".
2014-09-29 16:05:53 -04:00
Brad King 92b2c6189d Remove extra slashes from LOCATION target property value
In commit v3.0.0-rc1~429^2~2 (Remove the Location member from cmTarget,
2012-10-07) a few extra slashes were added to the path construction
logic, perhaps due to a partially implemented attempt at handling the
case that GetDirectory returns an empty string.  This leads to LOCATION
paths with double slashes in some cases.  Remove them now.
2014-09-22 09:32:21 -04:00
Brad King b2282631f6 cmTarget: Do not mistake a preceding error for a CMP0049 failure
After calls to ProcessSourceItemCMP0049, check for an empty return
string to detect a failure instead of trusting GetErrorOccuredFlag.
The latter could have been left from a preceding non-fatal error.

Extend the RunCMake.Configure test to cover a case that exposed this
problem.
2014-07-30 13:48:33 -04:00
Brad King 7b743a2e76 cmTarget: Avoid re-computing head-independent link interfaces 2014-07-21 13:04:04 -04:00
Brad King 46099b82ed cmTarget: Move ComputeLinkImplementation* to internals
There are no external callers, and this will allow the methods to see
the full OptionalLinkImplementation internal structure.
2014-07-21 11:55:56 -04:00
Brad King 438d9c7c82 cmTarget: Re-order link interface map lookup logic
In GetLinkInterface, GetLinkInterfaceLibraries, and
GetImportLinkInterface, lookup the HeadToLinkInterfaceMap for the
current configuration first, and then index it by head target.  In
GetLinkImplementationLibrariesInternal, lookup the
HeadToLinkImplementationMap for the current configuration first, and
then index it by head target.
2014-07-21 11:43:30 -04:00
Brad King fe665fdda8 cmTarget: Refactor link interface map storage
Convert LinkInterfaceMapType and LinkImplMapType to nested maps that
index on configuration first and 'head' target second.
2014-07-21 11:26:10 -04:00
Brad King 9d13e1679f cmTarget: Remove duplicate link interface map
No target is both imported and not imported so we do not need separate
link interface maps for them.
2014-07-21 11:16:45 -04:00
Brad King 133cd996d1 cmTarget: Drop internal cache of build properties
These use a huge amount of memory that accumulates as generation
proceeds.  On the Unix Makefiles generator, only GetIncludeDirectories
and GetCompileDefinitions are even called more than once per target
(once for build files, once for dependency scanning preprocessor info).
Another approach will be needed to avoid duplicate computation in the
cases where it does occur.
2014-07-21 11:00:34 -04:00
Brad King a4d58722a4 cmTarget: Drop internal cache of link interface usage requirements
These use a huge amount of memory that accumulates as generation
proceeds.  On the Unix Makefiles generator, only GetIncludeDirectories
and GetCompileDefinitions are even called more than once per target
(once for build files, once for dependency scanning preprocessor info).
Another approach will be needed to avoid duplicate computation in the
cases where it does occur.
2014-07-21 11:00:33 -04:00
Brad King 36a8184d40 Merge topic 'dev/target-fastpaths'
a9c9b66c cmTarget: use a hash_map for cmTargets typedef
bcb6dbc1 cmTarget: help the optimizer a bit
679f3dee cmTarget: use hash_set for sets of strings
23d6520d cmTarget: Allow caching of empty genex expansions
cd54f1db cmTarget: Only copy GenEx expansions when necessary
b75fc0e1 cmTarget: Don't set properties on custom targets
66076915 cmTarget: Use static strings for special property names
cebefa71 cmTarget: Sort special property checks
97ce676e cmTarget: Fast path for regular properties
4cfa918a cmTarget: Factor out common code
85242b7d cmTarget: Use else/if trees rather than an if tree
2014-07-18 11:00:29 -04:00
Ben Boeckel bcb6dbc1cb cmTarget: help the optimizer a bit 2014-07-17 11:17:52 -04:00
Ben Boeckel 679f3deeb7 cmTarget: use hash_set for sets of strings 2014-07-17 11:17:50 -04:00
Ben Boeckel 23d6520daa cmTarget: Allow caching of empty genex expansions 2014-07-17 11:17:50 -04:00
Ben Boeckel cd54f1dbeb cmTarget: Only copy GenEx expansions when necessary 2014-07-17 11:17:50 -04:00
Ben Boeckel b75fc0e1ad cmTarget: Don't set properties on custom targets
Properties are not required on custom targets.
2014-07-17 11:17:50 -04:00
Ben Boeckel 660769151a cmTarget: Use static strings for special property names
The function is called enough that the std::string/cstr comparisons are
expensive from the strlen. Cache the strings for faster comparisons.
2014-07-17 11:17:50 -04:00
Ben Boeckel cebefa71fa cmTarget: Sort special property checks
The LINK_LIBRARIES property is by *far* the most popular. Move it to the
top. TYPE is second, but with more generator expression usage, that may
change in the future.
2014-07-17 11:17:49 -04:00
Ben Boeckel 97ce676e75 cmTarget: Fast path for regular properties 2014-07-17 11:17:49 -04:00
Ben Boeckel 4cfa918a9a cmTarget: Factor out common code 2014-07-16 17:28:32 -04:00
Ben Boeckel 85242b7df6 cmTarget: Use else/if trees rather than an if tree
Skips lots of unnecessary string comparisons.
2014-07-16 17:28:32 -04:00
Brad King c45dd669ab cmTarget: Cache compatible interface property sets
Replace isLinkDependentProperty with a CompatibleInterfaces structure
that records all the compatible interface properties in a set for each
type.  This avoids repeatedly traversing the link implementation closure
and asking every target for its compatible interface properties.
2014-07-16 13:38:22 -04:00
Brad King 89095514a7 cmTarget: Refactor GetLinkImplementationClosure internals
Store the 'Done' flag directly in each map entry instead of using a
separate map.
2014-07-16 13:38:22 -04:00
Brad King 0a8fbac19a cmTarget: Drop GetTransitivePropertyTargets method
Inline the implementation at the only remaining call site.
2014-07-16 13:31:29 -04:00
Brad King 535fd6ce6d cmTarget: Make GetLink*Libraries methods safer to use
Split the library lists out of LinkImplementation and LinkInterface into
LinkImplementationLibraries and LinkInterfaceLibraries parent classes,
respectively.  Return these from GetLinkImplementationLibraries and
GetLinkInterfaceLibraries, respectively, so that callers cannot access
parts of the structures that have not been populated.
2014-07-16 13:31:29 -04:00
Brad King 6e7e881c57 Honor $<LINK_ONLY> when checking interface properties
Callers of cmTarget::GetLinkImplementationClosure are interested in the
set of targets whose interface properties propagate to the current
target.  This excludes targets guarded by $<LINK_ONLY>.

Teach the CompatibleInterface test to cover suppression of interface
compatibility tests with $<LINK_ONLY>.  Although this is not recommended
in practice, it is a way of covering the above behavior.
2014-07-16 13:28:47 -04:00
Brad King 0400cd5dd1 Make $<LINK_ONLY> available to projects (#14751)
Previously this generator expression was used internally by the
target_link_libraries command to honor private linking requirements of
static libraries in their INTERFACE_LINK_LIBRARIES.  Remove the check
that limits $<LINK_ONLY> to this use case to make it available for
project code to use too.
2014-07-16 13:28:44 -04:00
Brad King a0dc1354fe Merge topic 'refactor-link-internals'
1ca0c0e9 cmTarget: Refactor internal imported LinkInterface map
102eea60 cmTarget: Simplify internal ComputeLinkInterfaceLibraries method
b0f57408 cmTarget: Move ComputeLinkInterfaceLibraries to internals
c69e8a55 cmTarget: Refactor internal LinkInterface map
4db3990e cmTarget: Drop 'head' argument from processSources
4b8130b8 cmTarget: Drop 'head' argument from GetSourceFiles
4c763dd1 cmTarget: Drop 'head' argument from GetLanguages
190cabe7 cmTarget: Drop 'head' argument from ComputeLinkImplementationLanguages
2014-07-16 13:04:21 -04:00
Brad King 8a205b980c cmTarget: Compile old-style link dependencies only for VS 6
Compile all the "ForVS6" cmTarget members only on Windows.  No other
platforms support the VS 6 generator.
2014-07-14 14:39:20 -04:00
Brad King d57be904ae cmTarget: Run old-style link dependencies only for VS 6
Invoke it at runtime only with the VS 6 generator.  No other generators
need it.
2014-07-14 14:38:58 -04:00
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