[cmake-developers] ADDITIONAL_MAKE_CLEAN_FILES only works in Makefile generators / automoc cleaning problem

Brad King brad.king at kitware.com
Tue Apr 30 08:29:14 EDT 2013


On 04/29/2013 05:44 PM, Alexander Neundorf wrote:
> On Monday 29 April 2013, Brad King wrote:
>> VS needs to know that the file is the output of a custom command.
>> In order for CMake to tell VS about this, the file needs to be
>> listed as an OUTPUT in add_custom_command.
> 
> This is now in the AutomocFixCleaningHandling branch.
> It would be nice if you could have a look at it.

The AddCustomCommandToOutput is okay but there is nothing that
associates that output with the target.  You should continue to use
AddUtilityCommand but with an empty command line.  Instead list the
AddCustomCommandToOutput output in the "depends" list.

However, there is another problem to consider.

Look just above your patch.  In VS generators we now use a PRE_BUILD
event instead of a normal custom command with an output.  This was
originally motivated by issue

 http://www.cmake.org/Bug/view.php?id=13900

but makes much nicer looking VS solutions anyway.  Unfortunately the
PRE_BUILD event has no "output" to clean so VS will not clean anything.

Perhaps instead we can implement ADDITIONAL_MAKE_CLEAN_FILES, at least
in VS >= 10.  See the BeforeClean and AfterClean targets here:

 http://msdn.microsoft.com/en-us/library/ms366724.aspx

-Brad



More information about the cmake-developers mailing list