diff --git a/cmake/modules/RootNewMacros.cmake b/cmake/modules/RootNewMacros.cmake
index 91035eabb1bfd6d2ac28f1b4db77718912b4683b..25c33c1ec207d83ca1e5673ec3c1729bf0e4d8cc 100644
--- a/cmake/modules/RootNewMacros.cmake
+++ b/cmake/modules/RootNewMacros.cmake
@@ -267,7 +267,7 @@ function(ROOT_LINKER_LIBRARY library)
     message("Target ${library} already exists. Renaming target name to ${library}_new")
     set(library ${library}_new)
   endif()
-  if(WIN32 AND NOT ARG_DLLEXPORT)
+  if(WIN32 AND ARG_TYPE STREQUAL SHARED AND NOT ARG_DLLEXPORT) 
     #---create a list of all the object files-----------------------------
     if(CMAKE_GENERATOR MATCHES "Visual Studio")
       foreach(src1 ${lib_srcs})