Skip to content

Commit 370697f

Browse files
author
Chris B
authored
Merge pull request #5182 from llvm-beanz/dont-use-hashes
[CMake] Don't use hashes in target names
2 parents cfbd5c3 + 85d4473 commit 370697f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

cmake/modules/SwiftAddCustomCommandTarget.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,9 @@ function(add_custom_command_target dependency_out_var_name)
120120
set(ACCT_COMMANDS ${ACCT_UNPARSED_ARGUMENTS})
121121

122122
if("${ACCT_CUSTOM_TARGET_NAME}" STREQUAL "")
123-
# Construct a unique name for the custom target.
124-
# Use a hash so that the file name does not push the OS limits for filename
125-
# length.
123+
# CMake doesn't allow '/' characters in filenames, so replace them with '-'
126124
list(GET ACCT_OUTPUT 0 output_filename)
127-
string(MD5 target_md5
128-
"add_custom_command_target${CMAKE_CURRENT_BINARY_DIR}/${output_filename}")
129-
get_filename_component(output_filename_basename "${output_filename}" NAME)
130-
set(target_name
131-
"add_custom_command_target-${target_md5}-${output_filename_basename}")
125+
string(REPLACE "/" "-" target_name "${output_filename}")
132126
else()
133127
set(target_name "${ACCT_CUSTOM_TARGET_NAME}")
134128
endif()

0 commit comments

Comments
 (0)