Re: [CMake] generating source files with ADD_CUSTOM_COMMAND

2010-07-01 Thread Hicham Mouline
That must be it, obvious indeed, Thank you, From: David Cole [mailto:david.c...@kitware.com] Sent: 01 July 2010 20:27 To: Hicham Mouline Cc: cmake@cmake.org Subject: Re: [CMake] generating source files with ADD_CUSTOM_COMMAND Did you build yet? Custom commands are executed at

Re: [CMake] generating source files with ADD_CUSTOM_COMMAND

2010-07-01 Thread David Cole
; have the -E. There was no error. > > I traced it and the ADD_CUSTOM_COMMAND was in the trace. > > Is this an indication that line is not executed at all? > > > > *From:* David Cole [mailto:david.c...@kitware.com] > *Sent:* 01 July 2010 19:58 > *To:* Hicham Mouline &

Re: [CMake] generating source files with ADD_CUSTOM_COMMAND

2010-07-01 Thread Hicham Mouline
to:david.c...@kitware.com] Sent: 01 July 2010 19:58 To: Hicham Mouline Cc: cmake@cmake.org Subject: Re: [CMake] generating source files with ADD_CUSTOM_COMMAND I think you mean: ${CMAKE_COMMAND} -E copy src dst You forgot the -E. On Thu, Jul 1, 2010 at 2:38 PM, Hicham Mouline wrote:

Re: [CMake] generating source files with ADD_CUSTOM_COMMAND

2010-07-01 Thread Hicham Mouline
From: David Cole [mailto:david.c...@kitware.com] Sent: 01 July 2010 19:58 To: Hicham Mouline Cc: cmake@cmake.org Subject: Re: [CMake] generating source files with ADD_CUSTOM_COMMAND I think you mean: ${CMAKE_COMMAND} -E copy src dst You forgot the -E. _ I'll try

Re: [CMake] generating source files with ADD_CUSTOM_COMMAND

2010-07-01 Thread David Cole
I think you mean: ${CMAKE_COMMAND} -E copy src dst You forgot the -E. On Thu, Jul 1, 2010 at 2:38 PM, Hicham Mouline wrote: > Hello > > I'm trying to generate source files .cxx and include them in ADD_LIBRARY to > build a static library, according to > > http://www.cmake.org/Wiki/CMake_FAQ#How

[CMake] generating source files with ADD_CUSTOM_COMMAND

