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

856 Commits

Author SHA1 Message Date
Brad King
ac4d6d4a9d Merge topic 'unity-build'
7786a05c70 Unity build: Add XCode support
1353802af3 Unity build: Add unit tests
8dfeb5d278 Unity build: Add support for Visual Studio generator
7114c141e2 Unity build: Add support for Ninja and Makefile generators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Stanislav Ershov <digital.stream.of.mind@gmail.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
Acked-by: Viktor Kirilov <vik.kirilov@gmail.com>
Merge-request: !3611
2019-09-05 08:36:06 -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
cee20ad537 Merge topic 'vs-cuda-custom-dir'
25f29b9741 cuda: Adapted tests to work with modified cuda toolset
ee86770a3f cuda: Added docs for extended cuda toolset
0ad180d712 cuda: Extend cuda compiler detection to work with custom cuda path
55b0532128 cuda: Extend vs10 target generator to use custom cuda path
df0247a371 cuda: Extend toolset argument to accept path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3713
2019-09-03 09:34:46 -04:00
Benjamin Wozniak
55b0532128 cuda: Extend vs10 target generator to use custom cuda path 2019-08-30 08:13:58 +02:00
Cristian Adam
8dfeb5d278 Unity build: Add support for Visual Studio generator
It works as expected in Visual Studio.

Visual Studio 2017 will (partially) benefit from the build in
support for unity builds. The custom unity sources are used, because
the build in support doesn't allow batching of certain number of
files. It can do only batching by directory.
2019-08-29 16:45:42 +02:00
Brad King
fa36e2151d Merge topic 'precompile-headers'
8da78d4efe Precompile headers: Update documentation
5772930164 Precompile headers: Add unit tests
519606704e Precompile headers: Add support for Visual Studio generators
28be170fbc Precompile headers: Add support for Xcode generator
b8626261e9 Precompile headers: Add methods to generate PCH sources
375d01c680 PCH: add example/test
9b6797e71d PCH: add target_precompile_headers command
0467a2f91b PCH: add PRECOMPILE_HEADERS to special properties

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Acked-by: Ivan171 <heavenandhell171@gmail.com>
Acked-by: Stanislav Ershov <digital.stream.of.mind@gmail.com>
Acked-by: Steve Mokris <smokris@softpixel.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
Acked-by: Danila Malyutin <flashmozzg@gmail.com>
Acked-by: Viktor Kirilov <vik.kirilov@gmail.com>
Acked-by: Lucas Zhao <zhaopf6@163.com>
Merge-request: !3553
2019-08-29 09:38:21 -04:00
Brad King
3e93b2fa66 Merge topic 'vs-ConfigurationType-genex'
8909a450a6 VS: Add support for generator expressions to VS_CONFIGURATION_TYPE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3746
2019-08-28 11:53:12 -04:00
Cristian Adam
519606704e Precompile headers: Add support for Visual Studio generators
Tested with Visual C++ 2017 on Windows.

Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
2019-08-28 11:47:51 -04:00
Daniel Eiband
8909a450a6 VS: Add support for generator expressions to VS_CONFIGURATION_TYPE
Generator expressions in target property VS_CONFIGURATION_TYPE might be used to
set the ConfigurationType to Utility for certain configurations to not build
the target while still linking to the target in other configurations.

Fixes: #19613
2019-08-26 15:22:43 +02:00
Sebastian Holtermann
aaf59120bf Source sweep: Replace cmExpandList with the shorter cmExpandedList
This replaces the code pattern
```
std::vector<std::string> args;
cmExpandList(valueStr, args, ...)
```
with
```
std::vector<std::string> args = cmExpandedList(valueStr, ...)
```
2019-08-23 17:07:49 +02:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Brad King
bfe0ea2d98 Merge topic 'cm-contains'
2dfc52675c cmAlgorithms: Add cmContains

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@web.de>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !3700
2019-08-21 11:52:06 -04:00
Regina Pfeifer
2dfc52675c cmAlgorithms: Add cmContains
Also, use the new function where applicable.
2019-08-19 20:01:39 +02:00
Sebastian Holtermann
20e580be01 Source sweep: Use cmIsOn instead of cmSystemTools::IsOn
This replaces invocations of

- `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn`
- `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND`
- `cmSystemTools::IsOn` with `cmIsOn`
- `cmSystemTools::IsOff` with `cmIsOff`
2019-08-17 12:14:14 +02:00
Sebastian Holtermann
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument 2019-08-14 16:33:20 +02:00
Brad King
cb88632790 Merge topic 'vs-spectre-off'
f9b7c660d7 VS: Fix mapping of `-Qspectre-` flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3629
2019-07-31 11:41:37 -04: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
6618cbf38a Merge topic 'vs-asmlist-dir'
c1fc6c80c7 VS: Place intermediate files in the "ASM List Location" next to objects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3569
2019-07-19 11:55:48 -04:00
Brad King
c1fc6c80c7 VS: Place intermediate files in the "ASM List Location" next to objects
The `AssemblerListingLocation` setting in VS project files is meant for
intermediate files created during the build much like object files.
When the VS 7 generator was first under development, commit 49aebe6c99
(new arch, 2002-09-04) placed both object files and the ASM list
location in the same directory.  Later commit f9aef0e422 (Generator now
creates a separate intermediate files directory for each target,
2005-07-27) moved the object files to a per-target directory but the
ASM list location was not moved with them.  Move it now.

Fixes: #19480
2019-07-18 11:40:58 -04:00
Marc Chevrier
d9b2c7dae2 Introduce memory management helper: cm_memory.hxx 2019-07-14 15:37:30 +02:00
Brad King
609d86e813 Merge topic 'object-library-sbcs'
54290adcba VS: Fix SBCS support for object libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3537
2019-07-12 07:22:55 -04:00
Brad King
54290adcba VS: Fix SBCS support for object libraries
In commit 3a53005f7d (Build object library targets in VS, 2012-03-12,
v2.8.8~29^2~13) we updated the condition for unicode but accidentally
left out the SBCS case support for object libraries.

Fixes: #19469
2019-07-12 07:20:23 -04:00
Brad King
71fbebd1dc IWYU: Fix handling of <memory> standard header
An old workaround for `std::allocator_traits<>::value_type` lints from
IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`.
Convert the workaround to use the same approach we already use for a
workaround of `std::__decay_and_strip<>::::__type` lints.  Then update
the `<memory>` inclusions to follow the now-correct IWYU lints.
2019-07-10 11:48:56 -04:00
Brad King
41acd44625 Merge topic 'cuda-no-device-link-when-disabled'
a4d502a5bf CUDA: Do not device link if CUDA is not an enabled language

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3491
2019-07-02 08:36:56 -04:00
Robert Maynard
a4d502a5bf CUDA: Do not device link if CUDA is not an enabled language
Checks added in commit 81b4d10d8f (CUDA: More exhaustive checks to
determine when to do device linking, 2019-05-09, v3.15.0-rc1~82^2)
assumed that CUDA properties would be set only if CUDA is enabled.

We cannot do a device link step if we do not have the CUDA language
enabled.  This was discovered as some projects unconditionally set CUDA
properties such as `CUDA_RESOLVE_DEVICE_SYMBOLS` even when the CUDA
language has not been enabled.

Fixes: #19432
2019-07-01 08:29:10 -04:00
Brad King
3327fe948e Merge topic 'vs-dpi-aware'
cd92f8f8bf VS: Add VS_DPI_AWARE target property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3418
2019-06-27 08:56:41 -04:00
Brad King
6ddc0b4438 Merge topic 'cuda-msvc-runtime-library'
8fbd25772f CUDA: Implement MSVC runtime library abstraction
07807a2006 VS: Use AddLanguageFlags to de-duplicate CMAKE_{CUDA,ASM*}_FLAGS lookup

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3485
2019-06-27 07:30:01 -04:00
Matt Weir
cd92f8f8bf VS: Add VS_DPI_AWARE target property
Enables setting the visual studio project property for Manifests,
controlling the DPI Aware setting.
2019-06-26 09:55:49 -04:00
Brad King
07807a2006 VS: Use AddLanguageFlags to de-duplicate CMAKE_{CUDA,ASM*}_FLAGS lookup
Apply the refactoring from commit 707283981f (VS: Use AddLanguageFlags
to de-duplicate CMAKE_<LANG>_FLAGS* lookup, 2019-04-01,
v3.15.0-rc1~300^2) to the CUDA, ASM_MASM, and ASM_NASM languages too.
In particular, CUDA needs the MSVC runtime library selection logic
in the `AddLanguageFlags` method that is used by other generators.
2019-06-26 08:36:48 -04:00
Wil Stark
7035bdeb52 VS10Generator: add project properties to enable WindowsCE deployment.
Fixes: #19408
2019-06-19 15:11:57 -07:00
Sebastian Holtermann
8d934d861b cmPropertyMap: Make std::map container private 2019-06-08 12:25:35 +02: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
Brad King
82fec3784b Merge topic 'vs-depends-dedup'
42bc67bd43 VS: De-duplicate custom command dependencies
d03a6fc857 VS: Clarify name of custom commands AdditionalInputs variable
fcedf8e552 VS: Isolate custom command input/output generation scopes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3388
2019-05-31 09:04:47 -04:00
Frans van Dorsselaer
42bc67bd43 VS: De-duplicate custom command dependencies
Avoid listing the same input more than once in custom commands generated
in `.vcxproj` and `.csproj` files.  In the case of a `.vcxproj` file
additionally avoid listing the source to which the command is attached
since it is already implicitly a dependency.

This is a nice cleanup and also works around a VS 2019 16.1 regression
in MSBuild dependency checking.  Starting with that version, MSBuild now
re-builds custom commands when the list of dependencies has changed.
However, its check is confused by duplicate dependencies.
De-duplicating them avoids this problem.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #19303
2019-05-30 13:57:03 -04:00
Frans van Dorsselaer
d03a6fc857 VS: Clarify name of custom commands AdditionalInputs variable 2019-05-30 13:57:03 -04:00
Brad King
fcedf8e552 VS: Isolate custom command input/output generation scopes 2019-05-30 13:57:03 -04:00
Kinan Mahdi
42e14d90b1 VS: Added support for VS package references for nuget 2019-05-30 10:22:44 -04:00
Brad King
fc4cbbc2a5 Merge topic 'remove_unneeded_device_link_calls'
81b4d10d8f CUDA: More exhaustive checks to determine when to do device linking
3205c7c950 cmNinjaLinkLineDeviceComputer now lives in the correct source file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3320
2019-05-22 10:30:00 -04:00
Robert Maynard
81b4d10d8f CUDA: More exhaustive checks to determine when to do device linking
Previously CMake used fairly naive logic to determine when to do
device linking which caused unnecessary device linking to occur
frequently. We now use a more exhaustive algorithm to determine
when we have a need for device linking.

Fixes: #19238
2019-05-21 11:40:07 -04:00
Brad King
639e14def6 VS: Factor out helper to compute ApplicationTypeRevision
This is the first two components of `CMAKE_SYSTEM_VERSION`.
2019-05-21 08:50:01 -04:00
Vitaly Stakhovsky
23e8364aed Source: std::string related cleanup 2019-05-15 10:20:05 -04:00
Brad King
2d37678226 Merge topic 'vs-project-import'
d145d72e70 VS: add target property VS_PROJECT_IMPORT_<propspath>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3143
2019-04-16 13:43:52 -04:00
Leonid Pospelov
d145d72e70 VS: add target property VS_PROJECT_IMPORT_<propspath>
Fixes: #18998
2019-04-15 13:05:07 -04:00
Leonid Pospelov
3e70a8d0df cmVisualStudio10TargetGenerator: Simplify code of two functions 2019-04-12 18:24:21 +03:00
Leonid Pospelov
e10b04ef05 cmVisualStudio10TargetGenerator: Use count instead of find 2019-04-12 18:22:00 +03:00
Leonid Pospelov
2418a5aec0 cmVisualStudio10TargetGenerator: Remove uses of const_cast 2019-04-12 18:20:07 +03:00
Brad King
707283981f VS: Use AddLanguageFlags to de-duplicate CMAKE_<LANG>_FLAGS* lookup 2019-04-02 14:23:46 -04:00
Sebastian Holtermann
db182eb160 cmTarget: Move member *Commands to impl 2019-03-23 22:22:34 +01:00
Brad King
591fab8a6a Merge topic 'vs-explicit-newline'
0bf4418017 VS: Encode newlines in XML attributes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3065
2019-03-07 09:15:57 -05:00
Luca Cappa
0bf4418017 VS: Encode newlines in XML attributes
Encode `\n` as `&#10;` to avoid generating a literal newline inside an
XML attribute.  This is more readable and also fixes custom commands in
`.csproj` files with VS 2019 RC.

Fixes: #19001
2019-03-06 09:37:21 -05:00