168 Commits

Author SHA1 Message Date
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
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
Regina Pfeifer
dfaa87f1b3 cmState: Support BuiltinCommands as free functions 2019-07-22 15:27:56 +02:00
Regina Pfeifer
de77d355ac cmState: Add scripted commands by value 2019-07-21 09:25:32 +02:00
Regina Pfeifer
0101ace131 cmUnexpectedCommand: Replace with lambda expression 2019-07-21 09:25:32 +02:00
Regina Pfeifer
015001aaf1 cmState: Hold commands by value 2019-07-21 09:25:32 +02:00
Marc Chevrier
1591f138f1 modernize: manage cmCommand instances using unique_ptr. 2019-07-14 15:37:30 +02:00
Marc Chevrier
d9b2c7dae2 Introduce memory management helper: cm_memory.hxx 2019-07-14 15:37:30 +02:00
Alex Turbov
5e52de7d57 modermize: replace some raw pointers w/ unique_ptr 2019-06-24 09:36:09 -04:00
Sebastian Holtermann
8d934d861b cmPropertyMap: Make std::map container private 2019-06-08 12:25:35 +02:00
Robert Maynard
616282a5ce CMake: Provide language level compile features lists
Now CMake stores what compile features are associated with each
language level and exposes them as global properties.
2019-03-20 09:10:07 -07:00
Taylor Holberton
198650ae73 set: warn if CACHE type is not recognized 2019-01-30 10:47:24 -05:00
Brad King
68eabb3576 Avoid -Wstring-plus-int warning
In `cmState::GetGlobalProperty` we use a macro to produce a string of
the form ";a;b;c" and want to return "a;b;c" by skipping the leading
";".  Switch from pointer arithmetic to indexing+addressing to silence
the "warning: adding 'int' to a string does not append to the string"
diagnostic from Clang.
2019-01-23 13:17:22 -05:00
Brad King
65a3abf999 Merge topic 'GHS_updates'
21ab58d3f8 GHS: Update test suite
72e0c115b7 GHS: Add Compiler ID detection
436cc5e991 GHS: try_compile() now uses GHS platform variables
4a1ec0de3d GHS: Fix toolset selection
1a66acdef2 GHS: Append ".gpj" to target name when generating build command
0c9e47d7cd GHS: Integrity Application updates
8044318431 GHS: Add support for some of the source file properties
73092b2213 GHS: Add support for object libraries
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2231
2019-01-18 06:58:35 -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
Fred Baksik
436cc5e991 GHS: try_compile() now uses GHS platform variables
-- Forward GHS platform variables to try_compile()
   CMAKE_TRY_COMPILE_PLATFORM_VARIABLES only worked for source signature try_compile()
-- Update tests to no longer add GHS platform variables to try_compile()
-- Avoid linker error in GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt by building library
2019-01-16 10:42:00 -05:00
Regina Pfeifer
b2aa3aedea clang-tidy: Use default member initialization 2018-12-15 10:52:37 +01:00
Cengizhan Pasaoglu
c67ab22cdc Using front() and back() instead of calculations 2018-11-06 21:43:33 +03:00
Brad King
87dfd53b27 Merge topic 'set_directory_properties-script-mode'
50572d638b set_directory_properties: Restore in script mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2544
2018-10-30 11:01:36 -04:00
Brad King
50572d638b set_directory_properties: Restore in script mode
Since commit v3.10.0-rc1~391^2~3 (Add directory property 'LABELS' and
CMAKE_DIRECTORY_LABELS variable, 2017-06-23) this command was
accidentally not allowed in script mode.  It was dropped because
`ctest -S` mode needs to start with CMake's normal script mode and
then replace the `set_directory_properties` implementation.  Restore
the normal `set_directory_properties` in script mode and then add
special logic to replace it in ctest.  Also add a test case.

Fixes: #18523
2018-10-29 11:37:32 -04: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
Marc Chevrier
53ad52d66d LINK_OPTIONS: Add missing initialization actions 2018-09-17 16:42:37 +02:00
Vitaly Stakhovsky
13d10ee616 cmState::GetInitializedCacheValue: Return as const std::string* 2018-09-10 09:31:48 -04:00
Brad King
0aab59809c Merge topic 'gicv-stdstring'
46855d000f cmCacheManager::GetInitializedCacheValue(): Return as const std::string*

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2357
2018-09-10 08:00:41 -04:00
Vitaly Stakhovsky
46855d000f cmCacheManager::GetInitializedCacheValue(): Return as const std::string*
Expose std::string type used internally instead of const char*
2018-09-06 12:49:57 -04: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
Brad King
7b148e7a30 Merge topic 'state-reset-glob'
6f3b9e8b95 cmState: Clear GlobVerificationManager state on Reset

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2278
2018-08-24 13:34:06 -04:00
Shane Parris
6f3b9e8b95 cmState: Clear GlobVerificationManager state on Reset
It should not persist across multiple configure rounds.

Fixes: #18208
2018-08-09 13:03:50 -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
Florian Jacomme
b1a05d6c76 Revise implementation of case-insensitive command names
Store both the as-written and lower-case command names and use
the latter to avoid case-insensitive string comparisons.

With this I obtain 2-6% speed increase (on Windows) for the configure
step with no significant changes in memory usage.  A case-insensitive
comparison is a lot slower than just calling `==` because the operator
will use things like memcmp, so prefer the latter.

The `cmSystemTools::LowerCase` function allocates a new string each time
it is called, so before this change we were allocating in:

* cmMakefile::Configure two times for each function
  (to look for `cmake_minimum_required` and `project`)
* cmMakefile::ExecuteCommand twice by function by calling
  cmState::GetCommand and copying the name

Now we are only allocating once by function instead of four.
2018-05-22 10:56:24 -04:00
Shane Parris
599c93e22d Add cmGlobVerificationManager class, integrate with cmake and cmState 2018-03-29 10:58:03 -04: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
Kyle Edwards
a9c483071e cmCacheManager: Truncate values containing newlines
Fixes #16098.
2018-01-15 09:27:44 -05: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
Daniel Pfeifer
190e3825d4 Replace C-style casts 2017-08-27 09:58:46 +02: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
Daniel Pfeifer
a1218f59d9 cmCommand: remove unused methods from interface and all implementations 2017-05-11 19:49:06 +02:00
Daniel Pfeifer
4ba25a823e cmState: separate builtin and scripted commands 2017-05-11 19:49:06 +02:00
Daniel Pfeifer
a44dab461f cmState: introduce method for adding scripted commands 2017-05-11 19:49:06 +02:00
Daniel Pfeifer
587084052b cmState: introduce methods for adding builtin commands 2017-05-11 19:49:06 +02:00
Daniel Pfeifer
da8faa8c7e cmState: remove RemoveUnscriptableCommands 2017-05-08 22:58:01 +02:00
Daniel Pfeifer
1d829c862c Use quotes for non-system includes
Automate with:

git grep -l '#include <cm_' -- Source \
  | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g'

git grep -l '#include <cmsys/' -- Source \
  | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g'

git grep -l '#include <cm[A-Z]' -- Source \
  | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
2017-04-11 22:35:21 +02:00
Bastien Schatt
38fd5866c0 Add GENERATOR_IS_MULTI_CONFIG global property
Fixes: #16768
2017-04-04 09:49:00 -04:00
Daniel Pfeifer
2988abd939 clang-tidy: apply modernize-use-bool-literals fixes 2016-12-12 14:04:14 -05:00
Daniel Pfeifer
2e620f0b38 Fix several include-what-you-use findings 2016-11-08 09:42:04 -05:00
Daniel Pfeifer
15aa814b85 Remove cmObject.h and cmTypeMacro.h 2016-10-24 21:49:28 +02:00
Daniel Pfeifer
9855ebf11a Make cmCommand not inherit from cmObject 2016-10-23 00:45:08 +02: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
Stephen Kelly
a9bf981a4c cmState: Move Snapshot type to separate namespace
Leave behind a typedef to avoid porting dependent code in this commit.
2016-10-19 15:40:58 +02:00