2010-07-01 Thread Hicham Mouline
Hello I'm trying to generate source files .cxx and include them in ADD_LIBRARY to build a static library, according to http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_ the_build.3F # # Copy template source files to *.cxx and place them in the build dir # ADD_CUSTOM_CO

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: Yes, that is the only way to make it work right now. It would be nice to be able to add an arbitrary file that cmake would re-run when it changes. Please create a feature request for this. However, for now configure_file input is the only way to get your files in the list

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Jeremy Cowgar wrote: Ah! That caused it to work. I'm terribly sorry about that. Now, I have just one more question, hopefully, about this whole process. parser.e is only one of the files that could possibly trigger a retranslation. The entire list is: SET( EU_CORE_FILES common.e emit.e err

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: This is what you left out ** We have to make sure cmake re-runs when input files to this change, the only way to do that is to use them as an input to cmake # now make parser.e an input to cmake, so that cmake will # re-run when

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
OK, wait, you left something out Here is my original post: # only run if parser.e is newer than source.cmake if(parser.e IS_NEWER_THAN source.cmake) execute_process(COMMAND myparser parser.e --sources sources.cmake) endif() # include source.cmake, this file should set some vars # somet

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: So, you are saying that "${CMAKE_BINARY_DIR}/interpreter/int.cmake" changes and cmake does not re-run? Can you look in CMakeFiles/Makefile.cmake? Should be in your binary tree, and it should have int.cmake as a CMAKE_MAKEFILE_DEPENDS. If you do a make VERBOSE=1 it should

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: If the included file is newer than the last run of cmake, cmake will re-run during make. In your code, it looks like you write two different files: "${CMAKE_SOURCE_DIR}/int.ex" and "${CMAKE_SOURCE_DIR}/interpreter/int.cmake" I don't get it... I don't write int.ex, that

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Bill Hoffman wrote: Jeremy Cowgar wrote: Bill Hoffman wrote: The file that is produced by the execute_process needs to be the one that is included by cmake. The idea was: if( file.cmake does not exist or it is older than eu core files) generate file.cmake include(file.cmake) Bill, the

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Jeremy Cowgar wrote: Bill Hoffman wrote: The file that is produced by the execute_process needs to be the one that is included by cmake. The idea was: if( file.cmake does not exist or it is older than eu core files) generate file.cmake include(file.cmake) Bill, the problem is this sect

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: The file that is produced by the execute_process needs to be the one that is included by cmake. The idea was: if( file.cmake does not exist or it is older than eu core files) generate file.cmake include(file.cmake) Bill, the problem is this section: SET( EU_CORE_UPD

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: The file that is produced by the execute_process needs to be the one that is included by cmake. The idea was: if( file.cmake does not exist or it is older than eu core files) generate file.cmake include(file.cmake) It is included... It's included after the EXECUTE_PR

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Jeremy Cowgar wrote: Bill Hoffman wrote: Jeremy Cowgar wrote: INCLUDE( "${CMAKE_BINARY_DIR}/interpreter/int.cmake" ) So, you are saying that "${CMAKE_BINARY_DIR}/interpreter/int.cmake" changes and cmake does not re-run? Can you look in CMakeFiles/Makefile.cmake? Should be in your binary

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: Jeremy Cowgar wrote: INCLUDE( "${CMAKE_BINARY_DIR}/interpreter/int.cmake" ) So, you are saying that "${CMAKE_BINARY_DIR}/interpreter/int.cmake" changes and cmake does not re-run? Can you look in CMakeFiles/Makefile.cmake? Should be in your binary tree, and it should

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Jeremy Cowgar wrote: INCLUDE( "${CMAKE_BINARY_DIR}/interpreter/int.cmake" ) So, you are saying that "${CMAKE_BINARY_DIR}/interpreter/int.cmake" changes and cmake does not re-run? Can you look in CMakeFiles/Makefile.cmake? Should be in your binary tree, and it should have int.cmake as a C

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
James Bigler wrote: On Wed, Apr 8, 2009 at 1:41 PM, Jeremy Cowgar wrote: Bill Hoffman wrote: I like this solution as well, as you don't have to be running cmake from cmake. It does mean that you have to be able to run the parser at first cmake time. Ok, I have this implemente

Re: [CMake] Generating Source Files

2009-04-08 Thread James Bigler
On Wed, Apr 8, 2009 at 1:41 PM, Jeremy Cowgar wrote: > Bill Hoffman wrote: >> >> I like this solution as well, as you don't have to be running cmake from >> cmake.   It does mean that you have to be able to run the parser at first >> cmake time. > > Ok, I have this implemented now, however, it see

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: I like this solution as well, as you don't have to be running cmake from cmake. It does mean that you have to be able to run the parser at first cmake time. Ok, I have this implemented now, however, it seems that the checks for IS_NEWER and the execute_command does not r

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Jeremy Cowgar wrote: Bill Hoffman wrote: One more option would be to run the parser every time cmake is run. If you had an option to the parser that just spit out the list of files you needed to compile, and it ran relatively fast, you could do this: # only run if parser.e is newer than sou

Re: [CMake] Generating Source Files

2009-04-08 Thread Michael Jackson
Jeremy Cowgar wrote: Bill Hoffman wrote: One more option would be to run the parser every time cmake is run. If you had an option to the parser that just spit out the list of files you needed to compile, and it ran relatively fast, you could do this: # only run if parser.e is newer than sou

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: One more option would be to run the parser every time cmake is run. If you had an option to the parser that just spit out the list of files you needed to compile, and it ran relatively fast, you could do this: # only run if parser.e is newer than source.cmake if(parser.e

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Bill Hoffman wrote: So, you create a custom command that runs your parser and creates a full CMakeLists.txt file to build the output of the parser. Then run ctest --build-and-test on that directory to build the parser output. What is the output of the parser? Is it a program or a library, o

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Bill Hoffman wrote: Jeremy Cowgar wrote: I was hoping to not have to run cmake all the time. I don't want to have to worry if I edit parser.e, and it ads a new .c file to build, if I am compiling that new file or not. 1/2 the time I'll never know if parser.e was updated in such a way. I'm

Re: [CMake] Generating Source Files

2009-04-08 Thread Bill Hoffman
Jeremy Cowgar wrote: I was hoping to not have to run cmake all the time. I don't want to have to worry if I edit parser.e, and it ads a new .c file to build, if I am compiling that new file or not. 1/2 the time I'll never know if parser.e was updated in such a way. I'm beginning to think t

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
James Bigler wrote: By including progname.mak during configure, you tell CMake to reconfigure whenever that file changes. If a user changes parser.e, you will generate all your sources, plus the source list. Running cmake again will cause you to reconfigure. I was hoping to not have to run

Re: [CMake] Generating Source Files

2009-04-08 Thread James Bigler
On Wed, Apr 8, 2009 at 9:05 AM, Jeremy Cowgar wrote: > Jeremy Cowgar wrote: >> >> Bill Hoffman wrote: >>> >>> Jeremy Cowgar wrote: I am confused on how that would help me. The ADD_CUSTOM_COMMAND generates many source files, and it has dependencies, so it does not have to

Re: [CMake] Generating Source Files

2009-04-08 Thread Jeremy Cowgar
Jeremy Cowgar wrote: Bill Hoffman wrote: Jeremy Cowgar wrote: I am confused on how that would help me. The ADD_CUSTOM_COMMAND generates many source files, and it has dependencies, so it does not have to generate source files many times, but sometimes it does. When it does, I need the FILE( GL

Re: [CMake] Generating Source Files

2009-04-05 Thread Bill Hoffman
Jeremy Cowgar wrote: But, that executes each time that we run make, therefore it works great. I am looking for that ability in CMake but am having a hard time. We currently have 3 make files going, one for Unix systems (gcc, make), another for OpenWatcom and another for MSVC. What is happening

Re: [CMake] Generating Source Files

2009-04-04 Thread Jeremy Cowgar
Bill Hoffman wrote: Jeremy Cowgar wrote: I am confused on how that would help me. The ADD_CUSTOM_COMMAND generates many source files, and it has dependencies, so it does not have to generate source files many times, but sometimes it does. When it does, I need the FILE( GLOB .. ) to execute aft

Re: [CMake] Generating Source Files

2009-04-04 Thread Bill Hoffman
Jeremy Cowgar wrote: I am confused on how that would help me. The ADD_CUSTOM_COMMAND generates many source files, and it has dependencies, so it does not have to generate source files many times, but sometimes it does. When it does, I need the FILE( GLOB .. ) to execute after that custom comman

Re: [CMake] Generating Source Files

2009-04-04 Thread Jeremy Cowgar
I am confused on how that would help me. The ADD_CUSTOM_COMMAND generates many source files, and it has dependencies, so it does not have to generate source files many times, but sometimes it does. When it does, I need the FILE( GLOB .. ) to execute after that custom command is run so that the

Re: [CMake] Generating Source Files

2009-04-04 Thread Philip Lowman
You can run a CMake script with add_custom_command() which executes file(blob). Check out the "-P" flag to cmake. On Sat, Apr 4, 2009 at 10:07 AM, Jeremy Cowgar wrote: > Can I trigger the FILE( GLOB .. ) to run right before the executable is > built? Or cause the ADD_CUSTOM_COMMAND to execute t

Re: [CMake] Generating Source Files

2009-04-04 Thread Jeremy Cowgar
Can I trigger the FILE( GLOB .. ) to run right before the executable is built? Or cause the ADD_CUSTOM_COMMAND to execute the FILE( GLOB ... ) after it's done? This has to be able to be solved somehow... Jeremy Jeremy Cowgar wrote: Hello, I use CMake with quite a few simple projects, howeve

Re: [CMake] Generating Source Files

2009-04-03 Thread Jeremy Cowgar
Tyler Roscoe wrote: On Fri, Apr 03, 2009 at 03:48:54PM -0400, Jeremy Cowgar wrote: The problem with this is, it seems that FILE( GLOB .. ) is running before the custom command, thus, the first time I try to build, I get all sorts of linking problems because EU_INTERPRETER_SOURCES is empty.

Re: [CMake] Generating Source Files

2009-04-03 Thread Tyler Roscoe
On Fri, Apr 03, 2009 at 03:48:54PM -0400, Jeremy Cowgar wrote: > The problem with this is, it seems that FILE( GLOB .. ) is running > before the custom command, thus, the first time I try to build, I get > all sorts of linking problems because EU_INTERPRETER_SOURCES is empty. > Now, the next tim

[CMake] Generating Source Files

2009-04-03 Thread Jeremy Cowgar
Hello, I use CMake with quite a few simple projects, however, I am migrating one project that has a few Makefiles for different platforms/compilers. I am running into a problem with a custom command, it's output and how to link against it. Here is the situation. I have 1 file, say parser.e.