839 Commits

Author SHA1 Message Date
Sebastian Holtermann
e91bfe440c cmMakefile: Let AddDefinition accept a value as cm::string_view
This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value
argument instead of a `const char *`.

Benefits are:
- `std::string` can be passed to `cmMakefile::AddDefinition` directly without
  the `c_str()` plus string length recomputation fallback.
- Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at
  compile time.

In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid
`std::string::c_str` calls and the `std::string` is passed directly.
Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might
be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
2019-07-24 11:11:25 +02:00
Sebastian Holtermann
f2ba968ef2 cmMakefile: Simplify and rename AddDefinitionBool
This simplifies the `cmMakefile::AddDefinition` method with bool value
overload to call the string based `cmMakefile::AddDefinition` method
with either an "ON" or "OFF" string.
Also the method is renamed to `cmMakefile::AddDefinitionBool`
2019-07-24 11:11:25 +02:00
Brad King
82bbf976d1 Merge topic 'ccmake-clear-aliases'
b66d61a8d0 cmGlobalGenerator: Do not persist alias targets across configures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3529
2019-07-09 09:36:04 -04:00
Brad King
b66d61a8d0 cmGlobalGenerator: Do not persist alias targets across configures
In `ccmake` a single global generator instance may be used for multiple
configure step runs.  The `cmGlobalGenerator::ClearGeneratorMembers`
method is supposed to clear global state that is specific to each
configure run but forgot to clear alias targets.

Fixes: #19457
2019-07-08 14:40:46 -04:00
Alex Turbov
5e52de7d57 modermize: replace some raw pointers w/ unique_ptr 2019-06-24 09:36:09 -04:00
Saleem Abdulrasool
b06f4c8a74 Swift: disallow WIN32_EXECUTABLE properties
Currently, the compiler does not synthesize the correct entry point for
the application and passing the subsystem flag does not work the same
way with the Swift linker language.  Add a check to prevent the
application of `WIN32_EXECUTABLE` to Swift executables until they can be
properly supported.  This will prevent the need for a future policy
change.

Closes: #19325
2019-06-03 14:05:10 -04:00
Zsolt Parragi
4fe34b2d29 Fixing warnings generated by clang 8.0 on Windows
* Deprecation removals previously specific to MSVC/Intel now also used
  by clang
* String literals were assigned to non const pointers. These are stored
  in mutable arrays now
* An implicit function pointer to pointer conversion is a Microsoft
  extension warning is suppressed by an explicit reinterpret_cast
* The MSVC specific deprecation macro for jsoncpp was moved after the
  clang macro to avoid redefinition warnings. This is consistent with
  how jsoncpp fixed the issue in 36d8cfd7
2019-05-29 18:18:09 +02:00
Vitaly Stakhovsky
e884b1b693 cmSystemTools::Error(): remove const char* overload 2019-05-22 10:51:06 -04:00
Kyle Edwards
b133d14fb1 Refactor: Allow cmInstallGenerator::Compute() to return an error
This is preparation for an upcoming merge request, which will add
a new cmInstallGenerator that returns false if there are errors in
the Compute() step.
2019-05-13 10:45:36 -04:00
Artur Ryt
30bb14c657 Modernize: Enable modernize-raw-string-literal in clang-tidy 2019-04-02 19:59:54 +02:00
Sebastian Holtermann
b289243d99 cmGlobalGenerator: Inline aRange acquisition in for(x:aRange) invocations
Changes the following code snippets in `cmGlobalGenerator`
```
AType aRange = object.getRange();
for ( auto & item: aRange) {
```
to

