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                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to