1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-10 16:21:40 +08:00

168 Commits

Author SHA1 Message Date
Brad King
d3088a8eea Merge topic 'vs-dotnet-sdk-custom-command'
c7e5ebd0a8 VS: Support add_custom_command in .Net SDK-style projects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9616
2024-07-08 10:17:28 -04:00
Calum Robinson
0721f9bf0f VS: Add VS_FRAMEWORK_REFERENCES
Fixes: #26082
2024-06-26 16:44:51 +01:00
Calum Robinson
c7e5ebd0a8 VS: Support add_custom_command in .Net SDK-style projects
Fixes: #26048
2024-06-25 13:31:44 +01:00
Brad King
718f43e7ee Merge topic 'vs-scan-module-deps-settings'
3022f0363f VS: set ScanSourceForModuleDependencies at vcxproj level
dff511ad28 cmGeneratorTarget: add a target-level query for "needs dyndep"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: AaronRuizMoraUK <aaronruizmora@gmail.com>
Merge-request: !9471
2024-05-02 09:40:04 -04:00
Ben Boeckel
3022f0363f VS: set ScanSourceForModuleDependencies at vcxproj level
Implement the target-wide `CXX_SCAN_FOR_MODULES`/`CMP0155` selection
with the `.vcxproj`-wide `ScanSourceForModuleDependencies` setting.
Set the per-source equivalent only when needed for a per-source
`CXX_SCAN_FOR_MODULES` property.

This approach enables Intellisense for interfaces imported from modules.
It is also more consistent with what a user might expect when
investigating the state of module scanning from the VS property panels.

Fixes: #25806
Fixes: #25947
2024-05-01 09:54:50 -04:00
Brad King
0ae372daee VS: Factor out common MS tool configuration
De-duplicate code writing `PlatformToolset`.
2024-02-19 10:40:40 -05:00
Brad King
0d1529000d VS: Revert "Add CMake input files to ZERO_CHECK"
Since commit df58dbb0e9 (VS: Add CMake input files to ZERO_CHECK,
2023-03-19, v3.27.0-rc1~157^2), projects that specify the same file both
as input to `configure_file` and as the `MAIN_DEPENDENCY` of a custom
command fail to configure.  Revert the change pending further
investigation.  Add a test case demonstrating the problem.

Issue: #24557
Fixes: #25149
2023-08-02 11:53:48 -04:00
Andreas Weis
d90a61d671 VS: Make C++ module BMIs public by default for shared libraries
Enable the `AllProjectBMIsArePublic` option for shared libraries in the
VS project files when building with C++20 modules support.
2023-06-22 14:22:56 -04:00
Alexander Neundorf
df58dbb0e9 VS: Add CMake input files to ZERO_CHECK
Add all cmake input files to the `ZERO_CHECK` project.  Place files
under `CMAKE_SOURCE_DIR` in a folder structure matching the directory
structure.  This way they are easier to find, and Visual Studio does not
close them when reloading the project.

Fixes: #24557
2023-04-25 17:35:39 -04:00
Sergey Markelov
74e0b5d9f5 VS: Fix wrong appxManifest if OUTPUT_NAME != target name
Fixes #24416
2023-02-15 20:35:50 -07:00
Brad King
8024c41685 VS: Do not concurrently build custom commands with generated MAIN_DEPENDENCY
Since commit 33c15ae2b9 (VS: Build custom commands concurrently when
possible, 2023-01-19) several tests have failed intermittently with the
VS generator.  It seems that if the `BuildInParallel` setting is
attached to a generated input:

    <CustomBuild Include="generated_input.txt">
      <BuildInParallel Condition="...">true</BuildInParallel>
      <Command Condition="...">copy geneated_input.txt output.txt</Command>
      ...
    </CustomBuild>

then MSBuild does not wait for the input to be generated before running
the command.

This occurs when using `add_custom_command`'s `MAIN_DEPENDENCY`, so
avoid using `BuildInParallel` in that case.

