git: baf3577af428 - main - science/libkml: Fix linking with CMake >= 3.27

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Wed, 08 Nov 2023 05:36:42 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=baf3577af42838a9a09a98fd3ca03adc60a55853

commit baf3577af42838a9a09a98fd3ca03adc60a55853
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2023-11-08 05:30:32 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2023-11-08 05:36:35 +0000

    science/libkml: Fix linking with CMake >= 3.27
    
    Due to changes [1] in the FindEXPAT module, this was failing to link
    with newer versions of CMake.
    
    FAILED: bin/example_balloonwalker
    : && /usr/bin/c++ -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing -std=c++11 -O2 -pipe
    -fstack-protector-strong -fno-strict-aliasing -std=c++11 -DNDEBUG -lz -fstack-protector-strong
    examples/engine/CMakeFiles/example_balloonwalker.dir/balloonwalker.cc.o -o bin/example_balloonwalker
    -Wl,-rpath,/wrkdirs/usr/ports/science/libkml/work/.build/lib:/usr/local/lib  lib/libkmlengine.so.1.3.1
    lib/libkmldom.so.1.3.1  lib/libkmlbase.so.1.3.1  /usr/local/lib/libminizip.so  /usr/local/lib/liburiparser.so && :
    ld: error: lib/libkmldom.so.1.3.1: undefined reference to XML_StopParser [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParserCreateNS [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParserCreate [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetUserData [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetElementHandler [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetCharacterDataHandler [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetEntityDeclHandler [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_SetNamespaceDeclHandler [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_StopParser [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParserFree [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_Parse [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetBuffer [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ParseBuffer [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetParsingStatus [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetErrorCode [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_ErrorString [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetCurrentLineNumber [--no-allow-shlib-undefined]
    ld: error: lib/libkmlbase.so.1.3.1: undefined reference to XML_GetCurrentColumnNumber [--no-allow-shlib-undefined]
    c++: error: linker command failed with exit code 1 (use -v to see invocation)
    
    [1] https://github.com/Kitware/CMake/commit/13079f382b480c8fe6a68d98afc2cec716a75e59
    
    PR:             274225
---
 science/libkml/files/patch-src_kml_base_CMakeLists.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/science/libkml/files/patch-src_kml_base_CMakeLists.txt b/science/libkml/files/patch-src_kml_base_CMakeLists.txt
new file mode 100644
index 000000000000..0b4e8ffc3c41
--- /dev/null
+++ b/science/libkml/files/patch-src_kml_base_CMakeLists.txt
@@ -0,0 +1,12 @@
+Fix linking with CMake >= 3.27 due to changes [1] in the FindEXPAT module.
+
+[1] https://github.com/Kitware/CMake/commit/13079f382b480c8fe6a68d98afc2cec716a75e59
+
+--- src/kml/base/CMakeLists.txt.orig	2017-01-15 08:52:06 UTC
++++ src/kml/base/CMakeLists.txt
+@@ -49,4 +49,4 @@ build_target(
+   SRCS ${SRCS}
+   INCS ${INCS}
+   DEPENDS ${KMLBASE_DEPENDS}
+-  LINKS ${ZLIB_LIBRARY} ${MINIZIP_LIBRARIES} ${URIPARSER_LIBRARY} ${EXPAT_LIBRARY} )
++  LINKS ${ZLIB_LIBRARY} ${MINIZIP_LIBRARIES} ${URIPARSER_LIBRARY} EXPAT::EXPAT )