1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-20 19:55:10 +08:00

255 Commits

Author SHA1 Message Date
Brad King
43d218d970 VS: Add support for using Intel oneAPI Fortran compiler in .vfproj files
Add a `fortran={ifort,ifx}` field to `CMAKE_GENERATOR_TOOLSET` to
specify which Intel Fortran compiler to use.

Fixes: #25427
2023-11-22 10:22:12 -05:00
Richard Dzenis
899376d070 VS: Allow specifying VCTools version with the ClangCL toolset
Visual Studio supports specifying both:

    <PlatformToolset>ClangCL</PlatformToolset>
    <VCToolsVersion>14.32.31326</VCToolsVersion>

Fixes: #25189
2023-08-16 15:02:54 -04:00
Brad King
661e005a0e Merge topic 'vs-sdk-selection'
d5118ed2e5 Merge branch 'backport-vs-sdk-selection' into vs-sdk-selection
89b611ab32 VS: Select latest Windows SDK even when targeting Windows 8.1 and below
ae97d82e83 VS: Teach CMAKE_GENERATOR_PLATFORM to support Windows 8.1 SDK selection
15ff89654b VS: Teach CMAKE_GENERATOR_PLATFORM to use Windows 10 SDKs for older versions
bba1a23da9 VS: Consolidate Windows SDK major version selection dispatch
209973e510 VS: Do not print empty Windows SDK version when none is selected
ec6dd77053 Tests: Remove redundant condition in RunCMake.GeneratorPlatform test
4776a584ad Help: Add 3.27 release note on VS default SDK selection

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8697
2023-08-10 11:27:48 -04:00
Brad King
d5118ed2e5 Merge branch 'backport-vs-sdk-selection' into vs-sdk-selection 2023-08-10 10:00:53 -04:00
Brad King
15ff89654b VS: Teach CMAKE_GENERATOR_PLATFORM to use Windows 10 SDKs for older versions
Honor an explicit `version=` field selecting a Windows 10 SDK regardless
of the Windows target version.

Issue: #25170
2023-08-10 09:34:50 -04:00
Ben Boeckel
ec5f1c489a cmCryptoHash: prefer to cmSystemTools::ComputeStringMD5
The latter call is no longer post-bootstrap only since 596439b1bb
(cmCustomCommandGenerator: Add option to transform depfile, 2020-10-05)
via !5325. Convert callers to just use `cmCryptoHash` directly and
remove the bootstrap guard.
2023-08-08 13:22:13 -04:00
Ben Boeckel
d4144b9c0a strings: use emplace_back with cmStrCat arguments 2023-07-27 20:15:51 -04:00
Ben Boeckel
809248a0c9 strings: use character literals where possible 2023-07-27 20:00:59 -04:00
Ben Boeckel
7137b17835 cmStrCat: use in Windows-specific sources 2023-07-27 20:00:59 -04:00
Ben Boeckel
a5ba00bdf8 strings: combine string literals where possible 2023-07-27 19:10:39 -04:00
Ben Boeckel
3f1378fbca strings: compare to static string_view instances in Windows-only code 2023-07-27 19:10:39 -04:00
Brad King
536c1de1d4 Drop Visual Studio 11 2012 generator
This generator has been deprecated since CMake 3.25.  Remove it.
2023-06-13 14:20:48 -04:00
Brad King
2f3d945f83 VS: Add CMAKE_GENERATOR_PLATFORM field to control Windows SDK selection
Add a `version=` field to explicitly control the SDK version selection
without relying on `CMAKE_SYSTEM_VERSION`.

Fixes: #16713
2023-04-05 12:06:22 -04:00
Brad King
e259063b0a VS: Defer Windows SDK selection until CMAKE_GENERATOR_PLATFORM is known
Prepare to teach `CMAKE_GENERATOR_PLATFORM` to affect SDK selection.
2023-04-05 12:06:22 -04:00
Ivan Zinkevich
33c15ae2b9 VS: Build custom commands concurrently when possible
Enable the `BuildInParallel` setting in VS project files when supported.

Fixes: #18405
2023-01-23 10:38:07 -05:00
Kitware Robot
33abef7416 Revise C++ coding style using clang-format-15
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 15.

* 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.

