]> granicus.if.org Git - graphviz/commitdiff
remove use of sed in CMake files
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 21 Feb 2021 05:35:01 +0000 (21:35 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 27 Feb 2021 18:12:27 +0000 (10:12 -0800)
We now no longer need sed in either CMake or Visual Studio, removing it as a
build dependency on Windows.

CHANGELOG.md
lib/expr/CMakeLists.txt
lib/expr/exparse-replacements.cmake [new file with mode: 0644]

index 8f2528ded85a2ec91e047649b702caa88a44ecd7..0bbe0ccea5ffaf4d94ba53af66728a95d9984cea 100644 (file)
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - remove regex usage #1919
 - RxSpencer is no longer a dependency on Windows
 - gvmap.sh is compatible with POSIX shells in addition to ksh
+- sed is no longer a build dependency on Windows
 
 ### Fixed
 - Fix gvpr -? to actually print usage and exit non-zero
index 727271610d368db075d35b163238f23e8801d20b..d58a7d455f086d5ba53d72644acad436acd430e9 100644 (file)
@@ -8,7 +8,8 @@ BISON_TARGET(
 add_custom_command(
     OUTPUT exparse.c
     MAIN_DEPENDENCY y.tab.c
-    COMMAND sed -e "s/fprintf/sfprintf/g" -e "s/FILE/Sfio_t/g" -e "s/stderr/sfstderr/g" ${CMAKE_CURRENT_BINARY_DIR}/y.tab.c > exparse.c
+    COMMAND ${CMAKE_COMMAND}
+    ARGS -P ${CMAKE_CURRENT_SOURCE_DIR}/exparse-replacements.cmake
 )
 
 if (WIN32)
diff --git a/lib/expr/exparse-replacements.cmake b/lib/expr/exparse-replacements.cmake
new file mode 100644 (file)
index 0000000..12fddd1
--- /dev/null
@@ -0,0 +1,6 @@
+# replacement steps corresponding to the sed commands in Makefile.am
+FILE(READ y.tab.c data0)
+STRING(REPLACE "fprintf" "sfprintf" data1 "${data0}")
+STRING(REPLACE "FILE"    "Sfio_t"   data2 "${data1}")
+STRING(REPLACE "stderr"  "sfstderr" data3 "${data2}")
+FILE(WRITE exparse.c "${data3}")