Commit Graph

870 Commits

Author SHA1 Message Date
Daniel Pfeifer
cbcfb79f9c Use C++11 unordered containers 2017-08-22 23:05:27 +02:00
Pavel Solodovnikov
86dc86dd6c Add const-reference qualifications 2017-05-26 19:50:11 +03:00
Daniel Pfeifer
c2c2bbb3d4 cmake: register fake project commands in -P mode 2017-05-08 22:58:01 +02:00
Daniel Pfeifer
c36d63cd48 cmake: initialize with Role that controls which commands to register 2017-05-08 22:29:44 +02:00
Brad King
c94f1bcf92 Drop Visual Studio 7 .NET 2003 generator
This generator has been deprecated since CMake 3.6.  Remove it.
2017-04-19 15:28:05 -04:00
Daniel Pfeifer
1d829c862c Use quotes for non-system includes
Automate with:

git grep -l '#include <cm_' -- Source \
  | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g'

git grep -l '#include <cmsys/' -- Source \
  | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g'

git grep -l '#include <cm[A-Z]' -- Source \
  | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
2017-04-11 22:35:21 +02:00
Daniel Pfeifer
e9fc7ff505 Add self-sufficient wrapper for <sys/stat.h> 2017-03-24 22:58:25 +01:00
Ben Boeckel
aba92ffd92 cmWorkingDirectory: use the new class
These functions just need to change the directory for a block of code
and then go back to the caller's expected location. Use
cmWorkingDirectory to ensure that all return paths are handled.
2017-03-06 10:38:58 -05:00
Daniel Pfeifer
e0f3931226 cmCommands: add commands directly to cmState 2017-02-13 22:39:20 +01:00
Daniel Pfeifer
72dcbbe5c0 split Default commands into Scripting and Project 2017-02-13 22:32:55 +01:00
Iyyappa Murugandi
c93e85d87e VS: Use Visual Studio Installer to locate VS 2017
VS 2017 and later may no longer populate the Windows Registry entries
CMake has traditionally used to find the VS installations.  This is
because VS now supports having multiple installations of the same
version.  The Visual Studio Installer tool provides a COM interface we
can query to locate installations.
2016-12-16 09:58:43 -05:00
Brad King
31e013ae60 Merge branch 'vs15-rename-generator' into vs15-rename-generator-for-master 2016-11-29 10:51:35 -05:00
Roman Wüger
d639620e14 VS: Rename VS 15 generator to 'Visual Studio 15 2017'
The final name of this VS version was announced:

 https://blogs.msdn.microsoft.com/visualstudio/2016/11/16/visual-studio-2017-rc/

Add the year to the generator name accordingly.  For convenience, map
the name without the year to the name with the year.
2016-11-29 10:46:36 -05:00
Yves Frederix
427b6da9e5 VS: Teach cmake --build to reconfigure if needed before building
Visual Studio's build system does not cleanly handle itself being
re-generated during the build.  Teach `cmake --build` to check whether
the build system needs to be re-generated before launching the native
build tool.
2016-11-17 13:53:42 -05:00
Daniel Pfeifer
2e620f0b38 Fix several include-what-you-use findings 2016-11-08 09:42:04 -05:00
Brad King
b899c0a92f Merge topic 'separate-compilation'
569509f4 Fix newly discovered clang-tidy issues
6c9b3b5c cmCommand: implement functions in cxx file
8483dab8 bootstrap: Sort source files lexicographically
4fb70919 Create all commands from a single function
608afd4f Separate compilation for commands included in cmBootstrapCommands2
64f9c282 Separate compilation for commands included in cmBootstrapCommands1
f69e768d Separate compilation for commands included in cmCommands
2016-10-24 10:16:40 -04:00
Daniel Pfeifer
1a74e71906 Introduce CM_UNORDERED_MAP
Avoid duplicating switch among std::unordered_map, cmsys::hash_map, and
std::map.
2016-10-24 09:58:52 -04:00
Daniel Pfeifer
4fb70919a5 Create all commands from a single function 2016-10-21 18:14:51 +02:00
Stephen Kelly
cde6eb6249 cmState: Port dependent code to new cmStateSnapshot name 2016-10-19 15:40:59 +02:00
Stephen Kelly
2fe3e55d53 cmState: Move CacheEntryType enum to separate namespace
Port dependent code to the change.
2016-10-19 15:40:58 +02:00
Brad King
1b592b6458 Merge topic 'vs-default-generator'
5380948f cmake: Fix default VS generator selection for Microsoft Build Tools
1aee54ed cmake: Simplify default generator search by switching direction
24c86e1c cmake: Use array iteration for default generator VS variants
6db64ad4 cmake: Use array iteration for default generator list
d3df00ae cmake: Rename default generator selection list variable
10160f69 cmake: Rename default generator selection internal variable
0838d20e cmake: Simplify VS registry entry lookup
8f33de92 cmake: Factor out default generator selection into helper
2016-10-13 08:26:07 -04:00
Brad King
0123500309 Merge topic 'cmake-gui-fix-extra-generator-names'
bf86012a cmake-gui: Fix "extra" generator entries in drop-down list
2016-10-13 08:25:49 -04:00
Brad King
5380948fae cmake: Fix default VS generator selection for Microsoft Build Tools
Some versions of the VS tools do not install the registry entry

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\$v;InstallDir

