[CMake] cmake's REMOVE_RECURSE is not deleting symlinks

Ashok Nalkund ashoknn at qti.qualcomm.com
Wed May 21 02:49:50 EDT 2014


Hi All,
   I have a situation where I need to:
- create some dirs in the build directory
- create symlinks to the above dirs in the source directory

   The creation part works well, I'm using add_custom_command(OUTPUT 
...) and add_custom_target() which depends onthe output of custom 
command. The cmake_clean.cmake is shown below. However, when I run 'make 
clean' which finaly runs 'cmake -P 
CMakeFiles/Test_dirs.dir/cmake_clean.cmake', the first invocation of 
'make clean' only removes the dirs from the build dir. I have to run 
'make clean' a second time to get rid of the symlinks that were created 
in the source dir.

   Does anybody know how to fix the situation, I'd like a single 
invocation of 'make clean' to delete the dirs in the build directory as 
well as the symlinks in the source dir.

TIA,
Ashok

$cat CMakeFiles/Test_dirs.dir/cmake_clean.cmake
FILE(REMOVE_RECURSE
   "CMakeFiles/Test_dirs"
   "/local/mnt/workspace/ashoknn/Test/libs"
   "/local/mnt/workspace/ashoknn/Test/obj"
   "/local/mnt/workspace/ashoknn/Test/bin"
   "/local/mnt/workspace/ashoknn/Test/gen"
   "libs"
   "obj"
   "bin"
   "gen"
)

# Per-language clean rules from dependency scanning.
FOREACH(lang)
   INCLUDE(CMakeFiles/Test_dirs.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)



More information about the CMake mailing list