/cmake-module

Useful CMake modules.

Primary LanguageCMakeMIT LicenseMIT

cmake-module

MIT License CI Tests

This project provides a collection of useful CMake modules.

Modules

Build Types

The build type is set by CMAKE_BUILD_TYPE and determines the compiler settings for the target binary, e.g. Debug or Release.

DebugASanBuildType

Define the DebugASan build type for compiling with AddressSanitizer. If any memory issues are detected when the executable runs, it will exit with a nonzero error status and a diagnostic report will be displayed. Enable this in a CMakeLists.txt file using include(DebugASanBuildType).

Find Modules

A find module is used with find_package() to find system libraries and utilities. These use "modern CMake" and support exported targets and COMPONENTS where appropriate.

FindNetCDF

Find the installed NetCDF libraries, with COMPONENTS for additional languages (CXX, F77, and F90). The package exports the NetCDF::netcdf target.

FindUDUNITS2

Find the installed UDUNITS2 library. The package exports the UDUNITS2::udunits2 target.

Installation

Place module files in CMAKE_MODULE_PATH.

Development

Create a development environment and run tests:

$ make dev test