Commit Graph

372 Commits

Author SHA1 Message Date
Marius Messerschmidt
bceb8e2ed2 cmMessenger: Pass title inside a metadata structure 2021-05-19 09:06:27 -04:00
Brad King
408e6d6185 Utilities: Suppress warnings in third-party code with NVHPC 2021-04-20 11:44:25 -04:00
Brad King
87909f0600 Utilities: Suppress warnings in third-party code when using IntelLLVM 2021-01-28 09:07:00 -05:00
Ben Boeckel
cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -05:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Brad King
16accdc76e ccmake: suppress warnings in third-party form code 2020-08-18 17:09:23 -04:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
See https://github.com/codespell-project/codespell#readme

The following command was used:

```
codespell -q6 --skip="\
.git,\
*.json,\
./Copyright.txt,\
./Help/command/foreach.rst,\
./Help/prop_test/REQUIRED_FILES.rst,\
./Help/variable/CTEST_COVERAGE_COMMAND.rst,\
./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\
./Modules/CMakeRCInformation.cmake,\
./Modules/Internal/CPack/NSIS.template.in,\
./Modules/FindMatlab.cmake,\
./Modules/MatlabTestsRedirect.cmake,\
./Modules/Platform/Windows-Clang.cmake,\
./Modules/Platform/Windows-Intel-Fortran.cmake,\
./Modules/Platform/Windows-MSVC.cmake,\
./Source/CMakeVersion.cmake,\
./Source/cmConvertMSBuildXMLToJSON.py,\
./Source/cmCreateTestSourceList.cxx,\
./Source/cmGlobalVisualStudio10Generator.cxx,\
./Source/cmExportBuildFileGenerator.cxx,\
./Source/cmExportInstallAndroidMKGenerator.cxx,\
./Source/cmExportInstallFileGenerator.cxx,\
./Source/cmExportSet.cxx,\
./Source/cmExportTryCompileFileGenerator.cxx,\
./Source/cmFindPackageCommand.cxx,\
./Source/cmInstallCommand.cxx,\
./Source/cmGeneratorExpressionLexer.cxx,\
./Source/cmLocalVisualStudio7Generator.cxx,\
./Source/cmOrderDirectories.cxx,\
./Source/cmTarget.cxx,\
./Source/kwsys/*,\
./Source/QtDialog/CMakeSetupDialog.ui,\
./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\
./Source/CTest/cmParseCoberturaCoverage.h,\
./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\
./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\
./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\
./Tests/RunCMake/GoogleTest/xml_output.cpp,\
./Tests/RunCMake/Make/TargetMessages*,\
./Utilities/*,\
" \
-L "\
dependees,\
endwhile,\
fo,\
filetest,\
helpfull,\
nd,\
objext,\
stoll,\
supercedes,\
superceded,\
vas,\
varn,\
"
```
2020-07-22 12:44:47 -04:00
Bartosz Kosiorek
19689d34e6 ccmake: Display an error and interrupt execution if ncurses failed 2020-06-11 07:24:05 -04:00
Brad King
961ca77a7a Merge topic 'gitlab-ci-ninja-multi'
e1b2c0108f gitlab-ci: add a Ninja Multi-Config test job
1e8ecfccdd gitlab-ci: also build ncurses and Qt code on Linux
95721f0a82 ci: install ncurses and Qt development into the Fedora 31 image
ed2fe558b0 CursesDialog: resolve clang-tidy warnings
44f1744bed QtDialog: avoid using deprecated APIs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4832
2020-06-02 09:17:24 -04:00
Ben Boeckel
ed2fe558b0 CursesDialog: resolve clang-tidy warnings
Fixes:

  - unnecessary bool expression (cmCursesMainForm)
  - removes a duplicate if/else branch (RegexExplorer)
  - collapses redundant if/else branch logic (CMakeSetupDialog and
    cmCursesStringWidget)
