vcpkg/scripts/cmake/vcpkg_replace_string.cmake

16 lines
353 B
CMake
Raw Normal View History

#[===[.md:
# vcpkg_replace_string
Replace a string in a file.
```cmake
vcpkg_replace_string(<filename> <match> <replace>)
```
#]===]
function(vcpkg_replace_string filename match replace)
file(READ "${filename}" contents)
string(REPLACE "${match}" "${replace}" contents "${contents}")
file(WRITE "${filename}" "${contents}")
endfunction()