1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-09 15:38:15 +08:00

41 Commits

Author SHA1 Message Date
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Brad King
a429e4b9b1 CYGWIN: Drop pre-2.8.4 compatibility mode CMAKE_LEGACY_CYGWIN_WIN32
Prior to CMake 2.8.4 (released in 2011), we defined `WIN32` on CYGWIN.
That was removed, but an undocumented `CMAKE_LEGACY_CYGWIN_WIN32`
compatibility mode was left to help projects transition.  Only projects
that do not require at least 2.8.4 as their minimum CMake version need
the compatibility mode.  We've also long warned about projects that do
not require at least 2.8.12, so it is now reasonable to remove the
legacy compatibility mode.
2023-01-19 14:29:35 -05:00
Brad King
96ddcbee60 cmState: Clarify name of member tracking the active scope in a directory
The `DirectoryEnd` member added by commit 52dbe654de (cmState: Record
the end position of each directory., 2015-08-01, v3.4.0-rc1~251^2~1)
actually tracks the current top-most scope in a directory's stack.  This
is evidenced by the use case in commit 3f4e5e8c3d (cmState: Return end
snapshot for GetBuildsystemDirectoryParent., 2015-09-01,
v3.4.0-rc1~100^2~1).  Rename the member to `CurrentScope` to clarify
this role.
2022-11-07 14:36:46 -05:00
Cristian Adam
caffb15d09 LINUX: Set CMAKE_HOST_LINUX variable when running on a Linux host
Relates: #23840
2022-09-09 20:10:43 +02:00
Cristian Adam
1ea8b8ed86 BSD: Set CMAKE_HOST_BSD variable on a BSD host
Also the BSD variable will be set in CMake scripting mode (-P).

Relates: #23853
2022-09-06 01:15:44 +02:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Kyle Edwards
ab94c369c9 Refactor: Convert parallel string/backtrace vectors to BT vectors 2021-09-03 09:52:14 -04:00
Marc Chevrier
dc3aa4024e Refactor: Use new SetProperty signatures 2021-08-25 10:09:10 +02:00
Marc Chevrier
e5cd39ca80 cmProp: refactoring: transform alias in class
To handle safely the values used by CMake variables and properties,
introduce the class cmProp as a replacement from the simple pointer
to std::string instance.
2021-08-08 16:19:08 +02:00
Kyle Edwards
ad19da011d Refactor: Add cmSystemTools::GetSystemName()
And use it for CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME.
2021-03-15 14:41:42 -04:00
Brad King
b63f508e4d Merge topic 'GetExecutionListFile-by-ref'
879bd7fd9c cmStateSnapshot: Return const reference from GetExecutionListFile()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5186
2020-09-08 11:18:28 -04:00
Oleksandr Koval
879bd7fd9c cmStateSnapshot: Return const reference from GetExecutionListFile() 2020-09-04 00:17:32 +03:00
Vitaly Stakhovsky
1380b43764 Refactor: Use cmToCStr() 2020-09-03 11:36:54 -04:00
Vitaly Stakhovsky
7156911242 cmIsOn: add overload accepting const std::string* 2020-07-14 08:22:24 -04:00
Brad King
df6b077625 cmake: Remove broken '--warn-unused-vars' option
This option has been broken since commit b9f9915516 (cmMakefile: Remove
VarUsageStack., 2015-05-17, v3.3.0-rc1~52^2).  That commit removed the
check that an initialized variable has actually been used and caused the
option to warn on every variable ever set.  This was not caught by the
test suite because the test for the feature only checked that warnings
appear when needed and not that they do not appear when not needed.

The option was never very practical to use.  Remove it to avoid the
runtime cost of usage tracking and checks for every variable (which we
were doing even when the option was not used).
2020-06-29 17:23:27 -04:00
Brad King
fcea4a3b45 cmStateSnapshot: Invert CanPopPolicyScope return value to match name 2020-06-18 09:52:05 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Vitaly Stakhovsky
60f57d0dcc cmPropertyMap: Introduce cmProp as return type for GetProperty() functions
Currently properties are usually stored internally as `std::string`.
However, family of GetProperty() functions return them as `const char *` using `c_str()`.
The proposed `cmProp`, typedef'ed as `const std::string *` will expose properties
more naturally.
2020-03-13 13:32:17 -04:00
Butta
c5892e484e Android: add support for native compilation, such as with the Termux app
The CMake support for Android assumes cross-compilation using the NDK,
so stub out that Android NDK support and use the Linux support that's
already invoked. Set CMAKE_HOST_SYSTEM_NAME to "Android", rather than
"Linux".

