Skip to content

Modernize cmake #2713

@LecrisUT

Description

@LecrisUT

The cmake project should be modernized in order to make the project accessible via FetchContent:

  • Namespace the options and targets
  • remove various variables that are available built-in, e.g. detecting the OS
  • Add a NETCDF_INSTALL option with defaults if it's top_level or imported so that install is not called when imported
  • export the variables in netCDFConfig.cmake at the new nd of the cmakelists.txt
  • split the cmake file in subfolders
  • deprecate old options (use if(DEFINED))
  • change flags to be linked to a target, not global
  • move nonessential flags (warnings etc.) to CI preset file
  • use presets for the CI
  • DO NOT set cache variables that can have name overlap with other projects
  • separate into more targets and export them depending on options

Nitpicks:

  • move all options near the top to make the options visible to importers
  • move find_package/fetchcontent near the top as well
  • move autotools definitions to an separate file
  • move macros to a separate file and prefer using function

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions