diff --git a/cmake/FindRust.cmake b/cmake/FindRust.cmake index d67e681e..97c65dbc 100644 --- a/cmake/FindRust.cmake +++ b/cmake/FindRust.cmake @@ -162,7 +162,19 @@ function(_corrosion_determine_libs_new target_triple out_libs) if(cargo_build_error_message MATCHES "native-static-libs: ([^\r\n]+)\r?\n") string(REPLACE " " ";" "libs_list" "${CMAKE_MATCH_1}") set(stripped_lib_list "") + + set(was_last_framework OFF) foreach(lib ${libs_list}) + # merge -framework;lib -> "-framework lib" as CMake does de-duplication of link libraries, and -framework prefix is required + if (lib STREQUAL "-framework") + set(was_last_framework ON) + continue() + endif() + if (was_last_framework) + list(APPEND stripped_lib_list "-framework ${lib}") + set(was_last_framework OFF) + continue() + endif() # Strip leading `-l` (unix) and potential .lib suffix (windows) string(REGEX REPLACE "^-l" "" "stripped_lib" "${lib}") string(REGEX REPLACE "\.lib$" "" "stripped_lib" "${stripped_lib}")