<html><body>
<h2><a name="section_Commands"/>Commands</h2>
<ul>
<li><a href="#command_add_custom_command"><b><code>add_custom_command</code></b></a></li> <li><a href="#command_add_custom_target"><b><code>add_custom_target</code></b></a><li><a href="#command_while"><b><code>while</code></b></a></li></ul>
<ul>
<li>
<a name="command_add_custom_command"><b><code>add_custom_command</code></b></a>: Add a custom build rule to the generated build system.<br>
<p>There are two main signatures for add_custom_command The first signature is for adding a custom command to produce an
output.<br><pre> add_custom_command(OUTPUT output1 [output2 ...]<br> COMMAND command1 [ARGS] [args1...]<br> [COMMAND command2 [ARGS] [args2...] ...]<br> [MAIN_DEPENDENCY depend]<br> [DEPENDS [depends...]]<br> [IMPLICIT_DEPENDS <lang1> depend1 ...]<br> [WORKING_DIRECTORY dir]<br> [COMMENT comment] [VERBATIM] [APPEND])<br></pre>
<p>This defines a new command that can be executed during the build process. The outputs named should be listed as source files in
the target for which they are to be generated. If an output name is a relative path it will be interpreted relative to the build
tree directory corresponding to the current source directory. Note that MAIN_DEPENDENCY is completely optional and is used as a
suggestion to visual studio about where to hang the custom command. In makefile terms this creates a new target in the following
form:<br><pre> OUTPUT: MAIN_DEPENDENCY DEPENDS<br> COMMAND<br></pre>
<p>If more than one command is specified they will be executed in order. The optional ARGS argument is for backward compatibility
and will be ignored.<br><p>The second signature adds a custom command to a target such as a library or executable. This is useful
for performing an operation before or after building the target. The command becomes part of the target and will only execute when the
target itself is built. If the target is already built, the command will
not execute.<br><pre> add_custom_command(TARGET target<br> PRE_BUILD | PRE_LINK | POST_BUILD<br> COMMAND command1 [ARGS] [args1...]<br> [COMMAND command2 [ARGS] [args2...] ...]<br> [WORKING_DIRECTORY dir]<br> [COMMENT comment] [VERBATIM])<br></pre>
<p>This defines a new command that will be associated with building the specified target. When the command will happen is determined by
which of the following is specified:<br><pre> PRE_BUILD - run before all other dependencies<br> PRE_LINK - run after other dependencies<br> POST_BUILD - run after the target has been built<br></pre>
<p>Note that the PRE_BUILD option is only supported on Visual Studio 7 or later. For all other generators PRE_BUILD will be treated
as PRE_LINK.<br><p>If WORKING_DIRECTORY is specified the command will be executed in the directory given. If COMMENT is set, the
value will be displayed as a message before the commands are executed at build time. If APPEND is specified the COMMAND and
DEPENDS option values are appended to the custom command for the first output specified. There must have already been a previous
call to this command with the same output. The COMMENT, WORKING_DIRECTORY, and MAIN_DEPENDENCY options are currently ignored when
APPEND is given, but may be used in the future.<br><p>If VERBATIM is given then all the arguments to the commands will be passed
exactly as specified no matter the build tool used. Note that one level of escapes is still used by the CMake language processor
before ADD_CUSTOM_TARGET even sees the arguments. Use of VERBATIM is recommended as it enables correct behavior. When VERBATIM
is not given the behavior is platform specific. In the future VERBATIM may be enabled by default. The only reason it is an option
is to preserve compatibility with older CMake code.<br><p>If the output of the custom command is not actually created as a file
on disk it should be marked as SYMBOLIC with SET_SOURCE_FILES_PROPERTIES.<br><p>The IMPLICIT_DEPENDS option requests scanning of
implicit dependencies of an input file. The language given specifies the programming language whose corresponding dependency
scanner should be used. Currently only C and CXX language scanners are supported. Dependencies discovered from the scanning are
added to those of the custom command at build time. Note that the IMPLICIT_DEPENDS option is currently supported only for Makefile
generators and will be ignored by other generators.<br><p>If COMMAND specifies an executable target (created by ADD_EXECUTABLE)
it will automatically be replaced by the location of the executable created at build time. Additionally a target-level dependency
will be added so that the executable target will be built before any target using this custom command. However this does NOT add
a file-level dependency that would cause the custom command to re-run whenever the executable is recompiled.<br><p>If DEPENDS
specifies any target (created by an ADD_* command) a target-level dependency is created to make sure the target is built before
any target using this custom command. Additionally, if the target is an executable or library a file-level dependency is
created to cause the custom command to re-run whenever the target is recompiled.<br>
</li>
</ul>
<h2><a name="section_Copyright"/>Copyright</h2>
<ul>
</ul>
<p>Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
<p>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
<p>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
<p>The names of Kitware, Inc., the Insight Consortium, or the names of any consortium members, or of any contributors, may not be used to endorse or promote products derived from this software without specific prior written permission.
<p>Modified source versions must be plainly marked as such, and must not be misrepresented as being the original software.
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<h2><a name="section_See Also"/>See Also</h2>
<ul>
<li><a href="#command_Home Page"><b><code>Home Page</code></b></a></li> <li><a href="#command_Frequently Asked Questions"><b><code>Frequently Asked Questions</code></b></a></li> <li><a href="#command_Online Documentation"><b><code>Online Documentation</code></b></a></li> <li><a href="#command_Mailing List"><b><code>Mailing List</code></b></a></li></ul>
<p>The following resources are available to get help using CMake:
<ul>
<li>
<a name="command_Home Page"><b><code>Home Page</code></b></a>: <a href="http://www.cmake.org">http://www.cmake.org</a><br>
<p>The primary starting point for learning about CMake.
</li>
<li>
<a name="command_Frequently Asked Questions"><b><code>Frequently Asked Questions</code></b></a>: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<p>A Wiki is provided containing answers to frequently asked questions.
</li>
<li>
<a name="command_Online Documentation"><b><code>Online Documentation</code></b></a>: <a href="http://www.cmake.org/HTML/Documentation.html">http://www.cmake.org/HTML/Documentation.html</a><br>
<p>Links to available documentation may be found on this web page.
</li>
<li>
<a name="command_Mailing List"><b><code>Mailing List</code></b></a>: <a href="http://www.cmake.org/HTML/MailingLists.html">http://www.cmake.org/HTML/MailingLists.html</a><br>
<p>For help and discussion about using cmake, a mailing list is provided at cmake@cmake.org. The list is member-post-only but one may sign up on the CMake web page. Please first read the full documentation at <a href="http://www.cmake.org">http://www.cmake.org</a> before posting questions to the list.
</li>
</ul>
<p>Summary of helpful links:<br><pre> Home: <a href="http://www.cmake.org">http://www.cmake.org</a><br> Docs: <a href="http://www.cmake.org/HTML/Documentation.html">http://www.cmake.org/HTML/Documentation.html</a><br> Mail: <a href="http://www.cmake.org/HTML/MailingLists.html">http://www.cmake.org/HTML/MailingLists.html</a><br> FAQ: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br></pre>
</body></html>