BareCpper/Version.cmake

Document usage of CMake cache variables `VERSION_OUT_DIR` and `VERSION_SOURCE_DIR`

Opened this issue · 0 comments

I think it is a good idea to document CMake cache variables VERSION_OUT_DIR and VERSION_SOURCE_DIR in README, for projects where CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR can't be used as their values.
One example is incorporating external library which uses Version.cmake into project based on Zephyr RTOS, using their tool west.
As CMake is invoked in the Zephyr RTOS project, CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR refer to the zephyr project and git commands are invoked on incorrect project.

This can be circumvented, for example, if VERSION_OUT_DIR and VERSION_SOURCE_DIR are set to CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR respectively, before invoking find_package(Version.cmake) in the external library CMakeLists.txt.