Skip to content

Commit c42fcc5

Browse files
authored
Merge pull request swiftlang#79407 from compnerd/roses-are-green
Runtimes: make resource embedding work on Windows
2 parents 9cbd8e1 + 34266f6 commit c42fcc5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Runtimes/Core/cmake/modules/ResourceEmbedding.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ function(generate_plist project_name project_version target)
3030
endif()
3131
endfunction()
3232

33-
if(NOT DEFINED CMAKE_MT)
34-
find_program(CMAKE_MT NAMES mt llvm-mt)
33+
# FIXME: it appears that `CMAKE_MT` evaluates to an empty string which prevents
34+
# the use of the variable. This aliases `MT` to `CMAKE_MT` and tries to fallback
35+
# to known spellings for the tool.
36+
if(WIN32 AND BUILD_SHARED_LIBS)
37+
find_program(MT HINTS ${CMAKE_MT} NAMES mt llvm-mt REQUIRED)
3538
endif()
3639

3740
function(embed_manifest target)
@@ -62,6 +65,6 @@ function(embed_manifest target)
6265

6366
if(WIN32)
6467
add_custom_command(TARGET ${target} POST_BUILD
65-
COMMAND ${CMAKE_MT} -nologo -manifest "${_EM_BINARY_DIR}/${_EM_NAME}-${PROJECT_VERSION}.1.manifest" "-outputresource:$<TARGET_FILE:${target}>;#1")
68+
COMMAND "${MT}" -nologo -manifest "${_EM_BINARY_DIR}/${_EM_NAME}-${PROJECT_VERSION}.1.manifest" "-outputresource:$<TARGET_FILE:${target}>;#1")
6669
endif()
6770
endfunction()

0 commit comments

Comments
 (0)