diff --git a/CMakeLists.txt b/CMakeLists.txt index e686341..dcb00ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 $) target_compile_definitions(pugixml-shared - PUBLIC - ${PUGIXML_BUILD_DEFINES} PRIVATE + ${PUGIXML_BUILD_DEFINES} $<$:PUGIXML_API=__declspec\(dllexport\)> $<$:PUGIXML_HAS_LONG_LONG> $<$:PUGIXML_WCHAR_MODE> $<$:PUGIXML_COMPACT> $<$:PUGIXML_NO_XPATH> $<$:PUGIXML_NO_STL> - $<$:PUGIXML_NO_EXCEPTIONS>) + $<$:PUGIXML_NO_EXCEPTIONS> + $<$:PUGIXML_MEMORY_PAGE_SIZE=${PUGIXML_MEMORY_PAGE_SIZE}> + $<$:PUGIXML_MEMORY_OUTPUT_STACK=${PUGIXML_MEMORY_OUTPUT_STACK}> + $<$:PUGIXML_MEMORY_XPATH_PAGE_SIZE=${PUGIXML_MEMORY_XPATH_PAGE_SIZE}> + $<$: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 $) - target_compile_definitions(pugixml-static - PUBLIC - ${PUGIXML_BUILD_DEFINES} + target_compile_definitions(pugixml-static PRIVATE + ${PUGIXML_BUILD_DEFINES} $<$:PUGIXML_HAS_LONG_LONG> $<$:PUGIXML_WCHAR_MODE> $<$:PUGIXML_COMPACT> $<$:PUGIXML_NO_XPATH> $<$:PUGIXML_NO_STL> - $<$:PUGIXML_NO_EXCEPTIONS>) + $<$:PUGIXML_NO_EXCEPTIONS> + $<$:PUGIXML_MEMORY_PAGE_SIZE=${PUGIXML_MEMORY_PAGE_SIZE}> + $<$:PUGIXML_MEMORY_OUTPUT_STACK=${PUGIXML_MEMORY_OUTPUT_STACK}> + $<$:PUGIXML_MEMORY_XPATH_PAGE_SIZE=${PUGIXML_MEMORY_XPATH_PAGE_SIZE}> + $<$:PUGIXML_XPATH_DEPTH_LIMIT=${PUGIXML_XPATH_DEPTH_LIMIT}>) target_compile_options(pugixml-static PRIVATE ${msvc-rt-mtd-shared}