[CMake] How to determine the current target?

Jeremy Cowgar jeremy at cowgar.com
Thu Apr 9 16:38:58 EDT 2009


Alexander Neundorf wrote:
>
> No, that's wrong in principle.
> In the cmake files there is no current target, they describe all targets.
>
> If you want to do something when some target is built, you have to do this via 
> dependencies, either via add_custom_command() or add_custom_target().
>   

Hm, the reason I want it is because of how I am using CMake and 
triggering a generator. I have to translate .e files (Euphoria) into .c 
files when the source .e files change. Yesterday, Bill Hoffman helped me 
quite a bit with this and I finally got that working. The only problem 
is that we translate 3 main programs, the interpreter, the translator 
and the backend. Each one produces about 115,000 lines of C code and it 
takes ~20 seconds for each target. So, here's what happens... I edit 
common.e which is included in all three programs (interpreter, 
translator and backend). Right now I am working on the interpreter, so I do:

wmake eui  

To rebuild the interpreter. However, CMake now sees that common.e has 
changed, it triggers running cmake.exe to rebuild the makefiles and when 
it does so, all three produces are triggered for a generation because 
common.e has changed. That would be correct if I was building all three 
programs, however, I am only working on the interpreter, I don't want to 
wait an extra 40 seconds to translate the backend and translator when I 
am not working on it. Now, wmake eui only compiles the interpreter 
source files, but the translation is time consuming (considering you 
edit, compile, edit compile, etc...).

Some how I would like to realize that they want to build the interpreter 
only, don't worry about re-translating the translator and backend right now.

You can see my two main CMake files in : 
http://rapideuphoria.svn.sourceforge.net/viewvc/rapideuphoria/trunk/source/ 
to see how I am doing this currently. I just can't figure out how to not 
re-translate the other programs that I really don't care about right now.

Thanks for any help,

Jeremy



More information about the CMake mailing list