Commit: 14d98d0388043f7e49451e31fcc1cbb46a214fa9
Author: Ankit Meel
Date:   Tue Feb 15 10:14:35 2022 +0530
Branches: master
https://developer.blender.org/rB14d98d0388043f7e49451e31fcc1cbb46a214fa9

CMake: create readme.html with configure_file

Since the output file stays unmodified for most developer builds,
install step installed it redundantly.

Create readme.html using `configure_file`:
- Now it's modified only if final output changes (handled by CMake).
- If input file (from git) or blender version changes,
  it //will// be modified.

Also don't re-implement what CMake can do.

Reviewed By: campbellbarton, LazyDodo
Differential Revision: https://developer.blender.org/D13863

===================================================================

M       release/text/readme.html
M       source/creator/CMakeLists.txt

===================================================================

diff --git a/release/text/readme.html b/release/text/readme.html
index 3972f137d8e..6048dd78e6b 100644
--- a/release/text/readme.html
+++ b/release/text/readme.html
@@ -18,7 +18,7 @@
   </style>
 </head>
 <body>
-<p class="p1"><b>Blender BLENDER_VERSION</b></p>
+<p class="p1"><b>Blender @BLENDER_VERSION@</b></p>
 <p class="p2"><br></p>
 <p class="p3"><b>About</b></p>
 <p class="p4">
@@ -36,10 +36,10 @@ The entire source code is available on our website.
 For more information, visit <a href="http://www.blender.org/";><span 
class="s1">blender.org</span></a>.
 </p>
 <p class="p2"><br></p>
-<p class="p3"><b>BLENDER_VERSION</b></p>
+<p class="p3"><b>@BLENDER_VERSION@</b></p>
 <p class="p4">
-The Blender Foundation and online developer community is proud to present 
Blender BLENDER_VERSION.
-<a 
href="https://wiki.blender.org/wiki/Reference/Release_Notes/BLENDER_VERSION";>
+The Blender Foundation and online developer community is proud to present 
Blender @BLENDER_VERSION@.
+<a 
href="https://wiki.blender.org/wiki/Reference/Release_Notes/@BLENDER_VERSION@";>
 <span class="s1">More information about this release</span></a>.
 </p>
 <p class="p2"><br></p>
@@ -81,8 +81,8 @@ download an addon as a .py or .zip file, then press the 
"Install Addon" button a
 <p class="p5">
 <span class="s3">General information <a href="http://www.blender.org/";>
 <span class="s4">www.blender.org</span></a> <br>
-Release Notes <a 
href="https://wiki.blender.org/wiki/Reference/Release_Notes/BLENDER_VERSION";>
-<span 
class="s4">wiki.blender.org/wiki/Reference/Release_Notes/BLENDER_VERSION</span></a><br>
+Release Notes <a 
href="https://wiki.blender.org/wiki/Reference/Release_Notes/@BLENDER_VERSION@";>
+<span 
class="s4">wiki.blender.org/wiki/Reference/Release_Notes/@BLENDER_VERSION@</span></a><br>
 Tutorials <a href="http://www.blender.org/support/tutorials/";>
 <span class="s4">www.blender.org/support/tutorials/</span></a> <br>
 Manual <a href="https://docs.blender.org/manual/en/latest/";><span 
class="s4">https://docs.blender.org/manual/en/latest/</span></a><br>
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index e804db05687..e6e122508a9 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1130,15 +1130,9 @@ endif()
 
 if(DEFINED BLENDER_TEXT_FILES_DESTINATION)
 
-  install(
-    CODE
-    "
-    file(READ \"${CMAKE_SOURCE_DIR}/release/text/readme.html\" DATA_SRC)
-    string(REGEX REPLACE \"BLENDER_VERSION\" \"${BLENDER_VERSION}\" DATA_DST 
\"\${DATA_SRC}\")
-    file(WRITE \"${CMAKE_BINARY_DIR}/release/text/readme.html\" 
\"\${DATA_DST}\")
-    unset(DATA_SRC)
-    unset(DATA_DST)
-    "
+  configure_file(${CMAKE_SOURCE_DIR}/release/text/readme.html
+                 ${CMAKE_BINARY_DIR}/release/text/readme.html
+                 @ONLY
   )
   list(APPEND BLENDER_TEXT_FILES
     ${CMAKE_BINARY_DIR}/release/text/readme.html

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to