Fixes: #24315
2023-01-18 16:20:47 -05:00
Ben Boeckel
362d6cd234 clang-tidy: fix modernize-raw-string-literal 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
a805a897a8 clang-tidy: fix bugprone-parent-virtual-call 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
b72c45e39f clang-tidy: fix readability-else-after-return lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
07172aa31e clang-tidy: fix readability-redundant-string-cstr lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
c61ece5c40 clang-tidy: fix modernize-use-auto lints 2022-11-29 12:39:29 -05:00
Ben Boeckel
64c0702f91 clang-tidy: fix readability-static-accessed-through-instance lints 2022-11-29 12:39:29 -05:00
Brad King
48db261e69 cmake --build: Use both inter- and intra-project parallelism with msbuild
Since commit 1ab3881ec9 (cmake: Add options for parallel builds to
--build mode, 2018-04-14, v3.12.0-rc1~42^2), `cmake --build --parallel`
has added two options to the msbuild command line:

* `/m` enables inter-project parallelism in msbuild.
* `/p:CL_MPCount=1` suppresses intra-project parallelism in cl.

The latter was used to avoid `O(N^2)` compilation threads on `N`
processors.  In practice however, projects often have many source files
in a few targets, so `--parallel` actually reduces parallelism.

Drop the latter option to restore intra-project parallelism.
Users can always add `-- /p:CL_MPCount=1` themselves.

Fixes: #20564
2022-11-16 09:38:41 -05:00
Ilia K
3166547cf6 ASM_MARMASM: Add support for Microsoft ARM assembler language
https://learn.microsoft.com/en-us/cpp/assembler/arm/arm-assembler-reference

Fixes: #23999
2022-11-09 10:22:46 -05:00
Brad King
8d6f015d59 Drop Visual Studio 10 2010 generator
This generator has been deprecated since CMake 3.22.  Remove it.
2022-09-26 15:43:04 -04:00
Nicholas Sinlock
f972e4fd3a cmVSGenerator: Add support for two-part toolset versions for Visual Studio
Enables the Global Visual Studio Versioned Generator to use two-part toolset versions,
if only one toolset has that version number. For example, (14.32 is specified when
14.32.32142 and 14.32.23242 are installed). This change also add a unique return code
and message if a two-part version is used when multiple matching versions are present.

Fixes: #23933
2022-09-02 14:41:37 -07:00
Brad King
289932ded0 VS: Revert "Write ZERO_CHECK.proj for VS19 and above"
Revert commit a334f1b906 (VS: Write ZERO_CHECK.proj for VS19 and above,
2021-12-24, v3.24.0-rc1~607^2) and a supporting change from
commit 7219988b00 (VS: Exclude ZERO_CHECK.proj from .sln for
include_external_msproject, 2022-07-15, v3.24.0-rc4~1^2).

The change was made to support `dotnet` tooling in addition to
`msbuild`.  However, not having `ZERO_CHECK` in the `.sln` breaks common
interactive workflows.  Revert the change for now.  Later it can be
re-introduced behind some kind of option that enables `dotnet` support.

Fixes: #23726
Issue: #20227
2022-07-22 12:54:20 -04:00
Sumit Bhardwaj
7219988b00 VS: Exclude ZERO_CHECK.proj from .sln for include_external_msproject
In `cmGlobalVisualStudio7Generator::WriteTargetsToSolution`, we skip
writing `ZERO_CHECK.proj` to solution file as the check in
`cmGlobalVisualStudioGenerator::IsInSolution` returns `false` for
`ZERO_CHECK`. However, we write ZERO_CHECK to ProjectDependencies for
external projects as there are no checks in
`cmGlobalVisualStudio71Generator::WriteExternalProject`.

Similar to `cmGlobalVisualStudioGenerator::IsInSolution`, we introduce
`IsDepInSolution(const std::string&)` which excludes `ZERO_CHECK.proj`
from being added to sln file for the cases where we have `ZERO_CHECK.proj`.

