diff --git a/cmake/modules/SwiftAddCustomCommandTarget.cmake b/cmake/modules/SwiftAddCustomCommandTarget.cmake index 17ce9598e0d6d..5ac6ca6091631 100644 --- a/cmake/modules/SwiftAddCustomCommandTarget.cmake +++ b/cmake/modules/SwiftAddCustomCommandTarget.cmake @@ -120,15 +120,9 @@ function(add_custom_command_target dependency_out_var_name) set(ACCT_COMMANDS ${ACCT_UNPARSED_ARGUMENTS}) if("${ACCT_CUSTOM_TARGET_NAME}" STREQUAL "") - # Construct a unique name for the custom target. - # Use a hash so that the file name does not push the OS limits for filename - # length. + # CMake doesn't allow '/' characters in filenames, so replace them with '-' list(GET ACCT_OUTPUT 0 output_filename) - string(MD5 target_md5 - "add_custom_command_target${CMAKE_CURRENT_BINARY_DIR}/${output_filename}") - get_filename_component(output_filename_basename "${output_filename}" NAME) - set(target_name - "add_custom_command_target-${target_md5}-${output_filename_basename}") + string(REPLACE "/" "-" target_name "${output_filename}") else() set(target_name "${ACCT_CUSTOM_TARGET_NAME}") endif()