Commit Graph

1018 Commits

Author SHA1 Message Date
Brad King
85f4fdc000 Merge topic 'debugger-working-directory'
0a9fb88121 fileapi: Report DEBUGGER_WORKING_DIRECTORY in codemodel-v2 target objects
9ed178f9d8 Add generator-agnostic DEBUGGER_WORKING_DIRECTORY target property
200efab4d4 Tests/RunCMake/FileAPI: Improve error on unexpected line numbers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10075
2024-12-11 09:47:03 -05:00
Brad King
27be881b3f Merge topic 'vs-clang-cl-c++23'
30139913e9 VS: Restore support for mixing C++23 and C in one target with clang-cl
57da8712c1 VS: Factor out check for mixed C and C++ target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10082
2024-12-10 09:12:04 -05:00
Brad King
30139913e9 VS: Restore support for mixing C++23 and C in one target with clang-cl
Since commit 474eafe28c (clang-cl: Add support for C++23, 2024-09-13,
v3.31.0-rc1~97^2) we use a Clang-specific flag to enable C++23 since
`clang-cl` has no `-std:c++23` flag, and `-std:c++latest` may enable an
even newer version of C++.  However, in `.vcxproj` files there is no way
to express a target-wide `-clang:-std=c++23` flag for only C++ sources
when the target also has C sources.  Add a special case to map back to
`-std:c++latest` for targets with C++23 and C together.

Fixes: #26508
2024-12-09 14:57:35 -05:00
Brad King
57da8712c1 VS: Factor out check for mixed C and C++ target 2024-12-09 14:19:51 -05:00
Garrett Campbell
9ed178f9d8 Add generator-agnostic DEBUGGER_WORKING_DIRECTORY target property
Generalize the `VS_DEBUGGER_WORKING_DIRECTORY` property.

Issue: #16478
2024-12-09 10:47:10 -05:00
Joseph Snyder
2709f07b4d VS: Add minimal support for Windows Kernel Mode Drivers
Extend the experimental support for `WindowsKernelModeDriver` to the
Visual Studio generators.  Hard-code some settings for now.
2024-12-03 14:18:52 -05:00
Brad King
fec276e632 cmVisualStudio10TargetGenerator: Use inline member initialization 2024-12-03 09:43:26 -05:00
Marc Chevrier
7907c83175 Link step: Add LINK_WARNING_AS_ERROR target property
Add a way to specify, in a portable way, to raise an error for any
warning during the link step. For that purpose, define:
* CMAKE_LINK_WARNING_AS_ERROR variable
* LINK_WARNING_AS_ERROR target property

Fixes: #25343
2024-11-12 15:11:53 +01:00
Brad King
8353e6ab8d Merge topic 'vs-custom-command-disable-parallel-build'
4ee8705b12 VS: add source property VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9958
2024-11-07 10:07:03 -05:00
Darragh Coy
4ee8705b12 VS: add source property VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD
This boolean setting allows parallel building to be disabled for
individual source files built via `add_custom_command`. Using this
option is equivalent to setting policy `CMP0147` to the `OLD` behavior.

Closes: #26413
2024-11-06 13:29:57 -05:00
Marc Chevrier
2bd4c06c26 Refactoring cmRulePlaceHolderExpander: propagate cmBuildStep information 2024-11-04 17:08:02 +01:00
Marc Chevrier
35350c419d Add support of "LINKER:" prefix for CMAKE_<TYPE>_LINKER_FLAGS variable
The following variables now support the LINKER: prefix:
* CMAKE_<TYPE>_LINKER_FLAGS
* CMAKE_<TYPE>_LINKER_FLAGS_<CONFIG>

Fixes: #26171
2024-11-04 17:07:58 +01:00
Darragh Coy
55831faf5b VS: Honor VS_TOOL_OVERRIDE for known source file types too
Visual Studio Generator: The `VS_TOOL_OVERRIDE` source file property
would previously only be respected for file types that CMake didn't know
how to build out of the box. This change allows the user to override how
any source file is built with a custom build tool, even ones with
standard/recognized extensions such as `.cxx`, `.idl`, etc.

