[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:10:59 EST 2011
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?
-mika
"Rolf Eike Beer" <eike at sf-mail.de>
Sent by: cmake-bounces at cmake.org
08.03.2011 12:53
To
cmake at cmake.org
cc
Subject
Re: [CMake] Run/build custom command/target only when "input" files change
> Hi
>
> I have created a custom command that generates source code for me.
>
> There is a slight annoyance still, the command is excecuted every single
> time i tell the compiler to build.
>
> Can I make it so that it runs the program only when the source file
> changes or the target file doesn't exist?
>
> I looked at the documentation for add_custom_command and
add_custom_target
> but found no direct anwser from either.
>
> I tried using dependencies but nothing came out of that for me.
Then show us some code on how you defined that command.
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/50f645bd/attachment.htm>
More information about the CMake
mailing list