summaryrefslogtreecommitdiffstats
path: root/Source/cmGetPropertyCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Refactor: Use cmStrCat to construct error stringsAsit Dhal2019-09-181-23/+13
| | | | | Replace string construction using std::stringstream with cmStrCat and cmWrap.
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is generated by a python script that uses regular expressions to search for string concatenation patterns of the kind ``` std::string str = <ARG0>; str += <ARG1>; str += <ARG2>; ... ``` and replaces them with a single `cmStrCat` call ``` std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...); ``` If any `<ARGX>` is itself a concatenated string of the kind ``` a + b + c + ...; ``` then `<ARGX>` is split into multiple arguments for the `cmStrCat` call. If there's a sequence of literals in the `<ARGX>`, then all literals in the sequence are concatenated and merged into a single literal argument for the `cmStrCat` call. Single character strings are converted to single char arguments for the `cmStrCat` call. `std::to_string(...)` wrappings are removed from `cmStrCat` arguments, because it supports numeric types as well as string types. `arg.substr(x)` arguments to `cmStrCat` are replaced with `cm::string_view(arg).substr(x)`
* cmCommand_refactor: cmGetPropertyCommandGabor Bencze2019-08-201-112/+184
|
* cmMakefile: Let AddDefinition accept a value as cm::string_viewSebastian Holtermann2019-07-241-2/+2
| | | | | | | | | | | | | | | | 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.
* Factor out enum MessageType into dedicated headerBruno Manganelli2019-01-161-1/+2
| | | | Reduce the number of files relying on `cmake.h`.
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-1/+1
| | | | | | | | | | * 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.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-4/+4
|
* Provide and use CM_FALLTHROUGHDaniel Pfeifer2017-06-031-0/+1
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-1/+12
|
* Merge topic 'clang-tidy'Brad King2016-10-201-1/+1
|\ | | | | | | | | | | effa6c83 fix more issues reported by clang-tidy fb461cac silence selected clang-tidy violations
| * fix more issues reported by clang-tidyDaniel Pfeifer2016-10-201-1/+1
| |
* | cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | | | | | | Include it in dependents which have previously relied on it transitively.
* | cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|/
* cmTarget: Move sanity checks and computed property access to callersStephen Kelly2016-10-161-2/+13
| | | | | | | | | | | | | | | The GetProperty method is now just accessing contained data, meaning it can be implemented in cmState. Remove the cmMakefile context from the signature as a result and remove the overload with the same signature. Add a GetComputedProperty to cmTarget so that templates can be properly instantiated. Otherwise the Commands would need to be able to reach the specializations which are currently in cmTarget.cxx. As a side-effect, the CMP0026 warning now gives a backtrace to the target when issued from a generator expression.
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use CM_NULLPTRDaniel Pfeifer2016-09-161-1/+1
|
* Avoid else after returnDaniel Pfeifer2016-09-161-20/+14
|
* Do not report ALIASED_TARGET as always set (#15783)Gregor Jasny2016-07-161-1/+1
| | | | | | | | | The cmGetPropertyCommand::StoreResult expects NULL for unset properties. Make ALIASED_TARGET align with that expectation. Additional corrections to the unit tests are necessary because get_property removes variables for unset properties (in contrast to get_target_property which stores a -NOTFOUND value).
* Merge branch 'unknown-aliased-target' into compiler-featuresBrad King2016-06-281-6/+5
|\
| * Validate target name in ALIASED_TARGET property getterGregor Jasny2016-06-261-6/+5
| |
* | use CM_NULLPTRDaniel Pfeifer2016-06-281-2/+2
|/
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-199/+128
| | | | | | | | | | | | | 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Remove unused cmLocalGenerator include.Stephen Kelly2015-10-051-1/+0
|
* cmGlobalGenerator: Port Find API to cmMakefile.Stephen Kelly2015-08-071-7/+2
|
* cmMakefile: Move CMP0059 handling to command code.Stephen Kelly2015-06-081-0/+16
| | | | | | | | Don't pay a penalty for it in all GetProperty calls. Additionally, the storage of properties will eventually move to cmState, which should only contain state and not logic for policies like this.
* Constify property definition API.Stephen Kelly2015-06-071-4/+2
|
* Port to cmMakefile::GetGlobalGenerator.Stephen Kelly2015-05-031-2/+1
|
* cmMakefile: Rename GetCurrent{,Source}Directory.Stephen Kelly2015-04-201-1/+1
| | | | Match the names used in cmake code.
* Port Global property interaction to cmState.Stephen Kelly2015-04-151-1/+2
|
* Move property definition to cmState.Stephen Kelly2015-04-131-3/+3
|
* Port to cmState.Stephen Kelly2015-04-131-2/+3
|
* cmCacheManager: Port consumers to non-iterator API.Stephen Kelly2015-04-081-4/+3
| | | | | This simplifies reasoning about the follow-up commit which ports away from cmCacheManager to a class with the same method names.
* Revert topic 'refactor-cache-api'Brad King2015-04-071-3/+4
| | | | | | This topic was never tested without some follow-up commits. The GetCacheEntryValue API returns a pointer to memory freed on return. It will have to be revised along with the rest of the original topic.
* cmCacheManager: Port consumers to non-iterator API.Stephen Kelly2015-04-061-4/+3
| | | | | This simplifies reasoning about the follow-up commit which ports away from cmCacheManager to a class with the same method names.
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-6/+6
| | | | All compilers hosting CMake support the std class.
* strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-1/+1
| | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Add an "installed file" property scopeNils Gladitz2014-05-281-1/+36
| | | | | | | Teach set_property and get_property an "INSTALL" property type to be associated with install-tree file paths. Make the properties available to CPack for use during packaging. Add a "prop_inst" Sphinx domain object type for documentation of such properties.
* cmTarget: Evaluate CMP0026 and CMP0051 in calling contextBrad King2014-05-091-1/+2
| | | | | | | | | | | These policies should be checked at the call site that tries to access the LOCATION or SOURCES property, not the directory scope containing the target. Thread the caller context through cmTarget::GetProperty to use for checking the policy setting and emitting a diagnostic with proper backtrace. Extend the RunCMake.CMP0026 and RunCMake.CMP0051 tests with cross-directory cases.
* Remove some c_str() calls.Stephen Kelly2014-03-111-25/+25
| | | | | | 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.
* stringapi: Use strings in target nameBen Boeckel2014-03-081-1/+1
|
* cmMakefile: make some methods take const std::string& instead of const char*Rolf Eike Beer2014-01-161-3/+3
| | | | | | | | Most callers already have a std::string, on which they called c_str() to pass it into these methods, which internally converted it back to std::string. Pass a std::string directly to these methods now, avoiding all these conversions. Those methods that only pass in a const char* will get the conversion to std::string now only once.
* get_property: Fix testing ALIASED_TARGET target property (#14670)Stephen Kelly2014-01-041-1/+1
| | | | | In the case where the argument is not an ALIAS, the variable should be set to a -NOTFOUND content.
* Add the ALIAS target concept for libraries and executables.Stephen Kelly2013-08-021-0/+12
| | | | | | | | | | | | | | | | | * The ALIAS name must match a validity regex. * Executables and libraries may be aliased. * An ALIAS acts immutable. It can not be used as the lhs of target_link_libraries or other commands. * An ALIAS can be used with add_custom_command, add_custom_target, and add_test in the same way regular targets can. * The target of an ALIAS can be retrieved with the ALIASED_TARGET target property. * An ALIAS does not appear in the generated buildsystem. It is kept separate from cmMakefile::Targets for that reason. * A target may have multiple aliases. * An ALIAS target may not itself have an alias. * An IMPORTED target may not have an alias. * An ALIAS may not be exported or imported.
* Split cmBootstrapCommands.cxx into two sourcesBrad King2013-06-141-0/+3
| | | | | The single translation unit has grown too large for some compilers. Split it into cmBootstrapCommands1.cxx and cmBootstrapCommands2.cxx.
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | This converts the CMake license to a pure 3-clause OSI-approved BSD License. We drop the previous license clause requiring modified versions to be plainly marked. We also update the CMake copyright to cover the full development time range.
* ENH: Teach set/get_property about CACHE propertiesBrad King2009-03-101-1/+26
| | | | | | | | This adds the CACHE option to set_property and get_property commands. This allows full control over cache entry information, so advanced users can tweak their project cache as desired. The set_property command allows only pre-defined CACHE properties to be set since others would not persist anyway.
* BUG: Fix get_property result for bad propertyBrad King2009-03-091-1/+8
| | | | | | | When a property does not exist we are supposed to return an empty value. Previously if a property did not exist we just left the value of the output variable unchanged. This teaches CMake to remove the definition of the output variable in this case.
* ENH: Improve test property speed with a mapBrad King2009-01-051-8/+2
| | | | | | | Previously we stored a vector of tests to preserve their order. Property set/get operations would do a linear search for matching tests. This uses a map to efficiently look up tests while keeping the original order with a vector for test file generation.