If it is a relative path it will be evaluated with respect to the current output directory, but it may also be an absolute path. The binary_dir specifies the directory in which to place the output files. If it is a relative path it will be evaluated with respect to the current directory (the typical usage), but it may also be an absolute path. The source_dir specifies the directory in which the source CmakeLists.txt and code files are located. It will be built only if the user explicitly builds the target or another target that requires the target depends on it.Īdd a subdirectory to the build. If EXCLUDE_FROM_ALL is given the target will not be built by default. The MACOSX_BUNDLE also allows several variables to be specified: MACOSX_BUNDLE indicates that when build on Mac OSX, executable should be in the bundle form. This variable can be set to the following values: The variable CMAKE_MFC_FLAG be used if the windows app uses MFC. WIN32 indicates that the executable (when compiled on windows) is a windows app (using WinMain) not a console app (using main). The executable will be built from the list of source files specified.Īfter specifying the executable name, WIN32 and/or MACOSX_BUNDLE can be specified. This command adds an executable target to the current directory. Dependencies listed with the DEPENDS argument may reference files and outputs of custom commands created with ADD_CUSTOM_COMMAND.Īdd an executable to the project using the specified source files.ĪDD_EXECUTABLE(exename If COMMENT is set, the value will be displayed as a message before the commands are executed at build time. If WORKING_DIRECTORY is set, then the command will be run in that directory. The command and arguments are optional and if not specified an empty target will be created. If the ALL option is specified it indicates that this target should be added to the default build target so that it will be run every time (the command cannot be called ALL). Use ADD_DEPENDENCIES to add dependencies to or from other targets. By default nothing depends on the custom target. Use ADD_CUSTOM_COMMAND to generate a file with dependencies. The target has no output file and is ALWAYS CONSIDERED OUT OF DATE even if the commands try to create a file with the name of the target. 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.Īdd a target with no output so it will always be built.ĪDD_CUSTOM_TARGET(Name ]Īdds a target with the given name that executes the given commands. The only reason it is an option is to preserve compatibility with older CMake code. In the future VERBATIM may be enabled by default. When VERBATIM is not given the behavior is platform specific. Use of VERBATIM is recommended as it enables correct behavior. Note that one level of escapes is still used by the CMake language processor before ADD_CUSTOM_TARGET even sees the arguments. If VERBATIM is given then all the arguments to the commands will be passed exactly as specified no matter the build tool used. The COMMENT, WORKING_DIRECTORY, and MAIN_DEPENDENCY options are currently ignored when APPEND is given, but may be used in the future. There must have already been a previous call to this command with the same output. If APPEND is specified the COMMAND and DEPENDS option values are appended to the custom command for the first output specified. If WORKING_DIRECTORY is specified the command will be executed in the directory given. For all other generators PRE_BUILD will be treated as PRE_LINK. Note that the PRE_BUILD option is only supported on Visual Studio 7 or later. POST_BUILD - run after the target has been built PRE_BUILD - run before all other dependencies When the command will happen is determined by which of the following is specified: This defines a new command that will be associated with building the specified target. This is useful for performing an operation before or after building the target: The second signature adds a custom command to a target such as a library or executable. The optional ARGS argument is for backward compatibility and will be ignored. If more than one command is specified they will be executed in order. In makefile terms this creates a new target in the following form: Note that MAIN_DEPENDENCY is completely optional and is used as a suggestion to visual studio about where to hang the custom command. The outputs named should be listed as source files in the target for which they are to be generated. This defines a new command that can be executed during the build process. There are two main signatures for ADD_CUSTOM_COMMAND The first signature is for adding a custom command to produce an output.ĪDD_CUSTOM_COMMAND(OUTPUT output1 Add a custom build rule to the generated build system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |