AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO
Build external dependencies with FetchContent
- Dominant language
- C++
- Stars
- 2.1k
- Forks
- 503
- PR merge metrics
- No merged PRs in 30d
Description
When we are missing external dependencies and `OCIO_INSTALL_EXT_PACKAGES` has been set to `MISSING` or `ALL` , we use CMake [ExternalProject](https://cmake.org/cmake/help/latest/module/ExternalProject.html) to build these locally. This works but tends to be hard to manage correctly with modern CMake library that can export a number of targets as well as custom commands and probably other items. We also have a lot of manual CMake flags passing from the main project to the external ones, that are easy to miss.
An example of this would be OpenEXR which export more than 5 different targets we have to manually create, at the risk of getting out of sync when something changes upstream. Another case is pybind11 which export custom commands like `pybind11_add_module` which we cannot currently use in the build because it will not be there when pybind11 has been built locally I believe.
For well behaved modern CMake dependencies, it may be good to look into [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) instead, which behave similar to `add_subdirectory` and make the integration easier.
Contributor guide
Assessment
This issue has not been assessed yet.