0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-25 20:14:10 +08:00

73 Commits

Author SHA1 Message Date
Arseny Kapoulkine
8c3038f9c8 Update CMake version to 3.5...3.30
This should retain compatibility with earlier version of CMake and suppress
the deprecation warning for quite some time.
2024-11-17 08:25:06 +09:00
Arseny Kapoulkine
0f22f71f60 CMake now uses C++17 if supported by the compiler
We only set this when C++ version or requirement flag is not overridden
externally to be able to rely on CMake automatically downgrading the
standard version when the compiler doesn't support it.

CXX_STANDARD 17 also requires CMake 3.8 or later; on earlier versions we
use the old behavior and set C++11.
2024-10-30 14:18:39 -07:00
Arseny Kapoulkine
ca4f7cfecc Auto-detect std::string_view support by default
Instead of opting in std::string_view support via PUGIXML_STRING_VIEW
define, always enable it when C++17 is supported; this still requires
enabling C++17 support in the compiler, which this change doesn't
attempt to do yet.
2024-10-30 10:31:49 -07:00
Arseny Kapoulkine
23e617b158
Warn if PUGIXML_STRING_VIEW is set without CMAKE_CXX_STANDARD (#638)
Even if the compiler supports C++17, we define CMAKE_CXX_STANDARD as 11
by default which implicitly disables string_view support; for now warn
in this case.
2024-10-26 10:20:06 -07:00
dantargz
a0db6e2185
Initial support for std::string_view (#633)
When PUGIXML_STRING_VIEW define is set and C++17 is available, add std::string_view support to a few functions. In the future, string view support will be enabled without the need for an extra define, but for now the support is opt-in to reduce compatibility risks.

PR is based on initial contribution by @brandl-muc.
2024-10-22 13:31:54 -07:00
Miloš Komarčević
08e38a4c14
Relative and absolute paths for a relocatable pkgconf file 2024-03-22 14:05:43 +01:00
Ilya Lavrenov
3cfe51b72d Added cmake option to disable install rules 2023-10-12 02:15:05 +04:00
Richard Peters
efce4a8d7a Remove BUILD_TESTING as prerequisite for the PUGIXML_BUILD_TESTS; it was always set by including CTest, now CTest is conditionally included later on 2023-10-06 10:02:15 +02:00
Richard Peters
a468d5c438 Only include CTest when building the pugixml tests 2023-10-06 09:51:29 +02:00
Arseny Kapoulkine
db78afc2b7 Update version to 1.14 everywhere 2023-09-07 11:55:13 -07:00
Andy Maloney
b047f46e2c {cmake} Fix deprecation warning by updating min version to 3.5
With CMake 3.27, we get a deprecation warning:

"Compatibility with CMake < 3.5 will be removed from a future version of CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions."

Bump min version to 3.5 to remove warning.
2023-07-19 09:20:14 -04:00
Arseny Kapoulkine
750e20323b build: Fix CMake PUGIXML_STATIC_CRT behavior
Implementation of PUGIXML_STATIC_CRT for newer CMake versions (3.15+)
depend on MSVC_RUNTIME_LIBRARY, but this only works if the policy
is defined *before* the project.
2023-04-21 13:24:59 -07:00
Arseny Kapoulkine
76dcd89427 Update version number in preparation for 1.13 2022-10-20 20:08:52 -07:00
Izzy Muerte
ab8af53059 Fix exported symbols under clang-cl (Closes #503)
This also turns the define for PUGIXML_API into an `$<IF:>`, instead of an
`$<IF:>` with an empty true condition. If this is inadequate, I will
undo it, and place them on separate lines as they were before, but will
most likely use an inverse `$<NOT:>` instead of an `$<IF:>`.
2022-10-20 13:35:49 -07:00
Milian Wolff
173a263490 Correctly set default visibility on non-windows compilers
This fixes compilation of pugixml with -fvisibility=hidden. Without
this patch, one would get lots of unresolved symbols when consuming
pugixml as a shared library.
2022-09-25 11:37:48 +02:00
Arseny Kapoulkine
c9e219c17b Update version to 1.12 2022-02-08 19:56:41 -08:00
Arseny Kapoulkine
f1fbd707f1
Set CMP0091 CMake policy
This allows the correct use of runtime library override.

Fixes #412
2021-08-07 09:57:21 -07:00
Arseny Kapoulkine
c624c7a8bd
Update CMakeLists.txt
Remove memory configuration options and rely on automatic detection of long long
2021-08-07 09:51:54 -07:00
Björn Blissing
e7eae035ff Store definitions in variable to avoid duplication
Store compile definitions in variable to avoid duplicated generator
expressions.
2021-06-28 19:51:20 +02:00
Björn Blissing
52a7981b85 Make some compile definitions public
Moved needed defines to public section of target_compile_definitions.
2021-06-28 13:36:55 +02:00
Björn Blissing
50b103f127 Fix generator expressions 2021-06-28 13:17:06 +02:00
Björn Blissing
1cd65c7eb8 Move advanced memory settings into target defs.
Moved the advanced memory options into target_compile_definitions using
generator expressions.
2021-06-28 12:50:27 +02:00
Björn Blissing
f1946432ee Check for existence of long long 2021-06-28 12:50:27 +02:00
Björn Blissing
e2ba4f4014 Add options to build targets
Add custom options to the build targets via generator expressions.
2021-06-28 12:50:27 +02:00
Björn Blissing
5f49f2c657 Mark advanced options and removed redundant ones
Options marked as advanced are hidden by default in the CMake GUI.

The `PUGIXML_HEADER_ONLY` are redundant when during CMake builds, hence
removed.

The `PUGIXML_HAS_LONG_LONG` should be handled automatically and needs to
be rewritten, hence these options has been removed.
2021-06-28 12:50:27 +02:00
Björn Blissing
986b7ffd01 Add Cmake options for pugiconfig.hpp
Add Cmake options variables for each of the defines in pugiconfig.hpp.
2021-06-28 12:50:27 +02:00
Björn Blissing
7b1b7ee16d Reverted to use of global BUILD_SHARED_LIBS option
This commit reverts back to exposing the global variable
BUILD_SHARED_LIBS.

Since building static libraries are the default for CMake
(i.e. BUILD_SHARED_LIBS=OFF) the option to build both static and shared
libraries were moved into a conditional option. So the option
PUGIXML_BUILD_SHARED_AND_STATIC is now only visible when the global
BUILD_SHARED_LIBS variable is set to ON.

The change also prevents the case were the user first enables
BUILD_SHARED_LIBS and then enables PUGIXML_BUILD_SHARED_AND_STATIC to
then again disable BUILD_SHARED_LIBS.
2021-06-19 12:51:27 +02:00
Björn Blissing
fc7928a4b7 Use target_compile_definitions for custom defines
Replace `add_definitions` with `target_compile_definitions` for
specified targets. Multiple options are separated using the
`separate_arguments` function, which converts any string using
space-separated arguments into a semicolon-separated list.
2021-06-19 11:22:31 +02:00
Björn Blissing
0f1e75a902 Re-introduced the custom build defines
The ability to use custom build defines were removed in commit:
1c5a0bb32583fd294022e68e66b541bf6ff71a67

This commit will reintroduce this feature, but using a prefixed variable
name.
2021-06-15 09:00:31 +02:00
Björn Blissing
91fde92fc2 Add PUGIXML as prefix to CMake options
Added PUGIXML as prefix to all CMake options to avoid naming collisions
with downstream projects.

Removed the cached variable BUILD_DEFINES, since it was unused.
2021-06-15 08:42:30 +02:00
Arseny Kapoulkine
70bd6a6b0a Update version to 1.11 and update documentation 2020-11-25 10:18:42 -08:00
Wolfgang Stöggl
8b074b171f Fix debug postfix in pkgconfig file
In case of USE_POSTFIX, the POSTFIX is dependent
on the CMAKE_BUILD_TYPE.
Use the correct POSTFIX also in the generated pugixml.pc file.

This results in the following contents of pugixml.pc:
- Release:
  Libs: -L${libdir} -lpugixml
- RelWithDebInfo
  Libs: -L${libdir} -lpugixml_r
- MinSizeRel:
  Libs: -L${libdir} -lpugixml_m
- Debug:
  Libs: -L${libdir} -lpugixml_d
2020-07-15 21:59:05 +02:00
Julian Xhokaxhiu
5fdc78b66b
[Cmake] Static build should not export APIs
Fixes #359
2020-07-06 10:22:21 +02:00
Kyle Edwards
d272f11073 Export targets from build directory
This will allow projects to use pugixml from its build directory
rather than having to install it.
2020-04-27 16:02:56 -04:00
Kyle Edwards
184e6ed916 Use COMPONENT arguments in install() commands 2020-04-27 13:47:58 -04:00
Kyle Edwards
8c74d8b198 Fix multiple-rules-for-target error
The old logic for BUILD_SHARED_LIBS and BUILD_SHARED_AND_STATIC_LIBS
would produce two targets with the same name and different build
rules. The Makefile generator tolerated this, but the Ninja generator
raised an error. Fix the logic so that only one shared and one static
target gets built, and make the pugixml target an ALIAS of the one
dictated by BUILD_SHARED_LIBS.
2020-04-27 13:47:58 -04:00
Gianfranco Costamagna
2c24e90c23
Update CMakeLists.txt to rename the static and shared libraries to pugixml
Don't call them pugixml-shared or pugixml-static, because this breaks pkgconfig calls and userspace tools.
2020-02-07 14:55:25 +01:00
Arnaud Botella
aa2e0909ac
Add POSITION_INDEPENDENT_CODE option
Allow to use the static library in other dynamic librairies. This is a standard cmake option https://cmake.org/cmake/help/v3.11/prop_tgt/POSITION_INDEPENDENT_CODE.html#prop_tgt:POSITION_INDEPENDENT_CODE
2019-12-06 17:25:37 +01:00
Isabella Muerte
99ad261611 🐛 Fix incorrect installation location for exported CMake targets 2019-10-17 21:44:48 -07:00
Isabella Muerte
6949232bbd 🐛 Fix install locations for pkgconfig *and* cmake 2019-10-06 13:08:01 -07:00
Isabella Muerte
3df5036344 🔥 Remove commented out CMake code 2019-10-06 12:33:03 -07:00
Isabella Muerte
ad93a373ab Adjust MSVC runtime settings as requested.
The block of code can be removed in the future if CMake 3.15 ever
becomes the minimum
2019-10-01 10:20:30 -07:00
Isabella Muerte
8a0aac18ea Update check command to output text on failure
Move pugixml-config.cmake.in to scripts/ to prevent polluting the root
2019-09-30 22:00:04 -07:00
Isabella Muerte
1c5a0bb325 Update CMake to modern approach
New Features:

pugixml-shared and pugixml-static are "always" available, but not always
built. This allows downstream projects to still use them, and to make
sure our configurations are correct regardless of if they are being
built. They are not always installed however.

pugixml-shared and pugixml-static have ALIAS libraries of
pugixml::shared and pugixml::static respectively. These names are also
respected in the `find_package(pugixml CONFIG)` generated files, so its
safe to use pugixml in a CMake project regardless of whether it is
installed locally, or if its a subproject via `add_subdirectory`.

pugixml will automatically select the correct library type based on
BUILD_SHARED_LIBS. A pugixml::pugixml ALIAS is also available.

CMAKE_MSVC_RUNTIME_LIBRARY from CMake 3.15 has been backported.

CMake will now rely on generator expressions (a powerful abstraction in
large projects with many subdirectories) for most work. This offloads
work from the single-threaded configure stage to the multithreaded
generation stage.

pugixml now uses CTest as the runner.

Some settings are automatically disabled if pugixml is used as a
subdirectory. These are still able to be manually set, but are hidden
from folks who choose to use CMake GUI.
2019-09-28 13:02:55 -07:00
Isabella Muerte
195dfe1d8d 🚧 Begin moving pugixml to modern(ish) CMake
⬆️ Bump CMake minimum to 3.4
🐛 pugixml no longer requires a C compiler to be found or set to
compile correctly. This speeds up configuration and building on windows.
🚧 Begin laying groundwork to backport MSVC_RUNTIME_LIBRARY
property
2019-09-28 10:47:15 -07:00
Arseny Kapoulkine
6934b123d4 Move pugixml.rc to scripts/
This keeps src/ folder clean of auxiliary files only required for
special builds; note that CMakeLists.txt already depends on scripts/
(specifically for pkgconfig setup).
2019-09-21 09:21:13 -07:00
lady mesh
6fb765ca9d Add: Windows DLL version info header (#298)
Closes #294
2019-09-19 07:27:40 -07:00
Arseny Kapoulkine
44e4d7e40b Update version to 1.10
Note: this chang also updates PUGIXML_VERSION macro to allow for
double-digit minor versions; this preserves the continuity of versions
so PUGIXML_VERSION >= 190 will still work.
2019-09-11 21:09:50 -07:00
Matan Nassau
4f6e7454fd fix cmake option USE_POSTFIX (#283)
appending the suffix to the build product need not be a function of
whether CMAKE_CONFIGURATION_TYPES is set.  for example, having two ninja
build trees---one for debug and another for release---is a fine use-case
for USE_POSTFIX.
2019-08-04 13:15:10 -07:00
Artur Leonov
c5752917c7 fix running tests (#280) 2019-07-25 19:14:39 -07:00