Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Build] Use CMakeDeps Conan generator
Whilst attempting to write a test executable with an embedded Python interpreter for OpenAssetIO#739, it turned out that the old problem reported in OpenAssetIO#528 was still present. To recap, ultimately (via circuitous logic) every CMake target created by the Conan pybind11 package links to `libpython` (the `pybind11::embed` target is the only one that should). This means that Python extension modules (`pybind11::module`s) link to `libpython`, causing linker errors at runtime or even segfaults due to ODR violations. As of conan-io/conan-center-index#13283 this bug was fixed upstream. However, we still see it because the bug was not fixed for the deprecated `cmake_find_package` generator, which we use. It has not affected us so far because we haven't added in the `Development.Embed` component to our `find_package(Python` call. As soon as we add that component (e.g. for adding the aforementioned Python unit test) we see this problem. So modernise our `conanfile.py` to use the non-deprecated `CMakeDeps` generator. `CMakeDeps` insists on having the `build_type` setting available, so add that. Unfortunately `CMakeDeps` is designed to install dependencies with the same configuration (Release, Debug, etc) as the parent project, which is usually undesirable - we want Release versions of dependencies whilst we develop the project in Debug mode. This is logged upstream in conan-io/conan#11607, where a workaround is posted, which is used here (see code comments). Signed-off-by: David Feltell <david.feltell@foundry.com>
- Loading branch information