Invocations are used to specify the rules for producing a. This example makes use of both add_custom_command andĪdd_custom_target. # first define the executable target as usual add_executable( Foo bar.c ) # then add the custom command to copy it add_custom_command( TARGET Foo POST_BUILD COMMAND $ /doc1.pdf ) Therefore, the values substituted for them know all theĭetails of their evaluation context, including the current buildĬonfiguration and all build properties associated with a target. These are expressions that use the special syntax $Īnd are not evaluated while processing CMake inputįiles, but are instead delayed until generation of the final build These include CMAKE_EXECUTABLE_SUFFIX,ĬMAKE_SHARED_LIBRARY_PREFIX, etc. That are useful for custom commands that need to reference files with The cmake-variables(7) manual lists many variables Number of variables describing the characteristics of the The second tool that CMake provides to address portability issues is a Then use that executable in your custom commands. Use find_program to find an executable (Perl, for example), and To consider portability issues when doing it. You can use any command that you like, though it’s important Of course, CMake doesn’t limit you to using cmake -E in all your customĬommands. Using the CMAKE_COMMAND variable in your CMakeLists files, as The cmake executable can be referenced by Remove files, compare and conditionally copy, time, create symlinks and others. Platform-independent way to perform a few common tasks including copy or The arguments following the -E option indicate what Is passed the -E option, it acts as a general purpose, cross-platform Theįirst is the -E option (short for execute) to There are differences, such as which extensions are used for sharedĬMake provides three main tools for handling these differences. To make matters worse, frequently the names of files For example, copying a file on UNIX isĭone with the cp command, while on Windows it is done with theĬopy command. Even a simple command, such as copying a file, can be tricky CustomĬommands typically involve running programs with files as inputs or Before going into detail on how to use custom commands, we willĭiscuss how to deal with some of their portability issues.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |