Let OCIO CMake support add_subdirectory for git submodule
Hi And many thanks for your wonderful library.
It could be pleasant for git based application hosting OCIO library to benefit of submodule git feature. This allowing OCIO library source code be directly a child folder of the host application git folder. Then host application CMakeLists.txt will just have to add_subdirectory of the OCIO sub folder to let everything works.
For this we just have to modify CMAKE_SOURCE_DIR by CMAKE_CURRENT_SOURCE_DIR in the OCIO CMakeLists.txt files to let CMake understand that OCIO may not be always located in the CMake root folder.
Here my patch proposal: https://github.com/dlrd/OpenColorIO/commit/95194321306b9493e98c15792adfc3ca4585eeb9
Client application will also have to set CMAKE_MODULE_PATH manually or we may consider to patch this line too by using CMAKE_CURRENT_SOURCE_DIR
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/share/cmake/utils
${CMAKE_SOURCE_DIR}/share/cmake/macros
${CMAKE_SOURCE_DIR}/share/cmake/modules
Of course other CMAKE_BINARY_DIR replacement by CMAKE_CURRENT_BINARY_DIR may also be considered.
Thanks in advance for your interest about this. All the best
Thanks for the report @Qlex42, would you be able to open a PR for this?