Issue: #18405
2023-01-25 10:59:44 -05: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
Ben Boeckel
bcada09e45 clang-tidy: fix readability-redundant-access-specifiers lints 2022-11-29 12:39:29 -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
e781d92de5 Merge topic 'vs-fuzzer'
feeb9ae4ba VS: Add support for (lib)fuzzer /fsanitize=fuzzer flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7471
2022-07-27 09:53:52 -04: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
Fredrik Claesson
feeb9ae4ba VS: Add support for (lib)fuzzer /fsanitize=fuzzer flag 2022-07-13 16:12:15 +02: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
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
Brad King
63154cbf45 Merge topic 'vs-package-restore'
9aa7831f05 Presets: add resolve packages setting to build presets.
b2f8f0bb87 cmGlobalVisualStudio10Generator: Auto restore NuGet packages.
193b8fca52 cmBuildOptions: Split build arguments into separate object.
6a10103493 Help: Update preset schema description for version 3 entries.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6761
2022-01-24 11:46:29 -05:00
Carsten Rudolph
b2f8f0bb87 cmGlobalVisualStudio10Generator: Auto restore NuGet packages. 2022-01-22 06:35:41 -05:00
Hanaa Elghobashi
d13c8d25e6 VS: Add support for ASAN -fsanitize=address flag
Fixes: #21081
2022-01-20 11:46:46 -05:00
Sumit Bhardwaj
938a53f4f1 Refactor VsProjectType to its own header
Move VsProject to its own header so that we can consolidate IsManaged
and IsCSharp.
2021-12-23 11:53:39 -08:00
Sumit Bhardwaj
0eea32a376 VS: Add DOTNET_SDK property to generate SDK-style C# projects
Changes in cmVisualStudio10TargetGenerator::Generate to write .Net
SDK-style project for VS generators VS 19 and above. Also adds
documentation and tests.

Issue: #20227
2021-12-21 09:35:49 -08:00
Sumit Bhardwaj
fa76e5d194 cmVisualStudio10TargetGenerator: Factor out helper for classic MSBuild project
In preparation for generating .Net SDK style project, refactor
cmVisualStudio10TargetGenerato::Generate to split the functionality to
write classic MSBuild project file. This commit only introduces a helper
function and moves the functionality there. A later commit will add
WriteSdkStyleProjectFile, the call to it, and the rest of the .Net
SDK-style changes.
2021-12-15 12:27:06 -05:00
Sumit Bhardwaj
a80d95b114 cmVisualStudio10TargetGenerator: Change VsProjectType to be enum class 2021-12-01 09:51:26 -05:00
NAKAMURA Takumi
0e58a5ea07 Source: Fix possible IWYU warnings in Windows generators 2021-11-20 00:50:33 +09:00
Steven Boswell
f21158cdfe VS: Honor VS_SETTINGS source file property on all sources
Extend the feature added by commit 2ce42f281f (VS: Add VS_SETTINGS
source file property, 2020-03-18, v3.18.0-rc1~449^2~3) to support
all source file types.
2021-09-09 14:19:28 -04:00
Steven Boswell
3bf013632d cmVisualStudio10TargetGenerator: Factor out helper to write VS_SETTINGS 2021-09-09 14:19:28 -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
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Kyle Edwards
6051a49c78 Visual Studio: Add Android support 2020-06-24 08:41:09 -04:00
Brad King
65fe58a4b4 cmVisualStudio10TargetGenerator: Adopt Windows Store and Phone infrastructure
Move support for Resx, Xaml, Certificate, and AppManifest file handling
out of cmGeneratorTarget.
2020-05-18 12:56:56 -04:00
Brad King
156196938c Merge topic 'cmprop-source'
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp
fc223f9860 cmGlobalXCodeGenerator: Fix genex interpreter overloads

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4603
2020-04-15 09:49:46 -04:00
Vitaly Stakhovsky
e64fa5f1b6 cmSourceFile::GetProperty: return cmProp 2020-04-14 10:57:17 -04:00
Justin Goshi
bc877a7e94 Add support to indicate UTF-8 custom command pipe output encoding
Adds a flag to indicate that pipe output from a custom command should be
interpreted as UTF-8 encoded. This change does not introduce a public
way to set the flag, but generators that create internally-generated
commands know if they are calling cmake, which uses UTF-8 pipes.

