From 1d306d9aaf6c6e43b571b9a1f492d4e29cfec3f0 Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Mon, 16 Aug 2021 20:28:23 +0200 Subject: [PATCH] CMake: FindLTDL: ensure ltdl is found with MinGW CMake defines both WIN32 and MINGW when the compiler is some version of MinGW. With MinGW we do want to use the ltdl library athough on native Windows we only use the ltdl compatibility header introduced in d70cdba7937724c19393d97bd280320cdf8c3c8f, not the library itself. Fixes the following errors with MinGW: C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/gvc.dir/objects.a(gvplugin.c.obj):gvplugin.c:(.text+0x4f7): undefined reference to `lt_dlinit' C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/gvc.dir/objects.a(gvplugin.c.obj):gvplugin.c:(.text+0x529): undefined reference to `lt_dlopen' C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/gvc.dir/objects.a(gvplugin.c.obj):gvplugin.c:(.text+0x578): undefined reference to `lt_dlerror' C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/gvc.dir/objects.a(gvplugin.c.obj):gvplugin.c:(.text+0x69e): undefined reference to `lt_dlsym' Towards https://gitlab.com/graphviz/graphviz/-/issues/2102. --- cmake/FindLTDL.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindLTDL.cmake b/cmake/FindLTDL.cmake index b07571e3c..0623f89ab 100644 --- a/cmake/FindLTDL.cmake +++ b/cmake/FindLTDL.cmake @@ -1,10 +1,10 @@ find_path(LTDL_INCLUDE_DIR ltdl.h) -if (NOT WIN32) +if (NOT WIN32 OR MINGW) find_library(LTDL_LIBRARY NAMES ltdl) endif() include(FindPackageHandleStandardArgs) -if (NOT WIN32) +if (NOT WIN32 OR MINGW) find_package_handle_standard_args(LTDL DEFAULT_MSG LTDL_LIBRARY LTDL_INCLUDE_DIR) else() -- 2.40.0