From ef7f2279ccc4c8b557bb61310283c64f3901b7d8 Mon Sep 17 00:00:00 2001
From: Pokrovskiy <pokroa@amazon.com>
Date: Mon, 20 Apr 2015 23:28:21 -0700
Subject: [PATCH 2/3]  ExternalProject_Add: Allow generator expressions in
 CMAKE_ARGS when LOG_BUILD is set

---
 Modules/ExternalProject.cmake | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1c7cf51..c238d60 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1299,14 +1299,14 @@ endif()
       endif()
     endforeach()
     set(code "${code}set(command \"${cmd}\")${code_execute_process}")
-    file(WRITE ${stamp_dir}/${name}-${step}-impl.cmake "${code}")
+    file(GENERATE OUTPUT "${stamp_dir}/${name}-${step}-impl.cmake" CONTENT "${code}")
     set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-impl.cmake)
   endif()
 
   # Wrap the command in a script to log output to files.
   set(script ${stamp_dir}/${name}-${step}.cmake)
   set(logbase ${stamp_dir}/${name}-${step})
-  file(WRITE ${script} "
+  set(code "
 ${code_cygpath_make}
 set(command \"${command}\")
 execute_process(
@@ -1327,6 +1327,7 @@ else()
   message(STATUS \"\${msg}\")
 endif()
 ")
+  file(GENERATE OUTPUT "${script}" CONTENT "${code}")
   set(command ${CMAKE_COMMAND} ${make} ${config} -P ${script})
   set(${cmd_var} "${command}" PARENT_SCOPE)
 endfunction()
-- 
2.3.2 (Apple Git-55)

