MantisBT - CMake
View Issue Details
0007218CMakeCMakepublic2008-06-20 08:252016-06-10 14:30
Nils Gladitz 
Brad King 
normalminoralways
closedmoved 
CMake-2-6 
 
0007218: add_custom_command output file's folder not created by nmake makefile
When generating vs2005 project files output directories are created when using add_custom_command. When using the nmake generator output directories are not created from within the generated makefiles.
No tags attached.
Issue History
2008-06-20 08:25Nils GladitzNew Issue
2008-06-20 08:37Bill HoffmanNote Added: 0012429
2008-06-20 08:37Bill HoffmanStatusnew => assigned
2008-06-20 08:37Bill HoffmanAssigned To => Bill Hoffman
2008-06-20 09:21Nils GladitzNote Added: 0012433
2008-06-20 09:27Bill HoffmanNote Added: 0012434
2008-09-11 12:01Bill HoffmanAssigned ToBill Hoffman => Brad King
2012-08-13 10:37Brad KingStatusassigned => backlog
2012-08-13 10:37Brad KingNote Added: 0030524
2016-06-10 14:27Kitware RobotNote Added: 0041432
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0012429)
Bill Hoffman   
2008-06-20 08:37   
Can you give an example of this?
(0012433)
Nils Gladitz   
2008-06-20 09:21   
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foo/test.txt
    COMMAND cp ARGS ${CMAKE_CURRENT_SOURCE_DIR}/bar.txt ${CMAKE_CURRENT_BINARY_DIR}/foo/test.txt
    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/bar.txt
)

add_custom_target(data ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/foo/test.txt)

This is a condensed/modified example of what I was doing.

The source directory contains a file bar.txt.

My custom command takes bar.txt from the source directory and generates test.txt in the ${CMAKE_CURRENT_BINARY_DIR}/foo directory.

When using the MSVC2005 generator the ${CMAKE_CURRENT_BINARY_DIR}/foo directory is created prior to the custom command being executed.

When using the NMake Makefiles generator the ${CMAKE_CURRENT_BINARY_DIR}/foo directory is not created and the command fails (can't create a file in a non existing directory).
(0012434)
Bill Hoffman   
2008-06-20 09:27   
OK, visual studio must be doing this for us. You could use the file(MAKE_DIRECTORY [directory1 directory2 ...]) during cmake time to create the directory.
(0030524)
Brad King   
2012-08-13 10:37   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041432)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.