]> granicus.if.org Git - graphviz/commitdiff
CMake: FindLTDL: ensure ltdl is found with MinGW
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 16 Aug 2021 18:28:23 +0000 (20:28 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 31 Aug 2021 10:09:52 +0000 (12:09 +0200)
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

index b07571e3cf92916488b3aaaa38ac691be09f105d..0623f89ab7e6c26d2c14b1d602cfb03355969c7b 100644 (file)
@@ -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()