Commit Graph

41 Commits

Author SHA1 Message Date
Marc Chevrier 45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Ben Boeckel e8efcbec8c iwyu: ignore std::remove_reference requirements
This removes some includes from some existing files.
2023-05-15 22:26:36 -04:00
Marc Chevrier 241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Brad King 7e4a9afa1a cmCMakeHost*Command: Report keyword errors via argument parser results 2022-07-22 10:32:24 -04:00
Brad King 1ee5a4a548 cmArgumentParser: Avoid allocating copies of keyword strings 2022-07-05 16:34:57 -04:00
FeRD (Frank Dana) 98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Marc Chevrier 08941a9a40 cmWindowsRegistry: Add helper for conversion between string and enum View 2022-04-29 16:51:17 +02:00
Marc Chevrier 17ff86547e cmake_host_system_information: query windows registry
Fixes: #21240, #23367
2022-04-13 08:59:08 -04:00
Brad King 44a86d0b38 cmake_host_system_information: Add undocumented VS_MSBUILD_COMMAND key
When using the Visual Studio generator for VS 10 or above,
offer this key to get the location of the MSBuild command
before the first `project()` or `enable_language()` command
has finished running.

This will be needed only by one of our own modules, so leave it
undocumented for now.
2021-10-20 13:00:25 -04:00
Alex Turbov b9698f89df cmake_host_system_information: Make it available for all systems
Before it was Linux only.
2021-08-20 09:35:12 -04:00
Alex Turbov 5469c71a82 Refactor: Simplify GetValue() function calls 2021-08-20 09:35:12 -04:00
Alex Turbov 6c92f80f2e cmake_host_system_information: Also set USED_FALLBACK_SCRIPT
If the OS identification was obtained via fallback script.
2021-08-20 09:35:12 -04:00
Alex Turbov efe139d1b8 cmake_host_system_information: Can run fallback scripts 2021-08-20 09:35:12 -04:00
Alex Turbov 1e65e4a6e5 cmake_host_system_information: Can read /etc/os-release file 2021-08-20 09:35:09 -04:00
Alex Turbov 346f3de005 Refactor: Deduplicate code for VS_nn_DIR keys processing 2021-07-30 03:40:13 +03:00
Alex Turbov f9947ec9e3 Refactor: Use string view 2021-07-30 03:40:12 +03:00
Alex Turbov 69d3fcf2c8 Refactor: bool GetValue(..., string&)optional<string> GetValue(...)
Also, split `GetValue()` into 2 overloads:

- one used to get documented keys
- the other (different signature) to get `VS_nn_DIR` keys
2021-07-30 03:27:16 +03:00
Alex Turbov d6b4982697 Refactor: Move module private functions on top 2021-07-28 04:38:26 +03:00
Alex Turbov d6299d9941 Refactor: Run CPU/OS/Memory tests once on first run 2021-07-28 02:18:24 +03:00
Brad King c46b265839 VS: Add Visual Studio 17 2022 generator
Fixes: #22339
2021-06-25 12:45:44 -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
Regina Pfeifer f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Sebastian Holtermann 3b2b02825d Source sweep: Replace std::ostringstream when used with a single append
This replaces `std::ostringstream`, when it is written to only once.
If the single written argument was numeric, `std::to_string` is used instead.
Otherwise, the single written argument is used directly instead of the
`std::ostringstream::str()` invocation.
2019-08-23 18:52:33 +02:00
Gabor Bencze 413a960391 cmCommand refactor: cmCMakeHostSystemInformationCommand 2019-08-20 14:42:20 -04: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
Brad King 57e48f16f2 VS: Add Visual Studio 16 2019 generator
Add this generator *without* support for specifying the target
architecture in the generator name.  cmake-gui will be taught
to provide a field for this, and command-line builds can use -A.

Also, teach this generator to select a default target architecture
based on the host architecture.

Fixes: #18689
Inspired-by: Egor Pugin <egor.pugin@gmail.com>
2019-01-11 11:04:51 -05:00
Brad King 68d316e0cf VS: Rename VS 2017 generator sources to be version-independent
Rename `cmGlobalVisualStudio{15 => Versioned}Generator`.  Rename
`Factory` to `Factory15` since that part still needs to be
version-specific.
2019-01-11 10:37:39 -05:00
Brad King d8ed309d05 VS: Parameterize cmVSSetupAPIHelper instances with VS version 2019-01-11 10:37:38 -05: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 9ffb35386f VS: Select and save a VS 2017 instance persistently
Visual Studio 2017 supports multiple instances installed on a single
machine.  We use the Visual Studio Installer tool to enumerate instances
and select one.  Once we select an instance for a given build tree, save
the result in `CMAKE_GENERATOR_INSTANCE` so we can re-configure the tree
with the same instance on future re-runs of CMake.

Fixes: #17268
2017-10-19 10:20:12 -04:00
Florian Maushart e7869e80ce cmake_host_system_information: Add more keywords
Extend the `cmake_host_system_information()` command to add processor
identification keywords.
2017-06-05 13:51:30 -04:00
Pavel Solodovnikov 86dc86dd6c Add const-reference qualifications 2017-05-26 19:50:11 +03:00
Brad King cf784d9ff5 Add undocumented CMake language means to find VS 2017
Add a query to the `cmake_host_system_information` command to get
the location of a VS 2017 installation.  Leave it undocumented and
for internal use for now.
2017-03-27 11:43:01 -04:00
Daniel Pfeifer f69e768d94 Separate compilation for commands included in cmCommands 2016-10-21 18:14:50 +02:00
Brad King 86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Daniel Pfeifer 809ca6c81f Use braces around statements 2016-09-16 22:52:02 +02:00
Daniel Pfeifer 24ab29b882 Prefer istringstream and ostringstream over stringstream.
Use istringsream for parsing, ostringstream for generation.
2016-06-14 22:37:36 +02:00
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* 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.
2016-05-16 16:05:19 -04:00
Brad King 6db713c07f Remove use of include <cmsys/ios/*> and cmsys_ios::*
We no longer need this compatibility layer for the compilers we support.
2015-08-20 16:19:08 -04:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Nils Gladitz bb71a3a0df Add cmake_host_system_information command
Expose the internal system information API to the CMake language.  For
example, it is useful to see how much memory the system has available to
estimate an upper limit of tests that can run in parallel.
2013-06-19 08:46:37 -04:00