Fixes: #26336
2024-10-01 14:00:00 -04:00
Calum Robinson
55a5094f0e VS: Fix missing <Configurations> property for DOTNET_SDK
Fixes #26325
2024-09-25 16:20:12 +01:00
Calum Robinson
fd66818653 VS: Fix custom commands for DOTNET_SDK builds
Fixes: #23723
2024-09-18 18:26:27 +01:00
Brad King
d68ca050ef Merge topic 'vs-always-restore-net-sdk'
3283ef47d1 VS: Fix DOTNET_SDK builds when no VS_PACKAGE_REFERENCES set

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9807
2024-09-18 09:40:03 -04:00
Calum Robinson
3283ef47d1 VS: Fix DOTNET_SDK builds when no VS_PACKAGE_REFERENCES set
nuget restore always needs to be run for the new DOTNET_SDK style
projects, even when VS_PACKAGE_REFERENCES is empty.

Fixes: #23405
2024-09-16 13:32:19 +01:00
Calum Robinson
66bd326e28 VS: Use OUTPUT_NAME in DOTNET_SDK projects
Fixes: #26285
2024-09-11 12:25:08 +01:00
Brad King
e25f95c4cc Merge topic 'standard-link-directories'
20e9b59d5e Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9707
2024-08-29 08:31:17 -04:00
Vito Gamberini
20e9b59d5e Linking: Add CMAKE_LANG_STANDARD_LINK_DIRECTORIES
Closes: #18222
2024-08-28 15:54:43 -04:00
Brad King
241f923a6f Drop Visual Studio 12 2013 generator
This generator has been deprecated since CMake 3.28.  Remove it.
2024-08-28 14:13:05 -04:00
Vitaly Stakhovsky
58da4aa47d Source: Avoid comparing pointers to nullptr 2024-08-27 10:56:38 -04:00
Brad King
88e90fcd20 Merge topic 'cuda_unity'
b90ae10dda Add support for unity builds with CUDA sources
c99ff40b21 Unity: refactor unity extension logic to single function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9655
2024-08-13 11:01:13 -04:00
Robert Maynard
b90ae10dda Add support for unity builds with CUDA sources
Fixes #22750
2024-08-02 13:35:53 -04:00
Patrick H
373b29bd3f Rename {_ => }CMAKE_INCLUDE_SYSTEM_FLAG_${lang}_WARNING
Although not documented publicly, projects may need to override
this variable.  Remove the private `_` prefix from its name.

Issue: #25103
2024-07-29 11:50:02 -04:00
Brad King
f2e52b3124 Merge topic 'vs-cuda'
a9210a0c02 VS: Restore support for CUDA with no optimization flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !9666
2024-07-18 08:57:48 -04:00
Brad King
a9210a0c02 VS: Restore support for CUDA with no optimization flags
Since commit 67de5b7b82 (VS: Suppress MSBuild default settings affected
by UseDebugLibraries, 2024-02-13, v3.30.0-rc1~538^2~1) we generate an
empty `Optimization` element for the host compiler when there are no C
or C++ optimization flags enabled.  The CUDA Toolkit Visual Studio
integration fails with an error if an empty string is inherited from the
host compiler's `Optimization` element.  If no CUDA optimization flags
are specified, write an explicit empty `Optimization` element for the
CUDA compiler too.

Fixes: #26144
2024-07-17 11:42:31 -04:00
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
f0b40d451e Merge topic 'vs-filter-props'
56a96d1f1f VS: Add option to import .props in .vcxproj.filters files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9478
2024-05-02 09:43:17 -04: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
halx99
56a96d1f1f VS: Add option to import .props in .vcxproj.filters files
Adds new target property VS_FILTER_PROPS

Fixes: #25948
2024-05-02 00:30:00 +08: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
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Brad King
721d8b192a VS: Add UseDebugLibraries to vcxproj files by default
Use heuristics to select a reasonable value.  Add policy CMP0162
to provide compatibility with existing projects.

Fixes: #25327
2024-02-22 08:43:16 -05:00
Brad King
47136b6959 VS: Suppress more MSBuild defaults affected by UseDebugLibraries
Extend commit 67de5b7b82 (VS: Suppress MSBuild default settings affected
by UseDebugLibraries, 2024-02-13) to cover a `Microsoft.Cl.Common.props`
default from VS 2015 and older.
2024-02-22 08:42:58 -05:00
Brad King
f498032141 cmVisualStudioGeneratorOptions: Rename {IsDebug => UsingDebugInfo}
The latter name is more precise.
2024-02-20 10:48:31 -05:00
Brad King
b814641444 VS: Add [CMAKE_]VS_USE_DEBUG_LIBRARIES options to control UseDebugLibraries
This indicates to MSBuild which configurations are considered debug
configurations.  This is useful for reference both by humans and tools.

