Commit Graph

1195 Commits

Author SHA1 Message Date
Stephen Kelly fff3c6cd1c cmMakefile: Move a container population. 2015-06-21 20:10:47 +02:00
Stephen Kelly a6e661b848 cmMakefile: Rename variables. 2015-06-21 20:10:46 +02:00
Stephen Kelly fe38bb2c29 cmMakefile: Change return type of ReadListFileInternal. 2015-06-21 20:10:46 +02:00
Stephen Kelly ac10fc0958 cmMakefile: Move listfile parsing responsibility. 2015-06-21 20:10:45 +02:00
Stephen Kelly 52b9d828ab cmMakefile: Move CMP0059 handling to command code.
Don't pay a penalty for it in all GetProperty calls.

Additionally, the storage of properties will eventually move to
cmState, which should only contain state and not logic for policies
like this.
2015-06-08 22:23:44 +02:00
Brad King d17aa60659 Merge topic 'data-layout'
8174e5cd cmCustomCommand: Remove special member functions.
34e1d6db cmCustomCommand: Re-arrange data layout.
54cb76f2 cmComputeLinkDepends: Re-arrange data layout.
b661d6c6 cmQtAutoGenerators: Re-arrange data layout.
40844a14 cmProcessTools: Re-arrange data layout.
b1ff32af cmOrderDirectories: Re-arrange data layout.
dd0417c7 cmInstallTargetGenerator: Re-arrange data layout.
125c4866 cmInstallFilesGenerator: Re-arrange data layout.
92b8b1fc cmGraphVizWriter: Re-arrange data layout.
7f3e1623 cmGlobalGenerator: Re-arrange data layout.
d9df7fa7 cmComputeComponentGraph: Re-arrange data layout.
db24e41b cmCommandArgumentParserHelper: Re-arrange data.
4cd13e80 cmComputeLinkInformation: Re-arrange data layout.
3e087a40 cmLocalUnixMakefileGenerator: Re-arrange data layout.
e0421701 cmMakefile: Re-arrange data layout.
c26696eb cmSourceFile: Re-arrange data.
...
2015-06-08 13:54:11 -04:00
Brad King ccc6fe9445 Merge topic 'clean-up-cmMakefile'
4c192fb5 cmMakefile: Remove cacheOnly option from GetDefinitions.
046aafff cmGetCMakePropertyCommand: Don't explicitly specify default param.
021c4b6f cmMakefile: Simplify handling of CACHE_VARIABLES property.
1981c971 cmMakefile: Simplify InitializeFromParent method.
353e422b cmMakefile: Remove unused GetPolicies method.
00bfa047 cmMakefile: Out-of-line the cmMakefileCall.
db74ce58 cmMakefile: Inline PushScope into PushFunctionScope.
ca140c2e cmMakefile: Create a unified raii for macro scopes.
d5dc4169 cmMakefile: Create a unified raii for function scopes.
2015-06-08 13:54:09 -04:00
Brad King f5690cc57c Merge topic 'move-Feature-API'
f573bd22 cmLocalGenerator: Add Feature API from cmMakefile.
ccbc2259 cmGeneratorTarget: Move Feature API from cmTarget.
2015-06-08 13:54:05 -04:00
Stephen Kelly 4c192fb531 cmMakefile: Remove cacheOnly option from GetDefinitions.
It is now unused.
2015-06-07 15:21:56 +02:00
Stephen Kelly 021c4b6f2b cmMakefile: Simplify handling of CACHE_VARIABLES property. 2015-06-07 15:21:55 +02:00
Stephen Kelly 5181fae264 cmPropertyMap: Remove chaining logic.
The chaining logic doesn't belong to the container, and the
CMakeInstance pointer doesn't need to be in cmPropertyMap.

