[CMake] Remove custom targets

Michael Hertling mhertling at online.de
Tue Jul 5 01:37:34 EDT 2011


On 07/05/2011 01:40 AM, Glenn Coombs wrote:
> If you can modify the subdirectory cmakefiles then maybe you could protect
> the declaration of the uninstall target like this:
> 
> if (NOT TARGET uninstall)
>     add_custom_target(uninstall ...)
> endif()
> 
> That way if the top level cmakefile declares an uninstall target it should
> prevent the subdirectory versions from being declared.
> 
> --
> Glenn

There's also the ALLOW_DUPLICATE_CUSTOM_TARGETS global property,
but this is restricted to Makefile generators only.

Regards,

Michael

> On 4 July 2011 17:33, Joe H <expipiplus1 at gmail.com> wrote:
> 
>> Hi all!
>>
>> I have a project, which pulls in a bunch of sub-projects, using
>> add_subdirectory.
>>
>> The problem is that these projects all create a custom target called
>> uninstall. Obviously, when these projects are pulled together, the uninstall
>> targets clash.
>> An ideal solution would be to ignore the uninstall targets in
>> the subdirectories, and just pay attention to the one at the root. Is this
>> at all possible?
>>
>> Thanks!


More information about the CMake mailing list