[CMake] call already made makefile

Michael Hertling mhertling at online.de
Sat Nov 6 05:30:35 EDT 2010


On 11/06/2010 06:50 AM, SK wrote:
> On Fri, Nov 5, 2010 at 1:04 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
>> I agree the above idea should work, but dropping add_custom_command
>> completely and moving the COMMAND to add_custom_target instead (and
>> dropping all file DEPENDS for the custom target) is even a simpler way
>> to insure COMMAND gets executed every time the custom target is
>> built.
> 
> Yes it always runs, but there is no "output" from add_custom_target.
> When the external makefile produces an output needed by some larger
> dependency chain, then add_custom_command is the only way.

If you want to ensure that an output-producing custom command without
dependencies runs each time its output - present or not - is referred
to you might use a second, say, dummy output which never exists, e.g.:

ADD_CUSTOM_COMMAND(
    OUTPUT <xyz build directory>/libxyz.so dummy
    COMMAND make
    WORKING_DIRECTORY <xyz build directory>
)

Thus, there is no need for a triggering custom target unless the,
say, productive output is referenced from another CMakeLists.txt.

Regards,

Michael


More information about the CMake mailing list