From 29bcd93553aec026f247a479c3d6c103bd96b468 Mon Sep 17 00:00:00 2001 From: Luthaf Date: Mon, 17 Jun 2024 11:42:28 +0200 Subject: [PATCH] Fix build with MSVC and rustc 1.79 --- metatensor-core/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/metatensor-core/CMakeLists.txt b/metatensor-core/CMakeLists.txt index 624306dcf..e4d409eeb 100644 --- a/metatensor-core/CMakeLists.txt +++ b/metatensor-core/CMakeLists.txt @@ -219,6 +219,8 @@ if (CARGO_VERSION_CHANGED) # Special case `msvcrt` to link with the debug version in Debug mode. list(TRANSFORM stripped_lib_list REPLACE "^msvcrt$" "\$<\$:msvcrtd>") + # Don't try to pass a linker *flag* where CMake expects libraries + list(REMOVE_ITEM stripped_lib_list "/defaultlib:msvcrt") if (APPLE) # Prevent warnings about duplicated `System` in linked libraries @@ -229,9 +231,9 @@ if (CARGO_VERSION_CHANGED) list(REMOVE_DUPLICATES stripped_lib_list) set(CARGO_DEFAULT_LIBRARIES "${stripped_lib_list}" CACHE INTERNAL "list of implicitly linked libraries") - if (${METATENSOR_MAIN_PROJECT}) + # if (${METATENSOR_MAIN_PROJECT}) message(STATUS "Cargo default link libraries are: ${CARGO_DEFAULT_LIBRARIES}") - endif() + # endif() else() message(FATAL_ERROR "could not find default static libs: `native-static-libs` not found in: `${cargo_static_libs_stderr}`") endif()