669 Commits

Author SHA1 Message Date
Gabor Bencze
9413952c42 cmCommand refactor: cmCMakePolicyCommand 2019-08-20 14:42:20 -04:00
Kitware Robot
54e9d38c28 Refactor: Convert all instances of CMAKE_BUILD_WITH_CMAKE to CMAKE_BOOTSTRAP 2019-08-09 10:41:44 -04:00
Regina Pfeifer
6491270e0d cmFunctionBlocker: Move check for matching args 2019-07-31 00:03:17 +02:00
Regina Pfeifer
b51fba6298 cmMakefile: Add OnExecuteCommand callback
In cmCTestScriptHandler, port away from cmFunctionBlocker
and update the elapsed time with the new callback instead.
2019-07-31 00:03:17 +02:00
Kyle Edwards
89dc04af1d Merge topic 'cmStringAlgorithms'
f71f7ce3f0 cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.h

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3618
2019-07-30 10:04:40 -04:00
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
Regina Pfeifer
020478dbea cmMakefile: Keep function blockers in a stack
Highlight the fact that we only ever operate on the top element.
2019-07-27 00:22:15 +02:00
Sebastian Holtermann
e91bfe440c cmMakefile: Let AddDefinition accept a value as cm::string_view
This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value
argument instead of a `const char *`.

Benefits are:
- `std::string` can be passed to `cmMakefile::AddDefinition` directly without
  the `c_str()` plus string length recomputation fallback.
- Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at
  compile time.

In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid
`std::string::c_str` calls and the `std::string` is passed directly.
Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might
be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
2019-07-24 11:11:25 +02:00
Sebastian Holtermann
f2ba968ef2 cmMakefile: Simplify and rename AddDefinitionBool
This simplifies the `cmMakefile::AddDefinition` method with bool value
overload to call the string based `cmMakefile::AddDefinition` method
with either an "ON" or "OFF" string.
Also the method is renamed to `cmMakefile::AddDefinitionBool`
2019-07-24 11:11:25 +02:00
Brad King
573f1fc19b Merge topic 'command-final-action'
732dd344b9 cmCommand: remove FinalPass from interface
fbee46e262 cmVariableWatchCommand: Port away from FinalPass
360d415592 cmLoadCommandCommand: Port away from FinalPass
316e40baec cmInstallProgramsCommand: Port away from FinalPass
7bc88b9165 cmInstallFilesCommand: Port away from FinalPass
6a1a3763ee cmFLTKWrapUICommand: Port away from FinalPass
20169f0b8d cmExportLibraryDependenciesCommand: Port away from FinalPass
a74dad3bd3 cmMakefile: decouple FinalAction from cmCommand
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3562
2019-07-19 12:09:03 -04:00
Daniel Pfeifer
a74dad3bd3 cmMakefile: decouple FinalAction from cmCommand 2019-07-18 11:53:46 +02:00
Sebastian Holtermann
3bed969dac cmMakefile: Modernize AddFunctionBlocker method to accept a std::unique_ptr 2019-07-17 14:58:27 +02:00
Marc Chevrier
1591f138f1 modernize: manage cmCommand instances using unique_ptr. 2019-07-14 15:37:30 +02:00
Brad King
71fbebd1dc IWYU: Fix handling of <memory> standard header
An old workaround for `std::allocator_traits<>::value_type` lints from
IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`.
Convert the workaround to use the same approach we already use for a
workaround of `std::__decay_and_strip<>::::__type` lints.  Then update
the `<memory>` inclusions to follow the now-correct IWYU lints.
2019-07-10 11:48:56 -04:00
Sebastian Holtermann
7b4b61a4d3 cmMakefile: Define cmTargetMap type in cmMakefile instead of cmTarget
The `cmTargetMap` type is only used in the context of `cmMakefile`.
Therefore it is the most appropriate place to declare it.

This moves the `cmTarget.h/cmTargets` type definition to
`cmMakefile::cmTargetMap`.
2019-05-23 13:00:33 +02:00
Rosen Matev
9f76961de8 Support job pools in custom commands and targets
Provide a way for custom commands and targets to set the pool variable
of the ninja build statement. Setting `JOB_POOL` is not compatible with
`USES_TERMINAL`, which implies the `console` pool.

The option is silently ignored with other generators.

Closes: #18483
2019-05-14 15:58:00 +02:00
Sebastian Holtermann
735c6f39d9 Fix invalid ///! doxygen comment line starts
In various places `///!` was used to start a comment line.  This is not valid
Doygen syntax.  This patch replaces `///!` comment starts with `//!`.
2019-03-31 11:27:12 +02:00
Vitaly Stakhovsky
0281f9a4ca cmMakefile::ConfigureFile: Accept std::string parameters 2019-02-18 20:48:19 -05:00
Albert Astals Cid
ae5e97a005 Delete some default constructors and assignment operators
They are unused, but if someone used them they would lead to
problems since they would copy the internal raw pointers
and the destructor would cause double delete
2019-02-15 07:25:47 -05:00
Vitaly Stakhovsky
950c099d83 cmake: Progress functions use std::string param 2019-02-11 10:32:43 -05:00
Vitaly Stakhovsky
00ba28ffd0 cmMakefile::GetRequiredDefinition: return const std::string& 2019-02-07 07:35:16 -05:00
Regina Pfeifer
b05b778a2d clang-tidy: Use = delete 2019-01-29 14:09:21 -05:00
Kyle Edwards
a6982cff0d cmMakefile: Impose maximum recursion limit
In order to keep infinitely-recursive scripts from causing a stack
overflow in the CMake executable, CMake now imposes a maximum
recursion limit before issuing an error message. The limit can be
adjusted at runtime with CMAKE_MAXIMUM_RECURSION_DEPTH.

Fixes: #18694
2019-01-23 09:52:29 -05:00
Vitaly Stakhovsky
2993fc347a cmMakefile: GetModulesFile() accepts std::string param 2019-01-21 12:56:51 -05:00
Vitaly Stakhovsky
25caf7bafe cmMakefile::ReadListFile() accepts std::string argument
Same for cmMakefile::ReadDependentFile(); some cleanup
2019-01-17 12:36:07 -05:00
Bruno Manganelli
cc2a5261f8 Factor out enum MessageType into dedicated header
Reduce the number of files relying on `cmake.h`.
2019-01-16 08:16:31 -05:00
Artur Ryt
cbf0c0fce4 cmake: Enable --warn-uninitialized inside string(CONFIGURE) and configure_file
Fixes: #18489
2018-12-30 08:31:09 +11:00
Artur Ryt
67ac4ed1dc cmMakefile: Move uninitialized vars logic into MaybeWarnUninitialized() 2018-12-28 15:16:37 +01:00
Artur Ryt
5257af3634 cmMakefile: move common logic to IsProjectFile function 2018-12-28 15:16:37 +01:00
Kyle Edwards
0f5c1b404b find_package(): Add policy to remove the FindQt module
Removing FindQt.cmake gives Qt upstream a path forward to export its
own QtConfig.cmake files which can be found by find_package()
without having to explicitly specify CONFIG. Projects that still
want to use Qt3/4 can call find_package(Qt[34]), include(FindQt),
or add FindQt.cmake to their CMAKE_MODULE_PATH.
2018-11-14 15:05:06 -05:00
R2RT
f92f93467e cmMakefile: Rename SuppressWatches to SuppressSideEffects 2018-11-05 08:29:10 -05:00
Marc Chevrier
f9717725f9 link_directories(): enhance capabilities 2018-09-25 23:59:59 +10:00
Marc Chevrier
a71caab46b LINK_DIRECTORIES: Add new properties and commands
These new capabilities enable to manage link directories

Two new properties:
* target properties: LINK_DIRECTORIES and INTERFACE_LINK_DIRECTORIES

One new command
* target_link_directories(): to populate target properties

Fixes: #17215
2018-09-25 23:59:58 +10:00
Brad King
a8f628c0a4 Merge topic 'getsafedef-stdstring'
f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const&

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2350
2018-09-18 11:18:00 -04:00
Vitaly Stakhovsky
f4ff60a803 cmMakefile: Make GetSafeDefinition return std::string const& 2018-09-18 11:16:46 -04:00
Brad King
a1ad0a699b target_link_libraries: Allow use with targets in other directories
Previously the command did not allow naming targets on the LHS that
were not created in the calling directory.  Lift this restriction to
enable more flexible use by projects.

Targets named on the RHS will need to be looked up during generation in
the scope of the call site rather than the scope of the LHS target.
Introduce an internal syntax in `[INTERFACE_]LINK_LIBRARIES` properties
to specify target names that need to be looked up in a directory other
than that containing the target on which the property is set.  Add
minimal documentation of the syntax to help users that encounter it.

