aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Blissing <bjorn.blissing@vti.se>2021-06-23 11:05:34 +0200
committerBjörn Blissing <bjorn.blissing@vti.se>2021-06-28 12:50:27 +0200
commit986b7ffd01aedcd4f2aa16e78e4cad9313b6d7b2 (patch)
tree6f5f86c9b65178522d05b18e414c012b792ba2ed
parent06a516c73c2ac6cec059431bd5e609cc50f29a3c (diff)
downloadpugixml-986b7ffd01aedcd4f2aa16e78e4cad9313b6d7b2.zip
pugixml-986b7ffd01aedcd4f2aa16e78e4cad9313b6d7b2.tar.gz
pugixml-986b7ffd01aedcd4f2aa16e78e4cad9313b6d7b2.tar.bz2
Add Cmake options for pugiconfig.hpp
Add Cmake options variables for each of the defines in pugiconfig.hpp.
-rw-r--r--CMakeLists.txt70
1 files changed, 70 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3fd0c77..0ee5239 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,76 @@ option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
cmake_dependent_option(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS
"Build both shared and static libraries" OFF
"BUILD_SHARED_LIBS" OFF)
+
+# Expose options from the pugiconfig.hpp file.
+option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
+if (PUGIXML_WCHAR_MODE)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_WCHAR_MODE)
+endif()
+
+option(PUGIXML_COMPACT "Enable compact mode" OFF)
+if (PUGIXML_COMPACT)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_COMPACT)
+endif()
+
+option(PUGIXML_NO_XPATH "Disable XPath" OFF)
+if (PUGIXML_NO_XPATH)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_NO_XPATH)
+endif()
+
+option(PUGIXML_NO_STL "Disable STL" OFF)
+if (PUGIXML_NO_STL)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_NO_STL)
+endif()
+
+option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
+if (PUGIXML_NO_EXCEPTIONS)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_NO_EXCEPTIONS)
+endif()
+
+option(PUGIXML_HEADER_ONLY "Switch to header only" OFF)
+if (PUGIXML_HEADER_ONLY)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_HEADER_ONLY)
+endif()
+
+option(PUGIXML_HAS_LONG_LONG "Enable long long support" OFF)
+if (PUGIXML_HAS_LONG_LONG)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_HAS_LONG_LONG)
+endif()
+
+# Tune these to adjust memory-related behaviour
+if (DEFINED PUGIXML_MEMORY_PAGE_SIZE)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_MEMORY_PAGE_SIZE=${PUGIXML_MEMORY_PAGE_SIZE})
+endif()
+
+if(DEFINED PUGIXML_MEMORY_OUTPUT_STACK)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_MEMORY_OUTPUT_STACK=${PUGIXML_MEMORY_OUTPUT_STACK})
+endif()
+
+if (DEFINED PUGIXML_MEMORY_XPATH_PAGE_SIZE)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_MEMORY_XPATH_PAGE_SIZE=${PUGIXML_MEMORY_XPATH_PAGE_SIZE})
+endif()
+
+# Tune this to adjust max nesting for XPath queries
+if (DEFINED PUGIXML_XPATH_DEPTH_LIMIT)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_XPATH_DEPTH_LIMIT=${PUGIXML_XPATH_DEPTH_LIMIT})
+endif()
+
+# Set these to control attributes for public classes/functions
+option(PUGIXML_OVERRIDE_API "Export all public symbols from DLL" OFF)
+if(PUGIXML_OVERRIDE_API)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_API=__declspec(dllexport))
+endif()
+
+option(PUGIXML_OVERRIDE_CLASS "Import all classes from DLL" OFF)
+if(PUGIXML_OVERRIDE_CLASS)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_CLASS=__declspec(dllimport))
+endif()
+
+option(PUGIXML_OVERRIDE_FUNCTION "Set calling conventions to all public functions to fastcall" OFF)
+if(PUGIXML_OVERRIDE_FUNCTION)
+ list(APPEND PUGIXML_BUILD_DEFINES PUGIXML_FUNCTION=__fastcall)
+endif()
# This is used to backport a CMake 3.15 feature, but is also forwards compatible
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)