cmake-basis / legacy

Legacy CMake BASIS project for versions 3.2 and older. For newer versions, go to
https://github.com/cmake-basis/BASIS
Other
13 stars 11 forks source link

Support external modules included as Git submodules #527

Closed schuhschuh closed 8 years ago

schuhschuh commented 8 years ago

When the source tree of a project module is included as Git submodule, it is an "external module". As long as the Git submodule is not initialised and update, the respective subdirectory is empty and does not contain a BasisProject.cmake file. A top-level project should still be able to explicitly declare these external Git submodules such that basis_project_modules has a complete list of available modules. Instead of a MODULE_<MODULE> option, a NOTFOUND entry should be added to the cache if the module source files are missing. When the module is requested either as dependency of another module or by the user (e.g., on the command-line), an error message should make aware that the module source files are missing possible due to a forgotten git submodule update --init -- <module_dir> call.

ahundt commented 8 years ago

We also may want to take advantage of #514 for this

schuhschuh commented 8 years ago

I don't think we need anything fancy such as Hunter here. All this is about is that a project can declare that certain directories, if they exist, contain a module. Whether it is via git submodule or a manual extraction/copy of additional source files into the directory doesn't matter. Better would of course #528. Which then comes down to a project not to use Git submodules directly, but via a BASIS download functionality similar to Hunter's download function, but without any configure and build step.

schuhschuh commented 8 years ago

Here's the reason for this in the implementation:

https://github.com/schuhschuh/cmake-basis-modules/commit/2bafc364d6992fe3b1333df5fa33fcea7c942427#diff-03b4ff0f37a28121c13c29051a3d018aR1091

Instead of a boolean MODULE option, BASIS will add a cache entry MODULE with value "NOTFOUND" to indicate that the external module is missing for some reason.

schuhschuh commented 8 years ago

BASIS could of course also try to run git submodule update --init -- <missing_module_dir>, but I am not sure if that is a good idea. Eventually this "feature" is no longer necessary once #528 is implemented. I just needed something quick for now.