Discussion:
[CMake] make_directory deprecated. What's the correct solution to generate directories at build time now?
Paulo Waelkens
2016-10-11 22:21:24 UTC
Permalink
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
Paulo Waelkens
2016-10-14 09:08:16 UTC
Permalink
You are right!

The documentation quick search for the "make_directory" keyword does not
find the cmake executable documentation (i.e. the make_directory
command-line tool), only the script command. That tripped me up.
If you manually go to the cmake executable documentation (
https://cmake.org/cmake/help/v3.6/manual/cmake.1.html), you'll find that
"cmake.exe -E make_directory..." is indeed still up to date

Thanks Iosif! Cheers,
Paulo
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
Post by Paulo Waelkens
Hello,
to create a cmake directory at build time
(http://stackoverflow.com/questions/3702115/creating-a-
directory-in-cmake)
Post by Paulo Waelkens
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
Post by Paulo Waelkens
(https://cmake.org/cmake/help/v3.6/command/make_directory.html).
How exactly could I repeat the original behaviour without using
deprecated
Post by Paulo Waelkens
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
Post by Paulo Waelkens
for now, but that's kind of sad.
Thanks for the help! Cheers,
Paulo
--
Powered by www.kitware.com
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
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
http://public.kitware.com/mailman/listinfo/cmake
--
Powered by www.kitware.com
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
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
http://public.kitware.com/mailman/listinfo/cmake
Loading...