Commit Graph

84 Commits

Author SHA1 Message Date
Brad King
20cd951c9f VS: Add compiler flag table entry for -FI followed by separate argument
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
2022-04-01 16:37:08 -04:00
Benjamin Sluis
9e24437c91 VS: Remove the '/guard:cf' flag from v143 link flag table
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.
2022-01-12 16:45:07 -05:00
Brad King
3f9ef3703a VS: Fix /reference and /headerUnit flag table entries for v142 and v143
These flags accept values in following arguments, not immediately
appended.

Fixes: #22530
2021-08-10 10:37:57 -04:00
Brad King
937f454fb9 VS: Remove C++ module CompileAs flag table entries for v142 and v143
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
2021-07-26 10:49:26 -04:00
Brad King
8fb349a80e VS: Remove cl /FS entry from flag table for v142 and v143
The `ForceSynchronousPDBWrites` entry in a `.vcxproj` file does not
actually cause the `/FS` flag to be added to the command line.

Fixes: #22476
2021-07-26 10:45:09 -04:00
Brad King
1ac1436b25 VS: Fix /sourceDependencies flag table entries for v143
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).
2021-07-15 13:12:55 -04:00
Brad King
919fc7fd5f VS: Remove broken EnableASAN entry from flag table for v143
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
2021-07-15 13:12:55 -04:00
Brad King
3f19847b28 VS: Remove empty ExternalWarningLevel entry from flag table for v143 2021-07-15 13:12:54 -04:00
Brad King
ccb6083cbe VS: Remove empty LanguageStandard entries from flag table for v143 2021-07-15 13:12:54 -04:00
Brad King
c167de7e70 VS: Remove empty ConformanceMode entry from flag table for v143 2021-07-15 13:12:54 -04:00
Brad King
993d706a17 VS: Populate /JMC- flag table entry for v143
Apply the change from commit 049410c0b6 (VS: Populate `/JMC-` flag table
entry for v142, 2019-01-24, v3.14.0-rc1~74^2~6) to the v143 flag table.
2021-07-15 13:12:54 -04:00
Brad King
a070d87e08 VS: Populate -Qspectre- flag table entry for v143
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.
2021-07-15 13:12:54 -04:00
Brad King
3322bb7081 VS: Populate /Y- flag table entry for v143
Apply the change from commit 460a146e2b (VS: Populate `/Y-` flag table
entry for v142, 2019-01-24, v3.14.0-rc1~74^2~8) to the v143 flag table.
2021-07-15 13:12:54 -04:00
Brad King
cccef3c5b4 VS: Add -Zc:inline[-] flag table entry for v143
Apply the change from commit 0df3790371 (VS: Add `-Zc:inline[-]` flag
table entry for v142, 2019-01-24, v3.14.0-rc1~74^2~9) to the v143 flag
table.
2021-07-15 13:12:54 -04:00
Brad King
2d64b01223 VS: Fix /analyze:log flag mapping for v143
Apply the change from commit fb2e418c64 (VS: Fix `/analyze:log` flag
mapping for v142, 2019-01-24, v3.14.0-rc1~74^2~10) to the v143 flag
table.
2021-07-15 13:12:54 -04:00
Brad King
b933584a72 VS: Remove the /MERGE flag from v143 link flag table
Apply the change from commit a9f992434d (VS: Remove the /MERGE flag from
FlagTables, 2021-06-08, v3.21.0-rc1~58^2) to the v143 flag table.
2021-07-15 13:12:54 -04:00
Brad King
d3175a6079 VS: Map the link /debug flag for v143
Apply the changes from commit 533f95c847 (VS: Map the link `/debug` flag
for v142, 2019-01-24, v3.14.0-rc1~74^2~3) to the v143 flag table.
2021-07-15 13:12:53 -04:00
Brad King
9e10045552 VS: Fix /MANIFESTUAC: link flag mapping for v143
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.
2021-07-15 13:12:53 -04:00
Brad King
c152d08c52 VS: Add v143 flag tables for VS 17.0 Preview 2
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`.
2021-07-15 13:12:53 -04:00
Brad King
7adfd890fb VS: Add CSharp VS 2022 compiler version and flag table v143
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.
2021-07-15 13:12:07 -04:00
Brad King
63c1262375 VS: Improve v142 CL flag table LanguageStandard ordering 2021-07-15 13:12:06 -04:00
Brad King
b610b7a35c VS: Update v142 CL flag table for VS 17.0 Preview 1
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`.
2021-06-25 10:07:32 -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
5fd68d3ef7 Merge topic 'vs-custom-depfile'
526e2ef71c VS: Add support for add_custom_command DEPFILE
794ad78abb Help: Generalize release note filename for add_custom_command DEPFILE
7291f31254 cmTransformDepfile: Add support for MSBuild AdditionalInputs format
a6de8ec51b cmTransformDepfile: Make directory for transformed depfile automatically

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6206
2021-06-10 08:23:45 -04:00
Brad King
526e2ef71c VS: Add support for add_custom_command DEPFILE
Transform the depfile into MSBuild `AdditionalInputs` content.  Add
MSBuild Targets to update `AdditionalInputs` and the `.tlog` files for
future builds without actually modifying the `.vcxproj` file.

Fixes: #20286
2021-06-09 10:09:58 -04:00
Duncan Ogilvie
a9f992434d VS: Remove the /MERGE flag from FlagTables
Fixes #22229
2021-06-08 23:23:38 +02:00
Brad King
887e9df0c7 VS: Update v142 CL flag table for VS 16.10
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`.

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`.
2021-06-04 10:17:13 -04:00
Brad King
25e33a282b VS: Update v141 CL flag table for VS 15.9
Run the command

    python3 Source/cmConvertMSBuildXMLToJSON.py -t v141 \
        'c:/.../Common7/IDE/VC/VCTargets/1033/cl.xml'

To generate `v141_CL.json` locally.  Manually move new and updated
settings over to `Templates/MSBuild/FlagTables/v141_CL.json`.
2021-06-04 10:12:38 -04:00
Brad King
f9383e0140 VS: Re-order v141 and v142 CL flag table entries to match xml files better 2021-06-04 09:39:53 -04:00
Brad King
21832aa8fc Merge topic 'vs-16.10-map-external-warnings'
9054cd05e6 VS: Add flag table entries for '/external:W*' flags in VS 16.10

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6171
2021-05-28 12:52:42 -04:00
Brad King
9054cd05e6 VS: Add flag table entries for '/external:W*' flags in VS 16.10
Fixes: #22255
2021-05-28 11:54:57 -04:00
Brad King
7fce2d372e VS: Revert "Add support for ASAN -fsanitize=address flag"
Revert commit 1b37305b0f (VS: Add support for ASAN -fsanitize=address
flag, 2021-04-21).  The tag `EnableASAN` is created in
`ItemDefinitionGroup` but it needs to be in `PropertyGroup`.  Revert the
mapping pending an implementation in the generator.

Issue: #21081
2021-04-26 14:15:41 -04:00
Brad King
aa7d08e90a Merge topic 'vs-asan'
1b37305b0f VS: Add support for ASAN -fsanitize=address flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6034
2021-04-22 10:28:47 -04:00
oltolm
1b37305b0f VS: Add support for ASAN -fsanitize=address flag
Map it to the `EnableASAN` element in `.vcxproj` files.

Fixes: #21081
2021-04-21 13:37:26 -04:00
Brad King
11c0bfff89 VS: Generalize CSharp /langversion flag mapping
Map the `/langversion:` flag followed by any value to a `LangVersion`
element with the specified value in the `.csproj` file.

Fixes: #22089
2021-04-21 10:18:07 -04:00
Francois Keith
ee78391c09 CSharp: Add 'warnaserror:...' to v142 flag table for VS
This allows listing the warnings that must be flagged as errors.
For example:

    target_compile_options(proj PRIVATE "/warnaserror:1998,4014")
2021-01-25 12:32:30 -05:00
Francois Keith
e38997d85a CSharp: Add 'debug:portable' to v142 flag table for VS 2021-01-25 12:32:21 -05:00
Moyo Okeremi 😊
4ea3a88625 MSVC: Add support for targeting ARM64EC 2021-01-20 16:43:35 -08:00
Brad King
b11c723678 VS: Populate std:c{11,17} flag table entries for v142
The `-std:c11` option added by commit f7347f28c7 (MSVC: Record support
for C11 and c_restrict, 2020-08-09, v3.18.2~9^2) needs this flag table
entry to map in the VS IDE properly.

