Commit Graph

135 Commits

Author SHA1 Message Date
Brad King
266f97315b Tests: Update RunCMake.CommandLine to avoid duplicate custom commands
This test does not need to have the same custom command output generated
by multiple independent targets.  Revise the test to avoid that.
2020-09-01 10:32:45 -04:00
Thomas Bernard
a94672b919 cmake: Change cmake_llvm_rc separator from -- to ++ to avoid conflict 2020-08-07 11:47:15 -04:00
Sibi Siddharthan
2fad00940d cmake: Add -E create_hardlink
Fixes: #20950
Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
2020-07-15 20:22:04 +05:30
Brad King
41ede81341 Merge topic 'profiling-case-insensitive-command-names'
7cf2f7d2af cmake: Store lowercase command names in profiling output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5007
2020-07-14 07:14:08 -04:00
Craig Scott
7cf2f7d2af cmake: Store lowercase command names in profiling output
This ensures commands can be properly aggregated by tools
processing the profiling output.

Fixes: #20946
2020-07-13 11:03:05 +10:00
Brad King
f2b84d24cf Merge topic 'fileApiAddLanguageStandardBacktrace'
7d6861f367 fileapi: Extend codemodel targets with language standard
ba835874a4 Add backtrace support for language standard
e43486a639 cmGeneratorTarget: Clarify name of language property lookup helper

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4798
2020-06-29 08:25:42 -04:00
Justin Goshi
7d6861f367 fileapi: Extend codemodel targets with language standard 2020-06-26 08:52:29 -04:00
Asit Dhal
d4812a955b cmake-install: implement default directory permissions
provide an argument for default directory permissions in cmake --install

Fixes: #20700
2020-06-25 14:43:30 -04:00
Asit Dhal
b5b6075522 cmake: add dedicated error for -E compare_files invalid arguments
Return 2 when user provides invalid arguments

Fixes: #20815
2020-06-15 12:39:37 -04:00
Brad King
b9dd072e05 Tests: Add case for cmake --build with a failing target 2020-06-12 14:31:16 -04:00
Asit Dhal
a7d44d55ae cmake: remove -E compare_files error message if files differ
It is not an error for the files to be different.

Fixes: #20803
2020-06-10 07:23:10 -04:00
Brad King
15b9b41d72 Merge topic 'fileApiAddPrecompileHeadersBacktrace'
9f6d40ee23 fileapi: Extend codemodel targets with PRECOMPILE_HEADERS
b698764a31 Tests: Add a PCH example to RunCMake.FileAPI codemodel-v2
b3812c0e54 Tests: Fix indentation in RunCMake.FileAPI cxx_exe.json
9c48804b69 PCH: Fix source group of per-architecture PCH headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4684
2020-05-25 10:40:56 -04:00
Justin Goshi
9f6d40ee23 fileapi: Extend codemodel targets with PRECOMPILE_HEADERS 2020-05-22 11:26:55 -04:00
Brad King
171bf5fa92 Merge topic 'third-parties-layout'
2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
75e87e3db4 bootstrap: update list of problematic files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4705
2020-05-08 08:18:17 -04:00
Marc Chevrier
2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
Fixes: #20666
2020-05-07 12:06:08 +02:00
Alex Turbov
e4f1b301fe cmake: Allow arbitrary args passed to CMake script 2020-05-06 21:40:36 +10:00
Johnny Jazeix
a625f30785 cmake -E: add cat command.
Concatenate files and print on the standard output.

FIXES: #20557
2020-04-15 20:56:56 +02:00
Brad King
c0438d272d Merge topic 'llvm-rc-include-path'
35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4570
2020-04-07 08:00:45 -04:00
Thomas Bernard
35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing
Since commit 1c2d031cbd (Add -E cmake_llvm_rc to preprocess files for
llvm-rc, 2020-01-14, v3.17.0-rc1~24^2) with llvm-rc we explicitly
preprocess RC source files and then compile separately without -I flags.
This broke cases where the RC source references data files adjacent to
itself or in the include path.

This change adds the expansion of the include paths when calling the
llvm-rc in order for the resource files to be picked up correctly by
llvm-rc.  Since the RC compiled file is first preprocessed, the file
being compiled by llvm-rc resides in the build directory. In order for
llvm-rc to find the resource data specified relative to the .rc file
being compiled, the source file path is preppended in the include list
so that the original source path takes priority over all the other
includes paths specified.

A space was added in the CMAKE_INCLUDE_FLAG_RC to make the include
directive work properly for llvm-rc. Checks on the rc.exe showed that
the syntax change doesn't affect it's proper operation.

Fixes: #20529
2020-04-06 21:19:12 +02:00
Brad King
a88b27bfc7 Merge topic 'llvm-rc-stderr'
dc93cbb0d8 llvm-rc: Print stderr output when calling tools through cmake_llvm_rc

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4525
2020-03-27 07:39:30 -04:00
Thomas Bernard
dc93cbb0d8 llvm-rc: Print stderr output when calling tools through cmake_llvm_rc
The stored error pipe is output if the program fails.

Fixes: #20494
2020-03-26 07:59:55 -04:00
Wouter Klouwen
9aa4640792 cmake: add command line options to output script profiling data
For users of CMake who want to optimize their scripts if they take a
while to run, this commit adds the ability to output profiling data.

To enable this output, it adds the two command line parameters
to select the output path and format.

This commit adds the first profiling format of type ``google-trace``,
which is the output is a JSON file containing Duration events as per the
Google Trace Format specification:

https://docs.google.com/document/d/1CvAClvFfyA5R-
PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#
2020-03-07 13:36:27 +00:00
Thomas Bernard
1c2d031cbd Add -E cmake_llvm_rc to preprocess files for llvm-rc
llvm-rc requires preprocessed rc files. The CMake command line tool
cmake_llvm_rc enables channing the preprocessor call and the resource
compiler and make this appear as single compilation step.

When llvm-rc is detected as resource compiler, the RC compilation step
is set to use this command.
2020-02-04 08:19:12 -05:00
Frank Winklmeier
c829f0cfca trace: Add time and stack level to JSON output format
Add the timestamp and stack depth of the function call to the JSON trace
output format. This information can be useful for cmake profiling and
call stack inspection (see e.g. https://github.com/volo-zyko/cmake-profile-stats).

Improve unit test to allow for varying set of keys to check in trace lines.
2020-01-22 09:58:52 -05:00
Kyle Edwards
3c548cfaf6 Merge topic 'trace-test-support-python26-and-older'
00f25dacc0 trace: Directly parse commandline arguments without argparse

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4169
2020-01-03 11:28:29 -05:00
Daniel Mensinger
00f25dacc0 trace: Directly parse commandline arguments without argparse 2020-01-01 11:18:26 +01:00
Rolf Eike Beer
397d162b9a Tests: do not use the same variable name in nested loops
Spotted by LGTM.com.
2019-12-31 13:30:18 +01:00
Daniel Mensinger
e113ab1168 trace: Add test for the JSON-v1 trace 2019-12-23 14:05:42 +01:00
Johnny Jazeix
5239fc5c75 cmake -E: Add rm with improved semantics over remove and remove_directory 2019-11-13 18:02:18 -05:00
Daan De Meyer
8065a686dd Initialize CMAKE_EXPORT_COMPILE_COMMANDS from envvar of the same name
Fixes: #18386
2019-10-18 14:37:33 -04:00
Peter Waller
c9d73b26b0 cmake: Fix relative path regression in -C
Since commit 4ca0526f8a (cmake: Pass -S and -B into PreLoad.cmake and -C
scripts, 2019-08-20, v3.16.0-rc1~195^2) the value of `CMAKE_SOURCE_DIR`
is the source directory rather than the current working directory.
This was correct on its own, but the place storing that value is also
used as the base for relative paths specified on the command line.
The latter should of course be relative to the current working
directory.

The fix is to switch to use a full path internally, unless a full path
is already specified.  Add tests for the behaviour of `-C` under these
four circumstances:

    {with -S, without -S} x {full path, relative path}

Fixes: #19827
2019-10-14 16:17:00 -04:00
Brad King
a38965db9a Merge topic 'remove_directory-symlink'
e6c9a8bac3 cmake: Teach -E remove_directory to remove directory symlinks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3738
2019-08-30 10:38:25 -04:00
Jon Chronopoulos
e6c9a8bac3 cmake: Teach -E remove_directory to remove directory symlinks
If the argument to `remove_directory` is a symlink to a directory,
remove the symlink instead.

Issue: #19533
2019-08-30 10:37:30 -04:00
Peter Waller
4ca0526f8a cmake: Pass -S and -B into PreLoad.cmake and -C scripts
Before this, it was not possible to see what the source or build directories
were set to on the command line.

Fixes: #19619
2019-08-27 10:51:40 -04:00
Igor Ivanov
3c94069660 Add --trace-redirect parameter to redirect trace output to a file 2019-08-10 11:41:53 +03:00
Kyle Edwards
b8828ecbba cmake -E: Add true and false commands 2019-07-11 13:41:30 -04:00
Brad King
c932f49842 cmake: Teach -E capabilities to report supported fileapi requests
Fixes: #19339
2019-06-07 11:08:38 -04:00
Brad King
a7d2efc15b Merge topic 'remove_directories'
07a80c7002 cmake: Teach -E remove_directory to remove multiple directories
013bee698e Tests: Add RunCMake.CommandLine make_directory test checks
3eb16de327 Tests: Fix RunCMake.CommandLine make_directory test name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3411
2019-06-04 08:37:04 -04:00
Brad King
f263650f95 Tests: Fix RunCMake.CommandLine test to use generator in no-S-B case
Apply the fix from commit baed22c4b0 (Tests: Fix RunCMake.CommandLine
test to use generator with -S and -B, 2019-04-10) to the `no-S-B` case
too.  It also generates a build system and should use the generator
being tested.
2019-06-03 14:57:19 -04:00
John Freeman
07a80c7002 cmake: Teach -E remove_directory to remove multiple directories
The `make_directory` command can make multiple directories in a single
invocation.  Make `remove_directory` mirror that behavior.
2019-06-03 14:20:00 -04:00
John Freeman
013bee698e Tests: Add RunCMake.CommandLine make_directory test checks 2019-06-03 14:17:11 -04:00
John Freeman
3eb16de327 Tests: Fix RunCMake.CommandLine make_directory test name 2019-06-03 14:16:50 -04:00
Brad King
8ed6efbbd3 Merge topic 'default-generator-env'
d0f0ba0f7a Tests: Add environment generator tests
a48ce8f4bf Help: Add documentation for default generator environment variables
083cf7e8a2 cmake: Allow default generator to be set by environment variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3218
2019-05-22 10:32:43 -04:00
Eicke Herbertz
d0f0ba0f7a Tests: Add environment generator tests 2019-05-22 07:40:51 -04: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
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
Brad King
39e7fd8c68 Tests: Avoid enabling languages in RunCMake.CommandLine -S and -B cases
The test project does not compile any sources and so does not
need to enable any languages.
2019-04-10 09:40:48 -04:00
Brad King
baed22c4b0 Tests: Fix RunCMake.CommandLine test to use generator with -S and -B
The `-S` and `-B` command-line option tests do generate build systems
and so should use the generator being tested.
2019-04-10 09:40:48 -04: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