Fixes: #23708
2022-07-20 08:51:38 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Sumit Bhardwaj
a334f1b906 VS: Write ZERO_CHECK.proj for VS19 and above
For VS 19 and above, switch the format of project file to
`VsProjectType::proj` for ZERO_CHECK target. The `ZERO_CHECK.proj`
consists of primitive MSBuild commands only and has no dependency on any
other targets or props files. This proj file is written as a
`ProjectReference` for other targets, but is not written to the sln
file.
2022-02-20 16:47:36 -08:00
Brad King
4313c5acbc VS: Revert "Write ZERO_CHECK.proj for VS19 and above"
Revert commit 925da7d428 (VS: Write ZERO_CHECK.proj for VS19 and above,
2021-12-24).  Although its commit message was mistakenly not updated, it
implemented the change for VS 2017 and below too.  Since it was merged,
I've discovered several subtle failures in nightly testing with VS 2017.
Revert the change pending further investigation.
2022-02-17 11:23:02 -05:00
Brad King
731bdec8b9 Merge topic 'vs-package-restore-docs'
d92469e572 Help: Clarify how package resolve mode is intended to be used
f320a31087 cmake --build: prioritize --resolve-package-references over preset

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6984
2022-02-16 09:41:03 -05:00
Carsten Rudolph
f320a31087 cmake --build: prioritize --resolve-package-references over preset
Fixes: #23224
2022-02-15 10:20:02 -05:00
Sumit Bhardwaj
925da7d428 VS: Write ZERO_CHECK.proj for VS19 and above
Use VsProjectType::proj as the file format for ZERO_CHECK and write
ZERO_CHECK.proj as a msbuild dependency for other projects.
2022-02-12 12:09:09 -05:00
Florian Schweiger
5cdd774d51 VS: Handle build target correct for .NET SDK style projects with Any CPU
* Extend Visual Studio solution parser for reading build target
* Map solution build target to project build target (especially for Any CPU)
* Use C++ <optional> template instead of pointer return value for cmSlnData::GetProjectByGUID
2022-02-07 13:08:37 +01:00
Sumit Bhardwaj
a88f98b3be Make cmGlobalVisualStudioGenerator::VSVersion enum class 2022-01-25 11:25:18 -08:00
Carsten Rudolph
9aa7831f05 Presets: add resolve packages setting to build presets. 2022-01-22 06:35:41 -05:00
Carsten Rudolph
b2f8f0bb87 cmGlobalVisualStudio10Generator: Auto restore NuGet packages. 2022-01-22 06:35:41 -05:00
Carsten Rudolph
193b8fca52 cmBuildOptions: Split build arguments into separate object. 2022-01-22 06:35:38 -05:00
NAKAMURA Takumi
0e58a5ea07 Source: Fix possible IWYU warnings in Windows generators 2021-11-20 00:50:33 +09:00
Brad King
f97f8537f3 VS: Model a default target framework
Add fields to the VS generator to select a target framework.
Migrate the existing default for VS 12 .NET CF for Windows CE.

Report the values in `CMAKE_VS_*` variables and use them for
the CSharp compiler id project too.

Issue: #22849
2021-11-06 06:08:54 -04:00
Brad King
6999b87133 cmGlobalVisualStudio10Generator: Add method to find MSBuild early
Add a way to find MSBuild before the main `FindMakeProgram` code path
has executed.
2021-10-20 13:00:25 -04:00
Brad King
6511654164 cmGlobalVisualStudio10Generator: Allow subclasses to reset MSBuild search
While at it, convert to inline initialization.
2021-10-20 13:00:25 -04:00
Brad King
22dab6eb96 Deprecate Visual Studio 10 2010 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2021-07-29 14:15:01 -04:00
Brad King
c46b265839 VS: Add Visual Studio 17 2022 generator
Fixes: #22339
2021-06-25 12:45:44 -04:00
Brad King
b0f830ced6 VS: Do not apply any '/external:*' flag table mapping on VS < 16.10
Since commit 887e9df0c7 (VS: Update v142 CL flag table for VS 16.10,
2021-06-04) we map several `/external:*` flags to their corresponding
`.vcxproj` elements.  These elements were added to `cl.xml` in VS 16.10,
so filter them out in older VS versions.  Add a field to the json flag
table format to specify the minimum version of VS needed for a given
mapping.

Issue: #22308
2021-06-17 08:25:04 -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
Brad King
e4ca525d84 VS: Do not apply '/external:W*' flag table mapping on VS < 16.10
Since commit 9054cd05e6 (VS: Add flag table entries for '/external:W*'
flags in VS 16.10, 2021-05-28, v3.20.4~10^2) we map flags to the
`ExternalWarningLevel` element.  VS 16.9 does not support that element,
but its `cl` compiler does support the `/external:W*` flags.  Filter out
the flag table entry on older VS versions.

Fixes: #22308
2021-06-16 13:24:32 -04:00