Skip to content
Snippets Groups Projects
Commit f3e42969 authored by Arseny Kapoulkine's avatar Arseny Kapoulkine
Browse files

Simplify header-only mode usage

It's sufficient to define PUGIXML_HEADER_ONLY anywhere now, source is included
automatically.

This is a second attempt; this time it includes a workaround for QMake bug
that caused it to generate incorrect Makefile.
parent ff16dbdd
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
// Uncomment this to switch to header-only version // Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY // #define PUGIXML_HEADER_ONLY
// #include "pugixml.cpp"
// Uncomment this to enable long long support // Uncomment this to enable long long support
// #define PUGIXML_HAS_LONG_LONG // #define PUGIXML_HAS_LONG_LONG
......
...@@ -1329,6 +1329,13 @@ namespace std ...@@ -1329,6 +1329,13 @@ namespace std
#endif #endif
// Make sure implementation is included in header-only mode
// Use macro expansion in #include to work around QMake (QTBUG-11923)
#if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)
# define PUGIXML_SOURCE "pugixml.cpp"
# include PUGIXML_SOURCE
#endif
/** /**
* Copyright (c) 2006-2014 Arseny Kapoulkine * Copyright (c) 2006-2014 Arseny Kapoulkine
* *
......
#define PUGIXML_HEADER_ONLY
#define pugi pugih
#include "common.hpp"
// Check header guards
#include "../src/pugixml.hpp"
#include "../src/pugixml.hpp"
TEST(header_only)
{
xml_document doc;
CHECK(doc.load_string(STR("<node/>")));
CHECK_STRING(doc.first_child().name(), STR("node"));
CHECK(doc.first_child() == doc.select_node(STR("//*")).node());
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment