[Cmake] running another command

Andy Cedilnik andy.cedilnik at kitware.com
Fri Dec 27 08:17:13 EST 2002


Hi Nik,

This looks like the right way of doing this. I would make a small change
though. I would add another custom command that would depend on
element_headers.h. This way the headers will not be regenerated every
time. 

So, does it work?

Once CMake 1.6 is out, you should be able to add source file property on
whatever uses element_headers.h that it depends on that header file. 

			Andy

On Tue, 2002-12-24 at 08:34, Nikhil Kriplani wrote:
> I am new to cmake, and I was having a problem running a shell command during 
> the make process.
> 
> The command I want to run is
> 
> sh mkheaders.sh $(ELEMNAMES).
> What this does is, it generates a file called element_headers.h, which is 
> used by other source files later on during the make process.
> 
> What I tried is:
> 
> ADD_CUSTOM_TARGET(ElementHeaders echo "creating element_headers.h")
> 
> ADD_CUSTOM_COMMAND(
>         SOURCE
>         COMMAND sh
>         ARGS mkheaders.sh
>              ${ELEMNAMES}
>         TARGET ElementHeaders
>         OUTPUTS element_headers.h)
> 
> 
> In the CMakeLists.txt file, I made sure that I use SET(ELEMNAMES 
> source_list) and it shows up correctly in the Makefile generated.
> Also, I was not sure what name to give to TARGET, so I just arbitrarily used 
> ElementHeaders.





More information about the CMake mailing list