From 118cf3088840bd810aadc2a4bfed4172562fc36d Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 7 Apr 2021 00:11:30 +0200 Subject: [PATCH] (macOS) Fixed an issue with static linking against the Pugixml library. --- CMake/Packages/FindPugixml.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMake/Packages/FindPugixml.cmake b/CMake/Packages/FindPugixml.cmake index 265deb52b..ffecaa0c2 100644 --- a/CMake/Packages/FindPugixml.cmake +++ b/CMake/Packages/FindPugixml.cmake @@ -11,6 +11,12 @@ include(FindPkgMacros) +# On some macOS versions there could be a shared Pugixml library available, but as this +# is a rare exception, this hack is good enough to handle that scenario. +if(APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib) +endif() + if(NOT WIN32) find_package(PkgConfig) pkg_check_modules(PUGIXML REQUIRED pugixml>=1.09) @@ -42,3 +48,8 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Pugixml DEFAULT_MSG PUGIXML_LIBRARY) + +# Change back to the previous search order, which is required for the libraries following this one. +if(APPLE) + set(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .a) +endif()