1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-15 16:39:26 +08:00

82 Commits

Author SHA1 Message Date
Brad King
5c7ca6f8a8 CUDA: Move VS CudaRuntime selection to be with rest of CUDA options 2020-05-22 08:15:37 -04:00
Brad King
4468acb979 CUDA: Factor runtime library lookup into helper method 2020-05-22 08:15:32 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Robert Maynard
0d0145138f CUDA: Add abstraction for cuda runtime selection
Fixes #17559
Replace our hard-coded default of cudart=static with a first-class abstraction to select the runtime library from an enumeration of logical names.
2020-01-27 16:02:26 -05:00
Vitaly Stakhovsky
64843b1737 cmVisualStudio10TargetGenerator: use std::string for tag 2019-11-10 09:29:27 -05:00
Marc Chevrier
c688b401d3 cmstd: Modernize CMake system headers
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones.  For example:

    #include <cm/string_view>

can be used safely for CMake development in place of the `<string_view>`
standard header.

Fixes: #19491
2019-09-20 10:01:37 -04: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
Sebastian Holtermann
7fbcc16dcd cmStringAlgorithms: cmIsSpace, cmTrimWhitespace, cmEscapeQuotes, cmTokenize
This adds the following functions to `cmStringAlgorithms`:

- `cmIsSpace`
- `cmTrimWhitespace` (moved from `cmSystemTools::TrimWhitespace`)
- `cmEscapeQuotes` (moved from `cmSystemTools::EscapeQuotes`)
- `cmTokenize` (moved from `cmSystemTools::tokenize` and adapted to
  accept `cm::string_view`)
2019-08-05 11:25:30 +02:00
Brad King
f621e7fa5d VS: Fix Fortran runtime library flag map special case for '-' options 2019-04-10 13:40:25 -04:00
Artur Ryt
01b2d6ab74 Modernize: Use ranged for-loops when possible
Replaced most manual `const_iterator`-based loops and some
reverse-iterator loops with range loops.

Fixes: #18858
2019-02-07 22:39:05 +01:00
Brad King
57e48f16f2 VS: Add Visual Studio 16 2019 generator
Add this generator *without* support for specifying the target
architecture in the generator name.  cmake-gui will be taught
to provide a field for this, and command-line builds can use -A.

Also, teach this generator to select a default target architecture
based on the host architecture.

Fixes: #18689
Inspired-by: Egor Pugin <egor.pugin@gmail.com>
2019-01-11 11:04:51 -05:00
Bruno Manganelli
5bcfe98bd5 Source: Fix various compiler warnings in Visual Studio 2017 2019-01-09 08:25:10 -05:00
Vitaly Stakhovsky
6ce56028d5 cmVisualStudioGeneratorOptions::Parse(): const std::string& argument 2018-08-13 18:22:11 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2018-06-01 09:53:42 -04:00
Vitaly Stakhovsky
7d407b438d cmVisualStudioGeneratorOptions: specify indentation with integer 2018-04-25 11:01:37 -04:00
Craig Scott
8e841a473f Cleanup: Fix typos and grammar in docs and code
No functional changes, just docs, comments and error messages.
2018-04-23 07:48:03 +10:00
Vitaly Stakhovsky
80767dd50e VS: Simplify XML code
Get rid of suffix arguments
2018-03-27 17:39:19 -04:00
Vitaly Stakhovsky
a0d9429bd7 cmVisualStudioGeneratorOptions: Move XML code to subclasses 2018-03-26 09:35:58 -04:00
Vitaly Stakhovsky
5697c6ae03 cmVisualStudioGeneratorOptions: Factor out an OutputFlag helper 2018-03-20 14:10:04 -04:00
Vitaly Stakhovsky
8182ebca32 cmIDEOptions: use std::string 2018-02-26 11:24:45 -05:00
Vitaly Stakhovsky
b723fe3d7d VS: Convert loops to C++11, other C++ improvements 2018-02-21 21:18:59 -05:00
Marc Chevrier
3073bd1f3d VisualStudio generators: refactoring
Uniformize include directories handling.
Fix memory leaks in class cmVisualStudio10TargetGenerator:
OptionsMap uses now std::unique_ptr.
2018-01-23 10:25:03 +01:00
Brad King
fe8d74cc60 Merge topic 'cuda_msvc_support_complex_gencode_signatures'
a91fde13 CUDA: gencode signature that list multiple code types now supported.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1618
2018-01-11 10:18:11 -05:00
Robert Maynard
a91fde135d CUDA: gencode signature that list multiple code types now supported.
Fixes #17263
2018-01-10 10:45:57 -05:00
Luz Paz
3ab7bf8285 Various typo fixes
Some are user-facing. Others are source comments.
2018-01-04 06:52:01 +11:00
Vitaly Stakhovsky
c62ffdcd4f cmIDEOptions: use std::string instead of const char*
Revise method signatures to save a few c_str() conversions.
2017-12-08 22:30:16 -05:00
comicfans
3232f84c19 VS: Fix MANIFESTUAC link flag map to .vcxproj elements
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.

Fixes: #16563
2017-09-18 11:53:22 -04:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Brad King
c94f1bcf92 Drop Visual Studio 7 .NET 2003 generator
This generator has been deprecated since CMake 3.6.  Remove it.
2017-04-19 15:28:05 -04:00
Brad King
a4452fd82d cmGlobalVisualStudioGenerator: Drop VS7 enumeration value
We no longer support the VS 7.0 (.NET 2002) IDE, so drop the enumeration
value corresponding to its version.
2017-04-19 14:54:57 -04:00
Brad King
6dc7262bf7 Merge topic 'vs-rc-defines'
fff34934 MSVC: Restore _DEBUG preprocessor definition in RC debug builds
79a91538 RC: Add missing CMAKE_RC_FLAGS_<CONFIG> entries to cache
c77194ec VS: Honor preprocessor definitions in RC flags
1449f6f6 cmVisualStudio10TargetGenerator: De-duplicate preprocessor defs
8a619e8c cmIDEOptions: Add GetDefines method

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !640
2017-03-29 09:14:54 -04:00
Brad King
1449f6f63d cmVisualStudio10TargetGenerator: De-duplicate preprocessor defs 2017-03-28 13:10:55 -04:00
Brad King
94255511a6 VS: Select CUDA code generation architectures
Parse the `-gencode=`, `-arch`, and `-code` flags and generate a
`CodeGeneration` field in the project file.
2017-03-10 10:19:57 -05:00
Brad King
253594d0ae VS: Select the CUDA runtime library
Parse the `-cudart=` option and add a corresponding `CudaRuntime`
field to the generated project file.  Also add a matching `.lib`
to the list of libraries linked.
2017-03-10 10:19:57 -05:00
Brad King
b64b4629ea VS: Add basic infrastructure for CUDA generation
Generate the `CudaCompile` elements in `.vcxproj` files.
2017-03-10 10:19:56 -05:00
Brad King
80e982d7ad VS: Add method to take a value out of the option parser flag map
Remove a flag from the map and return its value.
2017-03-10 10:19:55 -05:00
Brad King
f7bb40c92d VS: Add method to re-parse specific option parser fields
This will allow a client to parse flags, replace the flag tables, and
then re-parse a field in which flags for a secondary tool were
collected.
2017-03-10 10:19:54 -05:00
Brad King
a05fc93ee6 VS: Add method to clear flag tables of option parser 2017-03-10 10:19:54 -05:00
Brad King
109b8a6fd3 VS: Refactor AdditionalOptions generation
Store unknown flags directly in a flag map entry for `AdditionalOptions`
instead of having a separate member for them.  This avoids duplicating
the output generation logic for the entry.
2017-02-15 10:41:36 -05:00
Brad King
bd5ea6993c cmVisualStudioGeneratorOptions: Add PrependInerhitedString method 2017-02-15 10:37:35 -05:00
Brad King
f7e5c6820a VS: De-duplicate PreprocessorDefinitions tag name
Store the name in a variable for re-use.
2017-02-14 13:37:54 -05:00
Michael Stürmer
e438693e95 VS: Teach option map IsDebug() method about C# projects 2016-12-07 11:49:43 -05:00
Daniel Pfeifer
66a7099993 iwyu: Fix VisualStudio specific issues 2016-11-28 14:06:40 -05:00
Brad King
4cb5d3353f VS: Place source-specific AdditionalOptions after target-wide flags
Flags specified in the `COMPILE_FLAGS` source-file property should
be placed after those in target-wide properties so that those on
individual source files can override those on the whole target.
This is already done by most generators but was not implemented
correctly for VS 2010 and above.

Closes: #16400
2016-11-02 13:11:08 -04:00
Michael Stürmer
f27492a4db VS: Add internal API for detecting "managed" projects
This is in preparation for adding CSharp language support to the VS
generator.
2016-10-19 11:14:19 -04:00
Brad King
bdc679a8ae VS15: Add Visual Studio 15 generator
Call the generator "Visual Studio 15" without any year because the
preview version of VS 15 does not provide a year in the product name.

Copy cmGlobalVisualStudio14Generator to cmGlobalVisualStudio15Generator
and update version numbers accordingly.  Add the VS15 enumeration value.
Note that we do not need to add a MSVC15 variable or v150 toolset
because Visual Studio 15 comes with an updated version of the v140
toolset and remains ABI-compatible.

Teach tests VSExternalInclude, RunCMake.GeneratorPlatform, and
RunCMake.GeneratorToolset to treat VS 15 as they do VS 10-14.

Closes: #16143
2016-09-07 15:49:08 -04:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King
0ac18d40c8 Remove //------... horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -04:00
Brad King
180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -04:00
Stephen Kelly
44ffb9cdb4 Replace foo.size() pattern with !foo.empty(). 2015-08-24 20:47:18 +02:00