Commit Graph

245 Commits

Author SHA1 Message Date
scivision
848f7b0a81 cmake -E time: use C++11 chrono and better format output
fixes #24415
2023-02-15 10:53:14 -05:00
Brad King
1edf138506 Tests/RunCMake: Update cmake_minimum_required versions
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.5 where possible.

Also, remove `cmake_minimum_required()` and `project()` calls from
individual cases where they are handled by `CMakeLists.txt`.
2023-02-11 06:24:22 -05:00
Brad King
536f35c4f1 Merge topic 'vs9-deprecate'
d7f440c5db Deprecate Visual Studio 9 2008 generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8181
2023-02-09 10:14:10 -05:00
Robert Maynard
f9e8a067c2 cmake: Stop parsing after -- when detecting script mode
The fix in commit 08aa516880 (cmake: Stop parsing after `--` when
detecting script mode, 2022-12-06, v3.26.0-rc1~216^2) only corrected the
case where `-P -- -P <arg>` occurred and not `-P -- -P -<other>`.

Fixes: #24220
2023-02-08 17:21:10 -05:00
Brad King
d7f440c5db Deprecate Visual Studio 9 2008 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2023-02-08 11:49:27 -05:00
Kitware Robot
33abef7416 Revise C++ coding style using clang-format-15
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 15.

* 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.

Fixes: #24315
2023-01-18 16:20:47 -05:00
Brad King
48639aa8fc clang-format.bash: Use generic clang-format attribute
Specify the clang-format version in the attribute value instead of its
name.

Issue: #24315
2023-01-18 11:48:49 -05:00
Robert Maynard
c1170b5602 cmake: Add -E copy_directory_if_different
Fixes #21584
2023-01-12 08:39:41 -05:00
Brad King
d811d86fd7 FileAPI: Add "configureLog" object kind
Provide clients with a way to get a known set of configure log event
versions.

Issue: #23200
2022-12-17 08:52:04 -05:00
Brad King
3b4337adc7 Merge topic 'clang-tidy-export-fixes-dir'
232467eb1c clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7982
2022-12-07 08:19:53 -05:00
Robert Maynard
08aa516880 cmake: Stop parsing after -- when detecting script mode
Fixes #24220
2022-12-06 13:04:31 -05:00
Kyle Edwards
232467eb1c clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property
Fixes: #21362
2022-12-06 10:39:29 -05:00
Brad King
eda68d229d Merge topic 'cmake-E-copy-t-mode'
8d9069e5b6 cmake -E copy: Add support for -t argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7913
2022-11-15 09:14:07 -05:00
Brad King
6f9544736a Merge topic 'better_handling_of_build_args'
01611f8258 cmake: --build improve detection of no build dir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7908
2022-11-15 08:55:19 -05:00
Kyle Edwards
8d9069e5b6 cmake -E copy: Add support for -t argument
Fixes: #23543
2022-11-15 07:47:07 -05:00
Robert Maynard
01611f8258 cmake: --build improve detection of no build dir
Fixes #24157
2022-11-14 10:46:17 -05:00
friendlyanon
59573bf5b9 project: Warn at top-level if cmake_minimum_required wasn't called
The top-level project() call will now issue an AUTHOR_WARNING if it
wasn't called after cmake_minimum_required().

Fixes: #24071
2022-11-11 22:49:36 +01:00
Ben Boeckel
b3e9fb67bb file-api: support exporting file set information
This includes listing the filesets themselves as well as which file set
(if any) each source file is associated with.

Fixes: #24128
2022-11-08 10:07:10 -05:00
Brad King
4180159758 Tests: Provide RunCMake.CommandLine compare_files data more robustly
The `lf` and `crlf` files need to have exact LF and CRLF newlines,
respectively.  Previously we used the Git `eol` attribute for this,
but occasionally the Git work tree ends up without the conversion.
It is unclear why that happens, so try to avoid the problem by
treating their content as binary instead.
2022-10-31 10:50:33 -04:00
Juan Ramos
3c3bce133d cmake: Honor CMAKE_GENERATOR env var in --help output 2022-10-20 19:53:14 -06:00
Matthew Woehlke
5ba51621af try_compile: Propagate --trace through try_compile
Add ability to specify another cmake instance from which to get the
trace output target. Use this during try_compile.
2022-10-11 12:10:18 -04:00
Matthew Woehlke
7e6b2a92a0 try_compile: Report build dir with --debug-trycompile
When `--debug-trycompile` is enabled, issue a log (with trace) for every
`try_compile` noting what directory is being used for the compilation.
This will make it easier to find the corresponding artifacts.

