[CMake] check directory existence in add_custom_command

Yifei Li yifli at mtu.edu
Tue Sep 6 23:00:18 EDT 2011



On Sep 6, 2011, at 9:29 PM, David Cole wrote:

> On Tue, Sep 6, 2011 at 8:48 PM, Yifei Li <yifli at mtu.edu> wrote:
>> 
>> Hi all,
>> 
>> I'm developing on Mac using Xcode, and I need to create a directory in 'Debug':  add_custom_command(TARGET target POST_BUILD ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/MyDir)
>> 
>> How do I test the existence of 'MyDir' before creating it? Can I put 'if (exists MyDir)' before make_directory?
>> 
> 
> Why do you need to check its existence first? Calling make_directory
> is a no-op if the directory already exists…
Thanks!  I did not know that
> 
> 
>> Thanks
>> 
>> Yifei
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>> 



More information about the CMake mailing list