Commit Graph

1263 Commits

Author SHA1 Message Date
Brad King 6cbf6a5197 Fix internal target lookup performance regression
Refactoring in commit v3.5.0-rc1~272^2~13 (cmGlobalGenerator: Remove
direct storage of targets, 2015-10-25) replaced an efficient data
structure mapping from target name to cmTarget instance with a linear
search.  Lookups through cmGlobalGenerator::FindTarget are done a lot.
Restore the efficient mapping structure with a name indicating its
purpose.

Reported-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2016-02-08 13:08:11 -05:00
Brad King d257d68138 add_custom_command: Clarify error when TARGET is out of scope (#15681)
The add_custom_command(TARGET) signature only works for targets defined
in the current directory.  Clarify this in the error message when the
target exists but was defined elsewhere.

Inspired-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2016-01-28 10:33:26 -05:00
Milian Wolff bd2384f593 Optimize cmMakefile::ExpandVariablesInStringNew.
We can remove the temporary allocations required for the
default-constructed t_lookup passed into the openstack by refactoring
the code slightly. Furthermore, we use a vector instead of a stack,
since the latter is based on a deque which is not required for a
heap / lifo structure.

This patch removes ~215k allocations.

This hotspot was found with heaptrack.
2016-01-20 21:20:55 +01:00
Michael Scott deec3a3f06 Make message suppression more consistent.
Make the message suppression more consistent, by adding a check
for the message related CMake variables in cmake::IssueMessage,
which allows callers of IssueMessage other than the message
command to behave as expected. Also added a check for
CMAKE_SUPPRESS_DEVELOPER_WARNINGS in the message command to
mirror the deprecated message type behaviour.

Added a 'force' flag to the cmake::IssueMessage method, to
make the message suppression consistent, when setting the
message related CMake variables directly in a CMake file.

Expand message command tests to cover the AUTHOR_WARNING message
type as well.
2015-11-30 15:00:08 -05:00
Brad King 9342a4c203 Merge branch 'reduce-cmState-accumulation' into reduce-cmState-accumulation-for-master 2015-11-25 12:33:06 -05:00
Brad King 32edac6fdd cmState: Enforce policy scope balancing around variable scopes
Everywhere we use cmMakefile::ScopePushPop to manage variable scopes
also expects policy scopes to be balanced.  There is no place that we
use cmMakefile::PolicyPushPop without also using ScopePushPop.  Relieve
PolicyPushPop of responsibility for policy scope balance checks by
moving it to ScopePushPop.
2015-11-24 19:38:36 -05:00
Brad King d85c9176ae cmMakefile: Remove unused PolicyPushPop interfaces
The PolicyPushPop constructor arguments and Quiet method were used to
pass non-default arguments to PushPolicy and PopSnapshot, but no clients
use them anymore.
2015-11-24 19:38:33 -05:00
Brad King 8e1be7bf68 cmMakefile: Clarify purpose of method that pops a scope snapshot
The `PopPolicyBarrier` method is actually responsible for closing any
scope opened by creating a snapshot.  Rename it to `PopSnapshot` and add
a comment explaining the purpose of the poilcy-scope-specific part of
the method.
2015-11-24 19:38:31 -05:00
Brad King 2fd5fd1f4d Merge topic 'minor-cleanups'
13a37f5f cmMakefile: Fix typo in comment
958508bb cmMakefile: Fix style
91a829c1 Makefiles: Remove unused variable
e0213882 cmTarget: Remove obsolete member
0554c2c9 cmTarget: Fix style
b22e5d0a Remove some obsolete declarations
ce43ed2c Use LocalGenerator when possible
d90c9738 Makefiles: Remove some unneeded casts
331023ae Export: Remove unused variable
a03f3d0e cmFunctionBlocker: Constify method
d50c4220 Xcode: Fix typo in comment
803f1901 Xcode: Remove trailing semicolon
2015-10-28 08:48:08 -04:00
Stephen Kelly 13a37f5f76 cmMakefile: Fix typo in comment 2015-10-27 21:54:12 +01:00
Stephen Kelly 958508bb1f cmMakefile: Fix style 2015-10-27 21:54:11 +01:00
Stephen Kelly 7a6caae1a7 cmMakefile: Add imported target accessor 2015-10-27 07:44:25 +01:00
Stephen Kelly a67231ac11 cmTarget: Implement ALIAS in terms of name mapping
Remove mapping to cmTarget.
2015-10-27 07:44:24 +01:00
Stephen Kelly 0c97d32f7a cmGlobalGenerator: Remove direct storage of targets
Find the target by looping when needed.
2015-10-27 07:44:23 +01:00
Stephen Kelly 780bff5279 cmake: Store hardcoded lists of sources and headers
Don't duplicate this in each cmMakefile.
2015-10-27 07:44:22 +01:00
Stephen Kelly f210cb131e cmTarget: Make compatbility API explicit. 2015-10-27 07:44:20 +01:00
Brad King d71920c457 Merge topic 'xcode-watch-and-tvos'
a91eebeb Xcode: Recognise Watch and TV OS as embedded platforms
2015-10-26 13:13:02 -04:00
Gregor Jasny a91eebebdb Xcode: Recognise Watch and TV OS as embedded platforms 2015-10-23 22:19:43 +02:00
Brad King e2d4bfef3f Merge topic 'fix-CMP0054-elseif-warning'
d6a03b47 cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)
2015-10-21 09:16:49 -04:00
Stephen Kelly d6a03b475e cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)
Commit v3.4.0-rc1~494^2~4 (cmMakefile: Add API for elseif to create
backtrace., 2015-05-29) removed the use of cmMakefileCall to push/pop
execution context in favor of a new way to create backtraces.

