--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -74,6 +74,7 @@
 # create hpdf library
 # =======================================================================
 add_library(hpdf ${LIBHPDF_SRCS})
+target_compile_definitions(hpdf PRIVATE HPDF_DLL_MAKE INTERFACE HPDF_DLL)
 set_target_properties(hpdf PROPERTIES
     SOVERSION ${HPDF_MAJOR_VERSION}.${HPDF_MINOR_VERSION}
     VERSION ${HPDF_MAJOR_VERSION}.${HPDF_MINOR_VERSION}.${HPDF_BUGFIX_VERSION}
