cmake_minimum_required(VERSION 2.8) project(CPack-issue-with-directory-symlink-and-RPM) add_custom_command( OUTPUT subdir-1/foo.txt COMMAND mkdir -p project/subdir-1 && cd project && cmake -E touch subdir-1/foo.txt && ln -sf subdir-1 subdir ) add_custom_target(foo ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir-1/foo.txt) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/project DESTINATION share/test) set(CPACK_PACKAGE_NAME it-will-fail) set(CPACK_GENERATOR "RPM") include(CPack)