Closes: #24022
2022-10-06 08:13:03 -04:00
Brad King
6c1337cb79 Deprecate Visual Studio 11 2012 generator
Update documentation to mark the generator deprecated.  Add a warning at
the end of generation plus an option to turn off the warning.
2022-09-27 11:45:50 -04:00
Brad King
5faf145a5b Tests: Drop unused files from RunCMake.CommandLine
Remove files missed by commit 8d6f015d59 (Drop Visual Studio 10 2010
generator, 2022-09-26).
2022-09-27 11:45:29 -04:00
Brad King
8d6f015d59 Drop Visual Studio 10 2010 generator
This generator has been deprecated since CMake 3.22.  Remove it.
2022-09-26 15:43:04 -04:00
Brad King
20f9b6973b Merge topic 'modules-use-new-try_compile-signature'
2edf0fc6d7 Modules: Use new keyword-dispatched try_compile signature

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7656
2022-09-14 08:13:27 -04:00
Matthew Woehlke
2edf0fc6d7 Modules: Use new keyword-dispatched try_compile signature
Modify most of the modules that ship with CMake to use the new
try_compile / try_run signatures added by commit aa9220d3a0
(try_compile: Add keyword-dispatched signature, 2022-09-02). This
improves debugging by each invocation using its own directory so that
the results of multiple invocations can be retained.

This does not cover any invocations which provide an entire project, as
that flavor of try_compile has not yet been updated.
2022-09-14 07:52:16 -04:00
Matthew Woehlke
7b62e40a64 Tests: Fix RunCMake.CommandLine test in unusual environments
Modify `Tests/RunCMake/CommandLine/P_working-dir.cmake` to not spuriously
fail in environments when the build directory's nominal path is not
canonicalized (i.e. `realpath(BINDIR) != BINDIR`).
2022-09-12 09:45:50 -04:00
Kyle Edwards
d0bb3286f0 cmake -E capabilities: Tell whether TLS is enabled
Fixes: #20507
2022-09-01 11:20:14 -04:00
Alex Reinking
c9d70a7cc3 cmake -E env: Add --modify flag
When `cmake -E env` is given the `--modify` flag, try to parse the
following argument as an `ENVIRONMENT_MODIFICATION` operation and apply
it to the environment.

This generalizes `--unset=`:

1.  When implementing `ENVIRONMENT_MODIFICATION` features for other CMake
    commands, the `MYVAR=OP:VALUE` strings do not need to be translated
    to OP-specific flags.
2.  This provides a natural and consistent extension point to introduce
    new operations without introducing very many flags.
3.  Users need to learn only one syntax to access the same functionality.

