Rework the generated include file for Windows
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index ef8ee6c..b8729b2 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -1,21 +1,12 @@
 # Configure
+
 if(WIN32)
-add_custom_target(configure_log4cxx
-  COMMAND "${CMAKE_COMMAND}" -E copy_if_different
-    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.hw
-    ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h
-  COMMAND "${CMAKE_COMMAND}" -E copy_if_different
-    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/private/log4cxx_private.hw
-    ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/log4cxx_private.h
-  DEPENDS
-    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/log4cxx.hw
-    ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/private/log4cxx_private.hw
-)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cxx/version_info.h.in
                ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/version_info.h
                @ONLY
 )
-else()
+endif()
+
 # Configure log4cxx.h
 set(LOG4CXX_CHAR "utf-8" CACHE STRING "Interal character representation, choice of utf-8 (default), wchar_t, unichar")
 set_property(CACHE LOG4CXX_CHAR PROPERTY STRINGS "utf-8" "wchar_t" "unichar")
@@ -107,4 +98,3 @@
 add_custom_target(configure_log4cxx
   COMMAND "${CMAKE_COMMAND}" -E echo "Checking configuration"
 )
-endif()
diff --git a/src/main/include/log4cxx/log4cxx.h.in b/src/main/include/log4cxx/log4cxx.h.in
index 05818f0..da8e998 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -45,8 +45,22 @@
 typedef unsigned int log4cxx_uint32_t;
 
 
-#define LOG4CXX_EXPORT
 #define LOG4CXX_PTR_DEF(T) typedef std::shared_ptr<T> T##Ptr
 #define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
 
+#if _WIN32
+//  definitions used when using static library
+#if defined(LOG4CXX_STATIC)
+#define LOG4CXX_EXPORT
+//   definitions used when building DLL
+#elif defined(LOG4CXX)
+#define LOG4CXX_EXPORT __declspec(dllexport)
+#else
+//    definitions used when using DLL
+#define LOG4CXX_EXPORT __declspec(dllimport)
+#endif
+#else
+#define LOG4CXX_EXPORT
+#endif /* WIN32 */
+
 #endif