Skip to content

CMake build system modification #204

@Mc-Zen

Description

@Mc-Zen

Hi there,

In the documentation you say that you are generally open to pull requests. Does that also apply to the CMake build system?

I noticed it is hard to create a structure that is more than just a single and simple external. Especially, the C++ version cannot be changed for an external in a straightforward way and linked libraries don't behave quite as they should. Also, the projects need to lie in the projects folder which makes it a bit tiresome to use version control and still keep updated with the min-devkit while also linking to other libraries.

If you were open to accept a modification I could maybe offer to propose a new backwards-compatible solution in form of a pull request. This would most likely also affect the submodules, naming min-api, max-sdk and min-lib. The rough idea is to

  • replace the pre- and post CMake scripts with a function call (the pre- and post scripts will not be removed of course as many existing projects probably rely on them),
  • create interface libraries for all header-only libraries. This allows for the necessary include paths to be set in a much simpler way which is not dependent on the current directory. Interface libraries are a CMake 3.19 feature but the currently demanded version by the devkit is already 3.19 in most places
  • and to add options for e.g. building the provided projects and unit tests (default ON).

Some advantages would be:

  • Much shorter project-level CMakeLists.txt files (could even become a one-liner).
  • Projects can live outside the projects folder and are still compiled to the externals directory.
  • The C++ standard may be changed (i.e. to C++20) easily.
  • Linking other libraries is easier.
  • Maybe future refactoring of the devkit and its dependencies should get simpler as no manual include_directories need to be set.

Maybe some target exports could also be added, so the entire sdk could be found via find_package() but I'm not sure yet if this is feasible or useful.

Let me know if this would be desired,
Cheers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions