Skip to content

Make FetchContent friendly #479

Description

@scivision

To modernize CMake packaging and allow easier/friendlier consumption of netCDF-C and netCDF-fortran from third-party projects, it would be good to make each project FetchContent-friendly by using modern CMake best practices.
This is especially important to allow netcdf-fortran to cleanly automatically build netcdf-c if it isn't found.

  • use NC4F_SOURCE_DIR or NC4F_BINARY_DIR instead of CMAKE_SOURCE_DIR OR CMAKE_BINARY_DIR Implement CMake FetchContent-friendly modernizations #480
  • don't use check_library_exists() tests that use try_compile() in netcdf-fortran when netcdf-c is presented via FetchContent
  • ensure that all targets (currently a problem under docs/) have unique names between netcdf-c and netcdf-fortran
  • only use enable_testing() if ENABLE_TESTS so that other projects don't run NetCDF internal tests unless requested

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions