(macOS) Fixed an issue with static linking against the Pugixml library.

This commit is contained in:
Leon Styhre 2021-04-07 00:11:30 +02:00
parent 2c7ef502cd
commit 118cf30888

View file

@ -11,6 +11,12 @@
include(FindPkgMacros) 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) if(NOT WIN32)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(PUGIXML REQUIRED pugixml>=1.09) pkg_check_modules(PUGIXML REQUIRED pugixml>=1.09)
@ -42,3 +48,8 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Pugixml DEFAULT_MSG PUGIXML_LIBRARY) 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()