Issue: #19840
2019-10-15 21:13:51 +05:30
Marc Chevrier
c688b401d3 cmstd: Modernize CMake system headers
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones.  For example:

    #include <cm/string_view>

can be used safely for CMake development in place of the `<string_view>`
standard header.

Fixes: #19491
2019-09-20 10:01:37 -04:00
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Regina Pfeifer
d25a5a7ec9 clang-tidy: modernize-use-auto
Set the MinTypeNameLength option to an impossibly high value in order
to limit the diagnostics to iterators.  Leave new expressions and cast
expressions for later.
2019-09-10 22:21:41 +02:00
Regina Pfeifer
d63c1e4e6e clang-tidy: modernize-return-braced-init-list 2019-09-06 22:27:39 +02:00
Sebastian Holtermann
20e580be01 Source sweep: Use cmIsOn instead of cmSystemTools::IsOn
This replaces invocations of

- `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn`
- `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND`
- `cmSystemTools::IsOn` with `cmIsOn`
- `cmSystemTools::IsOff` with `cmIsOff`
2019-08-17 12:14:14 +02:00
Sebastian Holtermann
9b5cc42531 cmDefinitions: Remove const char* based Set method
- Removes `cmDefinitions::Set` method overload that takes a `const char*`
  value argument.
- Updates calls to `cmDefinitions::Set` to use the `cm::string_view` based
  version instead.
2019-07-24 11:11:25 +02:00
Bruno Manganelli
3e867ed400 cmake: inlined files dir constant and removed it from cmake.h 2019-01-21 15:34:16 +00:00
Regina Pfeifer
32cb564bea clang-tidy: Remove redundant member initializations 2018-12-15 10:51:47 +01:00
Brad King
03d40110dc cmStateSnapshot: Add method to get current directory snapshot 2018-12-11 12:50:21 -05: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
Vitaly Stakhovsky
437d0c16c7 cmStateSnapshot::GetDefinition(): Return std::string const*
Expose std::string type used internally in cmDefinitions instead of const char*
2018-09-05 20:08:17 -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
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
jrp2014
acda926a04 Replace some uses of sprintf with std::to_string 2018-04-05 15:34:23 -04:00
Brad King
2d64f9f08d include_regular_expression: Fix propagation to subdirectories
Refactoring in commit v3.4.0-rc1~321^2 (cmMakefile: Remove special
handling of INCLUDE_REGULAR_EXPRESSION, 2015-04-04) accidentally broke
propagation of the include regex to subdirectories.  Refactoring in
commit v3.5.0-rc1~319^2~1 (cmState: Initialize properties immediately,
2015-10-07) moved maintenance of this value from `cmMakefile` to
`cmStateSnapshot`.

Restore propagation of the `INCLUDE_REGULAR_EXPRESSION` to
subdirectories and add a test to cover it.

Fixes: #17676
2018-01-24 08:20:19 -05:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Daniel Pfeifer
b1ec5deaf1 Pass large types by const&, small types by value 2017-06-04 00:48:21 +02:00
Brad King
c1aaf8a61d Fix CMAKE_HOST_SYSTEM_NAME on SunOS
In commit 0bbd993f (Make CMAKE_HOST_SYSTEM_NAME available in scripting
context, 2016-12-26) we added a call to `uname` that checks for a zero
return value.  However, on Solaris the `uname(2)` manual [1] says that
on success a non-negative value is returned.  Fix our return code check
so that we detect the `SunOS` name correctly.

[1] https://docs.oracle.com/cd/E53394_01/html/E54765/uname-2.html
2017-02-27 10:30:45 -05:00
Gregor Jasny
0bbd993f61 Make CMAKE_HOST_SYSTEM_NAME available in scripting context 2017-02-19 19:27:34 +01:00
Daniel Pfeifer
2e620f0b38 Fix several include-what-you-use findings 2016-11-08 09:42:04 -05:00
Stephen Kelly
e0a84904eb cmState: Split auxiliary classes into separate files
Port dependents to the new locations as needed.

Leave behind a cmState.h include in cmListFileCache to reduce noise. It
is removed in a following commit.
2016-10-19 15:40:59 +02:00