Issue: #25327
2024-02-19 10:40:41 -05:00
Brad King
67de5b7b82 VS: Suppress MSBuild default settings affected by UseDebugLibraries
`Microsoft.Cl.Common.props` changes some default settings based on
`UseDebugLibraries`.  CMake models its own controls for these settings,
so if the project does not set them, explicitly suppress them to avoid
letting `UseDebugLibraries` affect them.
2024-02-19 10:40:40 -05: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
899a1f64af Merge topic 'vs-scan-for-modules'
405dc7d19c Tests/CXXModules/scan_properties: use `ixx` extension
029ddc3410 cmVisualStudio10TargetGenerator: always specify scanning
6c9614cbf4 Tests/CXXModules: add a test case for VS generation without flags
34f4423851 cmVisualStudio10TargetGenerator: fix typo in flag name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9104
2024-01-10 10:17:03 -05:00
Ben Boeckel
029ddc3410 cmVisualStudio10TargetGenerator: always specify scanning
Set that sources should not be scanned on a target-wide basis and then
enable on a per-TU basis as needed.

Fixes: #25519
2024-01-06 11:18:57 -05:00
Ben Boeckel
34f4423851 cmVisualStudio10TargetGenerator: fix typo in flag name
It is case insensitive, so this only matches the official flag name and
still works.
2024-01-06 11:18:57 -05:00
Brad King
aff7870172 Merge topic 'cxxmodules-vs-no-synthetic-targets'
17fd7fe2ae Tests/CXXModules: test Visual Studio synthetic target error
badb6ab120 VS: Explicitly disallow C++ modules provided by imported targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8895
2023-10-18 09:51:53 -04:00
Ben Boeckel
badb6ab120 VS: Explicitly disallow C++ modules provided by imported targets
The `-ifcOnly` flag is understood by MSBuild, but there are unresolved
questions about how to integrate with with CMake's model.

See: #25328
2023-10-17 14:46:57 -04:00
Marc Chevrier
96a953b1ed Add options to specify linker tool
Offer the capability, through variable `CMAKE_LINKER_TYPE`, as well as
the target property `LINKER_TYPE` to specify which linker must be used.

The implementation of this capability is specified by variables specific
to the language and linker type: `CMAKE_<LANG>_USING_LINKER_<TYPE>`.
Some definitions are provided as part of `CMake`.

For example, to select the `LLVM` linker rather than the standard one,
the type `LLD` should be specified through the variable `CMAKE_LINKER_TYPE`.
And, on `Apple`, `Linux` and some environments on `Windows`, the variable
`CMAKE_<LANG>_USING_LINKER_LLD` has value `-fuse-ld=lld`. And for `Windows`
environments  based on `MSVC`, where the linker is used directly, the tool
`lld-link.exe` will be used rather than `link.exe`.

Fixes: #19174, #24254, #24990
2023-10-13 11:52:35 +02:00
Ben Boeckel
197a6bf171 cxxmodules: rework control logic for scanning regular C++ sources
Now that scanning support is no longer experimental, the logic for
whether or not to scan C++ 20 sources is now important because all
projects are now exposted to the logic. Make the scanning rules explicit
in the documentation and rework the queries to localize all of the
associated logic.

A policy to handle the ultimate fallback logic will be implemented in a
following commit.
2023-10-02 10:17:31 -04:00
Robert Maynard
aa8facefe8 CUDA: Visual Studio propagate objects to device linking
When given objects via `target_link_libraries(consumer PRIVATE producer)` the VisualStudio solution adds the objects
under as `<Object>` entries in the solution.

This works for host side linking but isn't handled by
the cuda msbuild extensions. So to work around this we
manually add the objects as additional link items.
2023-09-22 11:54:12 -04:00
Brad King
5b590882fa Merge topic 'cxxmodules-non-compiled-source'
24a9b00f83 Merge branch 'cxxmodules-non-compiled-source-release' into cxxmodules-non-compiled-source
458e3974a8 cxxmodules: detect and message about non-compiled sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8773
2023-09-14 13:01:21 -04:00