From 6745af99c8bc89d35d02e92ac2e9b9c29d91bc29 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 5 Feb 2025 10:33:11 -0500 Subject: [PATCH] FindArmadillo: Fix wrapper linking with MSVC Transitive linking does not work with MSVC, so we must link against both Armadillo and its dependencies directly if `ARMA_USE_WRAPPER` is enabled. --- Modules/FindArmadillo.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index 65d3ed50a5..d1d3e314dc 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -99,8 +99,13 @@ if(_ARMA_USE_WRAPPER) mark_as_advanced(ARMADILLO_LIBRARY) set(_ARMA_REQUIRED_VARS ARMADILLO_LIBRARY) else() - # Link directly to individual components. set(ARMADILLO_LIBRARY "") +endif() + +# Transitive linking with the wrapper does not work with MSVC, +# so we must *also* link against Armadillo's dependencies. +if(NOT _ARMA_USE_WRAPPER OR MSVC) + # Link directly to individual components. foreach(pkg LAPACK BLAS