summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCustomCommandCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-4/+4
| | | | All compilers hosting CMake support the std class.
* Add an option for explicit BYPRODUCTS of custom commands (#14963)Brad King2014-11-141-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+12
| | | | | | 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.
* 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_custom_command: Normalize OUTPUT and DEPENDS paths.Stephen Kelly2014-05-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | While tracing dependencies of a target, cmTargetTraceDependencies follows sources by full path to determine if the source is to be produced by a custom command. Commit 4959f341 (cmSourceFileLocation: Collapse full path for directory comparisons., 2014-03-27) changed the storage of target sources to be in the form of a normalized path instead of an unnormalized path. The path is followed by looking it up in a mapping via cmMakefile::GetSourceFileWithOutput to acquire an appropriate cmSourceFile. The mapping is populated with the OUTPUT components of add_custom_command invocations, however it is populated with unnormalized paths. This means that the tracing logic does not find appropriate cmSourceFiles, and does not generate appropriate build rules for the generated sources. Normalize the paths in the OUTPUT components of add_custom_command to resolve this. The paths in the DEPENDS component of add_custom_command are also not normalized, leading to the same problem again. Normalize the depends paths after generator evaluation and expansion.
* Remove c_str calls when using stream APIs.Stephen Kelly2014-03-111-1/+1
| | | | | Use an ad-hoc clang tool for matching the calls which should be ported.
* Remove some c_str() calls.Stephen Kelly2014-03-111-11/+11
| | | | | | 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.
* add_custom_command: Disallow use of SOURCE signatures.Stephen Kelly2014-02-121-0/+30
| | | | Add CMP0050 to control this behavior.
* Normalize slashes of add_custom_(command|target) DEPENDS (#11973)Brad King2011-03-301-3/+9
| | | | | | | | | | | | | | | | 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/+7
| | | | This also fixes handling of trailing slashes in the directory name.
* Normalize add_custom_command OUTPUT names (#10485)Brad King2010-12-151-0/+1
| | | | | | | | | | | | Previously the OUTPUT arguments of add_custom_command were not slash-normalized but those of add_library and add_executable were. This caused the example add_custom_command(OUTPUT a//b.c ...) add_library(... a//b.c ...) to fail at build time with "no rule to make a/b.c". Fix this and modify the CustomCommand test to try it.
* 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: Remove SKIP_RULE_DEPENDS option from add_custom_command()Brad King2008-06-021-18/+3
| | | | | | | | - Option was recently added but never released. - Custom commands no longer depend on build.make so we do not need the option. - Rule hashes now take care of rebuilding when rules change so the dependency is not needed.
* ENH: Add SKIP_RULE_DEPENDS option for add_custom_command()Brad King2008-05-141-3/+18
| | | | | | - Allows make rules to be created with no dependencies. - Such rules will not re-run even if the commands themselves change. - Useful to create rules that run only if the output is missing.
* ENH: Make add_custom_command interpret relative OUTPUT locations with ↵Brad King2008-01-301-1/+11
| | | | respect to the build tre instead of the source tree. This can greatly simplify user code since generating a file will not need to reference CMAKE_CURRENT_BINARY_DIR. The new behavior is what users expect 99% of the time.
* 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: Added IMPLICIT_DEPENDS option to ADD_CUSTOM_COMMAND. It currently ↵Brad King2007-09-171-0/+52
| | | | works only for Makefile generators. It allows a custom command to have implicit dependencies in the form of C or CXX sources.
* ENH: Added APPEND option to ADD_CUSTOM_COMMAND to allow extra dependencies ↵Brad King2006-10-041-0/+35
| | | | to be connected later. This is useful to create one rule and then have a macro add things to it later. This addresses bug#2151.
* BUG: Fix/cleanup custom commands and custom targets. Make empty comment ↵Brad King2006-09-281-6/+8
| | | | strings work. Fix ZERO_CHECK target always out of date for debugging. Fix Makefile driving of custom commands in a custom target. Fix dependencies on custom targets not in ALL in VS generators.
* ENH: Added VERBATIM option to ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET ↵Brad King2006-09-281-7/+15
| | | | commands. This option enables full escaping of custom command arguments on all platforms. See bug#3786.
* ENH: Added support for multiple outputs generated by a single custom ↵Brad King2006-04-111-31/+39
| | | | command. For Visual Studio generators the native tool provides support. For Xcode and Makefile generators a simple trick is used. The first output is considered primary and has the build rule attached. Other outputs simply depend on the first output with no build rule. During cmake_check_build_system CMake detects when a secondary output is missing and removes the primary output to make sure all outputs are regenerated. This approach always builds the custom command at the right time and only once even during parallel builds.
* ENH: Allow blocking of writing into the source treeAndy Cedilnik2006-03-221-0/+22
|
* STYLE: some m_ to this-> cleanupKen Martin2006-03-151-4/+4
|
* STYLE: Fix some style issuesAndy Cedilnik2006-03-101-5/+7
|
* ENH: fix broken testsBill Hoffman2006-02-081-1/+0
|
* ENH: add working directory supportBill Hoffman2006-02-081-3/+13
|
* ENH: fix for earlier fix on source with relative pathKen Martin2005-08-081-1/+1
|
* BUG: Do not convert SOURCE argument from relative to full path. It breaks ↵Brad King2005-08-081-1/+6
| | | | the old-style SOURCE==TARGET trick and the SOURCE argument is only present for old-style commands anyway. This addresses bug#2120.
* ENH: slightly modified version of Alex's relative path arguments for custom ↵Ken Martin2005-07-081-22/+39
| | | | commands
* ENH: Added check for invalid characters in output name.Brad King2005-03-221-0/+10
|
* ENH: Updated implementation of custom commands. Multiple command lines are ↵Brad King2005-02-221-44/+45
| | | | now supported effectively allowing entire scripts to be written. Also removed extra variable expansions and cleaned up passing of commands through to the generators. The command and individual arguments are now kept separate all the way until the generator writes them out. This cleans up alot of escaping issues.
* ENH: Fix typo: Bug #100 - Spelling correction to an error messageAndy Cedilnik2003-07-291-1/+1
|
* ENH: better error checkingBill Hoffman2003-07-151-0/+8
|
* yikes added new custom command supportKen Martin2003-06-031-12/+57
|
* ENH: Moved ExpandListVariables out of individual commands. Argument ↵Brad King2002-12-111-4/+2
| | | | evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside.
* Add comment support, so that you can see in build process what the custom ↵Andy Cedilnik2002-12-101-8/+12
| | | | command does
* ENH: Added reference to Copyright.txt. Removed old reference to ITK ↵Brad King2002-10-231-4/+4
| | | | copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs.
* remove unused variablesKen Martin2002-09-151-1/+0
|
* ENH: add list expansion backBill Hoffman2002-05-221-2/+4
|
* ENH: backwards compatible for VTK 4.0, add cmake version requiresBill Hoffman2002-04-171-4/+2
|
* ENH: use target as source if source is emptySebastien Barre2002-04-111-8/+12
|
* make sure ; expansion is done in all commandsBill Hoffman2002-03-291-2/+4
|
* ENH: expand variables in arguments before the commands get themBill Hoffman2002-03-051-3/+1
|
* ENH:Updated copyrightWill Schroeder2002-01-211-4/+5
|
* Remove hack.Sebastien Barre2002-01-161-28/+0
|
* Hack to make it work almost like beforeAndy Cedilnik2002-01-161-1/+7
|
* Fix add custom command so that it actually executes the codeAndy Cedilnik2002-01-031-0/+25
|
* SOURCE, COMMAND, TARGET are required nowSebastien Barre2001-11-091-6/+2
|
* Reimplement code. Since a custom command is very flexible and might be ↵Sebastien Barre2001-11-091-44/+95
| | | | extended in the future, make all arguments prefixed with arg type, make ordering irrelevant and potentially all args optional.
* Fix number of params and expand vars in all argsSebastien Barre2001-11-081-10/+25
|