[CMake] Run/build custom command/target only when "input" files change

Mika.Rajala at patria.fi Mika.Rajala at patria.fi
Tue Mar 8 06:36:19 EST 2011


My cmake version is 2.8.4 






"Rolf Eike Beer" <eike at sf-mail.de> 
Sent by: cmake-bounces at cmake.org
08.03.2011 13:21

To
cmake at cmake.org
cc

Subject
Re: [CMake] Run/build custom command/target only when "input" files change






> foreach(in_file ${ARGN})
>
> ....
>
> ADD_CUSTOM_COMMAND(
>         OUTPUT ${IDL_OUTPUT_DIR}/${out_file}.h
>                 ${IDL_OUTPUT_DIR}/${out_file}.tlb
>         DEPENDS ${in_file}
>         COMMAND(${MIDL_EXECUTABLE} ${in_file} <insert other args here>
>         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> )
>
> ....
>
> endforeach()
>
> i'm using this to generate files from IDL files so i can neatly list 
them
> and because there is no way to set the working directory for the midl 
tool
> in cmake
>
> I didn't put the rest of the file here because it's on another computer
> and i had to copy this by writing it.
>
> from what i read in the "Mastering CMake" book, the DEPENDS thing should
> work.
>
> I'v had 2 variations to the value, with absolute path and with relative,
> neither work.
>
> I checked that they were correct by writing the value out with the
> 'message' command and by testing the path printed out.
>
> Did i miss something?

Providing us the CMake version you are using ;) There was some fixes to
that dependencies stuff in 2.8.4 so maybe it would "just work" then?

Eike
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110308/e9d27e1b/attachment.htm>


More information about the CMake mailing list