0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +08:00

63 Commits

Author SHA1 Message Date
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
Arseny Kapoulkine
d902709da2 Refactor CMakeLists.txt support for multiple targets
We now have a ${LIBRARY} variable that we can either use directly or in
a foreach loop to be able to process either pugixml or pugixml-static
and pugixml-shared targets.

Also fixes incorrect shared library assignment when
BUILD_SHARED_AND_STATIC_LIBS is defined, and only links the static
library in for make check.
2019-02-06 08:15:27 -08:00
basti171
1d59e4d9d8 make pugixml build static and shared via cmake (#257) 2019-02-06 07:39:23 -08:00
Millian Poquet
b3db08ffcc pkg-config: Use CMake GnuInstallDirs FULL vars
Fixes an installation problem in Nix packages, as non-FULL variables are
already absolute paths in this case.
2018-12-10 11:12:36 -08:00
Arseny Kapoulkine
cb4a74d5e5 Minor CMakeLists.txt cleanup
Instead of hardcoding SOVERSION, use CMake variables to set it up.

Closes #220.
2018-08-13 21:38:44 -07:00
Wolfgang Stöggl
c12889f7cc Use CMAKE_INSTALL_LIBDIR for pugixml.pc (#215)
- Up to now, the libdir was hardcoded to "lib" inside pugixml.pc and
  the install directory of pugixml.pc was "lib/pkgconfig"
- Adds support for lib and lib64 by using CMAKE_INSTALL_LIBDIR variable
2018-06-26 15:53:42 -07:00
Bernd Amend
12139f587b fix cmake warning "Policy CMP0048 is not set" (#214)
This also bumps the minimum CMake version to 3.0 (from 2.8.12).
2018-06-20 07:55:14 -07:00
Arseny Kapoulkine
51322cffa1 Move CMake build postfix setup behind an off-by-default USE_POSTFIX
This setup can interfere with existing workflows in two ways:

- If the target application used CMake and configured custom postfixes,
this change would override them

- If the target application did *not* use CMake, it'd have to abide by
these conventions even if the target configuration used is unexpected -
for example, the default "preferred" configuration is frequently
RelWithDebugInfo, not Release, which now has a postfix.

Fixes #198.
2018-04-27 08:13:08 -07:00
Alexander Straub
4c791586ee Suffixes for different build types (#191) 2018-04-11 08:13:50 -07:00
Eli Schwartz
daeb8013b2 cmake: always install the pkg-config file (#193)
There's really never a reason to *not* want this installed. If an option
is needed to specify installing in a versioned subdirectory, this option
should be explicitly described rather than hidden in something else.

As an added bonus, this makes the CMake install code slightly *less*
complicated.
2018-04-09 10:48:53 -07:00
Arseny Kapoulkine
0c74e117b8 Update version to 1.9 2018-04-02 21:46:14 -07:00