but all appear to set

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\$v\Setup\VC;ProductDir

Update our search to consider both entries.

Closes: #16360
2016-10-11 13:39:58 -04:00
Brad King
1aee54ed87 cmake: Simplify default generator search by switching direction
Search from newest to oldest and stop once found.
2016-10-11 13:32:33 -04:00
Brad King
24c86e1c3f cmake: Use array iteration for default generator VS variants 2016-10-11 13:19:01 -04:00
Brad King
6db64ad432 cmake: Use array iteration for default generator list 2016-10-11 13:17:48 -04:00
Brad King
d3df00ae53 cmake: Rename default generator selection list variable 2016-10-11 13:16:24 -04:00
Brad King
10160f691c cmake: Rename default generator selection internal variable 2016-10-11 11:50:56 -04:00
Brad King
0838d20e50 cmake: Simplify VS registry entry lookup 2016-10-11 11:46:45 -04:00
Brad King
8f33de92ba cmake: Factor out default generator selection into helper 2016-10-11 11:30:46 -04:00
Brad King
bf86012ada cmake-gui: Fix "extra" generator entries in drop-down list
Refactoring in commit v3.7.0-rc1~291^2~1 (Refactor extra generator
registration to use factories, 2016-07-20) accidentally switched
the order of the "extra - base" generator names to "base - extra".
Switch it back.  While this could affect all callers of the
`GetRegisteredGenerators` method, only cmake-gui actually used this
particular field.

Closes: #16359
2016-10-11 08:39:44 -04:00
Stephen Kelly
f03d446e96 cmLinkLineComputer: Move FrameworkPath computation from cmLocalGenerator
Add UseWatcomQuote state, and remove corresponding method parameters.
2016-10-10 20:38:59 +02:00
Stephen Kelly
0c97806325 cmLinkLineComputer: Move ComputeLinkLibs from cmLocalGenerator
Add a cmOutputConverter to the cmLinkLineComputer and factory methods to
facilitate shell escapes.

Add state to the cmLinkLineComputer to record whether outputting for
response files or for watcom, to satisfy the cmOutputConverter API.
These are constant for the lifetime of the cmLinkLineComputer, even when
its functionality is extended in the future.  This also keeps the
signatures of cmLinkLineComputer relatively simple.

Pass the cmComputeLinkInformation as a method parameter so that
cmLinkLineComputer is free from target-specific state.  An instance
should be usable for all targets in a directory.
2016-10-10 20:38:58 +02:00
Stephen Kelly
5b361fdda0 cmLinkLineComputer: Extract from cmLocalGenerator
CMake has several classes which have too many responsibilities.
cmLocalGenerator is one of them.  Start to extract the link line
computation.  Create generator-specific implementations of the interface
to account for generator-specific behavior.

Unfortunately MSVC60 has different behavior to everything else and CMake
still generates makefiles for it.  Isolate it with MSVC60-specific
names.
2016-10-10 20:38:53 +02:00
Stephen Kelly
6c8dc7f1df cmake: Simplify find-package mode library addition
It does not need the cmMakefile version.
2016-10-07 20:23:19 +02:00
Brad King
86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Tobias Hunger
cd049f012e cmake-server: Report server mode availablitily in Capabilities
Report the availability of the server-mode in the output of
cmake -E capabilities.
2016-09-19 08:57:28 -04:00
Brad King
a098ca0d7a cmake: Fix --find-package mode link line output
Refactoring in commit v2.8.10~58^2~2 (Ninja: move -LIBPATH behind -link
option, 2012-09-26) added arguments to cmLocalGenerator::GetTargetFlags
and updated the call sites.  However, in the cmake::FindPackage and
cmLocalGenerator::AddBuildTargetRule call sites it added the new
arguments in the wrong order.  The latter was never used and has been
removed.  The former remains buggy and prints out compiler flags instead
of the link framework/library search paths.  Fix its argument order.
2016-09-16 10:03:15 -04:00
Brad King
cc770e7670 cmake: Make FindCacheFile a static method
It does not need access to member data.
2016-09-14 11:49:24 -04:00
Tobias Hunger
3e58b9af57 cmake: Factor out method to find the CMakeCache.txt file 2016-09-12 22:00:22 +02:00
Tobias Hunger
c73967cb4a cmake: Introduce ReportCapabilitiesJson
Introduce cmake::ReportCapabilitiesJson which returns a the Json object
that is serialized in cmake::ReportCapabilities.

This allows to re-use the information in cmake-server.
2016-09-12 17:24:06 +02:00
Brad King
bdc679a8ae VS15: Add Visual Studio 15 generator
Call the generator "Visual Studio 15" without any year because the
preview version of VS 15 does not provide a year in the product name.

Copy cmGlobalVisualStudio14Generator to cmGlobalVisualStudio15Generator
and update version numbers accordingly.  Add the VS15 enumeration value.
Note that we do not need to add a MSVC15 variable or v150 toolset
because Visual Studio 15 comes with an updated version of the v140
toolset and remains ABI-compatible.

Teach tests VSExternalInclude, RunCMake.GeneratorPlatform, and
RunCMake.GeneratorToolset to treat VS 15 as they do VS 10-14.

Closes: #16143
2016-09-07 15:49:08 -04:00
Daniel Pfeifer
efed6468ed fix a load of include-what-you-use violations 2016-09-03 08:04:56 -04:00
Stephen Kelly
421012a330 cmMessenger: Extract from cmake class
This way messages can be issued independent of the cmake instance.

It is now possible to make DisplayMessage a virtual interface and
override it to handle messages in the cmake-gui or future IDE
interaction interfaces.
2016-08-25 09:47:27 -04:00
Daniel Pfeifer
7b6349da4d CMake: don't use else after return 2016-08-18 20:36:29 +02:00
Brad King
67a7dcef45 Merge topic 'readability-named-parameter'
e7b842e1 Make sure unnused parameters are /*named*/
2016-08-17 10:46:35 -04:00
Daniel Pfeifer
e7b842e189 Make sure unnused parameters are /*named*/ 2016-08-17 01:49:57 +02:00
Tobias Hunger
49ad7f9af8 cmake: Add cmake -E capabilities mode
Add `cmake -E capabilities` to report on generators, cmake version and
possibly other static capabilities of cmake.

Closes: #15462
2016-08-16 13:45:05 -04:00
Brad King
1d408dc10f cmake: Constify cmake::GetRegisteredGenerators 2016-08-16 13:40:06 -04:00
Tobias Hunger
cd52a225d2 Report more information about extra generators in generator factories 2016-08-03 09:44:40 -04:00