GEOS-ESM / ESMA_cmake

Custom CMake macros for the GEOS Earth System Model
Apache License 2.0
4 stars 9 forks source link

Check to make sure install dir is writable #285

Closed mathomp4 closed 2 years ago

mathomp4 commented 2 years ago

This PR adds a check in esma.cmake to make sure the CMAKE_INSTALL_PREFIX provided is writable. This is pretty hard to trigger for most people, but belt-and-suspenders is never a bad thing.

Inspired by @scivision in this post: https://www.scivision.dev/cmake-test-path-writable/ . His version is more elegant, but I was trying out GitHub Copilot and it suggested this. The AI code seems...reasonable.

mathomp4 commented 2 years ago

This is a fairly large block of code. Can it be turned into a macro/function?

Hmm. Yes. I suppose it could. Let me try!