Skip to content

Commit

Permalink
Merge pull request #43 from coldtobi/use-system-pugixml-if-available
Browse files Browse the repository at this point in the history
Use packaged version of pugixml, if it is installed
  • Loading branch information
codereader authored Jul 23, 2024
2 parents fa4c266 + e0b7bf8 commit 9519871
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ pkg_check_modules(ZLIB zlib REQUIRED)
pkg_check_modules(GLIB glib-2.0 REQUIRED)
pkg_check_modules(EIGEN eigen3 REQUIRED)

# Locate a packaged pugixml, if installed if not, fall back to embedded code copy.
find_package(pugixml QUIET)
if (TARGET pugixml::pugixml)
message(NOTICE "Distribution pugixml found and used.")
else()
include_directories(libs/pugixml)
endif()

# Locate wxWidgets
find_package(wxWidgets REQUIRED
COMPONENTS base core stc adv gl xrc aui)
Expand Down
5 changes: 5 additions & 0 deletions libs/xmlutil/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
add_library(xmlutil Document.cpp Node.cpp)

# link with system puixml if we have it.
if (TARGET pugixml::pugixml)
target_link_libraries(xmlutil PUBLIC pugixml::pugixml)
endif()
2 changes: 1 addition & 1 deletion libs/xmlutil/Document.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "Node.h"
#include "pugixml/pugixml.hpp"

#include <pugixml.hpp>
#include <mutex>
#include <string>
#include <optional>
Expand Down
3 changes: 1 addition & 2 deletions libs/xmlutil/Node.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include "pugixml/pugixml.hpp"

#include <pugixml.hpp>
#include <string>
#include <vector>

Expand Down

0 comments on commit 9519871

Please sign in to comment.