diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ad5953ba29deb96d11ca0e582caae258caec33d..ca2d702f8c62ff1595a34db6b71c7663379aff39 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -630,9 +630,13 @@ macro(unix2dos VARNAME)
   set(UNIX2DOS_FILES)
   foreach(FILE ${${VARNAME}})
     file(READ ${FILE} F0)
-    string(REGEX REPLACE "\n" "\r\n" F1 "${F0}")
     get_filename_component(N ${FILE} NAME)
-    file(WRITE ${CMAKE_BINARY_DIR}/unix2dos/${N} "${F1}")
+    if(CYGWIN)
+      string(REGEX REPLACE "\n" "\r\n" F1 "${F0}")
+      file(WRITE ${CMAKE_BINARY_DIR}/unix2dos/${N} "${F1}")
+    else(CYGWIN) # if not in cygwin, assume cmake does it for us
+      file(WRITE ${CMAKE_BINARY_DIR}/unix2dos/${N} "${F0}")
+    endif(CYGWIN)
     list(APPEND UNIX2DOS_FILES ${CMAKE_BINARY_DIR}/unix2dos/${N})
   endforeach(FILE)
   set(${VARNAME} ${UNIX2DOS_FILES})
@@ -641,14 +645,12 @@ endmacro(unix2dos)
 if(WIN32)
   set(GMSH_BIN .)
   set(GMSH_DOC .)
-  if(CYGWIN)
-    unix2dos(GMSH_API)
-    unix2dos(WELCOME_FILE)
-    unix2dos(LICENSE_FILE)
-    unix2dos(CREDITS_FILE)
-    unix2dos(TUTORIAL_FILES)
-    unix2dos(DEMO_FILES)
-  endif(CYGWIN)
+  unix2dos(GMSH_API)
+  unix2dos(WELCOME_FILE)
+  unix2dos(LICENSE_FILE)
+  unix2dos(CREDITS_FILE)
+  unix2dos(TUTORIAL_FILES)
+  unix2dos(DEMO_FILES)
 else(WIN32)
   set(GMSH_BIN bin)
   set(GMSH_DOC share/doc/gmsh)