2020-06-02 07:37:56 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Brad King
3aede31cfc ccmake: Check that getmaxyx result width is non-negative
Otherwise GCC 10.1 issues a `-Wstringop-overflow=` diagnostic when
we use the width for indexing.
2020-05-19 15:43:12 -04:00
Matthew Woehlke
671fe28313 ccmake: Improve coloring, allow customization
Change the default color for strings from BLUE (which is nearly
illegible on any terminals using the standard color palette which has
been around since at least CGA, almost 40 years ago) to CYAN. Add
ability to customize the colors via an environment variable (inspired by
LS_COLORS and using similar syntax).

Fixes: #20596
2020-04-24 11:21:13 -04:00
Matthew Woehlke
f56a695440 ccmake: Rename cmCursesColor::{Options => Choice}
Rename the internal name for the color applied to multiple-choice
options to avoid use of the overloaded term 'option'.
2020-04-24 09:37:01 -04:00
Ben Boeckel
603a532b58 cmCursesLongMessageForm: avoid unnecessary string allocation
The addition makes a temporary string and then drops it after adding it
to `this->Messages`. Instead, just incrementally append.
2020-04-09 11:04:45 -04:00
Brad King
0e1313cdf4 Merge topic 'ccmake_incremental_log_display'
60bfaa8fe6 ccmake: Use incremental rendering for the logs
e9b36731e9 cmCursesLongMessageForm: Factor out helper to draw message to form

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !4573
2020-04-09 08:12:12 -04:00
Sylvain Joubert
60bfaa8fe6 ccmake: Use incremental rendering for the logs
This should avoid an exponential slowdown in the display time for
projects with lots of output.
This is still slower than cmake due to the ncurses drawing, but it should
now be O(L) in total and not O(L^2) wrt to output length.

Fixes: #20535
2020-04-08 14:40:09 -04:00
Brad King
e9b36731e9 cmCursesLongMessageForm: Factor out helper to draw message to form 2020-04-08 14:39:46 -04:00
Brad King
7e3d81b1df Merge topic 'cmprop-state'
a7f2ff16a4 cmState::GetCacheEntryProperty: return cmProp

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4522
2020-03-27 07:49:30 -04:00
Vitaly Stakhovsky
a7f2ff16a4 cmState::GetCacheEntryProperty: return cmProp 2020-03-25 14:46:52 -04:00
Rolf Eike Beer
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix() 2020-03-23 22:41:43 +01:00
Vitaly Stakhovsky
bd89133543 cmState::GetCacheEntryValue: return cmProp 2020-03-17 12:09:20 -04:00
Sylvain Joubert
b4ef7fbaa8 ccmake: Fix crash with cache entries almost the size of the window
The previous code:

if (curFieldLen < width) {
  ...
  strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);

was not correctly guarded against cache entries whose size were exactly
1 or 2 characters short of the window size.
"if (curFieldLen - 2 < width)" would have prevented a copy of
negative/max_int characters and a subsequent crash.

The whole method was modernized with std::string instead of char*
2019-11-19 20:06:31 +01:00
Sylvain Joubert
ce99f5ee69 ccmake: Fix rendering on window resize
Repro steps: configure (without errors), the logs are displayed then the
cache is displayed again, resize the window up -> the logs are
redisplayed after resize instead of the cache

The 'CurrentForm' pointer were left pointed to the last log message
form, this resets it to the main form when configure or generate is done
2019-11-18 17:05:37 +01:00
Sylvain Joubert
88cfef0821 ccmake: redirect stdout/stderr to the displayed logs
Use cmSystemTools to report some messages.
These should now be caught and displayed properly,
both in ccmake and cmake-gui

Avoid log display flickering during processing
- Don't clear the screen each time the long message form is rendered.
  It always renders the whole screen again so clearing it only causes
  flickering.
- Add scroll down capabilities to the long message form so that it can
  draw itself directly in the correct state. This removes the need to
  programatically scroll down just after that also caused flickering.

