1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-24 05:03:26 +08:00

844 Commits

Author SHA1 Message Date
Brad King
ea289314ef VS: Fix pre-VS15.8 unity build exclusion of per-config sources
In a unity build, the original source files need to be excluded from
the build.  Prior to VS 15.8, this is done via `ExcludeFromBuild`,
which is the same mechanism used to implement per-config sources.
Fix a conflict in the implementation of the two features so that
unity-batched sources are excluded from all configurations rather
than just those in which they would otherwise have been included.
2021-11-11 07:16:11 -05:00
Brad King
c0e23058f6 Merge topic 'vs-framework-version'
d51246c662 VS: Default TargetFrameworkVersion to v4.7.2 for VS 2022
f97f8537f3 VS: Model a default target framework
e40cedddc0 cmVisualStudio10TargetGenerator: Refactor target framework selection
78782cc7dc cmGlobalVisualStudio8Generator: Refactor SetGeneratorPlatform

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6699
2021-11-08 12:38:48 -05: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
e40cedddc0 cmVisualStudio10TargetGenerator: Refactor target framework selection
Split the selection from the generation of the resulting element(s).
2021-11-06 06:08:48 -04:00
Robert Maynard
61b9764b03 CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATION
The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION`
now aren't mutually exclusive and can now be used together on the same
target.
2021-10-20 11:18:06 -04:00
Brad King
71f15be957 VS: Fix compilation of single source with PCH in Unity Build
Sources that are part of a unity build are normally not compiled
individually.  However, the VS IDE allows a single source to be
compiled.  This can also be achieved on the command line:

    msbuild my.vcxproj ... -t:ClCompile -p:SelectedFiles=<src>

where `<src>` is the path in the vcxproj `ClCompile` entry.

In a target with precompiled headers, the source needs PCH settings to
support individual compilation even if the normal unity build does not.
2021-10-19 11:50:07 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Brad King
1b91aaecd8 Merge topic 'vs2022'
b6ac10394b VS: Update Visual Studio 17 2022 generator for Preview 4
f200f4d5a7 VS: Fix managed C++ project generation for VS 2022

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6524
2021-09-16 08:16:54 -04:00
Brad King
f200f4d5a7 VS: Fix managed C++ project generation for VS 2022
VS 2022 expects managed `.vcxproj` files to have a `ManagedAssembly`
element.

Fixes: #22583
2021-09-15 13:19:37 -04:00
Brad King
293070c325 Merge topic 'vs_settings'
f21158cdfe VS: Honor VS_SETTINGS source file property on all sources
3bf013632d cmVisualStudio10TargetGenerator: Factor out helper to write VS_SETTINGS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6492
2021-09-10 09:34:17 -04:00
Steven Boswell
b284a21fee VS: Add missing label in C# project-build events
Fixes: #21440
2021-09-09 14:22:26 -04: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
Marc Chevrier
5a2a275bb4 Refactor: reduce cmToCStr usage 2021-08-19 10:49:30 +02:00
Marc Chevrier
e5cd39ca80 cmProp: refactoring: transform alias in class
To handle safely the values used by CMake variables and properties,
introduce the class cmProp as a replacement from the simple pointer
to std::string instance.
2021-08-08 16:19:08 +02:00
Brad King
99d3e20999 Merge topic 'vs-iface-include-dirs'
53aabe9817 VS: Fix assertion failure on INCLUDE_DIRECTORIES in INTERFACE libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6411
2021-08-02 14:07:13 -04:00
Brad King
53aabe9817 VS: Fix assertion failure on INCLUDE_DIRECTORIES in INTERFACE libraries
Since commit 4391913133 (Add INTERFACE libraries to generated
buildsystem if they have SOURCES, 2020-07-20, v3.19.0-rc1~346^2~1), the
VS generator may process INTERFACE libraries.  Avoid code paths in the
generator that process include directories because they should not be
used by INTERFACE libraries since they do not compile anything.

Fixes: #22494
2021-07-29 11:38:58 -04:00
Brad King
cbdd6747ad Merge topic 'msvc-isystem'
f29e1874ad Compiler/MSVC: use the `-external:I` flag for system includes
5a5c85dffd Tests/IncludeDirectories: support MSVC in system include tests
399a3204bb Tests/IncludeDirectories: align sibling predicates
20ab49193b Tests/IncludeDirectories: factor out applying flags to targets
809f7b0c3a Tests/IncludeDirectories: fix copy pasta for otherlib
b094324948 Tests/IncludeDirectories: Include system headers via angle brackets
8f63f3b04e cmVisualStudio10TargetGenerator: remove unused variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Julien Waechter <greenjava@gmail.com>
Acked-by: DE-VS wenglor <devs.wenglor@gmail.com>
Merge-request: !4766
2021-06-21 09:50:52 -04:00
Ben Boeckel
8f63f3b04e cmVisualStudio10TargetGenerator: remove unused variable 2021-06-17 14:02:52 -04:00
Gustavo Varo
9ba99a1203 VS: Add support for Utf8Enconding when using VS 16.10+
On VS 16.10 Preview 2 or above, generate `UseUtf8Encoding`
instead of `StdOutEncoding=UTF-8` in `.vcxproj` files.

Fixes: #22032
2021-06-17 13:44:22 -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
Brad King
8a4ca110e4 cmComputeLinkInformation: Improve type safety of item IsPath member
Use an enum to avoid implicit conversions to bool.
2021-05-29 09:28:35 -04:00
Brad King
21da0f83a2 Merge topic 'relative-paths'
f6d4fa63f8 cmStateDirectory: Comment relative path top directory selection approach
f0ffb1e2d4 cmGlobalGenerator: Simplify relative path conversion in AddRuleHash
d346805e41 cmLocalCommonGenerator: Select work directory semantically
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
1879f1bcbc cmLocalCommonGenerator: Factor out relative path conversion helper
1d1d88d3c8 cmMakefileTargetGenerator: Clarify name of relative path conversion helper
ec1ea13066 cmDependsFortran: Simplify relative path conversion helper
ba7b939831 cmStateDirectory: Rename ConvertToRelPathIf{Not => }Contained
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6122
2021-05-14 08:37:24 -04:00
Brad King
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work
directories (e.g. top of the build tree) as the local path.  Add helpers
for each of the common cases to simplify and clarify call sites.
2021-05-13 12:47:25 -04:00
Dario Passet
65b58b0316 VS Generator: Properly reference included external C# projects 2021-05-13 09:48:31 +02:00
Vitaly Stakhovsky
5e8fa0b7bc Source: Minor code improvements 2021-05-11 11:20:04 -04:00
Brad King
8314edd065 Merge topic 'vs-config-specific-csproj'
d8786bfa16 VS: Add support for per-config C# sources

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6055
2021-05-04 11:27:43 -04:00
Kinan Mahdi
31bbcd1905 VS: Fix CSharp sources inside build directory
Fixes: #22104
2021-05-03 11:25:42 -04:00
Thomas Vaughan
d8786bfa16 VS: Add support for per-config C# sources
Fixes: #22108
2021-05-03 10:49:47 -04:00
Marcel Ritzschke
c73b847b03 VS: switch to new folder structure while keeping the old one working
Fixes: #21170
2021-03-18 15:44:13 +01:00
Brad King
3d661c6c3a Merge topic 'vs-toolset-version'
30c835428f VS: Accept and translate '-T version=' values with three components
58a50a3a0a VS: Fix '-T version=14.28' under VS 16.9
09f59da7f0 cmGlobalVisualStudioVersionedGenerator: Clarify local variable name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5903
2021-03-15 08:50:13 -04:00
Brad King
58a50a3a0a VS: Fix '-T version=14.28' under VS 16.9
CMake accepts the toolset version that is default in the current VS
version by matching the name later VS versions will use for the SxS
props files.  It predicts the future name based on the first two
components of the current VS version's default toolset.  However, this
heuristic breaks naming the VS 16.8 toolset version 14.28 under VS 16.9
because the latter's default toolset version is 14.28.29910, which did
not increment the second version component (unprecedented in VS).

Fix this by always using the requested version's SxS props file when it
exists, even if it matches the first two components of the current VS
version's default toolset.  Also add a special case for the name VS
16.10 will use for VS 16.9's default toolset, so that it can be used
with VS 16.9 too.

Fixes: #21922
2021-03-12 08:36:40 -05:00
Brad King
9945b3b565 VS: Restore support for PCH in CXX but not C within once target
Fix logic from commit 9df1f33c9a (VisualStudio: move PCH rules to
projects when possible., 2020-10-15, v3.20.0-rc1~638^2) to explicitly
disable PCH on sources that should not use the target-wide PCH rules.

Fixes: #21827
2021-02-19 11:25:29 -05:00
Brad King
d9fd32b3b3 cmVisualStudio10TargetGenerator: Refactor per-source PCH logic
De-duplicate the link language lookup.
2021-02-19 11:25:03 -05:00
Jeremiah van Oosten
67775aaf5b VS: Add genex support to VS_SHADER_FLAGS 2021-01-05 17:07:01 +01:00
Brad King
adf3ea701d Merge topic 'policy-cmp0111-iface'
54ef732b0c cmVisualStudio10TargetGenerator: Avoid GetFullPath on INTERFACE library
f06f4b517c cmTarget: Do not enforce CMP0111 on imported INTERFACE libraries
43c95df8fb Tests: Match RunCMake.CMP0111 stderr more strictly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5530
2020-11-24 08:43:22 -05:00
Brad King
54ef732b0c cmVisualStudio10TargetGenerator: Avoid GetFullPath on INTERFACE library
Issue: #21470
2020-11-23 15:57:05 -05:00
Vitaly Stakhovsky
f6e7d5f3a0 Reduce the scope of temporary cmProp variables and other improvements 2020-11-05 11:07:39 -05:00
Brad King
c300355aab Merge topic 'cuda_vs_skip_computation'
dd77dec18d VS: Don't compute CUDA options unless necessary

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5422
2020-10-27 08:20:55 -04:00
Brad King
8d6a0b9364 Merge topic 'cuda_vs_skip_computation' into release-3.19
dd77dec18d VS: Don't compute CUDA options unless necessary
e9109dec36 Merge branch 'ninja-multi-per-config-sources' into release-3.18
7c0de4175b Merge branch 'cmake-E-cat-binary' into release-3.18

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5422
2020-10-27 08:20:54 -04:00
Raul Tambre
dd77dec18d VS: Don't compute CUDA options unless necessary
In the following scenario (with 3.18 policies):
1. A CXX target is created.
2. CUDA language is enabled.

CMake 3.18 introduced CMP0104, which requires CUDA_ARCHITECTURES to be
set.  Because the CXX target was created before CUDA was enabled it
wouldn't have it set.  The Visual Studio generator would however end up
computing CUDA compile options for the CXX target, which would result in
a fatal error due to the policy violation.

There doesn't seem to be a reason to do this for targets that don't
actually use the CUDA language, so we can skip and generate the CXX
target just fine.

Fixes: #21341
2020-10-27 07:29:01 -04:00
Asit Dhal
03ad0e61c1 configure_file: Add option for user defined permissions
User defined permissions and options to copy permissions are
implemented.

Fixes: #20866
2020-10-24 12:00:47 +02:00
Robert Maynard
9df1f33c9a VisualStudio: move PCH rules to projects when possible.
This dramatically helps reduce the size of the solution files
when PCH is enabled, since 2 entries per source file are removed.

This also corrects a subtle issue where when UNITY + PCH was enabled,
the PCH would not be used if a user explicitly tried to compile
a source file from outside the unity group. This is possible via
the compile source option in the Visual Studio GUI.
2020-10-20 13:24:31 -04:00
Brad King
c814172e84 Merge topic 'csharp-source_group-bugfix'
8d87cfdbf3 VS: Fix regression in C# source links

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5314
2020-10-06 06:47:19 -04:00
Kinan Mahdi
8d87cfdbf3 VS: Fix regression in C# source links
Fix logic used since commit ac6b18cd90 (CSharp: Add support for source
groups with out-of-source builds, 2020-02-18, v3.18.0-rc1~645^2).
Add a check of the physical file location for C# source groups.
2020-10-05 12:49:14 -04:00
Brad King
436b57ccb2 Merge topic 'genexpr-for-mfc-flag'
c1f1eaf7a4 VS: Teach CMAKE_MFC_FLAG to support generator expressions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5283
2020-10-01 07:59:33 -04:00
Andrey Starodubtsev
c1f1eaf7a4 VS: Teach CMAKE_MFC_FLAG to support generator expressions 2020-09-30 12:24:13 -04:00
Mark Jansen
7bda9a7fc7 VS: Make ImportLibary generation optional
Fixes: #21180
2020-09-30 12:11:54 -04:00
Brad King
b325484928 VS: Fix C language standard in target with C++ sources
Add C-language standard to target-wide C++ settings.

Fixes: #21195
2020-09-29 07:26:36 -04:00
Brad King
503d0f80e1 Merge topic 'generate-target-order'
aea465793e cmLocalVisualStudio7Generator: Consolidate target iteration
1527242745 cmLocalVisualStudio10Generator: Simplify target ordering by dependencies
48bf7192e7 cmLocalVisualStudio7Generator: Generate targets in dependency order
17aba9c9a6 cmLocalUnixMakefileGenerator3: Generate targets in dependency order
69ee18163b cmLocalGhsMultiGenerator: Generate targets in dependency order
c4e296a609 cmGlobalGenerator: Compute a global target ordering respecting dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5187
2020-09-08 11:25:17 -04:00