[CMake] make_directory deprecated. What's the correct solution to generate directories at build time now?

Paulo Waelkens paulo.waelkens at gmail.com
Tue Oct 11 18:21:24 EDT 2016


Hello,

to create a cmake directory *at build time* (
http://stackoverflow.com/questions/3702115/creating-a-directory-in-cmake)
you could use

add_custom_target(build-time-make-directory ALL
    COMMAND ${CMAKE_COMMAND} -E make_directory ${directory})

*"make_directory"* is now listed as deprecated in the new cmake
documentation (https://cmake.org/cmake/help/v3.6/command/make_directory.html
).

How exactly could I repeat the original behaviour without using deprecated
functionality?
I understand that I'm supposed to use *file(MAKE_DIRECTORY ${directory})*
somehow, but don't understand how exactly to connect this with COMMAND.

I've tried to use
*COMMAND ${CMAKE_COMMAND} -E file ...       *(definitely wrong, because
cmake.exe -E <command> [args...] does not list "file" as an available
command)
*COMMAND file(MAKE_DIRECTORY ${directory})*   (wrong, again, *'file' is not
recognized as an internal or external command*)

Does anyone know how to do this right? I'll keep using the deprecated stuff
for now, but that's kind of sad.

Thanks for the help! Cheers,
Paulo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161012/ddd47417/attachment.html>


More information about the CMake mailing list