From: Matthew Fernandez Date: Sun, 21 Feb 2021 05:35:01 +0000 (-0800) Subject: remove use of sed in CMake files X-Git-Tag: 2.47.0~36^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2a452f33d4a7e4932023c4c6e6d04e71e9c067f;p=graphviz remove use of sed in CMake files We now no longer need sed in either CMake or Visual Studio, removing it as a build dependency on Windows. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2528ded..0bbe0ccea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/expr/CMakeLists.txt b/lib/expr/CMakeLists.txt index 727271610..d58a7d455 100644 --- a/lib/expr/CMakeLists.txt +++ b/lib/expr/CMakeLists.txt @@ -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 index 000000000..12fddd1e1 --- /dev/null +++ b/lib/expr/exparse-replacements.cmake @@ -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}")