Size goes from 56 to 48 bytes with GNU libstdc++-5.1.
2015-06-07 09:29:31 +02:00
Stephen Kelly 7c0aa672fe cmPropertyMap: Remove scope parameter from API where not used. 2015-06-07 09:29:30 +02:00
Stephen Kelly f573bd22e4 cmLocalGenerator: Add Feature API from cmMakefile. 2015-06-06 15:44:17 +02:00
Stephen Kelly 1981c9718b cmMakefile: Simplify InitializeFromParent method.
Provide a parent instead of requiring it to be computed through
the cmLocalGenerator.
2015-06-06 09:35:55 +02:00
Stephen Kelly 00bfa04748 cmMakefile: Out-of-line the cmMakefileCall. 2015-06-06 09:31:16 +02:00
Stephen Kelly db74ce5820 cmMakefile: Inline PushScope into PushFunctionScope.
Make it possible to group the various methods here a different way.
2015-06-06 09:30:45 +02:00
Stephen Kelly 242dcc2c22 cmListFileBacktrace: Replace local generator with cmState::Snapshot.
Construct cmOutputConverter only when needed.
2015-06-06 09:15:57 +02:00
Stephen Kelly 8680520fea cmMakefile: Make the cmState::Snapshot accessible. 2015-06-06 09:15:56 +02:00
Stephen Kelly ca140c2e89 cmMakefile: Create a unified raii for macro scopes. 2015-06-04 22:08:23 +02:00
Stephen Kelly d5dc4169ac cmMakefile: Create a unified raii for function scopes. 2015-06-04 22:08:23 +02:00
Brad King 0886880e3b Merge topic 'cmMakefile-Configure'
7657e8b1 cmMakefile: Introduce a local cmMakefile variable.
4e8f242d cmMakefile: Store unconfigured cmMakefiles.
d65e0123 cmMakefile: Implement ConfigureSubDirectory in terms of cmMakefile.
f059ed16 cmMakefile: Move Configure responsibility from cmLocalGenerator.
a653611d cmake: Replace CurrentLocalGenerator concept with CurrentMakefile.
69a038a9 cmMakefile: Refactor directories specified with the subdirs command.
08637970 cmLocalGenerator: ComputeObjectMaxPath just before generating.
27e11c6f Merge Configure state with GeneratingBuildSystem state.
363caa2f cmLocalGenerator: De-virtualize Configure().
2015-06-04 09:13:35 -04:00
Brad King 5a1c8806bf Merge topic 'rename-cmState-API'
cf1233a0 cmState: Rename GetParent method.
942df88b cmState: Rename CreateSnapshot method.
da28f115 cmState: Add CreateBaseSnapshot method.
2015-06-04 09:13:31 -04:00
Brad King b49aef6b10 Merge topic 'minor-cleanups'
eb7b6f6d cmVariableWatchCommand: Simplify error reporting.
499ebb65 cmListFileBacktrace: Internalize the step of making paths relative.
80b433b0 cmGlobalGenerator: Don't use else after a return.
52919ac8 cmMakefile: Make cmListFileBacktrace default constructible.
b68f2ea8 cmMakefile: Add API for elseif to create backtrace.
17e13f0a cmMakefile: Simplify CMP0000 handling.
2015-06-04 09:13:27 -04:00
Stephen Kelly 7657e8b1df cmMakefile: Introduce a local cmMakefile variable. 2015-06-04 09:06:42 -04:00
Stephen Kelly 4e8f242d17 cmMakefile: Store unconfigured cmMakefiles.
Not cmLocalGenerators.
2015-06-04 09:06:42 -04:00
Stephen Kelly d65e01235d cmMakefile: Implement ConfigureSubDirectory in terms of cmMakefile. 2015-06-04 09:06:42 -04:00
Stephen Kelly f059ed165b cmMakefile: Move Configure responsibility from cmLocalGenerator.
The generator should only have a function at generate time.
2015-06-04 09:06:41 -04:00
Stephen Kelly 69a038a9e9 cmMakefile: Refactor directories specified with the subdirs command.
Store the directories on the cmMakefile as explicitly not-configured-yet.
2015-06-04 09:06:41 -04:00
Stephen Kelly 27e11c6fea Merge Configure state with GeneratingBuildSystem state. 2015-06-04 09:06:40 -04:00
Brad King c85367f408 VS: Compute project GUIDs deterministically
Compute deterministic GUIDs that are unique to the build tree by
hashing the path to the build tree with the GUID logical name.
Avoid storing them in the cache, but honor any found there.
This will allow project GUIDs to be reproduced in a fresh build
tree so long as its path is the same as the original, which may
be useful for incremental builds.
2015-06-04 08:40:08 -04:00
Stephen Kelly cf1233a0ea cmState: Rename GetParent method.
Leave the namespace open for other Parent types.
2015-06-03 01:15:03 +02:00
Stephen Kelly 942df88bf8 cmState: Rename CreateSnapshot method.
Leave the namespace open for other snapshot types.
2015-06-03 01:14:34 +02:00
Stephen Kelly b68f2ea8ae cmMakefile: Add API for elseif to create backtrace. 2015-06-03 01:03:58 +02:00
Stephen Kelly 17e13f0a2d cmMakefile: Simplify CMP0000 handling. 2015-06-03 01:03:57 +02:00
Brad King c12fc3573b Merge topic 'inject-state-snapshot'
3b880a07 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
e12afe76 cmState: Host some state from the cmGlobalGenerator.
c7b79aa1 cmGlobalGenerator: Require a cmake instance in ctor.
01e1cd5c cmState: Move snapshot creation to the cmake instance.
2015-05-27 09:23:01 -04:00
Stephen Kelly 3b880a0741 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a
cmState::Snapshot.  Adjust MakeLocalGenerator to use the 'current'
snapshot in cases where there is no parent.  Create the snapshot
for subdirectories in cmMakefile::AddSubdirectory.

This means that snapshots are now created at the point of extending the tree,
as appropriate, and independently of the cmLocalGenerator and cmMakefile they
represent the state for.
2015-05-27 09:18:32 -04:00
Stephen Kelly f5b0a0fba4 cmMakefile: Don't pop the directory listfile off the stack.
Simplify the IssueMessage implementation.
2015-05-25 09:49:59 +02:00
Stephen Kelly e40fcb598d cmMakefile: Simplify convert condition.
The CallStack is checked above.
2015-05-25 09:21:56 +02:00
Stephen Kelly 8b4b9631f5 cmake: Add IssueMessage overload taking a single cmListFileContext.
Port appropriate clients to use it.
2015-05-22 01:21:35 +02:00
Brad King 3e3a09d1d3 Merge topic 'clean-up-CMAKE_COMMAND'
6fbd4cae Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
2015-05-21 09:03:52 -04:00
Brad King 6fbd4cae0d Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND"
everywhere.
2015-05-20 11:20:42 -04:00
Stephen Kelly b9f9915516 cmMakefile: Remove VarUsageStack.
Store usage information in the cmDefintions value instead.  We already
pay for the memory as padding in the Def struct, so we might as well
use it.
2015-05-19 22:36:53 +02:00
Stephen Kelly 2b09d9f346 cmMakefile: Remove VarInitStack.
In cmMakefile::PushScope, a copy of the closure of keys initialized
in the parent scope is made.  In PopScope, essentially the same copy
is inserted back into the parent.  That means a lot of duplication
of strings and a lot of string comparisons.  None of it is needed,
because the cmDefinitions keys already provide a canonical
representation of what is initialized.

The removal of the separate container also makes the variable handling
code more easy to reason about in general.

Before this patch, configuring llvm uses 200 KiB for the VarInitStack.
Overall peak memory consumption goes from 35.5 MiB to 35.1 MiB.
2015-05-19 22:36:53 +02:00
Stephen Kelly 528d68021c cmMakefile: Use more suitable method name to log var usage. 2015-05-19 22:36:52 +02:00
Stephen Kelly f58c3774d1 cmMakefile: Mark definitions explicitly erased, even at top level.
Presumably the intention here is to attempt to optimize memory by not
storing what is not needed.  However, all keys need to be tracked
anyway to implement initialization tracking, and this special case
gets in the way of simplifying the implementation of that.

