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

743 Commits

Author SHA1 Message Date
Sebastian Holtermann
006229278b Use cmAppend to append ranges to std::vector instances 2019-05-23 16:19:49 +02:00
Brad King
3020354f7c Merge topic 'string-cleanup'
23e8364aed Source: std::string related cleanup

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@web.de>
Merge-request: !3324
2019-05-17 09:26:05 -04:00
Vitaly Stakhovsky
23e8364aed Source: std::string related cleanup 2019-05-15 10:20:05 -04:00
Brad King
0064edf417 Merge topic 'ninja-pool-custom-command'
9f76961de8 Support job pools in custom commands and targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3308
2019-05-15 09:21:08 -04:00
Rosen Matev
9f76961de8 Support job pools in custom commands and targets
Provide a way for custom commands and targets to set the pool variable
of the ninja build statement. Setting `JOB_POOL` is not compatible with
`USES_TERMINAL`, which implies the `console` pool.

The option is silently ignored with other generators.

Closes: #18483
2019-05-14 15:58:00 +02:00
Sebastian Holtermann
cdff7f4e2a cmSystemTools: Add ExpandedListArgument and ExpandedLists methods
Changes
-------

In `cmSystemTools` this
- renames the method `ExpandList` to `ExpandLists` and makes it iterator based

and adds the methods
- `std::vector<std::string> ExpandedLists(InputIt first, InputIt last)`
- `std::vector<std::string> ExpandedListArgument(const std::string& arg,
                                                       bool emptyArgs)`

Both return the  `std::vector<std::string>` instead of taking a return vector
reference like `cmSystemTools::ExpandLists` and
`cmSystemTools::ExpandListArgument`.

Motivation
----------

Since C++17 return value optimization is mandatory, so returning a
`std:vector<std::string>` from a function should be (at least) as fast as
passing a return vector reference to the function.

The new methods can replace `cmSystemTools::ExpandLists` and
`cmSystemTools::ExpandListArgument` in many cases, which leads to
shorter and simpler syntax.

