Commit Graph

171 Commits

Author SHA1 Message Date
Vitaly Stakhovsky
c31b6e616d cmSystemTools: copy file member functions accept std::string params
Cleaned up `c_str()`s.
`cmSystemTools::CopyFileIfDifferent()` removed as redundant.
2019-01-29 10:34:18 -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
Taylor Braun-Jones
a5098cad94 cmake: Add --ignore-eol option to -E compare_files command
Fixes: #13007
2019-01-28 08:24:50 -05:00
Florian Maushart
638667efa2 cmake: cmcmd.cxx fix "The arguments are" comments
Changed "argv" to "args" in comments to match parameter names
2019-01-25 08:21:14 -05:00
Brad King
c18fc30d1a Merge topic 'renamefile-string'
9e5c13738b cmSystemTools::RenameFile: Accepts std::string args

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2842
2019-01-25 08:00:14 -05:00
Brad King
9f84cbd8c3 Merge topic 'error-overloads'
99337d345b cmSystemTools::Error(): new overload accepting std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2845
2019-01-25 07:59:11 -05:00
Vitaly Stakhovsky
99337d345b cmSystemTools::Error(): new overload accepting std::string 2019-01-23 10:19:30 -05:00
Vitaly Stakhovsky
9e5c13738b cmSystemTools::RenameFile: Accepts std::string args 2019-01-22 20:37:59 -05:00
Vitaly Stakhovsky
614876c638 cmLocalUnixMakefileGenerator3: more methods accept std::string 2019-01-22 11:11:13 -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
Sean McBride
b056bc3425 Fix most clang -Wextra-semi-stmt warnings in C++ files
Suppress one in code generated by flex.
2019-01-15 14:09:46 -05:00
Brad King
cd0881be61 IWYU: Update CMake code for IWYU built with Clang 6
IWYU now correctly requires `<utility>` for `std::move`.  It also
requires a container header when used via a range-based for loop.
2019-01-15 10:00:50 -05:00
jasjuang
c834c47dfc cpplint: only print diagnostics to console if there are errors
Fixes: #18781
2019-01-11 12:56:51 -05:00
Isaiah Norton
100366a267 cmake: add error message when '-E touch' fails
Issue: #16526
2018-11-27 16:20:43 -05:00
Cengizhan Pasaoglu
c67ab22cdc Using front() and back() instead of calculations 2018-11-06 21:43:33 +03:00
Brad King
a052479a5c Merge topic 'msvc-custom-rc-mt'
bd9bfc6449 MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}
0033676796 CUDA: Enable RC language on Windows
02f566a559 MSVC: Factor out enable_language(RC) call into helper macro
b601bb6f1c CUDA: Find CMAKE_LINKER on Windows
3eebe28ef4 cmLocalNinjaGenerator: Simplify CreateRulePlaceholderExpander

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2424
2018-11-02 07:57:06 -04:00
Mateusz Zych
bd9bfc6449 MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}
CMake commands vs_link_dll and vs_link_exe, performing linking on MSVC,
are responsible for calling resource compiler and manifest tool.

Before this commit, both of these tools were called directly, with the
expectation that they are available in the `PATH`. This has been fixed
by respecting CMake variables `CMAKE_RC_COMPILER` and `CMAKE_MT`
defining paths to these tools.

Fixes: #17804
2018-10-29 13:40:47 -04:00
Harald Brinkmann
3b80cd77fb Fail the build if cppcheck returns a non-zero exit code
This allows the build failure to be tuned with cppcheck's
options --error-exitcode=<n> and --exitcode-suppressions=<file>.
2018-10-11 07:56:05 -04:00
Jon Chronopoulos
afb7f6e4ff cmake: Add '-E create_symlink' support on Windows
The allows `-E create_symlink` to work on Windows.  It utilizes
`uv_fs_symlink`.  I am still unsure exactly which Windows platforms will
work without requiring Administrator privileges or needing a user/group
with the "Create Symbolic Links" User Rights.  It does work with my
Windows 10 Pro with Developer Mode turned on.  In the test suite check
that the symlink either worked or failed with a permissions error.

Use recent changes in cmSystemTools::FileExists to check that a symlink
is broken.
2018-09-18 11:24:08 -04:00
Vitaly Stakhovsky
6f16be6a62 Remove unnecessary c_str() calls
Use the new IsOn(),IsOff() overloads.
2018-09-05 15:12:57 -04:00
Justin Goshi
7e359823c9 MSVC: Preserve linker output encoding
When using the Ninja or Makefile generator with MSVC on Windows
we invoke the linker through a `cmake -E vs_link_{exe,dll}` wrapper.
Preserve the linker output encoding to match `link.exe` behavior
instead of forcing UTF-8.
2018-08-09 11:06:12 -04:00
Justin Goshi
b7e7718a38 MSVC: Fix manifest resource encoding
When using the Ninja or Makefile generator with MSVC on Windows
we invoke the resource compiler (`rc.exe`) to compile a manifest
resource.  CMake generates the file with UTF-8 encoding so we
need to add a pragma to inform the resource compiler.
2018-08-09 11:03:10 -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
Ilya A. Kriveshko
eaf9f69d41 Fix combined use of compiler launcher with lint tools
When using ccache with clang-tidy, ccache needs to wrap compiler
invocation, rather than cmake invocation.  But it needs to do it without
affecting the command line that iwyu-like tools are receiving.

With this fix, if __run_co_compile is used, compile launcher is passed
using the new --launcher option, but if __run_co_compile is not needed,
compiler launcher is prepended to the command line as before.

To better illustrate the change: with this fix if running clang-tidy
with CXX_COMPILER_LAUNCHER set to "/usr/bin/time;-p;ccache" (time -p
added strictly for illustration purposes), the command line changes
from:

    /usr/bin/time -p ccache cmake -E __run_co_compile \
        --tidy=clang-tidy ... -- g++ ...

to:

    cmake -E __run_co_compile \
        --launcher="/usr/bin/time;-p;ccache" \
        --tidy=clang-tidy ... -- g++ ...

This allows the compiler to be run via the launcher, but leaves tidy
(& friends) invocations unaffected.

Fixes: #16493
2018-02-27 13:07:04 -05:00
Shane Parris
602988e1e5 Adds file(TOUCH) and file(TOUCH_NOCREATE) sub-commands 2018-02-15 10:54:18 -05:00
Pavel Solodovnikov
653b894683 Reduce raw string pointers usage.
* Change some functions to take `std::string` instead of
  `const char*` in the following classes: `cmMakeFile`, `cmake`,
  `cmCoreTryCompile`, `cmSystemTools`,  `cmState`, `cmLocalGenerator`
  and a few others.
* Greatly reduce using of `const char*` overloads for
  `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`.
* Remove many redundant `c_str()` conversions throughout the code.
2018-01-31 18:23:03 +03:00
Wouter Klouwen
e6a80ccfc4 Make use of std::chrono throughout every component
This commit continues the changes made in CTest to support std::chrono
by
applying it throughout every component where a duration was used.

No functional change intended.
2018-01-23 18:56:42 +00:00
Taylor Braun-Jones
73bb781df0 Help: Reword misleading docs for cmake -E time 2018-01-19 16:07:39 -05:00
Brad King
099a4ea50c cmcmd: Fix cmake_symlink_library for inconsistent slashes
With the Ninja generator we may invoke `cmake_symlink_library` with
different slash conventions (`/` versus `\`) for different arguments.
Fix comparison of the paths/names given to tolerate this.

Fixes: #17579
2017-12-20 11:35:09 -05:00
Bill Hoffman
bfcc20343c Update cpplint support to return 0 and mark warnings for CDash.
This commit makes cpplint act like the other compiler mirroring tools. It
will always return 0 even if it reports warnings and will only return non
zero if there is a problem running the command. In addition, it will now
add some extra text to allow CTest to recognize the warnings and report
them correctly to CDash.
2017-12-01 16:23:45 -05:00
Sebastian Holtermann
27ed3b3537 Autogen: Rename cmQtAutoGenerators to cmQtAutoGeneratorMocUic 2017-11-19 12:51:30 +01:00
Sebastian Holtermann
b2a0b549bb Autogen: Introduce standalone RCC generator class
Introduces the standalone RCC generator class `cmQtAutoGeneratorRcc`.

Every instance of `cmQtAutoGeneratorRcc` class handles the
`rcc` invocation for a single `.qrc` file.
The class will be used in the future to allow parallel `.qrc` file
processing by calling `cmake -E cmake_autorcc <INFO_FILE> <CONFIG>`.
2017-11-19 12:51:30 +01:00
Brad King
11e2f53e30 Merge topic 'windows-mt-update-quiet'
5c07d390 cmcmd: Fix typo in RunCommand logic

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1473
2017-11-10 10:41:15 -05:00
Brad King
5c07d3900d cmcmd: Fix typo in RunCommand logic
Fix logic added by commit 18eae3f04d (Windows: Do not report manifest
tool update notification as failure, 2017-11-09).

Issue: #17444
2017-11-10 10:37:26 -05:00
Brad King
6d20c44f3d Merge topic 'windows-mt-update-quiet'
18eae3f0 Windows: Do not report manifest tool update notification as failure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1470
2017-11-10 07:31:55 -05:00
Brad King
18eae3f04d Windows: Do not report manifest tool update notification as failure
A diagnostic message added in commit v3.10.0-rc1~59^2 (Windows: Improve
link-time error messages when rc or mt fail, 2017-09-22) incorrectly
reports the `mt /notify_update` special return code as a failure.
Fix the logic to consider the special return codes as success.

Fixes: #17444
2017-11-09 11:22:00 -05:00
Brad King
197b4e18d4 Merge branch 'backport-fix-co-compile' into fix-co-compile
Resolve a logical conflict by replacing `cmArray{Begin,End}` from
the their side with `cm::{cbegin,cend}` from our side.
2017-10-27 09:31:04 -04:00
Brad King
992962c76d cmcmd: Restore support for running multiple lint tools
Refactoring in commit v3.10.0-rc1~115^2 (Clean up iwyu code to not be
one big if statement, 2017-08-28) incorrectly changed the logic to run
only one lint tool at a time.  Restore support for running all tools
specified on the command-line.
2017-10-27 09:26:50 -04:00
Brad King
a5197eeac7 cmcmd: Convert lint handlers to file-static functions
These do not need to be declared in the header.
2017-10-27 08:36:28 -04:00
Brad King
1c075ffd60 cmcmd: Rename loop iteration variable for clarity 2017-10-27 08:36:28 -04:00
Matthias Maennich
57132765e0 Replace cmArray{Begin,End,Size} by their standard counterparts
std::{begin,end} are part of C++11, std::{cbegin,cend} are part of C++14
and an standard compliant implementation has been introduced within the
'cm' namespace: cm::{cbegin,cend}.

std::size is only part of C++17, hence exposing a compliant implementation
within namespace cm (cm::size).

where possible, the standard implementations are reused.
2017-10-23 17:51:35 +02:00
Matthias Maennich
3345e2a2cc cmcmd: let operator<< for NumberFormatter reset the stream's format flags 2017-10-05 14:50:25 +02:00
Matthias Maennich
79b8c3802a Improve several occurrences of vector::push_back in loops
Fix issues diagnosed by clang-tidy by pre-allocating the vector capacity
before the loop [performance-inefficient-vector-operation].

Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-28 07:23:41 -04:00
Matthias Maennich
f0489856e3 Retire std::auto_ptr and its macro CM_AUTO_PTR
Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-26 00:07:19 +02:00
Jonathan Marler
0a8e23ad6e Windows: Improve link-time error messages when rc or mt fail
We run extra tools during linking on Windows to deal with manifests.
Report more information when these tools fail.  For example, if the
Windows SDK is not installed with VS then `rc.exe` will be missing.
2017-09-22 13:57:08 -04:00
Brad King
706b37b7f5 Enable clang-tidy modernize-loop-convert lint
Fix remaining diagnostics by this lint and remove it from our list of
disabled lints.
2017-09-19 09:32:25 -04:00
Brad King
c0c5f924fe Merge topic 'refactor-iwyu-code'
3bbe95f5 Clean up iwyu code to not be one big if statement.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1247
2017-09-15 08:54:32 -04:00
Bill Hoffman
3bbe95f58a Clean up iwyu code to not be one big if statement.
This commit changes the internal -E__run_iwyu to be -E__run_co_compile. This
is used for co-compile commands. These are tools that want to mirror the
compiler. For each compiler invocation the tool will be invoked first. This
started as a way to implement include what you use (iwyu), but has expanded
to include cpplint, cppcheck and others. Likely there will be more in the
future as well. This commit implements each one in its own function and
provides a way to add additional ones in the future with less work.
2017-09-13 17:44:49 -04: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