b3f1c60aff MSVC: Use -std:c++23preview flag for C++23 when available
1b4a802413 MSVC: Split C++23 flag selection into dedicated block
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10462
Our development workflow tooling prevents trailing blank lines
from being added, but some such lines remain from before that
was enforced. Remove them to make it easier to rename files
without triggering enforcement.
The file was added by commit 3006560d86 (ENH: Add template of ctest
script, 2006-04-28, v2.6.0~3433), but we do not use it for anything.
Technically it was public-facing by being in the `Templates/` directory,
but was never documented.
As of VS 17.6, MSBuild maps `ModuleDependenciesFile` to this flag
instead of the older `-sourceDependencies:directives` flag.
Map both flags to `ModuleDependenciesFile` for compatibility.
The Ninja and Makefile generators honor `target_compile_options` and
friends for ASM_NASM `.asm` sources. Teach the VS generator to
honor them too for consistency.
Issue: #24289
The Ninja and Makefile generators honor `target_compile_options` and
friends for ASM_MARMMASM `.asm` sources. Teach the VS generator to
honor them too for consistency.
Issue: #24289
The C# flag table added by commit 9b06c22648 (VS: Add flag tables for
C#, 2016-12-01, v3.8.0-rc1~230^2) and preserved by commit 6e947179a8
(Add json flag tables for C#, 2018-11-21, v3.14.0-rc1~282^2~27) was
written by hand. Fix the entry name for the `NoStdLib` property.
Fixes: #24077
The MSVC `/FI` flag accepts an attached value or a following argument.
Previously our flag tables only had entries for the former. Add
the latter.
Fixes: #23382
Apply the change from commit db35e3cfd6 (VS: Fix support for '/guard:cf'
linker flag for v142, 2019-01-24, v3.14.0-rc1~74^2~2) to the v143 flag
table.
The entry for `LinkControlFlowGuard` in `v143_Link.json` does not work
when used in a `.vcxproj` file. Drop our link flag table entries for
this toolset so that the flag will be passed via `AdditionalOptions`.
Also add a test case.
A C-style cast was added by commit 3f6ff4b5db (create_test_sourcelist:
add test driver option to run all tests, 2021-04-27, v3.21.0-rc1~257^2).
Use our `CM_CAST` macro to adapt based on the language.
The `CompileAs` entry in a `.vcxproj` file with values:
* `CompileAsCppModule` for `-interface`
* `CompileAsCppModuleInternalPartition` for `-internalPartition`
* `CompileAsHeaderUnit` for `-exportHeader`
does not cause the corresponding flag to be added to the command line.
Drop the flag table entries so that the flags go to `AdditionalOptions`.
Fixes: #22477
Revise the `/sourceDependencies[:directives]` table entries to properly
distinguish the two options (because one is a prefix of the other), and
to populate both `Generate*Dependencies` and `*DependenciesFile`.
This is the manual update mentioned in commit 887e9df0c7 (VS: Update
v142 CL flag table for VS 16.10, 2021-06-04, v3.21.0-rc1~77^2).
Apply the change from commit 7fce2d372e (VS: Revert "Add support for
ASAN -fsanitize=address flag", 2021-04-26, v3.21.0-rc1~270^2) to the
v143 flag table.
Issue: #21081
Apply the change from commit 43aa632f57 (VS: Populate `-Qspectre-` flag
table entry for v142, 2019-01-24, v3.14.0-rc1~74^2~7) to the v143 flag
table. Sort the longer options before the shorter ones. Remove the
default variant with an empty switch.
Apply the changes from commit d2fcc6748a (VS: Fix `/MANIFESTUAC:NO` link
flag mapping for v142, 2019-01-24, v3.14.0-rc1~74^2~4) and commit
fd45cbf40e (VS: Fix `/MANIFESTUAC:` link flag mapping for v142,
2019-01-24, v3.14.0-rc1~74^2~1) to the v143 flag table.
Run the commands
python3 Source/cmConvertMSBuildXMLToJSON.py -t v143 \
'c:/.../2022/Preview/MSBuild/Microsoft/VC/v170/1033/cl.xml'
python3 Source/cmConvertMSBuildXMLToJSON.py -t v143 \
'c:/.../2022/Preview/MSBuild/Microsoft/VC/v170/1033/link.xml'
To generate `Templates/MSBuild/FlagTables/v143_{CL,Link}.json`.
We can re-use `Templates/MSBuild/FlagTables/v14_LIB.json`.
While the flag tables for C and C++ were generated from MSBuild `.xml`
files, the CSharp flag tables were written by hand. Copy the `v142`
flag table to use for the `v143` toolset.
Move a declaration added by commit 3f6ff4b5db (create_test_sourcelist:
add test driver option to run all tests, 2021-04-27, v3.21.0-rc1~257^2)
into its own scope.
Run the command
python3 Source/cmConvertMSBuildXMLToJSON.py -t v142 \
'c:/.../MSBuild/Microsoft/VC/v160/1033/cl.xml'
To generate `v142_CL.json` locally. Manually move new and updated
settings over to `Templates/MSBuild/FlagTables/v142_CL.json`.