Hi all, I'm having trouble creating files using ADD_CUSTOM_COMMAND. Take a look at this CMakeLists.txt:
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Dir_2/file COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Dir_2 COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/Dir_2/file.in ${CMAKE_CURRENT_BINARY_DIR}/Dir_2/file DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Dir_2/file.in) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Dir_1/file COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Dir_1 COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/Dir_1/file.in ${CMAKE_CURRENT_BINARY_DIR}/Dir_1/file DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Dir_1/file.in) ADD_EXECUTABLE( my_exe my_source.cc Dir_1/file ${CMAKE_CURRENT_BINARY_DIR}/Dir_2/file ) If I build in the source directory it works (that meaning that the files are created). When I do it in another directory, only the second one is created but the build succeeds. The file my_source.cc is a dummy file with just an empty main(). I expected that it would fail, since neither ${CMAKE_CURRENT_BINARY_DIR}/Dir_1/file nor ${CMAKE_CURRENT_SOURCE_DIR}/Dir_1/file exist and is not created but there are no complains! If I add a dummy target for each file and then add the dependencies, then it works but I thought that was not the idea. What am I missing? thanks, Javier _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake