2011-11-02 11 views
9

क्या कोई तरीका है कि मैं वीएस -2010 प्रोजेक्ट फ़ाइल जेनरेट करने के लिए सीएमके सेट कर सकता हूं जिसमें प्री बिल्ड या पोस्ट बिल्ड इवेंट है?वीएम 2010 परियोजना कस्टम बिल्डिंग घटनाओं को जोड़ने के लिए

धन्यवाद।

उत्तर

14

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. 

उदाहरण के लिए, यदि आपका लक्ष्य MyProject नाम पर है और आप इमारत के बाद तर्क -1 -2 साथ आदेश SomeCommand चलाना चाहते हैं, निम्न पंक्ति के बाद जोड़ने के अपने add_executable या add_library कॉल, में परिभाषित किया जा सकता है क्योंकि लक्ष्य है:

add_custom_command(TARGET MyProject 
        POST_BUILD 
        COMMAND SomeCommand ARGS "-1 -2" 
        COMMENT "Running SomeCommand") 

मो के लिए https://cmake.org/cmake/help/v2.8.8/cmake.html#command:add_custom_command देखें add_custom_command() का उपयोग करने के तरीके के बारे में विवरण।

+0

बहुत बहुत धन्यवाद ... –

+0

अच्छी तरह से संरचित और पूरी तरह से उपयोगी उत्तर। : डी – MABVT

संबंधित मुद्दे