fdict icon indicating copy to clipboard operation
fdict copied to clipboard

Make project compatible with `FetchContent`

Open LecrisUT opened this issue 2 years ago • 11 comments
trafficstars

There are a few issues that should be resolved to make importing find_package and FetchContent equivalent:

  • [ ] alias library: fdict -> fdict::fdict
  • [ ] namespace targets, options, etc. In order to avoid nameclashes
  • [ ] Add options: FDICT_INSTALL, FDICT_SHARED_LIBS to control how fdict is being built
  • [ ] Set and propagate the variables in fdictConfig.cmake using return(PROPAGATE) or set(PARENT_SCOPE)

LecrisUT avatar Jun 09 '23 16:06 LecrisUT

Perhaps you can clarify some details I have been having about cmake, in the Config.cmake files generated, should one always specify set({pkg}_FOUND TRUE) or not? For instance you might end up in situations where a configuration file creates successfully finds the target it is supposed too, but it doesn't return _FOUND=true, the cmake documentation regarding this is very poor, and I cannot seem to figure out conventions in other packages?

Lastly, I have been focusing on getting the cmake stuff in. And was planning on getting the sub-project part done soonish, so I'll get my hands dirty again and will likely ask you some questions (here) if you don't mind? :)

zerothi avatar Jun 09 '23 18:06 zerothi

should one always specify set({pkg}_FOUND TRUE) or not?

In principle one does not have to do it. Normally you set <Package>_FOUND=FALSE when you specify that the import fails. I need to do more testing to confirm why <Package>_FOUND is not set to TRUE.

And was planning on getting the sub-project part done soonish, so I'll get my hands dirty again and will likely ask you some questions (here) if you don't mind? :)

Sure thing, feel free to make a PR and I can review and give some tips there.

LecrisUT avatar Jun 09 '23 18:06 LecrisUT

should one always specify set({pkg}_FOUND TRUE) or not?

In principle one does not have to do it. Normally you set <Package>_FOUND=FALSE when you specify that the import fails. I need to do more testing to confirm why <Package>_FOUND is not set to TRUE.

That information would be great, I have just encountered problems where the targets were found, but the _FOUND was not set (hence false), and then a Warning is issued for the users. This is then wrong... My solution was to never trust _FOUND but always check for the target...

zerothi avatar Jun 09 '23 18:06 zerothi

That information would be great, I have just encountered problems where the targets were found, but the _FOUND was not set (hence false), and then a Warning is issued for the users.

Note that FetchContent does not do an install() + find_package(), and in that case you need to synchronize the variables set in find_package() (hence the issue raised here)

LecrisUT avatar Jun 09 '23 18:06 LecrisUT

Might I ask what you are planning to use fdict for?

zerothi avatar Jun 10 '23 04:06 zerothi

Might I ask what you are planning to use fdict for?

I don't know if it's a well-known design pattern, but I'm using this to add a context object/field so it is easier to write extensions in octopus. I.e. add an arbitrarily typed dictionary which is exactly what this package is doing

LecrisUT avatar Jun 12 '23 13:06 LecrisUT