Move advanced memory settings into target defs.

Moved the advanced memory options into target_compile_definitions using
generator expressions.
This commit is contained in:
Björn Blissing 2021-06-28 12:41:11 +02:00
parent f1946432ee
commit 1cd65c7eb8

View file

@ -47,24 +47,6 @@ option(PUGIXML_NO_STL "Disable STL" OFF)
option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
mark_as_advanced(PUGIXML_NO_XPATH PUGIXML_NO_STL PUGIXML_NO_EXCEPTIONS)
# 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()
# This is used to backport a CMake 3.15 feature, but is also forwards compatible
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY
@ -116,16 +98,19 @@ if (BUILD_SHARED_LIBS)
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
target_compile_definitions(pugixml-shared
PUBLIC
${PUGIXML_BUILD_DEFINES}
PRIVATE
${PUGIXML_BUILD_DEFINES}
$<$<CXX_COMPILER_ID:MSVC>:PUGIXML_API=__declspec\(dllexport\)>
$<$<BOOL:HAVE_LONG_LONG>:PUGIXML_HAS_LONG_LONG>
$<$<BOOL:PUGIXML_WCHAR_MODE>:PUGIXML_WCHAR_MODE>
$<$<BOOL:PUGIXML_COMPACT>:PUGIXML_COMPACT>
$<$<BOOL:PUGIXML_NO_XPATH>:PUGIXML_NO_XPATH>
$<$<BOOL:PUGIXML_NO_STL>:PUGIXML_NO_STL>
$<$<BOOL:PUGIXML_NO_EXCEPTIONS>:PUGIXML_NO_EXCEPTIONS>)
$<$<BOOL:PUGIXML_NO_EXCEPTIONS>:PUGIXML_NO_EXCEPTIONS>
$<$<BOOL:PUGIXML_MEMORY_PAGE_SIZE>:PUGIXML_MEMORY_PAGE_SIZE=${PUGIXML_MEMORY_PAGE_SIZE}>
$<$<BOOL:PUGIXML_MEMORY_OUTPUT_STACK>:PUGIXML_MEMORY_OUTPUT_STACK=${PUGIXML_MEMORY_OUTPUT_STACK}>
$<$<BOOL:PUGIXML_MEMORY_XPATH_PAGE_SIZE>:PUGIXML_MEMORY_XPATH_PAGE_SIZE=${PUGIXML_MEMORY_XPATH_PAGE_SIZE}>
$<$<BOOL:PUGIXML_XPATH_DEPTH_LIMIT>:PUGIXML_XPATH_DEPTH_LIMIT=${PUGIXML_XPATH_DEPTH_LIMIT}>)
target_compile_options(pugixml-shared
PRIVATE
${msvc-rt-mtd-shared}
@ -144,16 +129,19 @@ if (NOT BUILD_SHARED_LIBS OR PUGIXML_BUILD_SHARED_AND_STATIC_LIBS)
target_include_directories(pugixml-static
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
target_compile_definitions(pugixml-static
PUBLIC
${PUGIXML_BUILD_DEFINES}
target_compile_definitions(pugixml-static
PRIVATE
${PUGIXML_BUILD_DEFINES}
$<$<BOOL:HAVE_LONG_LONG>:PUGIXML_HAS_LONG_LONG>
$<$<BOOL:PUGIXML_WCHAR_MODE>:PUGIXML_WCHAR_MODE>
$<$<BOOL:PUGIXML_COMPACT>:PUGIXML_COMPACT>
$<$<BOOL:PUGIXML_NO_XPATH>:PUGIXML_NO_XPATH>
$<$<BOOL:PUGIXML_NO_STL>:PUGIXML_NO_STL>
$<$<BOOL:PUGIXML_NO_EXCEPTIONS>:PUGIXML_NO_EXCEPTIONS>)
$<$<BOOL:PUGIXML_NO_EXCEPTIONS>:PUGIXML_NO_EXCEPTIONS>
$<$<BOOL:PUGIXML_MEMORY_PAGE_SIZE>:PUGIXML_MEMORY_PAGE_SIZE=${PUGIXML_MEMORY_PAGE_SIZE}>
$<$<BOOL:PUGIXML_MEMORY_OUTPUT_STACK>:PUGIXML_MEMORY_OUTPUT_STACK=${PUGIXML_MEMORY_OUTPUT_STACK}>
$<$<BOOL:PUGIXML_MEMORY_XPATH_PAGE_SIZE>:PUGIXML_MEMORY_XPATH_PAGE_SIZE=${PUGIXML_MEMORY_XPATH_PAGE_SIZE}>
$<$<BOOL:PUGIXML_XPATH_DEPTH_LIMIT>:PUGIXML_XPATH_DEPTH_LIMIT=${PUGIXML_XPATH_DEPTH_LIMIT}>)
target_compile_options(pugixml-static
PRIVATE
${msvc-rt-mtd-shared}