From f6ccb7105b20c62dc49cbb690e8af74ca15ee8ad Mon Sep 17 00:00:00 2001 From: Kr328 Date: Mon, 12 Aug 2024 12:56:17 +0800 Subject: [PATCH] Fix: add extension to cxxbridge path (#550) * Fix: installed cxxbridge path should has extension * Fix: detect extension by host --- cmake/Corrosion.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/Corrosion.cmake b/cmake/Corrosion.cmake index 21e0e433..3ad5bc17 100644 --- a/cmake/Corrosion.cmake +++ b/cmake/Corrosion.cmake @@ -1462,7 +1462,11 @@ function(corrosion_add_cxxbridge cxx_target) # No suitable version of cxxbridge was installed, so use custom target to build correct version. if(NOT cxxbridge) if(NOT TARGET "cxxbridge_v${cxx_required_version}") - add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/corrosion/cxxbridge_v${cxx_required_version}/bin/cxxbridge" + unset(executable_postfix) + if(Rust_CARGO_HOST_OS STREQUAL "windows") + set(executable_postfix ".exe") + endif() + add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/corrosion/cxxbridge_v${cxx_required_version}/bin/cxxbridge${executable_postfix}" COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/corrosion/cxxbridge_v${cxx_required_version}" COMMAND @@ -1477,10 +1481,10 @@ function(corrosion_add_cxxbridge cxx_target) COMMENT "Building cxxbridge (version ${cxx_required_version})" ) add_custom_target("cxxbridge_v${cxx_required_version}" - DEPENDS "${CMAKE_BINARY_DIR}/corrosion/cxxbridge_v${cxx_required_version}/bin/cxxbridge" + DEPENDS "${CMAKE_BINARY_DIR}/corrosion/cxxbridge_v${cxx_required_version}/bin/cxxbridge${executable_postfix}" ) endif() - set(cxxbridge "${CMAKE_BINARY_DIR}/corrosion/cxxbridge_v${cxx_required_version}/bin/cxxbridge") + set(cxxbridge "${CMAKE_BINARY_DIR}/corrosion/cxxbridge_v${cxx_required_version}/bin/cxxbridge${executable_postfix}") endif()