[cmake-developers] [CMake 0015655]: file(GENERATE) fails of the destination directory doesn't exist

Mantis Bug Tracker mantis at public.kitware.com
Wed Jul 15 13:42:23 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15655 
====================================================================== 
Reported By:                James Bigler
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15655
Category:                   (No Category)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-07-15 13:42 EDT
Last Modified:              2015-07-15 13:42 EDT
====================================================================== 
Summary:                    file(GENERATE) fails of the destination directory
doesn't exist
Description: 
I wanted to use file(GENERATE) to create some files in an output build
directory, but these directories don't exist at the time of configure and build
so the command fails.  These directories are created during build, though so
CMake knows about them somehow.

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

file(GENERATE OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/test.out
CONTENT "Hello, world")

file(WRITE a.cpp "int main() { return 0; }")
add_executable(a a.cpp)

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-07-15 13:42 James Bigler   New Issue                                    
======================================================================



More information about the cmake-developers mailing list