MSBuild added support for interpreting output of PreBuildEvent,
PreLinkEvent, PostBuildEvent, and CustomBuildStep as UTF-8. This change
will appear in Visual Studio 16.6 Preview 3. It is opt-in, and you need
to add the StdOutEncoding tag. MSBuild treats these as property bags so
if we emit the tag for earlier versions of Visual Studio it would be
safely ignored. This change emits the StdOutEncoding tag and sets it to
UTF-8 whenever the custom command UTF-8 pipe flag is set. This fixes
globalization issues when the output from cmake contained characters
that required MSBuild to interpret as UTF-8 before displaying them.
2020-04-13 12:54:47 -07:00
Brad King
ad22d0c1d0 Merge topic 'vs-non-built-file-item-metadata'
0723e04f7a VS: Add documentation for VS_SETTINGS and VS_SOURCE_SETTINGS_<tool>.
2ca1102f83 VS: Test VS_SETTINGS and VS_SOURCE_SETTINGS_<tool> properties.
f00e1b816d VS: Add VS_SOURCE_SETTINGS_<tool> target property
2ce42f281f VS: Add VS_SETTINGS source file property
53116d3942 VS: Use unordered_map to write HLSL settings.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4498
2020-03-30 13:28:19 -04:00
Rolf Eike Beer
94de927cab VS10Generator: avoid many string allocations 2020-03-24 17:50:42 +01:00
Matt Davies
f00e1b816d VS: Add VS_SOURCE_SETTINGS_<tool> target property
VS_SOURCE_SETTINGS_<tool> is a list of key value pairs that get written as item
metadata for any file associated with <tool> for that target. The entire value
of VS_SOURCE_SETTINGS_<tool> is evaluated as a generator expression. VS_SETTINGS
can override settings specified in this property.
2020-03-20 16:16:58 +00:00
Matt Davies
2ce42f281f VS: Add VS_SETTINGS source file property
VS_SETTINGS is a list of key value pairs that get written as item
metadata for the associated non-built file. The entire value of
VS_SETTINGS is evaluated as a generator expression.
2020-03-20 16:16:58 +00:00
Matt Davies
53116d3942 VS: Use unordered_map to write HLSL settings. 2020-03-20 16:16:44 +00:00
Kinan Mahdi
ac6b18cd90 CSharp: Add support for source groups with out-of-source builds
This also fixes support for multiple sources of the same name in
different directories.  Add a test for both problems.

Issue: #19505
2020-02-28 11:42:01 -05:00
Vitaly Stakhovsky
64843b1737 cmVisualStudio10TargetGenerator: use std::string for tag 2019-11-10 09:29:27 -05:00
Charly Mourglia
89ff3ee779 VS: Add VS_DOTNET_DOCUMENTATION_FILE property
Add a `VS_DOTNET_DOCUMENTATION_FILE` target property to tell VS
generators to add a `DocumentationFile` setting in `.csproj` files.

Fixes: #19784
2019-10-15 11:44:55 -04:00
Brad King
76ae4c5839 Merge topic 'vs-16.4-custom-commands'
0578239d3a VS: Tell VS 16.4 not to verify SYMBOLIC custom command outputs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3860
2019-09-25 12:39:14 -04:00
Brad King
0578239d3a VS: Tell VS 16.4 not to verify SYMBOLIC custom command outputs
VS 16.4 introduces an additional check on `CustomBuild` rules that warns
if the outputs of the command are not created.  However, CMake supports
marking outputs with the `SYMBOLIC` property to indicate that they will
not actually be generated.  That property is used by Makefile and Ninja
generators but has not been needed by the VS generators before.  Teach
the VS generator to disable `VerifyInputsAndOutputsExist` in custom
build rules that have a symbolic output.

Fixes: #19737
2019-09-24 10:41:20 -04:00
Regina Pfeifer
a1ddf2d0ba clang-tidy: Replace typedef with using
Automate the conversion with

  perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g'

then manually fix a few places.
2019-09-04 18:03:01 +02:00
Brad King
f9b7c660d7 VS: Fix mapping of -Qspectre- flag
The mapping for this flag was added by commit 43aa632f57 (VS: Populate
`-Qspectre-` flag table entry for v142, 2019-01-24, v3.14.0-rc1~74^2~7).
However, it did not do anything because the special logic added by
commit bb60ed6e72 (VS: Add flag table entry for -Qspectre, 2018-10-08,
v3.13.0-rc1~4^2) to move the `SpectreMitigation` element from
`ClCompile` to the top level only handled the presence of the setting
and not its value.  Extend the special logic to carry the value too.

Fixes: #19535
2019-07-30 11:17:28 -04:00
Brad King
187928875d Merge topic 'vs-add-package-reference'
42e14d90b1 VS: Added support for VS package references for nuget

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Leonid Pospelov <pospelovlm@yandex.ru>
Merge-request: !3389
2019-05-31 13:18:31 -04:00