224 Commits

Author SHA1 Message Date
Sebastian Holtermann
f71f7ce3f0 cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.h
This adds the `cmStringAlgorithms.h` header and moves all string functions
from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
2019-07-29 21:13:56 +02:00
Alex Turbov
0db458a0ce Refactor: Use anonymous namespace instead of statics
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-10 01:06:58 +03:00
Alex Turbov
0328b64efd Refactor: Remove one-time used macros
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-10 01:06:26 +03:00
Alex Turbov
b821f9ad62 Refactor: Optimize some stream output operations
- remove redundant `std::flush` right after `std::endl`
- join some string literals

Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-10 01:06:14 +03:00
Craig Scott
14ed40d670 Help: Use consistent levels for cmake --loglevel and message()
The message() command requires uppercase log levels. Even
though the cmake --loglevel option is not case sensitive, show
the supported values as uppercase to match the message()
docs as closely as possible, since they are related to the same
feature.

Also fixes the wrong string being shown for the warning level
by cmake --help.
2019-07-08 20:11:33 +10:00
Sebastian Holtermann
006229278b Use cmAppend to append ranges to std::vector instances 2019-05-23 16:19:49 +02:00
Brad King
186ca170da Merge topic 'std-pipes-always'
c85524a94a Ensure stdin, stdout, and stderr pipes are always open

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !3282
2019-05-03 11:48:46 -04:00
Brad King
9713154cf6 Merge topic 'jobs-positive-value'
6ad699358b cmake: --build -j <jobs> should not accept 0.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3255
2019-05-03 11:45:32 -04:00
Brad King
c85524a94a Ensure stdin, stdout, and stderr pipes are always open
On non-Windows platforms libuv assumes that file descriptors 0-2 are
always used for standard pipes and never for anything else.  Otherwise,
libuv may re-use one of these descriptors and then fail an assertion
when closing it.  Similarly, On Windows platforms our ConsoleBuf
implementation assumes that the standard handles are always open.

If CMake is run with any standard pipes closed, open them with
`/dev/null` or `NUL` to satisfy these assumptions.

Fixes: #19219
2019-05-02 14:34:58 -04:00
Fred Baksik
6ad699358b cmake: --build -j <jobs> should not accept 0.
Fixes #19059
2019-05-01 09:15:51 -04:00
Alex Turbov
6cc93b370e message(): Add support for log levels
Relates: #18943
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2019-04-28 22:45:44 +10:00
Kyle Edwards
8c0b7aa17d Merge topic 'cmake--install'
73f23d1e00 cmake: add '--install <dir>' option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Acked-by: Bartosz <gang65@poczta.onet.pl>
Acked-by: Cristian Adam <cristian.adam@gmail.com>
Rejected-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !3069
2019-03-19 13:39:18 -04:00
Jiang Yi
73f23d1e00 cmake: add '--install <dir>' option
Fixes: #19023
2019-03-17 01:31:25 +08:00
Bartosz Kosiorek
077ab5774c cmake: add short version of '--target <tgt>...' option 2019-03-12 12:00:09 +01:00
Bartosz Kosiorek
071f5e1544 cmake: Reformat '--parallel' and '--verbose' options in help 2019-03-12 11:59:16 +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
b3955a08ab cmakemain: Remove ignored --use-stderr option from command line help 2019-03-04 10:44:14 +01:00
Kyle Edwards
e795be115e Merge branch 'master' into cmake_role-vs-fix 2019-02-26 17:28:04 -05:00
Kyle Edwards
4b95e7fe63 CMAKE_ROLE: Fix value in --build for Visual Studio generators
Fixes: #18990
2019-02-26 14:52:17 -05:00
Vitaly Stakhovsky
950c099d83 cmake: Progress functions use std::string param 2019-02-11 10:32:43 -05:00
Vitaly Stakhovsky
82edd98300 cmSystemTools: MessageCallback and Message() accept std::string argument 2019-02-07 13:41:27 -05:00
Regina Pfeifer
8c92db829b MessageCallback: Remove unused bool& argument 2019-01-29 16:35:53 +01:00
Regina Pfeifer
bcee24aecc Use std::function for callbacks 2019-01-29 16:32:52 +01:00
Florian Maushart
439fe2e253 cmake: Add options for verbose output to --build mode
While we already support `VERBOSE` environment variable and
`CMAKE_VERBOSE_MAKEFILE` cached variable, add `-v` and `--verbose`
command line options to be able to activate verbose output directly from
CMake's build tool mode command line.

