On Thursday 27 August 2009, Michael Wild wrote:
> On 27. Aug, 2009, at 0:58, Swaroop Ramachandra wrote:
> > 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
> > directo
The extra thing that Michael put at the end is probably the key to
everything here. He did an "add_executable" with the output of the custom
command. You either need to have a library or executable or custom target
use the output of your custom command so that it is properly chained with
dependency
You must be doing something wrong. Have a look at this example:
generate.cpp:
-->8--
#include
#include
int main(int argc, char* argv[]) {
if( argc < 2 ) {
std::cerr << "Usage: " << argv[0] << " \n";
}
std::ofstream str(argv[1]);
str << "#include \nint main() {\n";
<<
I did. The same problem persists. Is there a work-around - maybe some other
command that I can use?
2009/8/27 Michael Wild
> David is probably right, that you need to add the dependency on "generate".
> However, only add it's target name to both the COMMAND and DEPENDS
> arguments, CMake should
David is probably right, that you need to add the dependency on
"generate". However, only add it's target name to both the COMMAND and
DEPENDS arguments, CMake should figure this out.
Michael
On 27. Aug, 2009, at 21:31, Swaroop Ramachandra wrote:
Still no luck :( . I really wonder why it is
Still no luck :( . I really wonder why it is trying to execute my "generate"
binary even before it is built. Here are my updated lines of code.
#Trying to compile and run generate.c. generate.c creates a new file
someoutput.txt and copies all data from someinput.txt to someoutput.txt
add_executable
Use full path file names as DEPENDS arguments.
Also: depend on the executable file too so that cmake knows not to try to
run the custom command before the executable is built...
i.e. :
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/server/someinput.txt
${CMAKE_BINARY_DIR}/bin/generate${CMAKE_EXECUTABLE_SUFFI
Hi Michael,
Thanks for your reply. I still have the same problem.
*
*
gmake-3.81[2]: bin/generate: Command not found
lin: gmake-3.81[2]: *** [bin/generate] Error 127
lin: gmake-3.81[1]: *** [CMakeFiles/generate.dir/all] Error 2
Here's my code as is:
#Trying to compile and run generate.c. gener
On 27. Aug, 2009, at 0:58, Swaroop Ramachandra wrote:
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
"
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 writ
10 matches
Mail list logo