Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-05 Thread Ajay Panyala
if(${GrammarSource}/test.g IS_NEWER_THAN ${PROJECT_BINARY_DIR}/test.g) ADD_CUSTOM_TARGET(...) ADD_CUSTOM_COMMAND(...) i.e I am totally avoiding the process of rebuilding the test.g file and copying the generated files to build/parser *IF* test.g has not been modified. ...and if

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-04 Thread Michael Hertling
On 03/04/2012 01:06 AM, Ajay Panyala wrote: Please provide a minimal but complete example for this issue. Please find it in the following link http://pastie.org/private/pd13u33s9xpfihf2dbzc1q The following project is a boiled-down version of yours but doesn't need any programs except for

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-04 Thread Ajay Panyala
The following project is a boiled-down version of yours but doesn't need any programs except for CMake - that's what I actually meant with minimal but complete as I don't have the org.antlr.Tool Java program: I am sorry. I was mainly trying to cleanup the big CMakeLists file I had and removed

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-04 Thread Michael Hertling
On 03/04/2012 08:02 PM, Ajay Panyala wrote: The following project is a boiled-down version of yours but doesn't need any programs except for CMake - that's what I actually meant with minimal but complete as I don't have the org.antlr.Tool Java program: I am sorry. I was mainly trying to

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-04 Thread Ajay Panyala
I use cmake version 2.8.3. If I use CMakeLists from your previous reply, it avoids overwriting files when X=0. I have attached the output of your script. It works for my CMakeLists as well now. What I did now is if(${GrammarSource}/test.g IS_NEWER_THAN ${PROJECT_BINARY_DIR}/test.g)

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-04 Thread Michael Hertling
On 03/05/2012 01:59 AM, Ajay Panyala wrote: I use cmake version 2.8.3. If I use CMakeLists from your previous reply, it avoids overwriting files when X=0. I have attached the output of your script. Actually, this is exactly what I was talking about: The second make X=0 invocation rewrites

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-04 Thread Ajay Panyala
So, my question again: What exactly does not work? I.e., does cmake -E copy_if_different - copy a file although the destination exists and has the same content as the source, or Sorry for the confusion. I thought something like the above mentioned happened, but in reality nothing like it

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-03 Thread Hendrik Sattler
Am Samstag, 3. März 2012, 21:41:49 schrieb Ajay Panyala: I have a custom target which runs a command to generate a C source file say test1.c ADD_CUSTOM_TARGET(TestGen ALL COMMAND genExec ${PROJECT_SOURCE_DIR}/Main.java DEPENDS ${PROJECT_SOURCE_DIR}/Main.java ) And I have a custom

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-03 Thread Ajay Panyala
Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be comparing a file with another non-existant file and that

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-03 Thread Michael Hertling
On 03/03/2012 10:36 PM, Ajay Panyala wrote: Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c build/tests/test1.c That would work when make is run atleast once. When running make for the 1st time test1.c was never copied to build/tests before. So I would be

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-03 Thread Ajay Panyala
No, it wouldn't; Thanks. It works now. I might have done something wrong earlier. - Ajay On Sat, Mar 3, 2012 at 2:47 PM, Michael Hertling mhertl...@online.dewrote: On 03/03/2012 10:36 PM, Ajay Panyala wrote: Try cmake -E copy_if_different ... cmake -E copy_if_different build/test1.c

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-03 Thread Ajay Panyala
No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b It works with one file, but I have 4 files that are generated. I have 4 cmake -E copy_if_different

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-03 Thread Michael Hertling
On 03/04/2012 12:14 AM, Ajay Panyala wrote: No, it wouldn't; check it out: % touch a % rm -f b % ls b ls: cannot access b: No such file or directory % cmake -E copy_if_different a b % ls b b % cksum a b 4294967295 0 a 4294967295 0 b It works with one file, but I have 4 files that

Re: [CMake] avoid rebuilding targets depending on generated source files

2012-03-03 Thread Ajay Panyala
Please provide a minimal but complete example for this issue. Please find it in the following link http://pastie.org/private/pd13u33s9xpfihf2dbzc1q Thank You Ajay On Sat, Mar 3, 2012 at 3:54 PM, Michael Hertling mhertl...@online.dewrote: On 03/04/2012 12:14 AM, Ajay Panyala wrote: No, it