set(CMAKE_POLICY_WARNING_CMP0112 TRUE) enable_language (C) add_executable (exec1 empty.c) add_custom_target(copyFile COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/empty.c" "$/$_e.c" ) add_dependencies(exec1 copyFile)