Unable to have clang-cl use wasm-ld as the linker

I never seem to be able to get clang-cl to link with wasm-ld instead of the default lld linker.

CMakeLists.txt

cmake_minimum_required(VERSION 3.18.0)

project(wasm_test)

set(CMAKE_LINKER "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/wasm-ld.exe")
set(CMAKE_C_LINK_EXECUTABLE "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/wasm-ld.exe")
set(CMAKE_CXX_LINK_EXECUTABLE "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/wasm-ld.exe")

add_compile_options("-fuse-ld=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/wasm-ld.exe")
add_compile_options("--target=wasm32-unknown-wasi -nostdlib -Wl,--no-entry")

add_executable(wasm_test add.cpp)

CMakePresets.json

{
    "version": 8,
    "configurePresets": [
        {
            "name": "clang-cl",
            "displayName": "Clang 17.0.3 (MSVC CLI) for MSVC 17.10.35027.167 (Visual Studio Community 2022 Release - amd64)",
            "description": "Using compilers: C = C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\clang-cl.exe, CXX = C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\clang-cl.exe",
            "generator": "Visual Studio 17 2022",
            "binaryDir": "${sourceDir}/out/build/${presetName}",
            "toolset": "ClangCL,host=x64",
            "cacheVariables": {
                "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
                "CMAKE_C_COMPILER": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe",
                "CMAKE_CXX_COMPILER": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe"
            }
        }
    ],
    "buildPresets": [
        {
            "name": "clang-Release",
            "displayName": "Clang 17.0.3 (MSVC CLI) for MSVC 17.10.35027.167 (Visual Studio Community 2022 Release - amd64) - Release",
            "configurePreset": "clang-cl",
            "configuration": "Release"
        }
    ]
}

Configure output

[main] Configuring project: wasm 
[driver] NOTE: You are configuring with preset Clang 17.0.3 (MSVC CLI) for MSVC 17.10.35027.167 (Visual Studio Community 2022 Release - amd64), but there are some overrides being applied from your VS Code settings.
[proc] Executing command: "C:Program FilesCMakebincmake.EXE" -DCMAKE_INSTALL_PREFIX=C:/dev/project/wasm/out/install/clang-cl "-DCMAKE_C_COMPILER=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe" "-DCMAKE_CXX_COMPILER=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe" -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -SC:/dev/project/wasm -BC:/dev/project/wasm/out/build/clang-cl -G "Visual Studio 17 2022" -T ClangCL,host=x64
[cmake] -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
[cmake] -- The C compiler identification is Clang 17.0.3 with MSVC-like command-line
[cmake] -- The CXX compiler identification is Clang 17.0.3 with MSVC-like command-line
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done (3.7s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: C:/dev/project/wasm/out/build/clang-cl

Built output

[main] Building folder: C:/dev/project/wasm/out/build/clang-cl 
[build] Starting build
[proc] Executing command: "C:Program FilesCMakebincmake.EXE" --build C:/dev/project/wasm/out/build/clang-cl --config Release --target wasm_test --
[build] MSBuild version 17.10.4+10fbfbf2e for .NET Framework
[build] 
[build]   1>Checking Build System
[build]   Building Custom Rule C:/dev/project/wasm/CMakeLists.txt
[build] clang-cl : warning : argument unused during compilation: '/O2' [-Wunused-command-line-argument] [C:devprojectwasmoutbuildclang-clwasm_test.vcxproj]
[build] clang-cl : warning : argument unused during compilation: '/Ob2' [-Wunused-command-line-argument] [C:devprojectwasmoutbuildclang-clwasm_test.vcxproj]
[build] clang-cl : warning : argument unused during compilation: '-fuse-ld=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/x64/bin/wasm-ld.exe' [-Wunused-command-line-argument] [C:devprojectwasmoutbuildclang-clwasm_test.vcxproj]
[build] lld-link : error : wasm_test.dirReleaseadd.obj: unknown file type [C:devprojectwasmoutbuildclang-clwasm_test.vcxproj]
[proc] The command: "C:Program FilesCMakebincmake.EXE" --build C:/dev/project/wasm/out/build/clang-cl --config Release --target wasm_test -- exited with code: 1
[driver] Build completed: 00:00:00.643
[build] Build finished with exit code 1

I have tried everything that I can think of yet I don’t seem to get any closer to any solution. My hoped would be that -fuse-ld=wasm-ld would work but it has not.

Any help would be much appreciated!

New contributor

Tasten is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật