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

iosif neitzke iosif.neitzke+cmake at gmail.com
Tue Oct 11 18:57:10 EDT 2016


I think only the cmake script command make_directory is deprecated, not
the cmake command-line tool -E mode make_directory?

On Tue, Oct 11, 2016 at 5:21 PM, Paulo Waelkens
<paulo.waelkens at gmail.com> wrote:
> 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
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list