Fixed an annoying CMake issue that also broke the macOS build.

This commit is contained in:
Leon Styhre 2020-11-27 20:04:02 +01:00
parent b8de48ae98
commit cc93ca4630
2 changed files with 12 additions and 19 deletions

View file

@ -11,32 +11,34 @@
include(FindPkgMacros) include(FindPkgMacros)
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)
endif (NOT WIN32) # Set the full path to the library instead of just 'pugixml'.
set(PUGIXML_LIBRARIES ${PUGIXML_LINK_LIBRARIES})
endif(NOT WIN32)
if (WIN32) if(WIN32)
find_path(PUGIXML_INCLUDE_DIR pugixml.hpp) find_path(PUGIXML_INCLUDE_DIR pugixml.hpp)
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found. # Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
include (FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PUGIXML DEFAULT_MSG PUGIXML_INCLUDE_DIR) find_package_handle_standard_args(PUGIXML DEFAULT_MSG PUGIXML_INCLUDE_DIR)
if (NOT PUGIXML_INCLUDE_DIR) if(NOT PUGIXML_INCLUDE_DIR)
message(FATAL_ERROR "PUGIXML include files not found!") message(FATAL_ERROR "PUGIXML include files not found!")
endif() endif()
endif (WIN32) endif(WIN32)
find_library(PUGIXML_LIBRARY pugixml) find_library(PUGIXML_LIBRARY pugixml)
if (NOT PUGIXML_LIBRARY) if(NOT PUGIXML_LIBRARY)
message(FATAL_ERROR "libpugixml library not found!") message(FATAL_ERROR "libpugixml library not found!")
endif() endif()
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found. # Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
include (FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(pugixml DEFAULT_MSG PUGIXML_LIBRARY) find_package_handle_standard_args(Pugixml DEFAULT_MSG PUGIXML_LIBRARY)

View file

@ -64,21 +64,12 @@ if(NOT WIN32)
find_package(CURL REQUIRED) find_package(CURL REQUIRED)
find_package(FreeImage REQUIRED) find_package(FreeImage REQUIRED)
find_package(Freetype REQUIRED) find_package(Freetype REQUIRED)
find_package(Pugixml REQUIRED)
find_package(RapidJSON REQUIRED) find_package(RapidJSON REQUIRED)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
find_package(VLC REQUIRED) find_package(VLC REQUIRED)
endif() endif()
if(APPLE)
# For some strange reason, macOS complains about an uppercase 'P' in Pugixml.
# FreeBSD, NetBSD and OpenBSD also complain about this, but applying the same rule to
# these OSs lead to linking issues for some reason, so we'll have to live with those
# warnings for now.
find_package(pugixml REQUIRED)
elseif(UNIX)
find_package(Pugixml REQUIRED)
endif()
# Add libCEC support. # Add libCEC support.
if(CEC) if(CEC)
find_package(libCEC REQUIRED) find_package(libCEC REQUIRED)