E.g. the commonly used pattern
```
  if (const char* value = X->GetProperty("A_KEY_STRING")) {
    std::vector<std::string> valuesList;
    cmSystemTools::ExpandListArgument(value, valuesList);
    for (std::string const& i : valuesList) {
      doSomething(i);
    }
  }
```
becomes
```
  if (const char* value = X->GetProperty("A_KEY_STRING")) {
    for (std::string const& i :
      cmSystemTools::ExpandedListArgument(value)) {
      doSomething(i);
    }
  }
```
2019-05-13 15:37:18 +02:00
Brad King
680641a882 Merge topic 'xcode-extra-sources'
428c1e429f Xcode: Avoid mutating App Bundle targets during generation
b4385d5ccc Xcode: Factor out duplicate source group code into lambda

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3208
2019-04-12 07:23:31 -04:00
Brad King
428c1e429f Xcode: Avoid mutating App Bundle targets during generation
For `MACOSX_BUNDLE` targets we generate an `Info.plist` automatically
and add it to the sources presented to Xcode.  Avoid mutating the
original target's list of sources to achieve this.  Otherwise when we
generate the same target again (e.g. in a sub-project's Xcode file) it
will look different than the first time and possibly break invariants.

Fixes: #19114
2019-04-11 10:35:14 -04:00
Brad King
b4385d5ccc Xcode: Factor out duplicate source group code into lambda 2019-04-11 10:35:14 -04:00
Brad King
8ca1b26286 cmLocalGenerator: Factor IPO logic out of AddLanguageFlags
The IPO flag logic was added to `AddLanguageFlags` based on my advice.
However, this method should really only be about `CMAKE_<LANG>_FLAGS*`
variables.  Move the IPO logic out to its call sites.
2019-04-02 14:23:32 -04:00
Sebastian Holtermann
735c6f39d9 Fix invalid ///! doxygen comment line starts
In various places `///!` was used to start a comment line.  This is not valid
Doygen syntax.  This patch replaces `///!` comment starts with `//!`.
2019-03-31 11:27:12 +02:00
Sebastian Holtermann
db182eb160 cmTarget: Move member *Commands to impl 2019-03-23 22:22:34 +01:00
Harry Mallon
413b71485a Xcode: Create Xcode schemes per target 2019-03-21 16:50:41 +00:00
Gregor Jasny
482d9ef9a8 cmGlobalXCodeGenerator: Prefer std::string over char* 2019-03-17 20:41:35 +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
Brad King
c2f6da3399 Merge topic 'configurefile-stdstring'
0281f9a4ca cmMakefile::ConfigureFile: Accept `std::string` parameters

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2982
2019-02-20 09:03:48 -05:00
Vitaly Stakhovsky
0281f9a4ca cmMakefile::ConfigureFile: Accept std::string parameters 2019-02-18 20:48:19 -05:00
Gregor Jasny
afb325018e Xcode: Require at least Xcode 5 2019-02-16 15:20:39 +01:00
Gregor Jasny
8af334f5ba Xcode: Derive stdlib from CXX flags
Closes: #18396
2019-02-07 06:43:51 -05:00
Brad King
96dece6dc1 Xcode: Update default Swift language version for Xcode 10.2
Xcode 10.2 no longer supports Swift language versions before 4.0.

Fixes: #18871
2019-02-04 13:26:10 -05:00
Sebastian Holtermann
6d407ae439 Use cmSourceFile::GetIsGenerated 2019-02-01 17:02:53 +01:00
Brad King
1b46f2f12a Merge topic 'xcode-object-dir'
8a7f93d000 Xcode: Fix object library builds with sanitizers enabled
eff9c69740 Xcode: Place object library artifacts outside Objects-normal directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2885
2019-01-31 11:17:40 -05:00
Brad King
8a7f93d000 Xcode: Fix object library builds with sanitizers enabled
Using `xcodebuild -enableAddressSanitizer YES ...` causes object files
to be placed in a different directory name.  Xcode provides a
placeholder for this that we can use in `OTHER_LDFLAGS` to reference
object files for linking the dependents of object libraries.  However,
CMake's features for installing and exporting object libraries depend on
knowing the real path with no placeholders.  For these cases, use the
default object directory.  Users will then have to choose between
sanitizers and the installation and export features, but both will work
individually.

Fixes: #16289
2019-01-30 10:28:40 -05:00
Brad King
eff9c69740 Xcode: Place object library artifacts outside Objects-normal directory
The `CONFIGURATION_BUILD_DIR` value in the Xcode project file specifies
where to place the library artifact.  For object libraries we've used
the `Objects-normal` directory to hide away the `.a` that we otherwise
cannot stop Xcode from producing.  The parent of this directory is also
specific to the target and does not vary with Xcode's sanitizer
features, so move the artifact there.

Issue: #16289
2019-01-30 10:28:05 -05:00
Regina Pfeifer
b05b778a2d clang-tidy: Use = delete 2019-01-29 14:09:21 -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
Bruno Manganelli
b6a957c969 cmOutputConverter: move ConvertToRelativePath to cmStateDirectory. 2019-01-27 15:48:57 +00:00
Florian Maushart
3ca4402966 ctest: Fix --build-and-test without --build-target on Xcode 2019-01-25 08:21:13 -05:00
Florian Maushart
cb6c233ecc cmake: Add -hideShellScriptEnvironment xcodebuild option
For CMake's build tool mode add -hideShellScriptEnvironment if version
is XCode 7.0 or above
2019-01-25 08:20:51 -05: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
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
Brad King
4b017d579d Merge topic 'Wcomma'
5ff7fb592e Fixed all but one clang -Wcomma warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2828
2019-01-22 09:38:30 -05:00
Brad King
17e12a9fa9 Merge topic 'cmake-gui-generator-platform'
67bced8a26 cmake-gui: Improve label for default platform
48ec0bc140 cmake-gui: Add field for generator platform selection
8bba458ea5 Add global generator factory method to get default platform name
818df52c48 Add global generator factory method to get list of known platforms
8144b00e32 Split global generator factory list with and without platforms
b70c0aed5c VS: Factor out helper function to compute host platform name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2832
2019-01-22 09:28:18 -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
8bba458ea5 Add global generator factory method to get default platform name 2019-01-18 12:30:19 -05:00
Brad King
818df52c48 Add global generator factory method to get list of known platforms
Add a `cmGlobalGeneratorFactory::GetKnownPlatforms` method to return
a list of known possible values for `CMAKE_GENERATOR_PLATFORM`.
Implement the method for each generator by referencing the list of
possible values documented in `Help/generator/*.rst` for it.

Co-Author: Julien Jomier <julien.jomier@kitware.com>
2019-01-18 12:29:53 -05:00
Brad King
8144b00e32 Split global generator factory list with and without platforms
Replace `cmGlobalGeneratorFactory::GetGenerators` with a pair of methods
to split the list of generator names into those that have platforms in
the name and those that do not.
2019-01-18 12:29:53 -05:00
Regina Pfeifer
ef61997b1b clang-tidy: Use emplace 2019-01-17 13:12:02 -05:00
Bruno Manganelli
cc2a5261f8 Factor out enum MessageType into dedicated header
Reduce the number of files relying on `cmake.h`.
2019-01-16 08:16:31 -05:00
Sean McBride
5ff7fb592e Fixed all but one clang -Wcomma warning 2019-01-11 20:48:19 -05:00
Bruno Manganelli
87e810f223 cmOutputConverter: Moved ForceToRelativePath to cmSystem 2018-12-07 19:29:30 +00:00
Brad King
cb6229b8b8 clang-tidy: fix warnings in macOS-only code 2018-11-27 13:20:34 -05:00
Marc Chevrier
c4b4d8b3a6 POSITION_INDEPENDENT_CODE: Manage link flags for executables
Fixes: #14983, #16561
2018-11-11 17:34:09 +01:00
Cengizhan Pasaoglu
c67ab22cdc Using front() and back() instead of calculations 2018-11-06 21:43:33 +03:00
Vitaly Stakhovsky
b8bb6ba653 cmGeneratorTarget::GetExportMacro: return const std::string* 2018-10-16 11:12:19 -04:00
Brad King
1b57f49586 genex: Simplify cmGeneratorExpressionInterpreter
All callers were constructing with a non-empty target name using the
target whose pointer was passed anyway.  Drop this argument.  Simplify
logic accordingly.  Re-order constructor arguments to match the
cmCompiledGeneratorExpression::Evaluate arguments.

Also remove unnecessary getters.
2018-09-07 09:23:43 -04:00