@miconda
Does this happen after you have build the `kamailio_docs` target? Doing `make all` and then `make clean` does not clean the README as far as I can see, only if `make kamailio_docs` was previously run. We still don't want that, just want to have this observation noted.
Reading the docs for `CLEAN_NO_CUSTOM`, it seems to work as you want, but it is only available for `Makefiles`.
I would propose, to not break this functionality if one wants to use some other build tool and instead modify the `custom command` to
``` add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/README # Copy the README file to the build directory so that `clean` target will clean the # README file found in build folder. but stiil keep the README file in the # source folder. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.txt ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/README COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.txt ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}/README DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.txt COMMENT "Generating README file for module ${MODULE_NAME}") ```
This would first build the readme doc target, copying the `.txt` into `README` in the build folder, since best practices of cmake expect all generated files to be in the build folder and have that as the output file. Then just also copy to each module's folder and since it's not the output anymore, clean won't do anything to.
Also, the expected behavior of clean is to clean everything, so it makes sense I think to have rebuild the docs fresh!