1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-07-17 20:21:11 +08:00

40 Commits

Author SHA1 Message Date
Ben Boeckel
7137b17835 cmStrCat: use in Windows-specific sources 2023-07-27 20:00:59 -04:00
Ben Boeckel
501408338a clang-tidy: fix readability-isolate-declaration lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
d64adb9267 clang-tidy: fix readability-string-compare lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
4deab0a75c clang-tidy: fix readability-braces-around-statements lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
714a466eeb clang-tidy: fix readability-container-size-empty lints 2022-11-29 12:39:45 -05:00
Ben Boeckel
b72c45e39f clang-tidy: fix readability-else-after-return lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
1b929ba8e4 clang-tidy: fix modernize-use-nullptr lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
f8a2926986 clang-tidy: fix modernize-use-default-member-init lints 2022-11-29 12:39:29 -05:00
Brad King
6eee8c9000 VS: Fix crash finding vswhere on 32-bit Windows
Since commit f85913fa08 (VS: Add support for enumerating VS instances
with vswhere, 2022-04-11, v3.24.0-rc1~282^2), if the COM lookup does not
report any VS instances, we fall back to finding vswhere.  However, the
`getenv` call returns nullptr if the `ProgramFiles(x86)` environment
variable is not set.  Update the logic to tolerate not-set environment
variables.  Also check the plain `ProgramFiles` environment variable.

Fixes: #24090
2022-10-26 11:12:46 -04:00
Niyas Sait
f85913fa08 VS: Add support for enumerating VS instances with vswhere 2022-04-13 08:40:46 -04:00
Niyas Sait
069cff63f6 VS: refactor EnumerateAndChooseVSInstance
Move all VS instance enumeration code using COM interface to
EnumerateVSInstancesWithCOM
2022-04-11 16:33:03 +01:00
Brad King
195d47e213 VS: Allow CMAKE_GENERATOR_INSTANCE to specify portable instance
Previously the `CMAKE_GENERATOR_INSTANCE` value was used only to filter
the instances reported by the Visual Studio Installer tool.  If the
specified install location is not known to the VS Installer, but the
user provided a `version=` field, check for the installation directly
on disk.

Fixes: #21639, #22197
2021-10-29 11:52:58 -04:00
Brad King
ec8d37b3b1 VS: Support version specification in CMAKE_GENERATOR_INSTANCE 2021-10-29 11:52:58 -04:00
Brad King
5d1f377737 cmVSSetupHelper: Factor out helper to load MSVC toolset version 2021-10-29 11:52:58 -04:00
Brad King
006fe1e919 cmVSSetupHelper: Convert wide to narrow strings early 2021-10-29 11:52:58 -04:00
Brad King
f5dfc788b8 cmVSSetupHelper: Drop unused InstanceId field
Minimize the amount of information needed about a VS instance.
2021-10-29 11:52:57 -04:00
Brad King
3213e2595d cmVSSetupHelper: Drop unused ullVersion field
The field has not been used since commit 3fd65f5ca6 (VS: Compare VS
instance versions as strings, 2021-06-17, v3.21.0-rc1~11^2~1).
2021-10-29 11:52:57 -04:00
Brad King
3fd65f5ca6 VS: Compare VS instance versions as strings
This makes the values more readable.
2021-06-17 07:54:48 -04:00
Justin Goshi
8a7ad923a8 VS: Extract instance version from VS Installer 2020-06-03 08:58:29 -04:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Sebastian Holtermann
7fbcc16dcd cmStringAlgorithms: cmIsSpace, cmTrimWhitespace, cmEscapeQuotes, cmTokenize
This adds the following functions to `cmStringAlgorithms`:

- `cmIsSpace`
- `cmTrimWhitespace` (moved from `cmSystemTools::TrimWhitespace`)
- `cmEscapeQuotes` (moved from `cmSystemTools::EscapeQuotes`)
- `cmTokenize` (moved from `cmSystemTools::tokenize` and adapted to
  accept `cm::string_view`)
2019-08-05 11:25:30 +02:00
Brad King
00c1120837 VS: Drop workaround needed only for VS 2019 preview 2 and 3
A temporary workaround added by commit 626c51f47b (VS: Update for Visual
Studio 2019 Preview 2, 2019-01-24, v3.14.0-rc1~74^2) is no longer needed
as of VS 2019 preview 4.

