From cc93ca4630c1fddb4d5ddb54350c3cf1414b8a2f Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 27 Nov 2020 20:04:02 +0100 Subject: [PATCH] Fixed an annoying CMake issue that also broke the macOS build. --- CMake/Packages/FindPugixml.cmake | 20 +++++++++++--------- CMakeLists.txt | 11 +---------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/CMake/Packages/FindPugixml.cmake b/CMake/Packages/FindPugixml.cmake index 9b81b8168..265deb52b 100644 --- a/CMake/Packages/FindPugixml.cmake +++ b/CMake/Packages/FindPugixml.cmake @@ -11,32 +11,34 @@ include(FindPkgMacros) -if (NOT WIN32) +if(NOT WIN32) find_package(PkgConfig) 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) # 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) -if (NOT PUGIXML_INCLUDE_DIR) +if(NOT PUGIXML_INCLUDE_DIR) message(FATAL_ERROR "PUGIXML include files not found!") endif() -endif (WIN32) +endif(WIN32) find_library(PUGIXML_LIBRARY pugixml) -if (NOT PUGIXML_LIBRARY) +if(NOT PUGIXML_LIBRARY) message(FATAL_ERROR "libpugixml library not found!") endif() # 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) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d93f8580..b394a2f98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,21 +64,12 @@ if(NOT WIN32) find_package(CURL REQUIRED) find_package(FreeImage REQUIRED) find_package(Freetype REQUIRED) + find_package(Pugixml REQUIRED) find_package(RapidJSON REQUIRED) find_package(SDL2 REQUIRED) find_package(VLC REQUIRED) 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. if(CEC) find_package(libCEC REQUIRED)