[cmake-developers] [CMake 0015856]: CLEAN_NO_CUSTOM is not supported for the Ninja (and MSVC?) generators
Mantis Bug Tracker
mantis at public.kitware.com
Mon Nov 23 13:14:03 EST 2015
The following issue has been SUBMITTED.
======================================================================
https://cmake.org/Bug/view.php?id=15856
======================================================================
Reported By: Peter Wu
Assigned To:
======================================================================
Project: CMake
Issue ID: 15856
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2015-11-23 13:14 EST
Last Modified: 2015-11-23 13:14 EST
======================================================================
Summary: CLEAN_NO_CUSTOM is not supported for the Ninja (and
MSVC?) generators
Description:
The 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 Information:
Lacking a per-target option to prevent output removal (bug
https://cmake.org/Bug/view.php?id=9505), 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.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2015-11-23 13:14 Peter Wu New Issue
======================================================================
More information about the cmake-developers
mailing list