View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015856CMakeCMakepublic2015-11-23 13:142016-05-02 08:30
ReporterPeter Wu 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionnot fixable 
PlatformLinuxOSOS Version
Product VersionCMake 3.4 
Target VersionFixed in Version 
Summary0015856: CLEAN_NO_CUSTOM is not supported for the Ninja (and MSVC?) generators
DescriptionThe directory property CLEAN_NO_CUSTOM does not work as advertised for the Ninja generator. The generated outputs are still removed.

Apparently MSVC is also affected[1], but I have not confirmed this.

 https://cmake.org/pipermail/cmake/2011-May/044214.html [^]
Steps To Reproduce# CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(test LANGUAGES)
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1)
add_custom_command(OUTPUT test.txt COMMAND touch test.txt)
add_custom_target(foo ALL DEPENDS test.txt)

# make keeps "test.txt"
(rm -rf m && mkdir $_ && cd $_ && cmake .. && make && make clean && ls)

# ninja removes "test.txt"
(rm -rf n && mkdir $_ && cd $_ && cmake -GNinja .. && ninja && ninja clean && ls)
Additional InformationLacking a per-target option to prevent output removal (bug 0009505), I was trying to implement it as follows:

 - set CLEAN_NO_CUSTOM on the directory to prevent removal of a single source file (generated using the add_custom_commands() command)
 - put all other generated files in ADDITIONAL_MAKE_CLEAN_FILES

except that it does not work due to this bug, the outputs are still removed.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0039906)
Brad King (manager)
2015-11-23 13:45

The CLEAN_NO_CUSTOM property can be implemented for Makefile generators because CMake generates the 'make clean' implementation. For Ninja, VS IDE, and Xcode this is not possible to implement because those underlying build tools do their own clean operations based on all build outputs.

I've updated the documentation accordingly:

 Help: Document CLEAN_NO_CUSTOM as for Makefile generators only
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=15c454fe [^]
(0040967)
Robert Maynard (manager)
2016-05-02 08:30

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-11-23 13:14 Peter Wu New Issue
2015-11-23 13:45 Brad King Note Added: 0039906
2015-11-23 13:45 Brad King Status new => resolved
2015-11-23 13:45 Brad King Resolution open => not fixable
2016-05-02 08:30 Robert Maynard Note Added: 0040967
2016-05-02 08:30 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team