OpenTimelineIO icon indicating copy to clipboard operation
OpenTimelineIO copied to clipboard

Q: CMake config files and interdependencies

Open foundry-markf opened this issue 3 years ago • 4 comments

Hi,

OTIO 0.14.0

I got approached with a question today, because in CMake, someone had done

find_package(OpenTimelineIO REQUIRED)

resulting in the error

CMake Error at CMakeLists.txt:326 (find_package):
  Found package configuration file:

    <some local path>/share/opentimelineio/OpenTimelineIOConfig.cmake

  but it set OpenTimelineIO_FOUND to FALSE so package "OpenTimelineIO" is
  considered to be NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  OTIO::opentime

due to the opentimelineio import target requiring opentime.

I hadn't seen this in my own testing, because I had done

find_package(OpenTime REQUIRED)
find_package(OpenTimelineIO REQUIRED)

(although I can't find that in documentation from a quick browse, so I must've just figured it out at the time.)

It's brought up the subsequent question of why are there two different CMake config files exported during the build?

I'm not aware of any technical restrictions of exporting two libraries in a single config file, even if you only consume one.

I'm curious if there was a particular need for them to be separate? Thanks

foundry-markf avatar Jan 14 '22 15:01 foundry-markf

The thought was that OpenTime might be more broadly interesting.

The OpenTime config file could stay as is, but it would make sense to add the OpenTime config information to the OpenTimelineIO config as well.

I think it's a reasonable user expectation that finding OpenTimelineIO itself is sufficient.

Are you able to prepare a PR for this?

meshula avatar Jan 15 '22 01:01 meshula

The OpenTime config file could stay as is, but it would make sense to add the OpenTime config information to the OpenTimelineIO config as well.

As far as I'm aware, in CMake, you can only export targets to a single config file.

Are you able to prepare a PR for this?

Not at the present time. I asked management prior to Christmas about CLAs, but breaks/holidays/catching up has meant no progress. I can query again though since I've opened a few issue reports.

If I could though, I would recommend a single CMake config file, with all targets in it. There is the component concept in CMake packages, so users could request different parts, e.g.

find_package(OpenTimelineIO REQUIRED COMPONENTS OpenTime)

I'm spitballing this idea - I've not actually tried it, or have a good inkling for how it would feel to consumers.

foundry-markf avatar Jan 18 '22 08:01 foundry-markf

@foundry-markf I see that Foundry is already on the list of signed CLAs for OpenTimelineIO. Are you able to revisit this issue?

jminor avatar Jun 09 '23 20:06 jminor

@jminor This certainly fell off my radar. Thanks for reaching out. I'll see if I can make a PR up in the near future.

foundry-markf avatar Jun 14 '23 12:06 foundry-markf