Fixes: #18898
2019-02-28 11:04:29 -05:00
Brad King
626c51f47b VS: Update for Visual Studio 2019 Preview 2
The toolset is now called `v142`.  Use matching flag tables.

Fixes: #18834
2019-01-24 13:49:25 -05:00
Brad King
d8ed309d05 VS: Parameterize cmVSSetupAPIHelper instances with VS version 2019-01-11 10:37:38 -05:00
Brad King
90b08fc27b Merge topic 'vs2017-skip-2019'
d44f81c217 VS: Exclude VS 2019 instances when using VS 2017 generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2775
2019-01-09 08:13:02 -05:00
Brad King
d44f81c217 VS: Exclude VS 2019 instances when using VS 2017 generator
Filter instances reported by the VS Installer to consider only VS 2017
instances for the "Visual Studio 15 2017" generator.

Fixes: #18721
2019-01-08 14:10:16 -05:00
Jon Doron
071c0e3ce4 cmVSSetupHelper: Support Enterprise WDK build enviornment
Enterprise WDK is a command line build enviornment that does not require
any installation prior to use.

More information and download can be found here:
https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/using-the-enterprise-wdk

Signed-off-by: Jon Doron <arilou@gmail.com>
2018-11-27 07:13:26 +02:00
Basil Fierz
b759f7068f cmVSSetupHelper: Expose default toolset version
We already detect the VS toolset version.  Expose it to clients.
2018-06-22 10:07:09 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* 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.
2018-06-01 09:53:42 -04:00
Brad King
9ffb35386f VS: Select and save a VS 2017 instance persistently
Visual Studio 2017 supports multiple instances installed on a single
machine.  We use the Visual Studio Installer tool to enumerate instances
and select one.  Once we select an instance for a given build tree, save
the result in `CMAKE_GENERATOR_INSTANCE` so we can re-configure the tree
with the same instance on future re-runs of CMake.

Fixes: #17268
2017-10-19 10:20:12 -04:00
Brad King
17edfa4198 cmVSSetupHelper: Add option to specify an instance 2017-10-19 10:20:12 -04:00
Brad King
f566586e1c VS: Detect compiler component in VS 2017 instances more reliably
The `Microsoft.VisualStudio.Component.VC.Tools.x86.x64` component is
not the only way a VS instance may provide the `cl` compiler tool.
For example, VS 2017 Express Edition does not install that component.
Instead search for the tools directly on disk within an instance.

Suggested-by: Rich Chiodo <rchiodo@microsoft.com>
Fixes: #17349
2017-10-16 11:57:15 -04:00
Brad King
c6bb704ea1 cmVSSetupHelper: Fix install location encoding conversion 2017-10-16 11:55:53 -04:00
Brad King
4c3116d754 cmVSSetupHelper: Factor out install location string construction
This also adds a missing conversion to unix slashes in one code path.
2017-10-16 11:55:53 -04:00
Pavel Solodovnikov
5db3aac111 Meta: replace empty-string assignments with clear(). 2017-09-16 02:26:49 +03:00
Brad King
2644e4c9fc VS: Choose VS 2017 instance via environment variable
In the `Visual Studio 15 2017` generator, if the `VS150COMNTOOLS`
environment variable points at a specific VS 2017 instance reported by
the Visual Studio Installer tool, use that as the preferred instance.

Inspired-by: Iyyappa Murugandi <iyyappam@microsoft.com>
Fixes: #16846
2017-07-10 11:08:11 -04:00
Brad King
0362c60fe5 cmVSSetupHelper: Simplify use of EnumerateAndChooseVSInstance
This method short-circuits when an instance has already been chosen, so
avoid duplicating this check at call sites.
2017-01-12 11:32:44 -05:00
Brad King
577f721fb7 VS: Fix detection of VS 2017 installation with WindowsStore
Fix logic in cmVSSetupAPIHelper::IsVS2017Installed to work correctly on
repeat calls.

Closes: #16549
2017-01-12 11:29:35 -05:00
Iyyappa Murugandi
18c8278b62 VS: Add helper class to interact with Visual Studio Installer
VS 2017 exports a COM component which can be queried to find if VS 2017
is installed and also other components such as VC toolset and Windows
SDKs.  Add a helper class to interact with this interface.
2016-12-16 09:58:43 -05:00