```
for ( auto & item: object.getRange()) {
```
2019-03-25 13:51:22 +01:00
Sebastian Holtermann
bf9afa1e15 cmGlobalGenerator: Use auto for long iterator types 2019-03-25 13:51:22 +01:00
Sebastian Holtermann
204c5ccb43 cmMakefile: Use std::unordered_map::emplace to add cmTargets to the list
When adding cmTargets to a cmMakefile, use std::unordered_map::emplace instead
of std::unordered_map::insert.
2019-03-21 20:43:48 +01:00
Bartosz Kosiorek
324d18bb34 cmake: Teach --build mode to support multiple targets
Fixes: #16136
2019-03-05 08:55:28 -05:00
Bartosz Kosiorek
fdeb364a84 cmGlobalGenerator: Change case of methods from GeneratedMakeCommand struct 2019-03-04 10:44:14 +01:00
Bartosz Kosiorek
f1367c8c51 cmGlobalGenerator: Remove unused code 2019-03-04 10:44:14 +01:00
Brad King
3c7662fd62 Merge topic 'add-xlclang'
d9d285c5ad jsoncpp: Fix include order for build within CMake
0d489fab19 libuv: fix atomic ops compilation with xlclang
1699f5c231 Utilities: Suppress warnings in third-party code when using XLClang
f709089d84 XLClang: Extract compiler implicit include directories
5c41386357 XLClang: Add policy CMP0089 to present as XL for compatibility
8278237933 XL: Remove overlap with the new XLClang compiler ID
6f5cf2d2c6 XL: Revert "Recognize compilers identified by __ibmxl__"
90c6156aa8 XLClang: Add a new compiler ID for the clang-based XL compiler
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2921
2019-02-26 11:07:54 -05:00
Brad King
f259e8759c Merge topic 'gt-shorter-unique-names'
3f685ac3e1 Use shorter names in internal TARGET_PROPERTY expressions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3009
2019-02-25 09:23:17 -05:00
Brad King
5c41386357 XLClang: Add policy CMP0089 to present as XL for compatibility
We now identify IBM's Clang-based XL compilers, which define
`__ibmxl__`, as `XLClang` rather than `XL`.  In order to support
existing project code that checks for `XL`, add a policy whose OLD
behavior is to present the compiler id as `XL` and whose NEW behavior is
to present the compiler id as `XLClang` as we really detect it.
2019-02-25 08:24:28 -05:00
Brad King
40768761b6 Merge topic 'drop-MIPSpro'
214fcefa52 Remove now-unused code once used for MIPSpro on IRIX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3004
2019-02-25 08:13:44 -05:00
Brad King
a4d99e4dec Merge topic 'cmrange-improvements'
b8031308f3 cmRange: Add unit tests
a8d51ef8b7 cmRange: Add functions filter and transform
da4773e8b8 cmRange: Add functions all_of, any_of, none_of
17a367e77f cmRange: Stylistic cleanup
9eb0e73f46 cmRange: Move to dedicated header file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Artur Ryt <artur.ryt@gmail.com>
Merge-request: !2972
2019-02-25 08:03:01 -05:00
Brad King
94970cd042 Merge topic 'error-consolidate'
9dd255548d cmSystemTools::Error: consolidate parameters into single std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2995
2019-02-25 08:02:07 -05:00
Brad King
3f685ac3e1 Use shorter names in internal TARGET_PROPERTY expressions
The change in commit 2f708f5d65 (Make internal TARGET_PROPERTY generator
expressions more robust, 2018-09-07, v3.13.0-rc1~94^2~4) introduced
globally unique names in synthesized `$<TARGET_PROPERTY:...>` generator.
We used the pattern `<target-name>::T<pointer-to-generator-target>` to
guarantee uniqueness.  However, in projects that require many such
expressions to be generated there was a measurable increase in runtime.

We had included the target name in the synthesized genex only for human
reference during debugging.  It is not necessary.  Switch to the pattern
`:<pointer-to-generator-target>` to shorten the name.  Also hand-roll a
hex-print loop instead of using sprintf.  Together these optimizations
get at least some of the time back.

Issue: #18964
2019-02-22 09:14:27 -05:00
Brad King
214fcefa52 Remove now-unused code once used for MIPSpro on IRIX
In commit beb991110d (Remove now-unused code once used on IRIX,
2019-01-11, v3.14.0-rc1~167^2) we removed remnants of IRIX support.
Also remove remnants of MIPSpro compiler support.
2019-02-21 11:12:51 -05:00
Regina Pfeifer
9eb0e73f46 cmRange: Move to dedicated header file 2019-02-21 08:24:25 -05:00
Vitaly Stakhovsky
4e315e9449 cmSystemTools: More functions accept std::string params 2019-02-20 14:53:39 -05:00
Vitaly Stakhovsky
9dd255548d cmSystemTools::Error: consolidate parameters into single std::string 2019-02-20 11:18:11 -05:00
Artur Ryt
706b93fa55 Modernize: C-arrays and loops over them
It replaces C arrays with deduced std::initializer_lists
or std::array what makes enables for-loop over them.
2019-02-15 23:40:30 +01:00
Vitaly Stakhovsky
950c099d83 cmake: Progress functions use std::string param 2019-02-11 10:32:43 -05:00
Brad King
4b37b4f1bb Merge topic 'modernize-for-loops'
01b2d6ab74 Modernize: Use ranged for-loops when possible
15bdbec017 cmAlgorithms: Make cmRange advance/retreat safe for rvalues

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !2901
2019-02-11 08:08:22 -05: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
Vitaly Stakhovsky
00ba28ffd0 cmMakefile::GetRequiredDefinition: return const std::string& 2019-02-07 07:35:16 -05:00
Brad King
d685a46f56 Merge topic 'vs-msbuild-arch'
da402a081b VS: Use MSBuild matching toolset host architecture
147d36ce93 Find native build tool after selecting a toolset

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2876
2019-01-30 08:13:04 -05:00
Brad King
9620cb935a Merge topic 'add_consistent_verbose_build_flag'
66801f4d40 cmake: Add tests for verbose output to --build mode
439fe2e253 cmake: Add options for verbose output to --build mode
638667efa2 cmake: cmcmd.cxx fix "The arguments are" comments
3ca4402966 ctest: Fix --build-and-test without --build-target on Xcode
cb6c233ecc cmake: Add -hideShellScriptEnvironment xcodebuild option
1a45266cb5 cmGlobalGenerator: Add a class that represent the build command

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2708
2019-01-29 09:19:39 -05:00
Brad King
60c06620a6 Merge topic 'cmoutputconverter-simplify'
b6a957c969 cmOutputConverter: move ConvertToRelativePath to cmStateDirectory.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2831
2019-01-29 09:18:42 -05:00
Brad King
147d36ce93 Find native build tool after selecting a toolset
This will allow `CMAKE_GENERATOR_TOOLSET` to influence build tool
selection.