There is one difference between the behavior here as compared to CTest's
interpretation of the `ENVIRONMENT_MODIFICATION` test property.
The `MYVAR=reset:` command when run in `cmake -E env` will reset `MYVAR`
to whatever its value was when `cmake -E env` launched, rather than try
to checkpoint after plain `MYVAR=VALUE` options.  This makes `MYVAR=VALUE`
and `--modify MYVAR=set:VALUE` semantically equivalent.
2022-08-17 12:54:39 -04:00
Brad King
4f8f577015 Merge topic 'cmake-help-flags-after-dashdash'
14a0e750cb cmake: In -P mode ignore flags like `--version` after `--`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7496
2022-07-25 12:00:39 -04:00
Brad King
cc663a8c1d Merge topic 'cmake-P-path-args'
febe3190f0 Merge branch 'backport-3.23-cmake-P-path-args'
846a650ff7 cmake: In -P mode ignore extra paths on the command line
c362cba566 cmake: simplify to a single source of truth of working mode
261fa5db39 cmake: In -P mode ignore extra paths on the command line
314135cdf1 cmake: simplify to a single source of truth of working mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7494
2022-07-25 11:57:48 -04:00
Robert Maynard
14a0e750cb cmake: In -P mode ignore flags like --version after --
Fixes: #21031
2022-07-22 14:30:21 -04:00
Robert Maynard
846a650ff7 cmake: In -P mode ignore extra paths on the command line
Fixes: #23748
2022-07-22 13:55:52 -04:00
Marc Chevrier
9480ced81a Makefiles generator: dependencies messages in verbose mode
Fixes: #23689
2022-07-06 17:40:08 +02:00
Niyas Sait
834422e075 Tests: Fix test failures for Windows Arm64 platforms 2022-05-11 18:13:25 +01:00
Kyle Edwards
313ea361b0 CMake: Use FindPython instead of FindPythonInterp to build CMake itself
Fixes: #23444
2022-04-21 14:23:36 -04:00
Braulio Valdivielso Martinez
fd46db1745 Trace: process else and elseif commands correctly
There have been two bugs reported about the `else` and `elseif`
commands in the context of the tracing functionality and the json-v1
format (#23191 #22315). In essence, the reported traces referred to
the layer of the stacktrace immediately on top of the expected ones.

This MR fixes both issues. My solution adds a new parameter to the
`PrintCommandTrace` function, `commandMissingFromStack`, that callers
can specify if the command they want to report a trace for is not a
regular part of the stack maintained in `cmMakefile`. This is only the
case for `else` and `elseif`. The other bug is fixed by having the
caller pass a `cmListFileBacktrace`, which helps in getting the right
lines, file names... for the reported command.

Fixes: #23191 #22315
2022-03-25 12:24:38 -04:00
Brad King
9f1471739d cmake: Add --fresh option to clear the cache and start from scratch
Simplify the workflow to re-run CMake from scratch as if a build tree
were never before processed, regardless of whether it has been.

Fixes: #23119
2022-03-22 09:27:47 -04:00
Brad King
5dbd068827 Merge topic 'cmake-P-args'
36056ff5a3 cmake: Improve acceptance of arbitrary arguments in -P script mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7083
2022-03-18 07:20:24 -04:00
Brad King
32e40f7f53 Merge topic 'always_prefer_last_source_dir'
b44ad7992a cmake: Always prefer the last source directory provided

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7084
2022-03-18 07:16:24 -04:00
Robert Maynard
b44ad7992a cmake: Always prefer the last source directory provided
Fixes: #23334
2022-03-17 15:23:01 -04:00
Brad King
36056ff5a3 cmake: Improve acceptance of arbitrary arguments in -P script mode
The fix in commit e4f1b301fe (cmake: Allow arbitrary args passed to
CMake script, 2020-05-04, v3.18.0-rc1~211^2) only applied to "cache"
arguments like `-DFOO`.  Extend the fix to allow arbitrary arguments
that collide with other CMake arguments like `-S` and `-B`.
2022-03-17 13:50:12 -04:00
Brad King
51e81d1f73 Merge topic 'color-diagnostics'
6ab9fbd43b color: Add tests for CMAKE_COLOR_DIAGNOSTICS
78adb1b952 color: Add CMAKE_COLOR_DIAGNOSTICS environment variable
884d9de8b7 color: Introduce CMAKE_COLOR_DIAGNOSTICS variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Frank Dana <ferdnyc@gmail.com>
Merge-request: !6990
2022-03-09 12:15:53 -05:00
Brad King
6ab9fbd43b color: Add tests for CMAKE_COLOR_DIAGNOSTICS 2022-03-08 17:29:12 -05:00
Brad King
c5ab0ea1fa Merge topic 'cmake-dir-args'
d2e9478321 Tests: Add RunCMake.CommandLine ExplicitiDirs explicit work directory
78e8f11456 cmake: Correct regression in `-B <dir> <src_dir>`
4091d5c58c Tests: Verify RunCMake.CommandLine ExplicitDirs source/build dirs
1b97f8f35c Tests: Clarify RunCMake.CommandLine ExplicitDirs case names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7030
2022-03-03 11:46:29 -05:00
Brad King
d2e9478321 Tests: Add RunCMake.CommandLine ExplicitiDirs explicit work directory
Verify that the work directory is not selected as the source or build
tree.

Issue: #23285
2022-03-02 12:21:34 -05:00
Robert Maynard
78e8f11456 cmake: Correct regression in -B <dir> <src_dir>
Fixes: #23285
2022-03-02 12:21:16 -05:00
Brad King
4091d5c58c Tests: Verify RunCMake.CommandLine ExplicitDirs source/build dirs 2022-03-02 12:21:03 -05:00
Brad King
1b97f8f35c Tests: Clarify RunCMake.CommandLine ExplicitDirs case names 2022-03-02 10:53:41 -05:00