View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0008164 | CMake | CMake | public | 2008-11-25 08:39 | 2016-06-10 14:30 | ||||
Reporter | Hugo Heden | ||||||||
Assigned To | Bill Hoffman | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0008164: additional_clean_files not respected if no target present in directory | ||||||||
Description | It seems that set_directory_properties( properties additional_clean_files ... ) is not respected if no target present in the directory -- that is 'make clean' will not remove the specified "additional clean file". | ||||||||
Additional Information | $ cmake --version cmake version 2.6-patch 2 A little test case to illustrate the issue follows. We have two CMakeLists.txt-files, one in the root directory and one in a sub directory. The former (src/CMakeLists.txt) is not really important, but included here for completeness. The latter, src/subdir/CMakeLists.txt, is where the bug appears. There is also a file that is being installed, src/subdir/hello.txt. Invoking 'make clean' will not clean that file unless there is an actual target specified in src/subdir/CMakeLists.txt. File tree:. |-- build |-- install `-- src |-- CMakeLists.txt `-- subdir |-- CMakeLists.txt `-- hello.txt -------------------------------- ------- src/CMakeLists.txt: CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET( CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/../install ) ADD_SUBDIRECTORY( subdir ) ADD_CUSTOM_TARGET( some_target COMMAND ${CMAKE_COMMAND} -E echo HELLO ) -------------------------------- ------- src/subdir/CMakeLists.txt: #ADD_CUSTOM_TARGET( # some_subdir_target # COMMAND ${CMAKE_COMMAND} -E echo WHOHOO #) INSTALL( FILES hello.txt DESTINATION ./ ) SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_INSTALL_PREFIX}/hello.txt ) --------------------------- --------------------------- As written above, with the target "some_subdir_target" commented out, the ADDITIONAL_MAKE_CLEAN_FILES will not be respected - - it seems to be sort of optimized away: $ cd build/ $ cmake ../src ... ... $ make install ... $ ls ../install hello.txt $ make clean $ ls ../install/ hello.txt # <--- OUCH -------------------------------- -------------------------------- However, if the target is not commented out it will all work nicely: -------------------------------- ------- src/subdir/CMakeLists.txt: ADD_CUSTOM_TARGET( some_subdir_target COMMAND ${CMAKE_COMMAND} -E echo WHOHOO ) INSTALL( FILES hello.txt DESTINATION ./ ) SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_INSTALL_PREFIX}/hello.txt ) -------------------------------- -------------------------------- $ cd build/ $ cmake ../src ... ... $ make install ... $ ls ../install hello.txt $ make clean $ ls ../install/ # <no files> -- as expected | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0014211) Hugo Heden (reporter) 2008-11-27 06:53 |
Ok, apparently this behaviour is to be expected. Bill Hoffman explains (on the mailing list, regarding a different matter) [1]: "The concept of a directory property in CMake is not one to one with the disk directories. A directory in CMake is a directory that has a list of targets in it. You can have a target that uses files from all sorts of different directories." Still, (1) It would be nice to be able to specify "additional-clean-files" in *any* CMakeLists.txt (whether it has a target in it or not should not matter) (2) CMake should perhaps report an error when one is trying to set a directory-property for a directory that is not actually a directory in the CMake sense.. [1] http://www.cmake.org/pipermail/cmake/2008-November/025608.html [^] |
(0014733) Hugo Heden (reporter) 2009-01-30 06:32 |
Another way to see this: "A directory in the cmake sense is a directory that has a list of targets in it". Ok, but I would like this list to be instantiated wherever there is a CMakeLists.txt, even if there is zero targets there. So any directory containing a CMakeLists.txt would count as a directory, even if there would be zero targets in it. |
(0041472) Kitware Robot (administrator) 2016-06-10 14:27 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2008-11-25 08:39 | Hugo Heden | New Issue | |
2008-11-27 06:53 | Hugo Heden | Note Added: 0014211 | |
2009-01-30 06:32 | Hugo Heden | Note Added: 0014733 | |
2009-09-14 15:15 | Bill Hoffman | Status | new => assigned |
2009-09-14 15:15 | Bill Hoffman | Assigned To | => Bill Hoffman |
2016-06-10 14:27 | Kitware Robot | Note Added: 0041472 | |
2016-06-10 14:27 | Kitware Robot | Status | assigned => resolved |
2016-06-10 14:27 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:30 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |