summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCustomTargetCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)`
* clang-tidy: isolate declarations for readabilityRegina Pfeifer2019-08-201-1/+2
|
* cmA*Command: Turn into free functionsRegina Pfeifer2019-08-071-23/+19
| | | | Ref: #19499
* Support job pools in custom commands and targetsRosen Matev2019-05-141-1/+13
| | | | | | | | | | 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
* Factor out enum MessageType into dedicated headerBruno Manganelli2019-01-161-4/+4
| | | | Reduce the number of files relying on `cmake.h`.
* add_custom_{command,target}: Fix WORKING_DIRECTORY leading genexBrad King2018-11-031-7/+0
| | | | | | | | | | | Since commit v3.13.0-rc1~39^2 (add_custom_{command,target}: WORKING_DIRECTORY generator expressions, 2018-09-22) the `WORKING_DIRECTORY` option accepts generator expressions. Fix support for the case of a leading generator expression by deferring conversion to an absolute path until after evaluation of the generator expression. Fixes: #18543
* cmMakefile: return directories as const std::string&Vitaly Stakhovsky2018-08-271-1/+1
|
* 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.
* Reduce allocation of temporary values on heap.Pavel Solodovnikov2018-01-261-1/+2
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* server: return whether or not a target is generator providedJustin Goshi2017-11-201-3/+3
| | | | | | Some generators auto-generate targets. For example VS generators create the ALL_BUILD target. Add the ability to mark targets as generator provided and return that info through cmake-server codemodel.
* CMP0037: De-duplicate check and message generationBrad King2017-10-301-30/+4
|
* Use C++11 nullptrDaniel Pfeifer2017-08-241-1/+1
|
* Access string npos without instancePavel Solodovnikov2017-06-011-2/+2
|
* Add const-reference qualificationsPavel Solodovnikov2017-05-261-1/+1
|
* add_custom_{command,target}: Add COMMAND_EXPAND_LISTS optionEd Branch2017-01-141-1/+12
| | | | | | This option allows lists generated by generator expressions to be expanded. Closes: #15935
* clang-tidy: apply performance-faster-string-find fixesDaniel Pfeifer2016-12-121-1/+1
|
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-0/+10
|
* 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 empty method to check for emptynessDaniel Pfeifer2016-09-151-1/+1
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-1/+1
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-103/+62
| | | | | | | | | | | | | 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.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* Port to static cmPolicies API.Stephen Kelly2015-05-041-2/+1
|
* cmMakefile: Rename GetCurrent{Output,Binary}Directory.Stephen Kelly2015-04-201-2/+2
| | | | Match names used in CMake code.
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-3/+3
| | | | All compilers hosting CMake support the std class.
* Add an option for explicit BYPRODUCTS of custom commands (#14963)Brad King2014-11-141-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common idiom in CMake-based build systems is to have custom commands that generate files not listed explicitly as outputs so that these files do not have to be newer than the inputs. The file modification times of such "byproducts" are updated only when their content changes. Then other build rules can depend on the byproducts explicitly so that their dependents rebuild when the content of the original byproducts really does change. This "undeclared byproduct" approach is necessary for Makefile, VS, and Xcode build tools because if a byproduct were listed as an output of a rule then the rule would always rerun when the input is newer than the byproduct but the byproduct may never be updated. Ninja solves this problem by offering a 'restat' feature to check whether an output was really modified after running a rule and tracking the fact that it is up to date separately from its timestamp. However, Ninja also stats all dependencies up front and will only restat files that are listed as outputs of rules with the 'restat' option enabled. Therefore an undeclared byproduct that does not exist at the start of the build will be considered missing and the build will fail even if other dependencies would cause the byproduct to be available before its dependents build. CMake works around this limitation by adding 'phony' build rules for custom command dependencies in the build tree that do not have any explicit specification of what produces them. This is not optimal because it prevents Ninja from reporting an error when an input to a rule really is missing. A better approach is to allow projects to explicitly specify the byproducts of their custom commands so that no phony rules are needed for them. In order to work with the non-Ninja generators, the byproducts must be known separately from the outputs. Add a new "BYPRODUCTS" option to the add_custom_command and add_custom_target commands to specify byproducts explicitly. Teach the Ninja generator to specify byproducts as outputs of the custom commands. In the case of POST_BUILD, PRE_LINK, and PRE_BUILD events on targets that link, the byproducts must be specified as outputs of the link rule that runs the commands. Activate 'restat' for such rules so that Ninja knows it needs to check the byproducts, but not for link rules that have no byproducts.
* Add USES_TERMINAL option for custom commandsPeter Collingbourne2014-11-141-1/+15
| | | | | | Teach the add_custom_command and add_custom_target commands a new USES_TERMINAL option. Use it to tell the generator to give the command direct access to the terminal if possible.
* Rename doing_verbatim to doing_nothingPeter Collingbourne2014-11-141-2/+2
| | | | | We are about to introduce another property here, so give this a better name.
* 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.
* Merge topic 'fix_policy_diagnostics'Brad King2014-04-011-3/+3
|\ | | | | | | | | 77b581c2 Policies: omit warnings about unset policies when they are actually set to NEW
| * Policies: omit warnings about unset policies when they are actually set to NEWNils Gladitz2014-03-311-3/+3
| |
* | Remove some c_str() calls.Stephen Kelly2014-03-111-5/+5
|/ | | | | | 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.
* CMP0037: Extend policy to reserved names and custom targetsNils Gladitz2013-11-191-7/+55
| | | | | | | | Teach add_custom_target to check the policy too. Extend the policy to disallow reserved target names that we use for builtin targets like "all". Extend the RunCMake.CMP0037 test to cover these cases.
* Drop compatibility with CMake < 2.4Brad King2013-10-231-11/+6
| | | | | | | | | | | | Drop all behavior activated by setting CMAKE_BACKWARDS_COMPATIBILITY to a value lower than 2.4, and generate an error when projects or the user attempt to do so. In the error suggest using a CMake 2.8.x release. Teach cmake_minimum_required to warn about projects that do not require at least CMake 2.4. They are not supported by CMake >= 3.0. Replace the documentation of CMAKE_BACKWARDS_COMPATIBILITY with a reference to policy CMP0001.
* Normalize slashes of add_custom_(command|target) DEPENDS (#11973)Brad King2011-03-301-1/+5
| | | | | | | | | | | | | | | | All commands accepting file paths should normalize the slashes so that the string-represented names can be compared reliably. The commands add_library and add_executable have done this for years. We taught add_custom_command to normalize its OUTPUT names in commit a75a0a14 (Normalize add_custom_command OUTPUT names, 2010-12-15). We handled a special case of the DEPENDS option in commit 7befc007 (Handle trailing slashes on add_custom_command DEPENDS, 2011-01-26). Teach both add_custom_command and add_custom_target to normalize slashes of DEPENDS files up front. This approach subsumes the above-mentioned special case so remove the one line added for it but keep its test. Extend the CustomCommand test to check that slash count mismatches between custom command OUTPUT and DEPENDS can still be linked correctly.
* Handle relative WORKING_DIRECTORY in add_custom_(command|target)Brad King2011-01-261-0/+8
| | | | This also fixes handling of trailing slashes in the directory name.
* 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: Allow custom sources in custom targetsBrad King2008-10-091-3/+16
| | | | | | | This adds a SOURCES option to ADD_CUSTOM_TARGET, enabling users to specify extra sources for inclusion in the target. Such sources may not build, but will show up in the IDE project files for convenient editing. See issue #5848.
* COMP: Fix unused parameter warning in cmAddCustomTargetCommand.Brad King2008-03-071-1/+1
|
* ENH: Improve handling of old-style compatibility.Brad King2008-03-071-38/+19
| | | | | | | | | | | | | | | | | | | - Remove CMP_0001 (no slash in target name) and restore old CMAKE_BACKWARDS_COMPATIBILITY check for it - Replace all checks of CMAKE_BACKWARDS_COMPATIBILITY with cmLocalGenerator::NeedBackwardsCompatibility calls - Create new CMP_0001 to determine whether or not CMAKE_BACKWARDS_COMPATIBILITY is used. (old = use, new = ignore) - Show CMAKE_BACKWARDS_COMPATIBILITY in cache only when CMP_0001 is set to OLD or WARN - Update documentation of cmake_policy and cmake_minimum_required to indicate their relationship and the 2.4 version boundary - When no cmake policy version is set in top level makefile implicitly call cmake_policy(VERSION 2.4) which restores CMAKE_BACKWARDS_COMPATIBILITY and other 2.4 compatibility - Fix tests MakeClean and Preprocess to call cmake_policy(VERSION 2.6) because they depend on new policies
* ENH: New format for warning and error messagesBrad King2008-03-071-6/+8
| | | | | | | | | | | | | - Add cmMakefile methods IssueError and IssueWarning - Maintain an explicit call stack in cmMakefile - Include context/call-stack info in messages - Nested errors now unwind the call stack - Use new mechanism for policy warnings and errors - Improve policy error message - Include cmExecutionStatus pointer in call stack so that errors deeper in the C++ stack under a command invocation will become errors for the command
* ENH: fix ICE with gcc in dash8Bill Hoffman2008-03-031-7/+12
|
* COMP: fix compile errors on vs6 and a warningKen Martin2008-03-021-1/+0
|
* COMP: fix some warningsKen Martin2008-03-011-0/+1
|
* ENH: add first cut and policies still need to add the doc supportKen Martin2008-03-011-19/+25
|
* ENH: Add global property ALLOW_DUPLICATE_CUSTOM_TARGETS to help existing ↵Brad King2008-02-141-1/+1
| | | | projects that depend on having duplicate custom targets. It is allowed only for Makefile generators. See bug#6348.
* COMP: Fix shadowed local variable warning.Brad King2008-02-111-0/+2
|
* ENH: Enforce global target name uniqueness.Brad King2008-02-111-0/+8
| | | | | | | | - Error if imported target is involved in conflict - Error for non-imported target conflict unless CMAKE_BACKWARDS_COMPATIBILITY <= 2.4 - Include OUTPUT_NAME property in error message - Update add_executable and add_library command documentation
* ENH: add return and break support to cmake, also change basic command ↵Ken Martin2008-01-231-2/+2
| | | | invocation signature to be able to return extra informaiton via the cmExecutionStatus class
* ENH: some more cleanupKen Martin2007-03-131-3/+3
|