Merge pull request #6652 from leoetlino/shared-pugixml

CMake: Use system-wide pugixml if available
This commit is contained in:
Mat M 2018-04-17 08:06:58 -04:00 committed by GitHub
commit 41f07a8773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

14
CMake/FindPugixml.cmake Normal file
View File

@ -0,0 +1,14 @@
find_path(pugixml_INCLUDE_DIRS pugixml.hpp)
find_library(pugixml_LIBRARIES NAMES pugixml)
mark_as_advanced(pugixml_INCLUDE_DIRS pugixml_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(pugixml REQUIRED_VARS pugixml_LIBRARIES pugixml_INCLUDE_DIRS)
if(Pugixml_FOUND AND NOT TARGET pugixml)
add_library(pugixml UNKNOWN IMPORTED)
set_target_properties(pugixml PROPERTIES
IMPORTED_LOCATION "${pugixml_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${pugixml_INCLUDE_DIRS}"
)
endif()

View File

@ -533,7 +533,12 @@ endif()
add_subdirectory(Externals/Bochs_disasm) add_subdirectory(Externals/Bochs_disasm)
add_subdirectory(Externals/cpp-optparse) add_subdirectory(Externals/cpp-optparse)
add_subdirectory(Externals/glslang) add_subdirectory(Externals/glslang)
find_package(Pugixml)
if(NOT Pugixml_FOUND)
message(STATUS "Using static pugixml from Externals")
add_subdirectory(Externals/pugixml) add_subdirectory(Externals/pugixml)
endif()
if(USE_SHARED_ENET) if(USE_SHARED_ENET)
check_lib(ENET libenet enet enet/enet.h QUIET) check_lib(ENET libenet enet enet/enet.h QUIET)