Install findPackage script


for a project I have some deependencies like MySQL. I therefore also have a FindMySQL.cmake script. In my Config script, when my project is installed, I have find_dependency(MySQL), because well mysql is a dependency.
But the FindMySQL.cmake is not installed and therefore users will get an error message that there is no such script and therefore mysql cannot be found.

So there are two solutions:

  1. Users provide the scripts themself
  2. I ship them

Shipping them sounds more comfortable for the user. Is it best practice? What would be the way to do this? My initial thought would be:

  1. Install it in the same directory as my Config Script
  2. In my config script set the cmake module path to the current directory

Is this correct?

Shipping your own Find modules is fine.

I’d recommend a subdirectory just to keep it more obvious what is what.

Yep. I’d recommend removing it after you’ve completed it though. See the discussion here:

1 Like

Thanks, that worked out!