This doesn't change any observable effects because values set
to 0 are considered not to exist by the cmDefinitions API.
2015-05-19 22:36:52 +02:00
Stephen Kelly ea7b962be2 cmMakefile: Raise variable in scope explicitly when needed.
The Get method implicitly pulls a copy of all variables into a local scope. This
is not necessary.
2015-05-19 22:36:51 +02:00
Stephen Kelly c8cb66880c cmMakefile: Use early return to reduce nested code. 2015-05-19 22:36:51 +02:00
Stephen Kelly bdd1aa91ae cmMakefile: Don't use else after return. 2015-05-19 22:36:51 +02:00
Stephen Kelly c42f0e2b3e cmMakefile: Remove redundant conditions.
This container is never empty.
2015-05-19 22:36:51 +02:00
Stephen Kelly bb1e8c3adf cmMakefile: Remove Print() debugging facilities.
They don't print things that are important in the modern implementation.
2015-05-19 22:36:50 +02:00
Stephen Kelly 1363bff83a cmMakefile: Remove duplicate variable initialization. 2015-05-19 22:36:50 +02:00
Stephen Kelly 5b7ff35c4d cmMakefile: Don't expect the VarStack iterator to support size(). 2015-05-19 22:36:50 +02:00
Stephen Kelly 390bc3244f cmMakefile: Remove redundant condition.
As this is called in the constructor, the definition will never be already
set.
2015-05-19 22:36:49 +02:00
Stephen Kelly 8ab1cce704 cmMakefile: Rename method to something more appropriate.
Allow the name to be used for something more-suitable.
2015-05-19 22:36:49 +02:00
Stephen Kelly 2dd5d42f52 cmMakefile: Make the public ReadListFile method take one param.
Make the existing method a private overload. All external callers
invoke the method with only one argument.
2015-05-19 22:36:49 +02:00
Stephen Kelly f3e6a336f2 cmMakefile: Remove CurrentListFile member.
It is never read externally.  The CollapseFullPath removed in this commit
is a repeat of a similar call inside ReadListFile.
2015-05-19 22:36:48 +02:00
Stephen Kelly 6b9e647239 cmMakefile: Port CurrentListFile clients to GetDefinition.
There is no need to store this as a member variable.
2015-05-19 22:36:48 +02:00
Brad King 0cbc69b9ea Merge topic 'minor-cleanups'
61d52e6e cmListFileBacktrace: Hide the context-stack implementation detail.
a271f7f1 cmTarget: Simplify CMP0023 message loop.
f4300cd4 cmTarget: Simplify output computation.
65a42849 cmTarget: Store context in stack only if different.
9645cba3 cmListFileContext: Implement EqualityComparable.
52a8d19c cmTarget: Store only cmListFileContext for CMP0023 handling.
59ba1215 cmTarget: Remove needless iteration.
18f810a8 cmListFileContext: Sort by line before file.
e96b5d14 cmListFileContext: Implement LessThanComparable.
7eb0dfa0 cmMakefile: Use std::set::insert API to simplify CMP0054 handling.
f9785e0c cmMakefile: Simplify CMP0054 handling.
e17b5e42 cmMakefile: Add access to the top-level execution context.
1ec1bf9f if(): Test the effect of cmMakefileCall use in elseif() handling.
9b4aefad cmMakefile: Replace deques with vectors.
2015-05-19 11:09:36 -04:00
Brad King 93acb504c0 Merge topic 'clean-up-makefile-generators'
036372c4 Remove obsolete overrides of CreateLocalGenerator.
684e5cef cmGlobalGenerator: Host the MakeSilentFlag.
2047144f cmLocalGenerator: Remove unused IgnoreLibPrefix.
333c1fa8 cmGlobalUnixMakefileGenerator3: Host the UnixCD.
a97df5e1 cmGlobalUnixMakefileGenerator3: Host the PassMakeflags.
14f171c3 Remove method calls just repeating the default.
cf7f03e5 cmGlobalUnixMakefileGenerator3: Host the DefineWindowsNULL.
e9b134b9 cmGlobalUnixMakefileGenerator3: Host the include directive.
24613d8b cmLocalGenerator: Remove unused method.
b659d161 cmGlobalGenerator: Add NVI wrapper to create local generator.
2015-05-19 11:09:31 -04:00
Brad King 2d1d8af9b1 Merge topic 'clean-up-cmDefinitions'
f170985e cmDefinitions: Make the ClosureKeys method static.
98c5c903 cmDefinitions: Centralize knowledge of iterator type.
7872201b cmDefinitions: Remove internal MakeClosure method.
2015-05-19 11:09:28 -04:00
Brad King aa68f2e4c9 Merge topic 'fix-function-missing-endforeach'
3a656065 Fix assertion failure on unmatched foreach in function (#15572)
2015-05-19 11:09:21 -04:00
Stephen Kelly 61d52e6e77 cmListFileBacktrace: Hide the context-stack implementation detail.
The backtrace will soon not be implemented in terms of a stack of
cmListFileContext objects.  Keep the cmListFileContext in the API
for convenience for now.
2015-05-18 23:56:00 +02:00
Stephen Kelly e96b5d14f9 cmListFileContext: Implement LessThanComparable.
Move wrapping existing code from cmMakefile, and simplify the
implementation there.
2015-05-18 23:55:43 +02:00
Stephen Kelly 7eb0dfa062 cmMakefile: Use std::set::insert API to simplify CMP0054 handling. 2015-05-18 23:55:43 +02:00
Stephen Kelly f9785e0cb6 cmMakefile: Simplify CMP0054 handling. 2015-05-18 23:55:43 +02:00
Stephen Kelly e17b5e4262 cmMakefile: Add access to the top-level execution context.
This is cheaper than getting the whole backtrace, and the cmListFileBacktrace
will not always be composed of cmListFileContext objects.
2015-05-18 23:55:41 +02:00
Stephen Kelly 9b4aefad41 cmMakefile: Replace deques with vectors. 2015-05-18 21:25:48 +02:00
Brad King 3a65606591 Fix assertion failure on unmatched foreach in function (#15572)
The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track
nested loop levels in CMake language with a stack of counters,
2014-11-18) forgot to account for scopes popped by error messages about
unclosed scopes.  Teach the error handler to pop the lexical scope it
reports as unclosed.  Re-order the lexical scope RAII object to be
inside the variable scope RAII object scope so that the lexical scope
is fully closed before we check assertions about variable scopes.

Extend the RunCMake.Syntax test with a case covering this.
2015-05-18 11:13:05 -04:00
Stephen Kelly f170985e7a cmDefinitions: Make the ClosureKeys method static.
For consistency with all other closure-related methods.
2015-05-17 16:50:18 +02:00
Stephen Kelly b659d161da cmGlobalGenerator: Add NVI wrapper to create local generator. 2015-05-16 05:18:25 +02:00
Stephen Kelly ce167b546d cmMakefile: Handle CMP0014 before configuring the generator. 2015-05-14 21:26:13 +02:00
Stephen Kelly 63255342c6 cmMakefile: Remove redundant variable set.
The variable is initialized by the constructor already.
2015-05-14 20:57:24 +02:00
Stephen Kelly 894961af16 cmMakefile: Use the state to determine the parent directory.
Do not depend on the local generator for that.
2015-05-14 20:57:21 +02:00
Stephen Kelly 76b598319f cmLocalGenerator: Initialize state before creating cmMakefile.
Access the state from the local generator in the cmMakefile.
2015-05-14 20:36:28 +02:00
Brad King 226df303f9 CTest: Stop telling 'make' to ignore errors with -i
Add policy CMP0061 to maintain compatibility for existing projects.
2015-05-12 09:06:49 -04:00
Brad King 2c5a1bff23 Merge topic 'refactor-cmPolicies'
013ada80 cmPolicies: Implement PolicyMap in terms of bitset.
be6664c2 cmPolicies: Implement abstraction for PolicyMap.
de211686 Port to static cmPolicies API.
13981f20 cmPolicies: Make all API static.
23e2bcc8 cmPolicies: Remove unused DefinePolicy method.
5641ba4f cmPolicies: Remove unused cmPolicy class.
3de54497 cmPolicies: Loop over all policies using enum constants.
387aff20 cmPolicies: Trivialize GetPolicyStatus method.
dbf680d6 cmPolicies: Use more-direct ID access.
8c204133 cmPolicies: Implement in terms of public API.
e3a8c029 cmPolicies: Make private method file-static.
cb765af0 cmPolicies: Implement short description access with XMacros.
5df267fa cmPolicies: Implement version check with XMacro.
2235cfeb cmPolicies: Implement id to version with XMacro.
05d84388 cmPolicies: Implement id to string conversion with XMacro.
6eaade8a cmPolicies: Introduce XMacro table for policy data.
...
2015-05-05 09:35:30 -04:00
Brad King 82a55ff916 Merge topic 'refactor-cmMakefile-constructor'
42142d4f cmMakefile: Inline Intialize method in constructor
f39f0c0a cmMakefile: Initialize SuppressWatches member before use
2015-05-05 09:35:23 -04:00
Stephen Kelly be6664c208 cmPolicies: Implement abstraction for PolicyMap.
Hide the detail that it is a std::map.
2015-05-04 22:32:21 +02:00
Stephen Kelly de21168612 Port to static cmPolicies API. 2015-05-04 22:32:20 +02:00
Brad King 0d167b3e60 Merge topic 'add-cmMakefile-GetGlobalGenerator'
a0836ed9 Port to cmMakefile::GetGlobalGenerator.
cbf143bb cmComputeTargetDepends: Use simpler global generator access.
040491fc cmComputeLinkDepends: Remove unused local generator.
0bb6dbe0 cmMakefile: Extract an accessor for the global generator.
e1bdf5f5 cmMakefile: Use GetCMakeInstance.
efcca935 cmMakefile: Simplify GetCMakeInstance implementation.
2015-05-04 11:02:23 -04:00
Brad King 42142d4fd2 cmMakefile: Inline Intialize method in constructor
Since commit 80909041 (cmMakefile: Disable copy constructor, 2015-04-18)
the only call to cmMakefile::Initialize is in one constructor.  Inline
it and drop the separate method.
2015-05-04 10:22:01 -04:00
Brad King f39f0c0aec cmMakefile: Initialize SuppressWatches member before use
In commit 86f3cd0f (cmMakefile: Require the localGenerator in the
constructor, 2015-04-27) we added use of GetDefinition to the
Initialize method.  Set SuppressWatches before calling this method
since GetDefinition checks it.
2015-05-04 10:22:01 -04:00
Stephen Kelly a0836ed978 Port to cmMakefile::GetGlobalGenerator. 2015-05-03 11:42:00 +02:00
Stephen Kelly 0bb6dbe0c6 cmMakefile: Extract an accessor for the global generator.
Both for convenience, and because cmMakefile should not be the
way to get access to the local generator, so that should go away
in the future.
2015-05-03 11:41:59 +02:00
Stephen Kelly e1bdf5f5b2 cmMakefile: Use GetCMakeInstance. 2015-05-03 11:41:59 +02:00
Stephen Kelly efcca9353f cmMakefile: Simplify GetCMakeInstance implementation.
No callers handle the possibility that it can return null, and that
is no longer possible anyway.
2015-05-03 11:05:27 +02:00
Stephen Kelly 6c7dad41d9 cmDefinitions: Make Get method static. 2015-05-01 19:45:05 +02:00
Stephen Kelly 191573f792 cmDefinitions: Remove Parent pointer.
All structural knowledge of the stack of scopes is now external.
2015-05-01 19:34:59 +02:00
Stephen Kelly 8b1745a1c5 cmDefinitions: Accept varStack iterators in Get API. 2015-05-01 19:34:59 +02:00
Stephen Kelly e8ae46e5e2 cmMakefile: Implement RaiseScope without relying on Parent. 2015-04-30 23:45:06 +02:00
Stephen Kelly 30a021cc22 cmMakefile: Implement RaiseScope in terms of local Get method.
The cmDefinitions::Get will change behavior in follow up commits.
2015-04-30 23:34:01 +02:00
Brad King 5e35d4a67f Merge topic 'refactor-cmDefinitions'
b48ea26a cmDefinitions: Invert conditional code.
5ccff640 cmDefinitions: Externalize looping for ClosureKeys.
f79cd99d cmDefinitions: Implement MakeClosure in terms of reverse iterators.
aa4d1ee8 cmDefinitions: Convert MakeClosure into a static method.
60becdc6 cmDefinitions: Implement MakeClosure in terms of a list of ancestors.
d858f363 cmDefinitions: Use list of cmDefinitions* to create closure.
aaaa65b6 cmMakefile: Remove stack adaptor for the VarStack.
f983d891 cmDefinitions: Replace recursion with loop.
24885d4e cmDefinitions: Replace private constructor with MakeClosure.
012a75a0 cmDefinitions: Make ClosureKeys API vector-based.
ca9fa77d cmDefinitions: Inline GetClosureKeys implementation.
78e1454e cmDefinitions: Replace ClosureKeys recursion with looping.
818bf727 cmDefinitions: Change LocalKeys to return a vector.
5067ae41 cmDefinitions: Externalize the Set logic.
60200ca5 cmDefinitions: Add an Erase method.
b43c162e cmMakefile: Use the Internal class to enclose the VarStack.
2015-04-30 11:19:20 -04:00
Brad King b39929ab42 Merge topic 'revert-CMP0057'
32a2f414 Revert "add_custom_command: Diagnose MAIN_DEPENDENCY limitation."
2015-04-30 10:32:01 -04:00
Nils Gladitz 32a2f41402 Revert "add_custom_command: Diagnose MAIN_DEPENDENCY limitation."
This reverts commit 242c3966 (add_custom_command: Diagnose
MAIN_DEPENDENCY limitation, 2015-03-09) and the follow up commit
b372a99a (UseSWIG: Do not use MAIN_DEPENDENCY on custom commands,
2015-03-26).

I misdiagnosed the underlying issue that prompted creation of policy CMP0057.
The actual issue surfaces when a single custom command's MAIN_DEPENDENCY
is listed in more than one target; this issue will have to be addressed
independently.
2015-04-30 10:20:20 -04:00
Stephen Kelly 5ccff6408c cmDefinitions: Externalize looping for ClosureKeys. 2015-04-30 00:32:18 +02:00
Stephen Kelly f79cd99d6d cmDefinitions: Implement MakeClosure in terms of reverse iterators.
Iterate directly over the parent content provided by cmMakefile.
2015-04-29 23:54:20 +02:00
Stephen Kelly aa4d1ee80f cmDefinitions: Convert MakeClosure into a static method.
Accept a range of cmDefinitions*.
2015-04-29 23:54:17 +02:00
Stephen Kelly aaaa65b6a5 cmMakefile: Remove stack adaptor for the VarStack.
The purpose of the stack is to allow access only to the top of it.  Access
to items which are not at the top is needed, so cmDefinitions objects
get a Parent pointer.

The existence of the Parent pointer is a workaround for the inappropriate
use of stack in the first place.  Remove it now.
2015-04-29 22:51:47 +02:00
Stephen Kelly 24885d4efa cmDefinitions: Replace private constructor with MakeClosure. 2015-04-29 22:51:46 +02:00
Stephen Kelly 012a75a00f cmDefinitions: Make ClosureKeys API vector-based.
Construct the final list directly in a named return value.  Use
a single set to track bindings already found.

Co-Author: Brad King <brad.king@kitware.com>
2015-04-29 22:51:28 +02:00
Stephen Kelly 818bf727c1 cmDefinitions: Change LocalKeys to return a vector.
This is more efficient and we lose nothing.
2015-04-29 22:49:05 +02:00
Stephen Kelly 5067ae41b0 cmDefinitions: Externalize the Set logic. 2015-04-29 22:48:56 +02:00
Stephen Kelly b43c162e99 cmMakefile: Use the Internal class to enclose the VarStack.
Put knowledge of the implementation details in one place.
2015-04-29 22:48:12 +02:00
Stephen Kelly 46f6a5f458 cmState: Store the Current directories. 2015-04-28 07:57:21 +02:00
Stephen Kelly 3a041c5949 Introduce cmState::Snapshot.
Create snapshots for buildsystem directories during configure time.

This class will be extended in follow up commits to snapshot
all values in the cmState.
2015-04-28 07:57:01 +02:00
Stephen Kelly 86f3cd0f7e cmMakefile: Require the localGenerator in the constructor.
Move the contents of cmMakeile::SetLocalGenerator to the Initialize
method.
2015-04-28 07:50:57 +02:00
Stephen Kelly a48aebcb67 cmLocalGenerator: Require a parent in the constructor.
Pass the parent though cmGlobalGenerator::CreateLocalGenerator.

This will make it easy to initialize state scopes independent of
cmMakefile.
2015-04-28 07:50:52 +02:00
Stephen Kelly e4c78b37ce cmMakefile: Inline SetHome* methods into last remaining caller. 2015-04-28 07:50:02 +02:00
Stephen Kelly 410f39a43e cmMakefile: Delegate storage of Home dirs to the cmake class.
There is no need to duplicate these on every cmMakefile.
2015-04-28 07:50:01 +02:00
Brad King 5a5ef00106 Merge topic 'clean-up-cmMakefile'
8dc3a67c cmMakefile: Out-of-line the directory methods.
0f3c8cfa cmMakefile: Use method abstraction to access directories.
b288a997 cmMakefile: Rename SetStart* directory API to SetCurrent*.
932d53bc cmMakefile: Remove redundant method duplication.
32b8f03a cmMakefile: Port users of GetStart* methods to new names.
54d6a918 cmMakefile: Rename GetCurrent{Output,Binary}Directory.
55d80d0a cmMakefile: Rename GetCurrent{,Source}Directory.
b23cf06f cmake: Remove redundant start directories.
fcf246ac cmMakefile: Populate Home directories on initialize.
8878bea7 cmake: Initialize Home directories on cmake for find-package mode.
044dc815 Use the Home directories from the cmake class where intended.
d67e8f24 cmake: Fix directory used to find the cache
1ea085d1 cmMakefile: Initialize dir definitions early.
f034bb2f Remove redundant calls to MakeStartDirectoriesCurrent.
3a68c323 cmMakefile: Fix wrong parameter names.
2015-04-21 09:42:07 -04:00
Stephen Kelly 8dc3a67c9c cmMakefile: Out-of-line the directory methods. 2015-04-21 09:41:27 -04:00
Stephen Kelly 0f3c8cfa96 cmMakefile: Use method abstraction to access directories. 2015-04-21 09:41:27 -04:00
Stephen Kelly 8090904198 cmMakefile: Disable copy constructor.
It is no longer necessary to be able to copy it.  Additionally, this
gives us one less reason to copy cmTarget.
2015-04-21 00:26:37 +02:00
Stephen Kelly b288a997e9 cmMakefile: Rename SetStart* directory API to SetCurrent*. 2015-04-21 00:15:20 +02:00
Stephen Kelly 32b8f03acc cmMakefile: Port users of GetStart* methods to new names. 2015-04-21 00:15:20 +02:00
Stephen Kelly 55d80d0a85 cmMakefile: Rename GetCurrent{,Source}Directory.
Match the names used in cmake code.
2015-04-21 00:12:52 +02:00
Stephen Kelly b23cf06f86 cmake: Remove redundant start directories.
They are maintained as containing the same content as the 'home'
directories, but they are never read from.

Fix some comments and help strings which confused the two by
name. They actually mean what is called CMAKE_SOURCE_DIR in
cmake code.
2015-04-21 00:12:51 +02:00
Stephen Kelly fcf246acd1 cmMakefile: Populate Home directories on initialize. 2015-04-21 00:12:51 +02:00
Stephen Kelly 1ea085d1b6 cmMakefile: Initialize dir definitions early. 2015-04-21 00:12:51 +02:00
Stephen Kelly 3a68c323ba cmMakefile: Fix wrong parameter names. 2015-04-21 00:12:51 +02:00
Stephen Kelly 05245b4229 cmMakefile: Move some preamble out of the Internal method. 2015-04-18 15:31:18 +02:00
Stephen Kelly 6e23a4bddd cmMakefile: Remove always-null first parameter to ReadListFile. 2015-04-18 15:31:18 +02:00
Stephen Kelly d21ebcb244 cmMakefile: Swap parameters of calls to ReadListFile.
The version with a null first parameter is now equivalent.
2015-04-18 15:31:18 +02:00
Stephen Kelly 95a27267da cmMakefile: Extract conditional code to caller. 2015-04-18 15:31:17 +02:00
Stephen Kelly 7d24854736 cmMakefile: Remove intermediate variable. 2015-04-18 15:31:17 +02:00
Stephen Kelly 9db1595410 cmMakefile: Move condition to the only calling context where it is true.
Call the Internal method with equivalent parameters, passing a null first
argument.

A duplicate path computation exists inside the external_in condition now,
but that is harmless at this point.
2015-04-18 15:31:11 +02:00
Stephen Kelly 5d4480a8c7 cmMakefile: Populate CMAKE_PARENT_LIST_FILE in callers.
Because all external callers of this method pass a null first
parameter, this change has no effect for them.

This also makes it obvious that the CMAKE_PARENT_LIST_FILE is set to
the name of the file being read itself for CMakeLists.txt files,
which may not make any sense.
2015-04-18 15:29:20 +02:00
Stephen Kelly 3a8ac2423e cmMakefile: Collapse nested conditional. 2015-04-18 15:29:19 +02:00
Stephen Kelly 5947d9b031 cmMakefile: Convert filenametoread into a std::string.
Remove other intermediate variables.
2015-04-18 15:29:19 +02:00
Stephen Kelly e2d0e0fbeb cmMakefile: Remove intermediate variable. 2015-04-18 15:29:19 +02:00
Stephen Kelly 3a1ad1713f cmMakefile: Combine duplicate condition. 2015-04-18 15:29:19 +02:00
Stephen Kelly f0dae032ee cmMakefile: Re-order independent statements. 2015-04-18 15:29:19 +02:00
Stephen Kelly 08da874270 cmMakefile: Split a conditional. 2015-04-18 15:29:19 +02:00
Stephen Kelly 3dc4fe02e6 cmMakefile: Re-order independent variable setting. 2015-04-18 15:29:19 +02:00
Stephen Kelly e4f8f1f1b7 cmMakefile: Remove intermediate variable. 2015-04-18 15:29:18 +02:00
Stephen Kelly 2d6121a9a7 cmMakefile: Remove use of intermediate variable. 2015-04-18 15:29:18 +02:00
Stephen Kelly bdd4c5f5ba cmMakefile: Move variable definition above a condition. 2015-04-18 15:29:18 +02:00
Stephen Kelly 524ce89542 cmMakefile: Change condition to its equivalent.
This makes it easier to reason about follow-up commits.
2015-04-18 15:29:18 +02:00
Stephen Kelly 813cd719c4 cmMakefile: Determine the file to read before calling Internal. 2015-04-18 15:29:18 +02:00
Stephen Kelly 5c201f1ee6 cmMakefile: Remove duplication in ReadListFile. 2015-04-18 15:29:18 +02:00
Stephen Kelly 0d9555779d cmMakefile: Delegate ListFile reading to internal method. 2015-04-18 15:29:17 +02:00
Stephen Kelly 846608f267 cmMakefile: Remove useless condition. 2015-04-18 15:29:17 +02:00
Stephen Kelly a2f2aeee2f cmMakefile: Add wrapper for reading listfiles which have an origin.
Such files are delegates from other files, and so they set the
CMAKE_PARENT_LIST_FILE to the originator.  They also may set a
policy scope.
2015-04-18 15:29:17 +02:00
Stephen Kelly 68f791cd06 cmMakefile: Add a method for processing buildsystem files.
These are different from other ListFiles in that a project() command is
required if it is top-level.
2015-04-18 15:29:17 +02:00
Stephen Kelly 5bb4248a80 cmMakefile: Remove fullPath parameter from ReadListFile.
There is no reason for this to be a responsibility of
ReadListFile.  Additionally, the only user of it already computes
it itself.
2015-04-18 15:29:17 +02:00
Stephen Kelly 5d056c0dd8 Port Global property interaction to cmState. 2015-04-15 11:43:50 -04:00
Stephen Kelly 0076b5d834 cmake: Remove the happy global property scope pattern.
Global properties are already global in scope, so remove the
overload for specifying it and port users of the API.

The call from cmMakefile::GetProperty can be simplified because
the scope is only used during chaining, and there is no further
chaining after processing global properties.
2015-04-15 11:43:50 -04:00
Stephen Kelly 0aec491328 Port cmCommand consumers to cmState. 2015-04-15 11:43:49 -04:00
Stephen Kelly b159bff732 Move property definition to cmState. 2015-04-13 20:13:13 +02:00
Brad King 62c5e6f1a1 Merge topic 'introduce-cmState'
f081c5bd cmState: Move CacheEntryType enum from cmCacheManager.
f71fdf0e cmMakefile: Remove unused CacheManager accessor.
ff7169a0 Port to cmState.
a6b1ad13 Introduce cmState class.
2015-04-13 11:45:02 -04:00
Stephen Kelly f081c5bddd cmState: Move CacheEntryType enum from cmCacheManager. 2015-04-13 11:44:16 -04:00
Stephen Kelly f71fdf0ec8 cmMakefile: Remove unused CacheManager accessor.
Remove unneeded friend declarations from cmCacheManager.
2015-04-13 11:44:15 -04:00
Stephen Kelly ff7169a03c Port to cmState. 2015-04-13 11:44:15 -04:00
Stephen Kelly a6b1ad1309 Introduce cmState class.
At this point, it is an interface to the cache.  It will be extended
to be a universal interface for access to and manipulation of
configuration-time data (defintions, properties on targets,
directories, source files etc).

This will allow porting all command implementations away
from the cmMakefile and cmTarget classes, and result in something
more-purely related to configuration-time processing of cmake
commands.  That should serve at least the following goals:

 * Split the CMake implementation more definitively into three
   stages: Configuration, computation and generation, and be able to
   implement each optimally for memory access patterns etc.
 * Make better IDE integration possible by making more configuration
   data available.
 * Make it possiblte to use a smaller library than CMakeLib.a in
   cpack and ctest, resulting in smaller executables.
 * Make it possible to run the configure step multiple times in
   the same CMake run (#14539).

Manage its lifetime in the cmake class, and add a convenience accessor
to cmMakefile.
2015-04-13 11:44:14 -04:00
Stephen Kelly ea819b29f8 cmMakefile: Remove unused method. 2015-04-12 23:10:45 +02:00
Stephen Kelly 6ad86c7fc4 cmMakefile: Remove bad comment. 2015-04-12 23:10:45 +02:00
Stephen Kelly fca2b542b4 cmMakefile: Internalize setting of CMakeInstance on Properties. 2015-04-12 23:10:45 +02:00
Stephen Kelly 7bb4e3db06 cmMakefile: Out-of-line Home directory accessors. 2015-04-12 23:10:44 +02:00
Stephen Kelly ba404938a2 cmCacheManager: Port consumers to non-iterator API.
This simplifies reasoning about the follow-up commit which ports
away from cmCacheManager to a class with the same method names.
2015-04-08 18:47:00 +02:00
Stephen Kelly 9e64156725 cmMakefile: Port away from CacheEntry.Initialized.
The API has no other external users.
2015-04-08 18:47:00 +02:00
Stephen Kelly 77f2807ce5 cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
Being initialized is a requirement for this method to return something,
and is what differentiates it from using GetIterator with it.GetValue.
2015-04-07 23:25:44 +02:00
Stephen Kelly 1f2c12ebd1 cmMakefile: Remove cache version accessors.
They are only used by legacy code. Inline them there to simplify
cmMakefile.
2015-04-07 23:25:35 +02:00
Stephen Kelly 97c50a8dbd cmMakefile: Simplify GetDefinitions implementation. 2015-04-07 23:25:31 +02:00
Brad King 3347c5e4f9 Revert topic 'refactor-cache-api'
This topic was never tested without some follow-up commits.  The
GetCacheEntryValue API returns a pointer to memory freed on return.
It will have to be revised along with the rest of the original topic.
2015-04-07 17:15:04 -04:00
Stephen Kelly 9410e24a4a cmCacheManager: Port consumers to non-iterator API.
This simplifies reasoning about the follow-up commit which ports
away from cmCacheManager to a class with the same method names.
2015-04-06 17:58:55 +02:00
Stephen Kelly 2e50f5e7d9 cmMakefile: Port away from CacheEntry.Initialized.
The API has no other external users.
2015-04-06 17:58:55 +02:00
Stephen Kelly 9ada4c0433 cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
Being initialized is a requirement for this method to return something,
and is what differentiates it from using GetIterator with it.GetValue.
2015-04-06 17:58:55 +02:00
Stephen Kelly 08c642c6ae cmMakefile: Remove cache version accessors.
They are only used by legacy code. Inline them there to simplify
cmMakefile.
2015-04-06 17:58:54 +02:00
Stephen Kelly cec8f97e57 cmMakefile: Simplify GetDefinitions implementation. 2015-04-06 17:58:54 +02:00
Stephen Kelly c37cf7fa9e cmCacheManager: Remove unused method 2015-04-05 10:26:10 +02:00
Stephen Kelly 06f61c26cf Do not treat DEFINITIONS as a built-in directory property
Add policy CMP0059 to cover this change.  The property has been
deprecated since CMake 2.4 anyway.

This will help clean up cmMakefile -- the DefineFlagsOrig member should
not need to exist.
2015-04-02 13:00:48 -04:00
Stephen Kelly f2e07a6d90 cmMakefile: Remove unused PreOrder member.
Remove references from dependendent API.
2015-04-01 20:32:48 +02:00
Stephen Kelly aafe282188 cmMakefile: Remove unused Prefix member.
Unused since it was added in commit 1f42f521 (NEW: move from tools
and config to create CMake, 2000-08-29).
2015-04-01 20:32:48 +02:00
Stephen Kelly 1fcf590b14 cmMakefile: Remove unused SubDirectoryOrder member.
The last use was removed in v2.4.0~2054 (ENH: add support for out
of source source, 2005-03-14)
2015-04-01 20:32:47 +02:00
Stephen Kelly c3a60cc9cc cmMakefile: Remove AddExtraDirectory method.
It has no effect.
2015-04-01 20:32:47 +02:00
Bill Hoffman a4a1b729c6 Fix warnings from clang scanbuild. 2015-03-25 12:38:37 -04:00
Brad King 15b06bc012 Merge topic 'cmAlgorithms-cleanup'
95dd238f cmRemoveDuplicates: Fix iterator -> const_iterator.
4448f175 cmInstalledFile: Move Property implementation out of line.
7916d7ba Include cmAlgorithms where it is used.
2015-03-12 15:26:35 -04:00
Stephen Kelly 7916d7bac6 Include cmAlgorithms where it is used. 2015-03-11 00:17:29 +01:00
Nils Gladitz 242c396656 add_custom_command: Diagnose MAIN_DEPENDENCY limitation.
The new policy CMP0057 diagnoses reuse of the same MAIN_DEPENDENCY across
multiple custom commands.
2015-03-09 12:45:38 +01:00
Brad King 6dc9a627b6 Merge topic 'minor-cleanups'
c021f59c cmMakefile: Store macro list in a vector not in a map.
2d130896 cmMakefile: Fix list of macros generation.
f1969234 cmFunctionCommand: Remove ineffectual code.
1116698a cmTarget: Don't needlessly clear vectors in the destructor.
2015-02-23 10:26:42 -05:00
Stephen Kelly c021f59c1f cmMakefile: Store macro list in a vector not in a map.
The signature was computed (incorrectly) and stored as the map
value, but never used.  Remove it now.
2015-02-21 11:25:47 +01:00
Stephen Kelly 2d130896a0 cmMakefile: Fix list of macros generation.
It was broken by commit 7ee56f03 (Convert loops into the commonly
used pattern., 2015-01-17).
2015-02-21 11:25:26 +01:00
Stephen Kelly 416df93aa9 Convert some raw loops to cmWrap. 2015-02-20 21:36:57 +01:00
Stephen Kelly f20a4257f2 cmMakefile: Add flag to result and manipulate in place.
Rather than creating a string, manipulating it, and then
copying it to the result.
2015-02-18 23:57:59 +01:00
Stephen Kelly ee269f4f16 cmMakefile: Replace two loops with std::replace. 2015-02-18 23:45:19 +01:00
Stephen Kelly 470cff497b cmMakefile: Replace loop with composed algorithm. 2015-02-18 23:45:18 +01:00
Stephen Kelly 8910224950 Replace common loop pattern with cmJoin 2015-02-11 22:57:55 +01:00
Stephen Kelly 7ee56f0399 Convert loops into the commonly used pattern. 2015-02-11 22:57:41 +01:00
Brad King cbffbf7437 Merge topic 'cmStandardIncludes-cleanup'
af65da0a cmStandardIncludes: Remove list include.
e848cc50 cmStandardIncludes: Remove deque include.
5fea6898 cmStandardIncludes: Remove some VS6 workarounds.
2015-02-10 12:56:08 -05:00
Stephen Kelly af65da0aa9 cmStandardIncludes: Remove list include.
Include it only where used.
2015-02-06 19:04:53 +01:00
Stephen Kelly 3f3db74413 cmMakefile: Remove ExpandSourceListArguments. 2015-02-05 20:44:25 +01:00
Brad King 3228fc5049 Features: Define meaning for no language standard default
Define an empty string in CMAKE_<LANG>_STANDARD_DEFAULT to mean that
the toolchain has no notion of lanuage standard levels.  In this case
the <LANG>_STANDARD[_REQUIRED] properties will have no effect.

Update the RunCMake.CompileFeatures test to exclude the
LinkImplementationFeatureCycle test when there is no standard default.
It can never fail because no use of specific features will adjust the
CXX_STANDARD level required for any target since the standard levels
have no meaning in this case.
2015-01-29 15:01:40 -05:00
Stephen Kelly fd7b371293 Replace foo.size() pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly 930bd47816 Replace 'foo.size() == 0' pattern with foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly d92887efab Replace 'foo.size() > 0' pattern with !foo.empty(). 2015-01-18 14:25:24 +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 6418eef222 Merge topic 'fix-COMPILE_FEATURES-genex'
45ec182d Features: Fix the COMPILE_FEATURES genex for unavailable features.
2bead0eb cmMakefile: Rename a method to what it really does.
2015-01-15 09:54:02 -05:00
Stephen Kelly 4a6e795b0c Use the cmDeleteAll algorithm instead of trivial raw loops. 2015-01-13 23:00:17 +01:00
Stephen Kelly 2bead0eb1b cmMakefile: Rename a method to what it really does.
The method does not test availability of compile features.
2015-01-12 10:30:43 -05: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