From 27b9377d3ccf6528f434e0e6d6352d9a0caadb40 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 25 May 2020 11:57:41 +0200 Subject: [PATCH] Findngspice.cmake: fix not found libngspice dll on msys. Recent msys version does not find libngspice-0.dll, only libngspice-0.dll.a when using find_library. When not found, a find_file is made, instead of find_library. --- CMakeModules/Findngspice.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeModules/Findngspice.cmake b/CMakeModules/Findngspice.cmake index 2073ad9786..f8b01a9131 100644 --- a/CMakeModules/Findngspice.cmake +++ b/CMakeModules/Findngspice.cmake @@ -37,8 +37,19 @@ if( WIN32 AND MSYS ) # Note: libngspice-0.dll or libngspice-1.dll must be in a executable path find_library( NGSPICE_DLL NAMES libngspice-0.dll libngspice-1.dll ) + # Some msys versions do not find xxx.dll lib files, only xxx.dll.a files + # so try a find_file in exec paths + if( NGSPICE_DLL STREQUAL "NGSPICE_DLL-NOTFOUND" ) + find_file( NGSPICE_DLL NAMES libngspice-0.dll libngspice-1.dll + PATHS ${NGSPICE_ROOT_DIR} + PATH_SUFFIXES bin lib + ) + endif() + if( NGSPICE_DLL STREQUAL "NGSPICE_DLL-NOTFOUND" ) message( ERROR ":\n***** libngspice-x.dll not found in any executable path *****\n\n" ) + else() + message( info ": libngspice shared lib found: ${NGSPICE_DLL}\n" ) endif() else() set( NGSPICE_DLL "${NGSPICE_LIBRARY}" )