89 Commits

Author SHA1 Message Date
Brad King
db02be85a0 VS: Provide the default platform name to project code
The value of `CMAKE_VS_PLATFORM_NAME` is computed by Visual Studio
generators based on `CMAKE_GENERATOR_PLATFORM` or some default.
Prior to the VS 2019 generator, the default was always `Win32`.
However, for the `Visual Studio 16 2019` generator, the default is
based on the host platform.

Store the default in a new `CMAKE_VS_PLATFORM_NAME_DEFAULT` variable for
use by project code.  This is particularly useful in toolchain files
because they are allowed to set `CMAKE_GENERATOR_PLATFORM` and so
`CMAKE_VS_PLATFORM_NAME` is not yet known.  Of course the toolchain file
author knows whether it will set `CMAKE_GENERATOR_PLATFORM`, and if not
then `CMAKE_VS_PLATFORM_NAME_DEFAULT` provides the platform name that
will be used.

Fixes: #19177
2019-04-19 07:46:13 -04:00
Brad King
57e48f16f2 VS: Add Visual Studio 16 2019 generator
Add this generator *without* support for specifying the target
architecture in the generator name.  cmake-gui will be taught
to provide a field for this, and command-line builds can use -A.

Also, teach this generator to select a default target architecture
based on the host architecture.

Fixes: #18689
Inspired-by: Egor Pugin <egor.pugin@gmail.com>
2019-01-11 11:04:51 -05:00
Brad King
b91f6f39f7 VS: Track explicitly when platform is specified in generator name 2019-01-10 09:38:35 -05:00
Brad King
89cc3d432b VS: Move platform name members to top-level global generator
We no longer support any VS versions that pre-date support for
multiple platforms (target architectures).
2019-01-10 09:38:35 -05:00
Brad King
40a732800d VS: Clarify global generator constructor interface
Make the constructors protected since they should be produced through
factories.  Also rename `platform{ => InGenerator}Name` to clarify
the meaning of the argument.
2019-01-10 09:38:35 -05:00
Brad King
163cc8bbdd VS: Convert WriteSLNHeader to non-virtual lookup table 2019-01-10 07:52:51 -05:00
Brad King
6d99406e69 VS: Move ExpressEdition member to top-level generator
We no longer support any VS versions that pre-date introduction of
express editions.
2019-01-10 07:52:49 -05:00
Brad King
03f74a16cd VS: Convert GetIDEVersion to non-virtual table lookup 2019-01-10 07:52:48 -05:00
Vitaly Stakhovsky
77d83568e0 cmGlobalVisualStudioGenerator::GetIDEVersion(): const added 2019-01-02 08:25:49 -05:00
Vitaly Stakhovsky
94632087b2 Add missing override 2018-12-30 12:32:55 -05:00
Michael Stürmer
663f5120f4 cmGlobalVisualStudioGenerator: remove TargetCanBeReferenced() 2018-04-24 07:05:17 +02:00
Michael Stürmer
f9042d807d remove TargetIsCSharpOnly() and use methods from cmGeneratorTarget 2018-04-23 07:31:21 +02:00
Brad King
eb80af9093 Drop Visual Studio 8 2005 generator
This generator has been deprecated since CMake 3.9.  Remove it.
2018-04-02 10:08:10 -04:00
Vitaly Stakhovsky
cfe4e2db1f VS: Use 'override' keyword for overridden methods in generator classes
The corresponding 'virtual' removed.
2017-12-15 21:17:49 -05:00
Tomoki Imai
c89e8522bb cmGlobalGenerator: Add IsIncludeExternalMSProjectSupported method 2017-12-04 11:21:43 -05:00
Gregor Jasny
5de37a4a64 cmake: Add --open option for IDE generators 2017-10-13 21:28:34 +02:00
Brad King
0b33aee48b Use C++11 override instead of CM_OVERRIDE
We now require C++11 support including `override`.  Drop use of
the old compatibility macro.  Convert references as follows:

    git grep -l CM_OVERRIDE -- '*.h' '*.hxx' '*.cxx' |
      xargs sed -i 's/CM_OVERRIDE/override/g'
2017-09-15 10:06:41 -04:00
Brad King
94e70e5329 Merge branch 'backport-vs-csharp-ref-no-asm' into vs-csharp-ref-no-asm 2017-09-05 09:42:16 -04:00
Michael Stürmer
7e57e6ae12 VS: Do not reference output assemblies if not possible for CSharp target
Since commit v3.9.0-rc4~4^2 (Vs: allow CSharp targets to be linked to
CXX targets, 2017-06-20) CSharp targets get `ProjectReference` entries
to their dependencies.  This causes VS to also reference the
dependency's output assembly by default, which is incorrect for
non-managed targets.

Fix this by setting `ReferenceOutputAssembly` to `false` for targets
that can't provide output assemblies.  Unmanaged C++ targets (shared
libs & executables) can still be referenced and a warning will be shown
in the IDE but the build will not break anymore.

Fixes: #17172
2017-09-05 09:41:40 -04:00
Daniel Pfeifer
ca2233e31f IWYU: Mark cmConfigure.h with pragma: keep
Also remove `#include "cmConfigure.h"` from most source files.
2017-08-26 07:41:04 +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
Brad King
a4452fd82d cmGlobalVisualStudioGenerator: Drop VS7 enumeration value
We no longer support the VS 7.0 (.NET 2002) IDE, so drop the enumeration
value corresponding to its version.
2017-04-19 14:54:57 -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
66a7099993 iwyu: Fix VisualStudio specific issues 2016-11-28 14:06:40 -05:00
Brad King
2d3aa94225 cmGlobalGenerator: Allow FindMakeProgram to fail
Revise its signature to return `bool` so that it can fail and abort
configuration early.
2016-10-20 10:37:27 -04:00
Michael Stürmer
4f78b9ff2d VS: Add CSharp project uuid and file extension
This is in preparation for adding CSharp language support to the VS
generator.
2016-10-19 11:14:16 -04: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
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
Tobias Hunger
2175e5bfa5 cmGlobalGenerator: Make IsMultiConfig() const 2016-06-01 11:12:58 -04:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Davy Durham
78ec046130 VS: Add option to choose the .sln startup project (#15578)
Add a `VS_STARTUP_PROJECT` directory property to specify the project
that should be placed first in the `.sln` file so that it will be
selected as the default startup project.

Co-Author: Taylor Braun-Jones <taylor.braunjones@avigilon.com>
2016-03-22 07:57:00 -04:00
Brad King
b42866a34a Drop Visual Studio 6 generator
This generator has been deprecated since CMake 3.3.  Remove it.
Update documentation, modules, and tests to drop content specific
to this generator.
2016-03-09 09:42:18 -05:00
Stephen Kelly
6cac952b9e VS: Port interface to cmGeneratorTarget 2015-10-24 09:24:43 +02:00
Stephen Kelly
97b3768898 VS: Port WriteUtilityDepends to cmGeneratorTarget 2015-10-24 09:24:43 +02:00
Stephen Kelly
600af01d41 VS: Port utility depends to cmGeneratorTarget 2015-10-24 09:24:43 +02:00
Stephen Kelly
330bfa8336 VS: Port target depends to cmGeneratorTarget 2015-10-24 09:24:43 +02:00
Stephen Kelly
8ac8739b2e VS: Port TargetIsFortranOnly to cmGeneratorTarget 2015-10-24 09:19:57 +02:00
Stephen Kelly
ce9e9a92cf VS: Port LinkClosure to cmGeneratorTarget 2015-10-24 09:19:56 +02:00
Stephen Kelly
21f428f4c0 VisualStudio: Replace Compute override with AddExtraIDETargets override. 2015-10-05 18:43:18 +02:00
Brad King
03bfe71ae0 VS: Refactor target ordering logic
Refactor cmGlobalVisualStudioGenerator::TargetCompare to store the name of
the target that should come first instead of hard-coding "ALL_BUILD".
Update client sites to specify "ALL_BUILD" when ordering for .sln files
and an empty string otherwise (in cases when "ALL_BUILD" should not be
encountered anyway).
2015-09-22 10:25:58 -04:00
Stephen Kelly
5edb335485 cmGlobalGenerator: Virtualize the Compute step and override it. 2015-07-30 08:28:31 +02:00
Brad King
ad91d0edd5 Merge topic 'auto_export_dll_symbols'
8f86407c Windows: Optionally generate DLL module definition files automatically
069aa93b bindexplib: Add support for "/bigobj" format objects
61bbbdcf bindexplib: Fix treatment of some symbols
de70c922 bindexplib: Teach DumpFile to return errors
8ea69dfe bindexplib: Build source as part of CMakeLib
2963cb2a bindexplib: Wrap long lines
4ff09893 bindexplib: Drop code that CMake does not need
7de8276c bindexplib: Add copyright/license notice block
65086ad7 bindexplib: Import original implementation from CERN
2015-07-08 09:19:07 -04:00
Bill Hoffman
8f86407cfd Windows: Optionally generate DLL module definition files automatically
Create target property WINDOWS_EXPORT_ALL_SYMBOLS to automatically
generate a module definition file from MS-compatible .obj files and give
it to the linker in order to export all symbols from the .dll part of a
SHARED library.
2015-07-06 11:11:02 -04:00
Stephen Kelly
faec4e611d cmComputeTargetDepends: Change API to use cmGeneratorTarget. 2015-07-01 19:46:19 +02:00
Stephen Kelly
c7b79aa16a cmGlobalGenerator: Require a cmake instance in ctor.
It is required anyway, so this makes it explicit.
2015-05-27 09:18:31 -04:00
Stephen Kelly
e435f875ec VS: Move version information to global generator. 2015-05-19 11:02:33 -04:00
Brad King
885ab9ab37 VS: Drop reload macros for VS >= 10 (#11258,#14680)
We never implemented them for VS 11 (2012), 12 (2013), or 14 (2015).
For VS 10 (2010) the reload macro does not work correctly when run from
inside a build launched through the IDE because stopping the build kills
the CMake that is driving the reload.  Fortunately VS >= 10 know how to
reload the whole solution anyway.
2015-04-15 09:58:42 -04:00
Brad King
f5c0efdbe4 cmGlobalGenerator: Create a non-virtual 'DoGenerate' method
Make the virtual 'Generate' method protected.  Make 'DoGenerate'
the main entry point to generation.  This gives cmGlobalGenerator
a chance to do some early operations before the individual
generator-specific implementations take over.
2014-07-22 15:05:36 -04:00
Brad King
eeb60102e8 VS: Refactor CMAKE_FORCE_*64 platform definitions
Remove the general infrastructure for these additional platform
definitions and hard-code the only two special cases that used
it.  They are only for historical reasons so no new such cases
should be added.
2014-07-17 16:17:35 -04:00
Stephen Kelly
6c9dd0ec7b cmGlobalGenerator: Make ComputeTargetObjects non-virtual
Implement it in terms of the ComputeObjectFilenames virtual method
on the local generators.

Remove the reimplementation from the global generators which are
now all functionally identical.
2014-03-15 09:30:24 +01:00