Good day all, It seems that
set_directory_propersties( 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". Is this possibly a CMake bug, or is it rather a misunderstanding on my part? $ cmake --version cmake version 2.6-patch 2 A little test case to illustrate this 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 ---- Any thoughts? Let me know if this is just a misunderstanding, if I should file a bug on this or if more information is needed. Best regards Hugo Heden Stockholm Sweden _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake