C'è un modo per impostare CMake per generare un file di progetto VS2010 che contiene eventi Pre Build o Post Build?Cmake per aggiungere VS2010 Project Custom Build Events
Grazie.
C'è un modo per impostare CMake per generare un file di progetto VS2010 che contiene eventi Pre Build o Post Build?Cmake per aggiungere VS2010 Project Custom Build Events
Grazie.
Dalla documentazione CMake:
add_custom_command(TARGET target
PRE_BUILD | PRE_LINK | POST_BUILD`
COMMAND command1 [ARGS] [args1...]
[COMMAND command2 [ARGS] [args2...] ...]
[WORKING_DIRECTORY dir]
[COMMENT comment] [VERBATIM])
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:
PRE_BUILD - run before all other dependencies
PRE_LINK - run after other dependencies
POST_BUILD - run after the target has been built
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.
Per esempio, se il vostro obiettivo è chiamato MyProject
e si desidera eseguire il comando SomeCommand
con l'argomento -1 -2
dopo la costruzione, aggiungere la seguente riga dopo tua add_executable
o add_library
chiamata, perché l'obiettivo è da definire:
add_custom_command(TARGET MyProject
POST_BUILD
COMMAND SomeCommand ARGS "-1 -2"
COMMENT "Running SomeCommand")
Vedi https://cmake.org/cmake/help/v2.8.8/cmake.html#command:add_custom_command per mo re dettagli su come utilizzare add_custom_command()
.
Grazie mille ... –
Risposta ben strutturata e perfettamente utile. : D – MABVT