Hi, I'm trying to do the following in my CMake file:
1. Generate a "xyz.txt" file 2. Compile a "generate.c" file to give out a "generate" binary in my bin directory. 3. Execute the "generate" binary (The binary just reads contents of "xyz.txt" and creates a copy of "xyz.txt"using read() and write() functions in C) The problem: When I do a fresh build, 1 and 2 succeed. 3 fails with the following error *"bin/generate: Command not found"* However, if I *re-run the build immediately* after, since the "generate" binary is already created, all 3 successfully execute. Here's a snippet of what I have written. ------------ ------------ /*---- Code to generate xyz.txt -- Successfully generated each time------*/ ---------- --------- ADD_EXECUTABLE(generate ${CMAKE_CURRENT_SOURCE_DIR}/server/generate.c) set(GEN ${CMAKE_BINARY_DIR}/bin/generate) ADD_CUSTOM_COMMAND( TARGET generate POST_BUILD COMMAND ${GEN} DEPENDS ${CMAKE_BINARY_DIR}/server/xyz.txt} ) In my ADD_CUSTOM_COMMAND, I have specified POST_BUILD, which I understood to be that the command will be executed only after creation of the "generate" binary. Any help is greatly appreciated. Thank you in advance for your time. Regards, Swaroop
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake