widberg / bgfx.cmake

https://github.com/bkaradzic/bgfx.cmake. Independently maintained CMake build scripts for bgfx. Released under public domain.
https://github.com/bkaradzic/bgfx.cmake
Creative Commons Zero v1.0 Universal
286 stars 252 forks source link

Use `configure_file` instead of `file WRITE` to write generated files. #61

Closed bdero closed 4 years ago

bdero commented 4 years ago

This ensures that running CMake will only result in the generated files being overwritten if their contents will change. This is important because these files are used as build inputs, and so every time these files are written, their downstream dependants may be marked as dirty during the build, and so downstream dependencies end up needlessly re-building every time when file WRITE is used.

For example, if you're generating Makefiles and you're using the convenient add_shader function to add shaderc build commands to your build when shader sources change, this change prevents shaderc from being needlessly re-linked (which often takes minutes) on the first build after every CMake run.