Issue: #21069
2020-09-28 15:51:01 -04:00
Robert Maynard
568298a336 CUDA: MSVC + NVCC support --compiler-options compiler flag
Fixes #20164
2020-01-02 14:35:24 -05:00
Brad King
bbf216fb6b VS: Add toolset v142 CSharp flag table
While the flag tables for C and C++ were generated from MSBuild `.xml`
files, the CSharp flag tables were written by hand.  Copy the `v141`
flag table to use for the `v142` toolset.

Remove the special case added by commit 626c51f47b (VS: Update for
Visual Studio 2019 Preview 2, 2019-01-24, v3.14.0-rc1~74^2) that mapped
the v142 flag table lookup to v141 since we now have the real v142
table.

Fixes: #19828
2019-10-11 11:11:20 -04:00
Wil Stark
822697996e VS: Fix nowarn compiler option to accept warning numbers.
Warning disables are transferred to the VS IDE `<NoWarn>` node.

Fixes: #18878
2019-02-07 06:39:45 -05:00
Brad King
fd45cbf40e VS: Fix /MANIFESTUAC: link flag mapping for v142
Apply the change from commit 454b47ba0b (VS: Fix MANIFESTUAC link flag
map to .vcxproj elements, 2018-11-21) to the v142 flag table.

Add special parsing of the flags given in `/MANIFESTUAC:"..."` in order
to map them correctly to `.vcxproj` elements.

Keep the old incorrect flag table entries for `uiAccess` and `level`
flags for compatibility even though they do not really exist.
2019-01-24 13:19:57 -05:00
Brad King
db35e3cfd6 VS: Fix support for '/guard:cf' linker flag for v142
Apply the change from commit 57a78b5526 (VS: Fix support for '/guard:cf'
linker flag, 2018-11-21) to the v142 flag table.

Although `$(VCTargetsPath)/1033/link.xml` contains an entry for
`LinkControlFlowGuard`, it does not work when used in a `.vcxproj` file
(at least as of v140 and v141).  Drop our link flag table entries for
these toolsets so that the flag will be passed via `AdditionalOptions`.
2019-01-24 13:19:55 -05:00
Brad King
533f95c847 VS: Map the link /debug flag for v142
Apply the changes from commit a5d9aa5063 (VS: Map the link `/debug` to
its IDE property, 2018-11-21) and commit f77320c12a (VS: Add v140 and
v141 flag table entries for /DEBUG:NONE and /DEBUG:FULL, 2018-11-21) to
the v142 flag table.

See commit ae44496e2b (VS: Fix GenerateDebugInformation values for v140
and v141 toolsets, 2017-06-27, v3.9.0-rc6~15^2~1) for explanation.
2019-01-24 13:19:54 -05:00
Brad King
d2fcc6748a VS: Fix /MANIFESTUAC:NO link flag mapping for v142
Apply the change from commit 1d00fd7702 (VS: Fix /MANIFESTUAC:NO linker
option mapping, 2018-11-21) to the v142 flag table.

There are no versions of `/MANIFESTUAC:NO` where addition values are
appended.  Remove both of the `MANIFESTUAC:NO` entries from our flag
tables and replace them with one which would set `EnableUAC` to false
and immediately stop processing the `/MANIFESTUAC:NO` option.
2019-01-24 13:19:53 -05:00
Brad King
a7973ccb53 VS: Populate /permissive flag table entry for v142
Apply the change from commit e0d6d01e52 (VS: Add flag table entry for
"permissive" flag to disable conformance mode, 2018-12-10) to the
v142 flag table.
2019-01-24 13:19:52 -05:00
Brad King
049410c0b6 VS: Populate /JMC- flag table entry for v142
Add the negative form of the option.
2019-01-24 13:19:50 -05:00
Brad King
43aa632f57 VS: Populate -Qspectre- flag table entry for v142
Rather than the change from commit 584ad067ba (VS: Fix flag table entry
for -Qspectre, 2018-11-26), update the v142 flag table with an actual
flag for the negative form of the flag.  Switch the entry order so that
the longer negative form is first.
2019-01-24 13:19:49 -05:00
Brad King
460a146e2b VS: Populate /Y- flag table entry for v142
Apply the change from commit 8df25f9400 (VS: connect /Y- compiler option
with "Not Using Precompiled Headers", 2018-11-26) to the v142 flag
table.
2019-01-24 13:19:48 -05:00