Unfortunately CMake previously did allow such calls in the case that
only `INTERFACE` libraries are specified, but those libraries would be
looked up in the target's directory rather than the caller's.  Add
policy `CMP0079` to enable the new behavior with new lookup scope in a
compatible way.

Fixes: #17943
2018-09-12 13:06:36 -04:00
Vitaly Stakhovsky
4d89830d71 cmMakefile: Make GetRequiredDefinition return std::string
In all cases the return value is converted to std::string anyway.

Also remove unnecessary `c_str()` calls in arguments to
`GetRequiredDefinition`.
2018-09-05 15:15:55 -04:00
Vitaly Stakhovsky
c8fd23ec6f cmMakefile: return directories as const std::string& 2018-08-27 14:07:43 -04:00
Marc Chevrier
c1f5a44b28 LINK_OPTIONS: Add new family of properties
This family enable to manage link flags

Three new properties:
* directory property: LINK_OPTIONS
* target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS

Two new commands
* add_link_options(): to populate directory property
* target_link_options(): to populate target properties

Fixes: #16543
2018-06-06 17:22:39 +02: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
Vitaly Stakhovsky
0c47ed6430 cmMakefile: Convert private helpers to file static functions
The two-argument forms of `AddDefineFlag` and `RemoveDefineFlag`
need no access to `cmMakefile` class members.  They are used only
within the implementation file.
2018-05-01 10:25:49 -04:00
Vitaly Stakhovsky
e13fa223fc cmMakefile: Improve ExpandVariablesInString return type
Return `std::string const&` instead of a `const char*` that points
into a string anyway.  Update call sites accordingly.
2018-05-01 10:24:31 -04:00
Marc Chevrier
cb83314e65 add_compile_definitions: add new command
This command manages preprocessor definitions at directory level and
supports generator expressions.

Fixes: #15374
2018-04-20 09:28:13 -04:00
Brad King
391a5837ee cmake_policy: Add undocumented PARENT_SCOPE option to GET
Policies affecting the behavior of CMake-provided macros and functions
need to be able to get the policy setting as of the call site rather
than the definition site.  Add an undocumented option to do this.
2018-04-18 08:09:56 -04:00
Brad King
7fe580a362 Features: Add infrastructure for C++ 20 language standard
Issue: #17849
2018-03-27 07:40:54 -04:00
Craig Scott
82df2fe17e Merge topic 'policy-version-range'
45408b5ea1 cmake_minimum_required: Optionally set policies with version range
6a41aa2abd cmPolicies: Split parsing and impl of ApplyPolicyVersion
1d00ed7cf7 cmPolicies: Drop unnecessary check from ApplyPolicyVersion
0df559832b cmPolicies: Pass policy version as std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1864
2018-03-22 15:24:49 -04:00
Brad King
45408b5ea1 cmake_minimum_required: Optionally set policies with version range
Teach `cmake_minimum_required` and `cmake_policy(VERSION)` to support a
version range of the form `<min>[...<max>]`.  Define this to mean that
version `<min>` is required, but known policies up to those introduced
by `<max>` will be set to `NEW`.  This will allow projects to easily
specify a range of versions for which they have been updated.
2018-03-21 08:00:28 -04:00
Brad King
0df559832b cmPolicies: Pass policy version as std::string 2018-03-16 12:06:04 -04:00
Brad King
eb35d8884b find_package: Use PackageName_ROOT variables as search prefixes
This feature was originally added by commit v3.9.0-rc1~71^2~2 (find_*:
Add a new PackageRoot search path group, 2017-05-03) and documented by
commit v3.9.0-rc1~71^2 (find_*: Add docs for PackageRoot search path
group, 2017-05-03).  However, we had to disable the feature and remove
the documentation in commit v3.9.1~2^2 (find_*: Disable the PACKAGE_ROOT
search path group for CMake 3.9, 2017-08-08) due to breaking projects
that used `PackageName_ROOT` variables themselves.

Add policy `CMP0074` to restore the `PackageName_ROOT` variable behavior
in a compatible way.  Also revise the stack of root paths to store the
paths themselves rather than the package names.  This way the policy can
be considered at the `find_package` call site instead of individual
`find_` calls inside a find module.

Co-Author: Chuck Atkins <chuck.atkins@kitware.com>
Issue: #17144
2018-03-16 09:19:28 -04:00