Fixes #19882
Fixes #13288
2019-11-16 08:27:32 +01:00
Sylvain Joubert
d5d5ba3f7f ccmake: Identify the current cache entry 2019-11-04 20:06:51 +01:00
Sylvain Joubert
005aba29a1 ccmake: Improve display of the key controls
Reduce space usage and add the key to display the output
2019-11-04 18:59:20 +01:00
Sylvain Joubert
93b66735ac ccmake: Use type-based colors to display cache values
The colors are based on the entry type (or value for booleans),
paths and filepaths sharing the same color.
2019-11-04 18:59:20 +01:00
Sylvain Joubert
66d969fcc4 ccmake: Don't overwrite the last character of the title 2019-10-25 14:58:23 +02:00
Sylvain Joubert
1d0e557aed ccmake: Display output during configure and generate 2019-10-25 14:58:23 +02:00
Sylvain Joubert
c168e789df ccmake: Use the error display for all the logs 2019-10-25 14:58:23 +02:00
Sylvain Joubert
3300070cc2 ccmake: Display an ASCII progress bar in the status bar
The status bar is now only used to display the progress.
The status log are not shown anymore since for the most cases they went
by too quickly to be read. As for cases when a process is long enough
to display and read a log, it would probably be a previous unrelated
message.
2019-10-25 14:58:23 +02:00
Brad King
0bf7a93f91 Merge topic 'ccmake-clear-help'
9276beae5e ccmake: Fully clear the 1st help line when processing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3937
2019-10-21 11:29:12 -04:00
Sylvain Joubert
9276beae5e ccmake: Fully clear the 1st help line when processing 2019-10-20 14:25:05 +02:00
Brad King
b7509dd674 Add option to configure Ninja link job pool for CMake's own binaries
Create an undocumented `CMake_JOB_POOL_LINK_BIN` option that builders
can set to avoid linking too many of our binaries at once.
2019-10-10 13:28:45 -04:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Tushar Maheshwari
7d6e08b438 cmCursesMainForm: change Entries to object vector
- Add move constructor and move assignment operator for
`cmCursesCacheEntryComposite`.
- Transfer ownership of Entries objects to std::vector.
2019-09-27 17:18:16 +05:30
Tushar Maheshwari
0833486d62 cmCursesStringWidget: remove manual delete
- Relpace `char*` operations with `std::string`
2019-09-27 17:18:16 +05:30
Tushar Maheshwari
bc71b253cb cmCursesCacheEntryComposite: default destructor 2019-09-26 11:10:22 -04:00
Tushar Maheshwari
36875ff419 cmCursesMainForm: cleanup manual allocation 2019-09-26 11:10:20 -04:00
Tushar Maheshwari
2b16071149 CursesDialog: modernize CMake usage 2019-09-26 13:50:58 +05:30
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Sebastian Holtermann
aaf59120bf Source sweep: Replace cmExpandList with the shorter cmExpandedList
This replaces the code pattern
```
std::vector<std::string> args;
cmExpandList(valueStr, args, ...)
```
with
```
std::vector<std::string> args = cmExpandedList(valueStr, ...)
```
2019-08-23 17:07:49 +02:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Brad King
337be1507d Merge topic 'isolate-declarations'
d331021255 clang-tidy: isolate declarations for readability

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3704
2019-08-22 10:23:34 -04:00
Brad King
bd3f088abe Merge topic 'ccmake-find-system-form-header'
66654135c1 ccmake: Fix form.h include with CMAKE_USE_SYSTEM_FORM

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3683
2019-08-21 11:54:48 -04:00
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Christoph Grüninger
66654135c1 ccmake: Fix form.h include with CMAKE_USE_SYSTEM_FORM
Some distributions have form.h in ncurses/ next to the ncurses.h found
by FindCurses.

Fixes: #19589
2019-08-20 10:45:32 -04:00
Brad King
4aff5a0ffa Merge topic 'ccmake-crash-on-empty-strings-property'
154c5f7949 ccmake: handle cache entries with empty STRINGS property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3678
2019-08-20 08:57:37 -04:00
M Furkan USLU
154c5f7949 ccmake: handle cache entries with empty STRINGS property
Fixes: #19585
2019-08-20 08:48:09 -04:00