2009/6/19 Tyler Roscoe <[email protected]>:
> On Fri, Jun 19, 2009 at 06:10:16PM +0200, pjtr hahn wrote:
>> # generate source file
>> add_custom_command( OUTPUT __phony_target_name
>> COMMAND some_command_to_generate
>> ARGS -o __my_outfile.cpp
>> ....
>> )
>
> Why don't you just do OUTPUT __my_outfile.cpp? That's what OUTPUT is for
> -- to tell CMake which custom_command generates the file you need.
I did not add __my_outfile.cpp to OUTPUT because I don't want it to
get recompiled at every build but just if it has been really
regenerated.
Therefor I made the custom command PHONY and made the PHONY target a
dependency of __my_outfile.cpp through the OBJECT_DEPENDS property.
This way the command is run at every build, but since the command
itself may or may not change __my_outfile.cpp I don't added
__my_outfile.cpp as OUTPUT.
For __my_outfile.cpp I would like to have the standard behaviour of
only recompile it if it was really touched.
> What is ${__phony_target}? Is it just __phony_target_name?
Yes. Sorry for the typo.
> What is that OBJECT_DEPENDS line trying to accomplish?
It's purpose is to make __my_outfile.cpp depend on __phony_target_name
without forcing it to get recompiled althought it didn't changed.
pjtr
_______________________________________________
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