[Cmake] Changing the order of entries in the default targets

Alexander Neundorf a.neundorf-work at gmx.net
Thu Sep 2 08:04:29 EDT 2004


> Hi, 
... 
>  pro*c is a precompiler which takes files names <something>.pc and 
> outputs <something>.cpp. 
>  
>  We want to have the pro*c output pre compiled for a shared object to use.

>  We used the following ADD_CUSTOM_COMMAND for it: 
> ADD_CUSTOM_COMMAND( 
>  PRE_BUILD 
>  COMMAND   proc 
>  ARGS      INAME=../../path/to/file.pc CODE=cpp CPP_SUFFIX=cpp 
> SYS_INCLUDE=/usr/include PARSE=NONE 
>  TARGET    <Shared object>) 
 
I had a similar problem. I'm doing the following now: 
 
SET_SOURCE_FILES_PROPERTIES( 
<something.cpp>  
PROPERTIES OBJECT_DEPENDS  
<generated_file.cpp> 
) 
 
ADD_CUSTOM_COMMAND( 
OUTPUT <generated_file.cpp>  
COMMAND proc 
ARGS <all your args> 
DEPENDS <something.pc> 
) 
 
This forces that <something.cpp> is recompiled if <generated_file.cpp>
changes, 
which itself depends on <something.pc>, which is created by the custom
command. 
Maybe you can tweak this so it does what you want. You can also do a lot
with macros 
to, e.g. ${ARGN} is quite cool, multiple dereferencing of list variables,
and other 
funny things :-) 
 
Alex 
 

-- 
Supergünstige DSL-Tarife + WLAN-Router für 0,- EUR*
Jetzt zu GMX wechseln und sparen http://www.gmx.net/de/go/dsl



More information about the Cmake mailing list