However, a call to cmMakefile::GetExecutionContext is still invoked to
issue a contextual CMP0054 warning through cmConditionEvaluator.  As
the elseif is not part of the call stack, this resulted in trying to
access an empty vector.

Avoid the attempt at getting execution context when evaluating elseif by
constructing a context and backtrace on behalf of the cmConditionEvaluator
in all cases.
2015-10-20 23:40:12 +02:00
Stephen Kelly 55474e6182 cmState: Move GetTargetTypeName from cmTarget. 2015-10-15 00:41:40 +02:00
Stephen Kelly eac15298a8 cmState: Move TargetType enum from cmTarget.
Mostly automated:

 values=( "EXECUTABLE" "STATIC_LIBRARY" "SHARED_LIBRARY" "MODULE_LIBRARY" "OBJECT_LIBRARY" "UTILITY" "GLOBAL_TARGET" "INTERFACE_LIBRARY" "UNKNOWN_LIBRARY" "TargetType")
 for i in "${values[@]}"; do     git grep -l cmTarget::$i | xargs sed -i "s|cmTarget::$i|cmState::$i|g"; done
2015-10-15 00:41:39 +02:00
Stephen Kelly 482b3811e4 cmTarget: Move link type enum out.
Remove a reason for generate time code to depend on the cmTarget header/type.
2015-10-15 00:41:22 +02:00
Brad King ad3ff60f4a Merge topic 'genex-generator-objects'
2293d43d cmLocalGenerator: Store cmGeneratorTargets.
488723f5 cmMakefile: Store container of cmExportBuildFileGenerators.
15834405 cmGeneratorExpression: Port interface to cmGeneratorTarget.
11165525 cmGeneratorExpression: Port to cmLocalGenerator.
2015-10-14 13:35:59 -04:00
Stephen Kelly 2293d43d00 cmLocalGenerator: Store cmGeneratorTargets.
Relieve cmMakefile of this responsibility.
2015-10-14 13:32:09 -04:00
Stephen Kelly 488723f5cd cmMakefile: Store container of cmExportBuildFileGenerators.
Set a cmLocalGenerator on each instance at compute time.  That will
soon be needed to access cmGeneratorTarget instances.

If a cmExportBuildFileGenerator is processed early during configure time as a
result of CMP0024 it must be removed from the list to process later at generate
time.
2015-10-14 13:32:09 -04:00
Stephen Kelly 2bf7de167f Subdirs: Initialize from parent before configuring.
Add new API for the subdirs command to cmState.

This fixes a regression introduced in commit f716460e (cmMakefile: Move
invokation to initialize snapshot., 2015-10-06).
2015-10-14 00:34:11 +02:00
Stephen Kelly 0aa34de549 cmState: Initialize properties immediately.
Don't leave this as cmMakefile responsibility.
2015-10-14 00:16:21 +02:00
Stephen Kelly 20b95ef8c8 cmState: Initialize default definitions immediately.
Don't leave this as cmMakefile responsibility.
2015-10-14 00:16:20 +02:00
Stephen Kelly 841164cb36 cmState: Initialize current directories immediately.
Don't leave this as cmMakefile responsibility.
2015-10-14 00:16:07 +02:00
Stephen Kelly 2c219bafc0 cmState: Initialize top level source directories immediately.
Don't leave this as cmMakefile responsibility.
2015-10-14 00:16:07 +02:00
Stephen Kelly 84e0776e77 cmMakefile: Set default internal definitions directly.
The usage tracking of cmMakefile::AddDefinition is not needed.
2015-10-14 00:16:06 +02:00
Stephen Kelly 871ab98dad cmMakefile: Set internal definitions directly.
The usage tracking of cmMakefile::AddDefinition is not needed.
2015-10-14 00:16:06 +02:00
Brad King 83d2b6f378 Merge topic 'refactor-cache-manager'
79a309d7 cmState: Port away from cmake instance.
e2eecae2 cmState: Move ParseCacheEntry from cmCacheManager.
b5212c68 cmState: Add API for cache version.
95b0d761 cmState: Externalize logic to caller.
6f02034e cmState: Make AddCacheEntry method private.
435a2f3c cmCacheManager: Port away from cmake instance.
062ed22e cmState: Add cache file manipulation wrappers.
a02e53eb Inline unary LoadCache.
bec3487f cmCacheManager: Remove cmMakefile dependency.
e0f740f1 Always cache entries through the cmake instance.
2afadb0d cmake: Port away from trivial cmCacheManager use.
3d8c299f cmake: Use existing cache API wrapper.
2015-10-12 10:26:18 -04:00
Brad King 762108f3ec Merge topic 'add-cmLocalGenerator-API'
223d0efe Remove some needless GetMakefile() calls.
a367416c cmLocalGenerator: Add current source directory accessor.
bbef3c2d cmLocalGenerator: Add current binary directory accessor.
12cb3bdc cmLocalGenerator: Add Home directory accessors.
72efa15d Eclipse: Port API to cmLocalGenerator.
f2a641d6 Kate: Remove unused variables.
10cf42f5 Kate: Port API to cmLocalGenerator.
e46ef270 export: Port internal method to cmGeneratorTarget.
53d3a1c9 cmMakefile: Remove unused GetProjectName calls.
4ab2750c cmLocalGenerator: Add GetProjectName method.
c8187f41 cmCPluginAPI: Inline code to get project name.
8c6e6dd3 cmMakefile: Inline initialization of project name.
27916f2c cmLocalGenerator: Add cmake instance accessor.
2015-10-12 10:26:15 -04:00
Stephen Kelly e0f740f1b1 Always cache entries through the cmake instance. 2015-10-10 15:36:57 +02:00
Stephen Kelly 4f767afe1d cmMakefile: Remove unneeded container clears.
No need to do that in a destructor.
2015-10-09 00:05:14 +02:00
Stephen Kelly 53d3a1c95a cmMakefile: Remove unused GetProjectName calls. 2015-10-09 00:00:18 +02:00
Stephen Kelly 8c6e6dd3ce cmMakefile: Inline initialization of project name. 2015-10-09 00:00:18 +02:00
Stephen Kelly 28749903b6 cmState: Internalize the initialization of a snapshot from its parent. 2015-10-07 20:19:42 +02:00
Stephen Kelly 6c02f62f75 Remove now-unused directory setters. 2015-10-07 20:19:42 +02:00
Stephen Kelly 360e4e1db0 Set the current dirs on the snapshot before creating the cmMakefile.
The cmMakefile should get a fully prepared snapshot and not clobber its
definitions.  It should eventually be able to process list files from any
starting-point snapshot, though that is some refactoring away still.
2015-10-07 20:19:41 +02:00
Stephen Kelly f716460ed8 cmMakefile: Move invokation to initialize snapshot. 2015-10-06 21:46:09 +02:00
Brad King e67e0155d9 cmMakefile: Avoid name conflict with Solaris global typedef
On Solaris there is a global typedef called 'single':

 /usr/include/floatingpoint.h:77:15: note: shadowed declaration is here
  typedef float single;

Avoid shadowing it by using a different name.
2015-09-30 08:47:02 -04:00
Stephen Kelly 203eada65e cmMakefile: Remove Configured state.
It is vestigial.
2015-09-27 12:08:07 +02:00
Stephen Kelly c5f07e0537 cmGlobalGenerator: Create local generators after all makefiles configured. 2015-09-24 09:39:38 +02:00
Stephen Kelly 8a88089bbe cmMakefile: Create the local generator after configuring the makefile.
The local generator is not used during configure time.
2015-09-24 09:39:38 +02:00
Stephen Kelly 3e08b4df95 cmMakefile: Skip Global targets for CMP0019 evaluation. 2015-08-28 18:44:39 +02:00
Stephen Kelly ff8ac8ee6a cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
2015-08-28 18:44:39 +02:00
Stephen Kelly 92041eec49 cmGlobalGenerator: Remove MakeLocalGenerator method.
Inline implementation to callers.
2015-08-28 18:44:38 +02:00
Stephen Kelly 83b8a927e5 cmMakefile: Remove cmLocalGenerator member. 2015-08-28 18:44:38 +02:00
Stephen Kelly 9b6a743b80 cmLocalGenerator: Remove Parent pointer. 2015-08-28 18:44:38 +02:00
Brad King 445077cbd2 Merge topic 'minor-cleanups'
7f551b4f cmGlobalGenerator: Implement VS6 check without virtual method.
cd6293cd cmMakefile: Fix style.
de6b2895 cmTarget: Remove vestigal method declaration.
e35ee02d cmTarget: Fix indentation.
00f2298f Reduce uses of cmMakefile::GetGlobalGenerator.
6254ba95 cmMakefile: Remove Internal class.
cf0a78dc cmGeneratorTarget: Issue messages through the local generator.
2015-08-27 10:04:12 -04:00
Stephen Kelly cd6293cdf8 cmMakefile: Fix style. 2015-08-25 23:06:33 +02:00
Stephen Kelly 6254ba9578 cmMakefile: Remove Internal class.
Move only remaining state to the direct class.
2015-08-25 22:19:57 +02:00
Stephen Kelly b3f2299e06 cmState: Move ProjectName from cmMakefile. 2015-08-25 19:57:42 +02:00
Stephen Kelly 6ce940ac97 cmMakefile: Use std::string in ProjectName API. 2015-08-25 19:55:34 +02:00
Stephen Kelly e8c0341d86 cmMakefile: Out-of-line GetProjectName. 2015-08-25 19:55:32 +02:00
Stephen Kelly f4150bd88d cmState: Move directory Properties from cmMakefile. 2015-08-24 20:02:21 +02:00
Stephen Kelly 0178754725 cmMakefile: Inline GetDefinitions into GetProperty.
It will soon move to cmState.
2015-08-24 19:48:45 +02:00
Brad King 2370a99400 Merge topic 'cmState-definitions'
bff27391 cmState: Host variable definitions.
6954c893 cmState: Add a VariableScope snapshot type.
1fc645bd cmState: Add a Base snapshot type.
0f070dd3 cmMakefile: Decouple the container of cmDefinitions from scoping logic.
25e04ddf cmDefinitions: Implement in terms of cmLinkedTree.
4bbe261c cmMakefile: Extract InitializeVarScope method.
2015-08-24 10:07:04 -04:00
Gregor Jasny 744e6c497c Fix iOS Bundle layouts (#15669)
In contrast to Mac OS X App bundle layout the iOS one lacks the
Contents/MacOSX structure.  See also the Bundle Structures documentation
in Mac Developer Library:

  https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html

For now detect iOS targets by checking the SDK name/path.
2015-08-24 09:50:20 -04:00
Stephen Kelly bff27391a9 cmState: Host variable definitions. 2015-08-23 19:05:11 +02:00
Stephen Kelly 6954c8936f cmState: Add a VariableScope snapshot type.
Match the scopes currently used in cmMakefile for definitions.
2015-08-23 17:08:54 +02:00
Stephen Kelly 0f070dd3e1 cmMakefile: Decouple the container of cmDefinitions from scoping logic.
Maintain a Parent tree node for writing to in RaiseScope.
2015-08-23 17:08:53 +02:00
Stephen Kelly 25e04ddffe cmDefinitions: Implement in terms of cmLinkedTree.
Store the definitions in a cmLinkedTree in the cmMakefile.  This can
be moved to cmState and then the tree will provide snapshotting
possibilities.  It will also make the Closure copy created at
the start of each cmMakefile unnecesarry.
2015-08-23 17:08:53 +02:00
Stephen Kelly 4bbe261cd3 cmMakefile: Extract InitializeVarScope method. 2015-08-23 17:08:53 +02:00
Stephen Kelly 73e4df99cb cmGlobalGenerator: Store a container of cmMakefiles.
For use at configure-time.
2015-08-07 04:10:28 +02:00
Brad King 73e3de381d Merge topic 'cmState-policies'
757a1f54 cmState: Move PolicyState from cmMakefile.
52dbe654 cmState: Record the end position of each directory.
65a5e0c6 cmLinkedTree: Add Clear API.
34835433 cmState: Add Type for policy scope.
af0de01c cmState: Remove call stack parent tracking.
6ae8b30b cmMakefile: Move policy barriers inside cmState scopes.
a5fc17b5 cmMakefile: Re-order policy entries and barriers.
0a01e6c6 cmState: Add Snapshot Type accessor.
f0005bb4 Tests: Verify generate-time policy scope behavior.
2015-08-06 09:38:24 -04:00
Brad King 370e2c6785 Merge topic 'refactor-evaluation-files'
12c3f248 cmGeneratorExpressionEvaluationFile: Require generator context.
6c0e9ee2 cmMakefile: Store EvaluationFiles.
2015-08-06 09:38:22 -04:00
Brad King d356bced9b Merge topic 'fix-missing-subdir-error'
c4d2f64f add_subdirectory: Fix error message on missing CMakeLists.txt (#15680)
2015-08-06 09:38:17 -04:00
Brad King c4d2f64f3c add_subdirectory: Fix error message on missing CMakeLists.txt (#15680)
Refactoring in commit v3.3.0-rc1~76^2 (cmMakefile: Handle CMP0014 before
configuring the generator, 2015-05-14) accidentally left the file name
"/CMakeLists.txt" in the error message.  Remove it and add a test case.
2015-08-04 16:40:13 -04:00
Stephen Kelly 757a1f5408 cmState: Move PolicyState from cmMakefile.
Implement lexical scope checking in terms of the state stack instead
of barriers.
2015-08-02 08:56:57 +02:00
Stephen Kelly 348354333a cmState: Add Type for policy scope. 2015-08-02 08:56:57 +02:00
Stephen Kelly 12c3f24827 cmGeneratorExpressionEvaluationFile: Require generator context.
Avoid storing a cmMakefile as a member, and evaluate in the context of
a cmLocalGenerator instead.
2015-08-01 13:07:11 +02:00
Stephen Kelly 6c0e9ee276 cmMakefile: Store EvaluationFiles.
Relieve the cmGlobalGenerator of this responsibility.  Evaluate
the generator expressions in the context of the cmLocalGenerator.
2015-08-01 13:07:11 +02:00
Stephen Kelly 6ae8b30bf4 cmMakefile: Move policy barriers inside cmState scopes. 2015-08-01 07:18:34 +02:00
Stephen Kelly a5fc17b509 cmMakefile: Re-order policy entries and barriers.
Make the barriers surround the entries.
2015-08-01 07:18:34 +02:00
Stephen Kelly 610572b7d2 cmMakefile: Simplify generate-time cmGeneratorTarget creation. 2015-07-29 10:43:33 -04:00
Stephen Kelly 34b902a5a6 cmMakefile: Move method out of line. 2015-07-29 10:43:31 -04:00
Brad King aaa322a5cb cmMakefile: Return target from all AddUtilityCommand signatures 2015-07-29 10:43:31 -04:00
Brad King 280dde34dd Merge topic 'trace-expand'
594bafe5 cmake: add --trace-expand option
2015-07-27 09:31:22 -04:00
Brad King cb21c548db Merge topic 'policy-refactor'
8329fc01 cmPolicies: Replace unused include.
5447ca1a cmMakefile: Remove CMP0001 handling to callers.
d0dcce15 cmMakefile: Simplify computation of ancient policy status.
658bfc5c cmMakefile: Remove redundant condition from policy status computation.
f4a25874 cmMakefile: Inline internal policy status method.
3c45471c cmPolicies: Enable RVO for internal method.
71e69fc9 cmPolicies: Store only state that users can set.
84e18056 cmMakefile: Convert recursion to loop.
2015-07-27 09:31:18 -04:00
Stephen Kelly bbb507aebc cmMakefile: Move the InitializeFromParent method 2015-07-25 14:53:06 +02:00
Stephen Kelly 6ed9c7e024 cmState: Host buildsystem properties for directories. 2015-07-25 14:53:05 +02:00
Stephen Kelly 5447ca1a94 cmMakefile: Remove CMP0001 handling to callers. 2015-07-25 14:48:37 +02:00
Stephen Kelly d0dcce15f4 cmMakefile: Simplify computation of ancient policy status. 2015-07-25 14:48:37 +02:00
Stephen Kelly 658bfc5c52 cmMakefile: Remove redundant condition from policy status computation. 2015-07-25 14:48:36 +02:00
Stephen Kelly f4a25874a2 cmMakefile: Inline internal policy status method. 2015-07-25 14:48:36 +02:00
Stephen Kelly 3c45471c2d cmPolicies: Enable RVO for internal method. 2015-07-25 14:48:36 +02:00
Stephen Kelly 84e1805666 cmMakefile: Convert recursion to loop. 2015-07-25 14:48:36 +02:00
Ben Boeckel 594bafe527 cmake: add --trace-expand option
The --trace option is helpful, but sometimes, what you're looking for is
deep under many layers of function calls and figuring out what instance
of the function call you're looking at is tedious to determine (usually
involving patching and message()). Instead, add a --trace-expand option
to trace while expanding commands into what CMake actually sees.
2015-07-23 15:33:10 -04:00
Stephen Kelly 1e77de7411 cmMakefile: Don't clear buildsystem properties.
Instead put a sentinal empty entry in the container when a property
is overwritten.  Use this sentinal when reading from the containers.

Use iterator::operator+(size_type) directly instead of std::advance,
because this only really makes sense if using RandomAccessIterators.
2015-07-22 21:23:49 +02:00
Stephen Kelly 8d336875b3 cmMakefile: Use Ranges for buildsystem property access.
Don't return vector copies.
2015-07-22 20:25:48 +02:00
Stephen Kelly c7b39d06f9 cmMakefile: Split accessors for include directories and origins. 2015-07-22 20:25:47 +02:00
Stephen Kelly b2de25aded cmMakefile: Split accessors for compile options and origins. 2015-07-22 20:25:46 +02:00
Stephen Kelly d6239507b2 cmMakefile: Split accessors for compile definitions and origins. 2015-07-22 20:25:45 +02:00
Stephen Kelly ef17bbefd7 cmMakefile: Separate storage of buildsystem properties and their origins.
This simplifies some existing and upcoming algorithms.
2015-07-22 20:25:43 +02:00
Stephen Kelly a89c02ce3d cmMakefile: Out of line some API. 2015-07-22 20:06:23 +02:00
Stephen Kelly 8ea0b81d20 cmAlgorithms: Rename cmRange to cmMakeRange. 2015-07-22 10:58:19 -04:00