diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1aa40a8..1051997 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,7 @@ option (BUILD_TESTING     "Build tests"                         ON)
 if (WIN32)
    if (BUILD_SHARED_LIBS)
      add_definitions(-D CHARLS_DLL)
+     set_source_files_properties(src/interface.cpp PROPERTIES COMPILE_FLAGS -DCHARLS_DLL_BUILD)
    else()
      add_definitions(-D CHARLS_STATIC)
    endif()
