From 5e284d6d280d1f1af2713330d0b62ba5aa952989 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 14 Aug 2009 17:14:31 +0000
Subject: [PATCH] trying to fix unix2dos, again

---
 CMakeLists.txt | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ad5953ba2..ca2d702f8c 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)
-- 
GitLab