[CMake] add_custom_command issue

Surya Kiran Gullapalli suryakiran.gullapalli at gmail.com
Mon Mar 1 04:38:04 EST 2010


>
> you have to tell add_custom_command on what the output depends:
>
> add_custom_command (OUTPUT ${trofile}
>   COMMAND perl trans.pl ${file} -o ${file_tro}
>   DEPENDS ${file}
>  )
>

I'm sorry. I should have been more clearer. I've already done this. But what
I'm getting is the .tro files are generated even when the corresponding
source file doesn't change.

I have some thing like this.

*ForEach (file ${AllFiles})*
*List(APPEND trofiles ${TransOutFile})*
* Add_Custom_Command (*
*      OUTPUT ${TransOutFile}*
*      COMMAND ${PERL_EXECUTABLE}
${CUE_MAKE_DIR}/trcomp.pl${infileModified} -o ${TransOutFile} # this
create .tro file from .cxx/.hxx
file*
*      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}*
*      DEPENDS ${file}*
*      VERBATIM*
*      )*
*End_Loop *
*
*
*  Add_Custom_Command (*
*    OUTPUT ${trxfile}*
*    COMMAND ${PERL_EXECUTABLE} ${CUE_MAKE_DIR}/trlink.pl -o ${trxfile}
${trofiles} // this combines all the .tro files to .trx file.*
*    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}*
*    COMMENT "Creating translation files for ${LibName} module"*
*    DEPENDS ${trofiles}*
*    VERBATIM*
*    )*

*Add_Custom_Target (${TargetName}TrxFile DEPENDS ${trxfile})* # Create
custom target to create .trx file from .tro files.

*Add_Dependencies (${TargetName} ${TargetName}TrxFile)* # the library is now
dependent on the previous custom target.


So when i build the library, these tro files gets generated and subsequently
this .trx file.

I build it again (without modifying any source files)
The library itself does not get built, but this library depends upon trx
file which in turn depend upon .tro files which in turn depends upon the
source files. The source files are not changed and hence i expect the tro
files does not get generated. But they are getting generated.

Am I missing something here ?

Thanks,
Surya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100301/f3befc20/attachment.htm>


More information about the CMake mailing list