Also make `msbuild` honor the verbosity setting. `xcodebuild` still
doesn't honor the verbosity setting as it will need a policy added
and reworking of cmGlobalGenerator and cmsys to support
multiple command invocation.
2019-01-28 09:44:50 -05:00
Brad King
c1247d861a Merge topic 'cmake_build_jobs_supports_no_space'
f2fca92686 cmake: --build supports '-jN'
e463133cd2 Tests: Remove unused files from RunCMake.CommandLine test

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2819
2019-01-23 08:15:36 -05:00
Brad King
a1f65014a3 Merge topic 'help-mark-default-generator'
dfd5ae7da7 Help: Mark default CMake generator with asterisk
6023fe7ff2 ccmake: Append rather than replace Generators section of docs
7408cd3929 cmake: Return generator docs directly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2682
2019-01-22 11:37:01 -05:00
Robert Maynard
f2fca92686 cmake: --build supports '-jN' 2019-01-22 08:27:04 -05:00
Artur Ryt
7408cd3929 cmake: Return generator docs directly
The GetGeneratorDocumentation() function was not accurately
named and required the vector to populate to be passed as a
function argument. This commit makes the slightly renamed
function return by value, making it a true getter as implied
by its name. Some minor refactoring of the implementation
also makes the steps of populating the vector clearer.
2019-01-18 12:57:32 -05:00
Regina Pfeifer
ef61997b1b clang-tidy: Use emplace 2019-01-17 13:12:02 -05:00
Kyle Edwards
4568d046c4 Properties: Add CMAKE_ROLE global property
This property allows scripts to determine whether they're in project
mode, script mode, find-package mode, CTest, or CPack.
2019-01-17 09:44:29 -05:00
Craig Scott
a1adbc7243 cmake: Stop processing if -P option lacks file name
While an error message was being logged, processing was
continuing nonetheless except with the -P argument omitted.
This could have allowed unintended effects if the remaining
arguments formed a valid set of command line options.
2019-01-14 07:13:27 +11:00
Robert Maynard
a10d63d578 cmake: -S and -B can be used to specify source and build directories
Document the previously internal option of '-B' and provide a
matching source directory option with '-S'. Both '-B', and '-S'
can be used independently of each other.
2018-09-15 11:25:47 -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
Florian Maushart
1ab3881ec9 cmake: Add options for parallel builds to --build mode
While we already support `cmake --build . -- -j`, the options after `--`
are specific to the native build tool.  Add new options `--parallel
[<N>]` and `-j [<N>]` to abstract this and map to the proper option
for the native build tool.
2018-05-25 09:42:20 -04:00
Brad King
98628de812 Extend libuv file translate mode workaround to all executables
Since libuv commit v1.14.1~7 (win: add uv__once_init() calls,
2017-08-30) the libuv initialization of the file translate mode may take
place even if we do not use a uv loop.  This change was included in our
libuv update commit f4a26c748b (libuv 2018-01-19).  Therefore use of
libuv even through `cmSystemTools::GetRealPath` in any executable may
trigger its file translate mode setting.

Factor out the logic added to `cmake.exe` by commit v3.9.0-rc4~10^2
(cmake: Fix default file translate mode when using libuv, 2017-06-13)
and re-use to initialize all executables.

Issue: #16962
2018-01-23 09:29:07 -05:00
Gregor Jasny
5de37a4a64 cmake: Add --open option for IDE generators 2017-10-13 21:28:34 +02:00
Brad King
7c28081c14 Merge topic 'string-clear'
5db3aac1 Meta: replace empty-string assignments with `clear()`.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1276
2017-09-19 08:27:00 -04:00
Brad King
714ce72882 bootstrap: Make libuv available during bootstrap
On UNIX, build only the parts of libuv we need for the filesystem,
process, and poll abstractions using the POSIX poll() backend.  This
avoids many platform-specific conditions.  On Windows, build all of
libuv; there are no conditional alternatives anyway.
2017-09-17 11:10:18 -04:00
Pavel Solodovnikov
5db3aac111 Meta: replace empty-string assignments with clear(). 2017-09-16 02:26:49 +03:00
Pavel Solodovnikov
7d5095796a Meta: modernize old-fashioned loops to range-based for.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
2017-09-12 16:22:47 +03:00
Rolf Eike Beer
353ec23737 use static_cast<> for casts from void* 2017-09-01 20:50:00 +02:00
Brad King
2df8dbcdf2 Merge topic 'fix-find-package-mode'
18454ea4 cmake: Fix --find-package mode with imported targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1208
2017-08-30 10:44:36 -04:00
Daniel Pfeifer
7ddd43183d Merge topic 'cstyle-casts'
190e3825 Replace C-style casts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1176
2017-08-30 06:38:00 -04:00
Brad King
18454ea44d cmake: Fix --find-package mode with imported targets
The change in commit v3.9.0-rc1~116^2~6 (cmakemain: use script role for
-P, 2017-05-11) accidentally left project commands out of find-package
mode, causing packages that provide imported targets to break.

Fixes: #17124
2017-08-29 15:30:07 -04:00
Daniel Pfeifer
190e3825d4 Replace C-style casts 2017-08-27 09:58:46 +02:00
Daniel Pfeifer
ca2233e31f IWYU: Mark cmConfigure.h with pragma: keep
Also remove `#include "cmConfigure.h"` from most source files.
2017-08-26 07:41:04 +02:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Brad King
88c9878af9 Make libuv available to all parts of CMake
The libuv library provides many useful platform abstractions and better
process management than KWSys.  We'd like to use it everywhere instead
of just in the server mode.  Drop the `CMAKE_USE_LIBUV` option and use
libuv everywhere except during bootstrap.
2017-08-08 09:34:54 -04:00
Brad King
871adefce9 cmake: Fix default file translate mode when using libuv
On Windows, libuv's one-time initialization changes the C runtime
library's  `_fmode` setting to `_O_BINARY`, thus causing files to open
as binary after that instead of the default `_O_TEXT` mode.  See
upstream libuv issue 840.  Work around the problem by performing libuv
initialization early and then restoring `_fmode`.

In particular, this currently affects server mode.  Without this fix,
the `_fmode` setting changes when the server mode initializes libuv.

Fixes: #16962
2017-06-14 12:46:03 -04:00
Daniel Pfeifer
a890ca2f8d cmakemain: use script role for -P 2017-05-11 17:57:59 +02:00