diff --git a/CMakeLists.txt b/CMakeLists.txt index 855045c..dbae2f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,11 @@ else() add_library(pugixml STATIC ${SOURCES}) endif() +# Export symbols for shared library builds +if(BUILD_SHARED_LIBS AND MSVC) + target_compile_definitions(pugixml PRIVATE "PUGIXML_API=__declspec(dllexport)") +endif() + # Enable C++11 long long for compilers that are capable of it if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STRLESS 3.1 AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_long_long_type;") target_compile_features(pugixml PUBLIC cxx_long_long_type)