The Convert methods never belonged to the local generator concept, so
split them out now. The cmOutputConverter is cheap to construct and
destroy, so it can be instantiated where needed to perform
conversions. This will allow further decoupling of cmLocalGenerator
from the configure step.
Inherit cmLocalGenerator from cmOutputConverter for the purpose of
source compatibility.
This will be used to contain most of the content of the cmState
in several different trees. Refer to the BuildsystemDirectory
state from the SnapshotData state. Currently these trees have
the same structure, but that will change when we have more snapshot
types.
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().
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.
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.
The test for this variable was removed in commit v2.8.8~330^2~7 (complex:
Remove ancient unused ComplexRelativePaths test, 2011-12-23).
Commit v3.1.0-rc1~425^2~2 (backtrace: Convert to local paths in
IssueMessage, 2014-03-12) appears to have accidentally made some backtraces
print relative paths with the variable because conversions which used to be
done at configure time, before the variable had an effect are now potentially
done at generate time.
The documentation of the variable says not to use it, and the docs are wrong in
that the variable actually applies in per-directory scope.
The read of the variable makes it harder to split conversion methods from
cmLocalGenerator where they don't belong. Remove it now.
Use the KWSys Process "MergeOutput" option to give each test child
process the same pipe for both stdout and stderr. This allows natural
merging of stdout and stderr together instead of merging on arbitrary
buffered read boundaries as before.
Currently cmMakefile calls MakeRelative on a copy of the backtrace,
emits the copy to the stream once, then discards the copy. There
is no need to have API for the path conversion.
Teach cmFileCommandCurlDebugCallback to filter the debug data by type
and show only summary information instead of the raw data. This avoids
allocating memory for all data transferred by UPLOAD or DOWNLOAD.
The chunkDebug buffer we use to accumulate the LOG variable content
is populated if and only if a log variable was requested by the call,
but it is much clearer to check that a log variable was requested
explicitly before populating it.
Remove debugging logic left from commit v2.6.0~305 (add DOWNLOAD option
to FILE command, 2008-02-06). The CURLE_OPERATION_TIMEOUTED code path
does nothing that the code immediately after it does not do.
de2ef305 cmCTest: Drop unused method overloads
b04500a7 cmCTest{Test,MemCheck}Handler: Port to cmXMLWriter
8fbc509a cmCTestCoverageHandler: Port to cmXMLWriter
82455a9d cmCTestBuildHandler: Port to cmXMLWriter
1dbd86fd cmCTestLaunch: Port to cmXMLWriter
a53bd63e cmCTest: Port GenerateNotesFile to cmXMLWriter
9c0bb7d8 cmCTestConfigureHandler: Port to cmXMLWriter
6cf5cc71 cmCTestUploadHandler: Port to cmXMLWriter
ed42c203 cmCTestUpdateHandler: Port to cmXMLWriter
18825baf cmCTest: Port to cmXMLWriter
f6413400 Add cmXMLWriter class to consolidate XML generation
The regex update in commit v3.1.2~4^2 (ctest_build: Update GNU make
error message matching, 2015-01-28) broke matching of the messages it
updated. Remove the escape character before the square brackets added
by that commit.
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.
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.
The StartXML, EndXML, and AddSiteProperties overloads that take a stream
directly are no longer called anywhere. All clients hvae been ported to
cmXMLWriter. Drop the old overloads.
In commit a390de65 (Ninja: Generate separate compile and link rules for
each target, 2015-05-18) we removed the _RSP_FILE suffix from rule names
meant for targets that need to build with a .rsp file because we now use
per-target rules anyway. Remove this suffix from references to the rule
too.
Reported-by: Herz Thomas <Thomas.Herz@kuka.com>
The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN were first
merged in commit v2.8.12~322 (Merge topic 'VISIBILITY_PRESET-property',
2013-06-05) but worked only for shared libraries and executables with
exports. Prior to commit v3.0.0-rc1~581^2 (GenerateExportHeader:
Deprecate add_compiler_export_flags function., 2013-09-02) the
add_compiler_export_flags function was used to add visibility flags to
all targets.
The visibility flags are useful for sources in all target types because
they may be later linked into shared libraries or executables with
exports. Introduce policy CMP0063 to enable them for all target types
while preserving compatibility with existing projects that do not expect
this.
Don't create a snapshot in Initialize(), but leave the creation
responsibility to the cmake instance instead. Previously, the
cmState would Initialize() in its constructor, and the cmake instance
would re-Initialize() during Configure(). The end result was the
same and there would be one snapshot present. However, cmLocalGenerator
also created a snapshot on construction, and that one was used, leaving
the first snapshot unused, and potential for off-by-one errors.
Fix that by making the cmLocalGenerator use the existing snapshot
if it is top-level. Add a CurrentSnapshot to the cmake instance and
populated it while configuring a directory. This will eventually
replace the 'current local generator' concept. Fix the GetParent
implementation to be able to return the first snapshot.
The virtual methods are overrides not overloads, the constructor
is no longer a default variant, the destructor and GetCMakeInstance
comments add no value, only a typo.
The 'ctest --launch' command must be placed before the IWYU launcher on
the compiler command line. Extend the RunCMake.IncludeWhatYouUse test
to cover this case. The Ninja generator already does it correctly.
Drop the VS >= 7 generator's global Configurations member and instead
lookup configurations using cmMakefile::GetConfigurations where needed.
This avoids accumulating all CMAKE_CONFIGURATION_TYPES values ever
encountered by a project() or enable_language() command and allows
the final value to be used in each directory. We don't officially
support per-directory CMAKE_CONFIGURATION_TYPES values but we certainly
should not generate configurations not in the final value in the top
level directory.
This reverts commit f85db2f323.
Discussion by the QtCreator community at
https://bugreports.qt.io/browse/QTCREATORBUG-13695
raises concerns about this particular approach to working with CMake
projects using QtCreator. Also, the functionality and design of the QBS
extra generator was never discussed on the CMake mailing list or with
QtCreator developers. There may be better ways to make the two tools
work together.
In order to avoid committing to long-term support of this generator
prior to such discussion taking place, revert it from CMake for now.
We may restore this or use an alternative design based on results of
such discussion.
e462ef74 Help: Add notes for topic 'cmake-gui-osx-install-command-line'
8ea2db26 cmake-gui: Replace command-line install dialog with information box
438ce4a0 cmake-gui: Add --install option to add command-line tools on OS X
41477d5c cmake-gui: Drop undocumented and unused --mac-install option
a5b59fae QtAutogen: Create global generator on the stack.
fe401ede QtAutogen: Use a more-obvious delete-target.
c95a55ad QtAutogen: Remove the need for a local makefile variable.
460e8fb9 QtAutogen: Inline static factory method.
58f41c78 QtAutogen: Remove repeated setters.
b9f99155 cmMakefile: Remove VarUsageStack.
2b09d9f3 cmMakefile: Remove VarInitStack.
528d6802 cmMakefile: Use more suitable method name to log var usage.
9118b53b cmMakefile: Move internal method to private scope.
f58c3774 cmMakefile: Mark definitions explicitly erased, even at top level.
ea7b962b cmMakefile: Raise variable in scope explicitly when needed.
c8cb6688 cmMakefile: Use early return to reduce nested code.
bdd1aa91 cmMakefile: Don't use else after return.
c42f0e2b cmMakefile: Remove redundant conditions.
caff8e5a cmCTest: Remove unimplemented method.
bb1e8c3a cmMakefile: Remove Print() debugging facilities.
1363bff8 cmMakefile: Remove duplicate variable initialization.
5b7ff35c cmMakefile: Don't expect the VarStack iterator to support size().
390bc324 cmMakefile: Remove redundant condition.
8ab1cce7 cmMakefile: Rename method to something more appropriate.
2dd5d42f cmMakefile: Make the public ReadListFile method take one param.
...
The QMacInstallDialog infrastructure no longer works on modern OS X
versions. Drop it and replace the dialog with a simple info box that
explains to the user how to run 'cmake-gui --install' to add symlinks.
Also suggest simply modifying the PATH.
This approach is similar to the Xcode 'xcode-select --install' method
of installing Xcode Command Line Tools.
On OS X add an "--install[=/path/to/bin]" option (defaulting to
/usr/bin) that installs symbolic links into the given directory.
This will help OS X users make the tools available on the command
line even when they sit inside a CMake.app bundle.
Always show the option with its argument separate in summary text.
State in the main documentation that the option and its argument can be
given together too.
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.
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.
Create a <LANG>_INCLUDE_WHAT_YOU_USE target property (initialized by a
CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE variable) to specify an IWYU command
line to be run along with the compiler.
Add an internal "cmake -E __run_iwyu" mode to wrap the compiler call.
Run a given include-what-you-use command line with the compiler options
and report a warning if it finds anything. Then run the real compiler.
Co-Author: Brad King <brad.king@kitware.com>
d7923b82 Use std::unordered_map instead of hash_map where available.
820777af Tests: Don't rely on ordering of targets in maps.
921d74d8 AutoGen: Don't iterate over a container while populating it.
fa9eb814 cmLocalGenerator: Remove redundant path access.
1933f3d1 cmLocalGenerator: Remove redundant path conversions.
9e4b6cc2 cmState: Store computed relative paths to to current directories.
991f5e49 cmState::Snapshot: Store components for current directories.
57bdc1a2 cmState: Compute and store directory components.
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.
This option was once used by our OS X package installer to create
symlinks at install time. Since switching to the DragNDrop installer
we no longer use this option.
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.
The PushTLLCommandTrace method is called once per link item for a single
target_link_libraries command. Avoid storing copies of identical
execution contexts and rely on the uniqueness while printing output.
Our <LANG>_COMPILER and <LANG>_<TARGET_TYPE>_LINKER rule generation has
access to a specific cmTarget so the results may depend on it. Instead
generate separate rules for each target using an encoded target name.
In particular, this makes CTEST_USE_LAUNCHERS report proper target
information.
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.
There is no need to duplicate these in all cmLocalGenerators.
Rename the symbols according to current conventions.
Add explicit calls to Set{Source,Binary}Directory with empty strings
in order to trigger the population of the components containers with
the current working directory in cmLocalGenerator. Having
directories set to empty is a special case in CMake, which is relied
on for the `if(CMAKE_BINARY_DIR)` condition at the end of
CMakeDetermineSystem.cmake.
The InitializeAutogenTarget creates new targets and adds them to the
Targets container on the makefile. In this method, we have a reference
to that container and we are iterating over it. That happens to work
with hash_map, but it fails with undefined behavior when using the
std::unordered_map from libstdc++-4.9 (and likely others).
ce167b54 cmMakefile: Handle CMP0014 before configuring the generator.
7baef756 cmLocalGenerator: Assert that there is a parent.
63255342 cmMakefile: Remove redundant variable set.
894961af cmMakefile: Use the state to determine the parent directory.
115e9199 Use new top-level check abstraction.
c5059c90 cmLocalGenerator: Add abstraction to check if top-level.
b17686d2 cmGlobalGenerator: Move some flags from cmLocalGenerator.
ed41a8e7 cmLocalGenerator: Port loops to cmState::Snapshot.
48a9e91b cmState: Add an accessor for Parent snapshot and a validity check.
e7f7c2e2 cmLocalGenerator: Convert two recursive methods to loops.
c5cb3a73 cmLocalGenerator: Get project directories from the cmState.
76b59831 cmLocalGenerator: Initialize state before creating cmMakefile.
34c9ee2e cmLocalGenerator: Require a global generator in the constructor.
3837c483 Tests: Add case for 'ctest' run with bad CTestTestfile
b317b38d cmGlobalBorlandMakefileGenerator: Do not inherit from NMake generator
94867698 Don't use a cmLocalGenerator instance to call static methods.
...
If the CMakeLists.txt file does not exist, there must be a parent.
The case for the top-level of the project is already handled in
cmake::DoPreConfigureChecks.
The Borland generator re-implements every method the NMake generator
does, so there is no reason to inherit this way. Instead inherit
directly from cmGlobalUnixMakefileGenerator3 like all the other
makefile generators do.
KWSys upstream added an attribute to export .gitattributes so that
importing snapshots into the sources of other projects would bring along
the attributes. However, we don't want to export them from CMake.
Drop .gitattributes entries not relevant to CMake.
Teach the legacy two-argument signature to use CMAKE_CONFIG_TYPE
from the environment only if it is non-empty. This makes behavior
consistent with the main signature.
The find_package command, on Windows, has always searched build trees
recently visited by cmake-gui (or CMakeSetup at one time). This was
done when the command was created with the intention of simplifying
workflows involving building multiple dependent projects. However,
this behavior depends on recent developer interaction and therefore
can create different find results based on transient system states.
It can lead to surprising results and user confusion.
Since this behavior was first added CMake has gained many more search
options, better error messages when a package is not found, and a
package registry. The latter in particular allows projects to make
their build trees available for dependent projects to find without
user intervention. Therefore the originally intended workflow can
be achieved in other, more stable ways.
After the above evoluion of find_package we have now decided that
the magic search-where-cmake-gui-was behavior does more harm than
good. Drop it. We do not need a policy for this behavior change
because it only affects interactive use.
The GNU 4.8 standard library's cstdio header is not aware that C++14
honors C11's removal of "gets" from stdio.h and results in an error:
/.../include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
Detect this problematic case and default to using C++11 instead of
C++14 for building CMake itself.
20560e8d Ninja: Do not use newlines in response files with Windows GNU tools (#15439)
b3de0dfe Ninja: Use forward slashes for any GCC on Windows (#15439)
378c2a0e Ninja: Refactor detection of MinGW tools on Windows
957c2aac RC: Simplify selection of resource compiler based on C/C++ toolchain
Use the KWSys Process "MergeOutput" option to give the child process
the same pipe (or file) for both stdout and stderr. This allows
natural merging of stdout and stderr together instead of merging
on arbitrary buffered read boundaries as before.
Since commit v2.8.11~213^2 (Ninja: Avoid LNK1170 linker error, 2013-02-01)
we generate linker response files with "$in_newline" to support a large
number of object files with the MS link.exe tool. However, the GNU linker
on Windows does not understand the newline endings that Ninja puts in the
response files. Switch back to "$in" for that case.
Check for CMAKE_COMPILER_IS_MINGW only after enabling a language when it
might actually be set. Previously this worked by accident because the
check for working compiler or a second language enabled would cause the
code path to be taken.
Store UsingMinGW as an instance member of cmGlobalNinjaGenerator so that
it is reset on each reconfigure. Otherwise cmake-gui cannot switch
between build trees for MinGW or non-MinGW tools.
Revert the refactoring by commit v2.8.11~105^2~1 (Ninja: use MinGW
generator code in EnableLanguage, 2013-03-09) and move the MinGW-
specific logic back to the "MinGW Makefiles" generator. Instead teach
the platform information modules for GNU and MSVC on Windows to set the
preferred RC compiler just before enabling the RC language. This way
we choose the RC compiler based on the C/C++ toolchain that is actually
enabled.
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.
...
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.
6c7dad41 cmDefinitions: Make Get method static.
a7ce0c7b cmDefinitions: Make GetInternal method static.
7a5039fa cmDefinitions: Use static member without this->.
191573f7 cmDefinitions: Remove Parent pointer.
8b1745a1 cmDefinitions: Accept varStack iterators in Get API.
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.
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.
When Configure is executed multiple times with the same cmake
instance (either using CTest --two-config or a interactive gui), the
location and structural data was preserved though it would not be used
again. Fix that by clearing the data in a method called early in
the configure step.
For some reason, using recursion here is faster to configure ParaView
than using a loop. Probably some compiler optimization is inhibited
by using a loop.
Co-Author: Brad King <brad.king@kitware.com>
When given the command line
tool a\ b c
mingw32-make incorrectly passes "a b" and "c" to the tool. When given
the command line
tool a\ b "c"
mingw32-make correctly passes "a\", "b", and "c" to the tool.
Since commit v3.1.0-rc1~861^2 (MSVC: Add properties to configure
compiler PDB files, 2014-02-24) we pass the compiler pdb option to
MS-style compiler tools as "/Fd<dir>\" but mingw32-make may consume
the backslash as escaping a following space as described above.
Workaround this problem by changing the backslash to a forward
slash as had been used prior to the above commit.
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.
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.
In commit 74de9a73 (cmGlobalGenerator: Delegate storage of enabled
languages to cmState, 2015-04-11) the original LanguageEnabled
member of cmGlobalGenerator was left behind by mistake. One use
of it in EnableLanguagesFromGenerator (for try_compile) was left,
but the member is not populated anymore. Drop the member and
teach EnableLanguagesFromGenerator to copy the list of enabled
languages from one cmState to the other.
Reported-by: Matt McCormick <matt.mccormick@kitware.com>