For reference, commit f8cb9944a1 (Find native build tool after
determining the target system, 2017-09-26, v3.10.0-rc1~31^2) already
delayed this step from where it was historically.
2019-01-29 09:09:18 -05:00
Vitaly Stakhovsky
186d9b083d cmSystemTools::Message: Add overload accepting std::string 2019-01-28 09:35:51 -05:00
Bruno Manganelli
b6a957c969 cmOutputConverter: move ConvertToRelativePath to cmStateDirectory. 2019-01-27 15:48:57 +00:00
Robert Maynard
1a45266cb5 cmGlobalGenerator: Add a class that represent the build command
This refactors a std::vector<std::string> into a class so that
we can extend the features to represent things such as multiple
chained commands in the future.
2019-01-25 08:20:02 -05:00
Brad King
40628b2519 Merge topic 'max-recursion-depth'
a6982cff0d cmMakefile: Impose maximum recursion limit

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Juraj Oršulić <juraj.orsulic@fer.hr>
Merge-request: !2746
2019-01-25 08:09:37 -05:00
Brad King
24b6e4830d Merge topic 'exclude_from_all'
dc6888573d Pass EXCLUDE_FROM_ALL from directory to targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2816
2019-01-25 08:06:54 -05:00
Brad King
40745ad35a Merge topic 'cmake-files-directory'
3e867ed400 cmake: inlined files dir constant and removed it from cmake.h

Acked-by: Kitware Robot <kwrobot@kitware.com>
Rejected-by: vvs31415 <vstakhovsky@fastmail.com>
Merge-request: !2655
2019-01-25 08:01:26 -05:00
Vitaly Stakhovsky
99337d345b cmSystemTools::Error(): new overload accepting std::string 2019-01-23 10:19:30 -05:00
Kyle Edwards
a6982cff0d cmMakefile: Impose maximum recursion limit
In order to keep infinitely-recursive scripts from causing a stack
overflow in the CMake executable, CMake now imposes a maximum
recursion limit before issuing an error message. The limit can be
adjusted at runtime with CMAKE_MAXIMUM_RECURSION_DEPTH.

Fixes: #18694
2019-01-23 09:52:29 -05:00
Vitaly Stakhovsky
2993fc347a cmMakefile: GetModulesFile() accepts std::string param 2019-01-21 12:56:51 -05:00
Zack Galbreath
dc6888573d Pass EXCLUDE_FROM_ALL from directory to targets
When a target is created it now inherits the EXCLUDE_FROM_ALL property
from its directory. This change makes it possible to include a target
in "all", even if its directory has been marked as EXCLUDE_FROM_ALL.
2019-01-21 11:38:24 -05:00
Bruno Manganelli
3e867ed400 cmake: inlined files dir constant and removed it from cmake.h 2019-01-21 15:34:16 +00:00
Brad King
c7428e1729 Merge topic 'read-list-file'
25caf7bafe cmMakefile::ReadListFile() accepts std::string argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2821
2019-01-21 07:57:33 -05:00
Brad King
4dba5d6ce2 Merge topic 'use-emplace'
ef61997b1b clang-tidy: Use emplace
2e5307a2a4 CTestSVN: Accept std::string in SVNInfo constructor

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2811
2019-01-21 07:51:54 -05:00
Regina Pfeifer
ef61997b1b clang-tidy: Use emplace 2019-01-17 13:12:02 -05:00