lammps/cmake/README.md

44 KiB
Raw Blame History

Building LAMMPS using CMake

LAMMPS recently acquired support for building with CMake thanks to the efforts of Christoph Junghans (LANL) and Richard Berger (Temple U). One of the key strengths of CMake is that it can generate the necessary build system files of your own personal preference. It also enables using common development IDEs such as Eclipse, Visual Studio, QtCreator, Xcode and many more for LAMMPS development.

CMake can both be used as a command-line (CLI) utility cmake or through one of its GUIs. ccmake is a text-based ui to configure and build CMake projects. cmake-gui is a graphical frontend for running CMake operations that works on Linux desktop environments, Windows and MacOS X.

The following is a tutorial-style introduction in using the CMake system. It should give you the necessary foundation to understand how to do the most common tasks, act as a reference and provide examples of typical use cases.

Table of Contents

Quick Start for the Impatient

If you want to skip ahead and just run the compilation using cmake, please find a minimal example below. Together with the options reference below, this should get you started.

git clone https://github.com/lammps/lammps.git
mkdir lammps/build
cd lammps/build
cmake [-D OPTION_A=VALUE_A -D OPTION_B=VALUE_B ...] ../cmake
make

Building LAMMPS using cmake

Prerequisites

This tutorial assumes you are running in a command-line environment using a shell like Bash.

  • Linux: any terminal window will work
  • MacOS X: launch the Terminal app
  • Windows 10: install and run "Bash on Windows" (aka Ubuntu on Windows)

Before we start, please download the latest and greatest version of LAMMPS from GitHub. You can either download it as a tarball or ZIP file, or via git. When you start with a fresh lammps directory, the contents should look like this:

$ ls
bench  doc       lib      potentials  README  tools
cmake  examples  LICENSE  python      src

Build directory vs. Source Directory

By using CMake we separate building LAMMPS into multiple phases:

  1. Configuration: define which features we want to enable/disable and how it should be compiled
  2. Compilation: compile each source file and generate binaries and libraries based on the configuration
  3. Installation (Optional): finally we can install the generated binaries on our system

In the GNU Make based build system of LAMMPS, configuration occurs by running special make targets like make yes-MOLECULAR. These targets modify the source directory (src/) directory by copying package files and patching Makefile. In some cases you are force to manually edit Makefiles to add compiler options and/or correct include directory and library paths.

These edits and copy operations are no longer necessary when compiling with CMake. The source directory stays untouched, so you compile LAMMPS in many different variants using the same source code checkout. It enables true out-of-source builds.

When using Cmake, you can compile in any folder outside of the source directory. Any working directory you choose becomes a so-called build directory. All configuration files and compilation results are stored in this folder. We recommend calling it something like build/.

Let's have a look a quick example, where we get the greatest and latest version of LAMMPS from GitHub via git:

git clone https://github.com/lammps/lammps.git

We then create a new build folder and make it our current working directory:

mkdir lammps/build
cd lammps/build

To configure LAMMPS we run cmake inside of this folder. However it requires at least one argument. cmake needs to read the LAMMPS CMakeLists.txt file to know what to do. This file is located in the cmake/ subdirectory of the lammps checkout. To run cmake add the relative or absolute path to the cmake/ directory as first argument.

E.g., if the current working directory is lammps/build you can specify the relative path to lammps/cmake as follows:

cmake ../cmake

You could also specify the absolute path:

cmake /path/to/my/lammps/folder/cmake

Please note: This does NOT compile the code! Running cmake only configures the next build. It generates the necessary files to compile the code. On Unix/Linux it defaults to generating Makefiles. You can also choose other output formats to generate files for Eclipse, Xcode or Visual Studio which are supported on other platorms.

To compile LAMMPS once the Makefiles are generated, simply type make in the build directory.

make

Defining and using presets

The CMake build exposes a lot of different options. In the old build system some of the package selections were possible by using special make target like make yes-std or make no-lib. Achieving the same result with cmake requires specifying all options manually. This can quickly become a very long command line that is hard to handle. While these could be stored in a simple script file, there is another way of defining "presets" to compile LAMMPS in a certain way.

A preset is a regular CMake script file that can use constructs such as variables, lists and for-loops to manipulate configuration options and create an initial cache. Options must be set with the CACHE and FORCE flag to ensure they are considered even during a second cmake run.

Such a file can then be passed to cmake via the -C flag. Several examples of presets can be found in the cmake/presets folder.

# build LAMMPS with all "standard" packages which don't use libraries and enable GPU package
mkdir build
cd build
cmake -C ../cmake/presets/std_nolib.cmake -D PKG_GPU=on ../cmake

Reference

Common CMake Configuration Options

Option Description Values
CMAKE_INSTALL_PREFIX Install location where LAMMPS files will be copied to. In the Unix/Linux case with Makefiles this controls what `make install` will do. Default setting is $HOME/.local.
CMAKE_BUILD_TYPE Controls if debugging symbols are added to the generated binaries
Release (default)
Debug
<CMAKE_VERBOSE_MAKEFILE/code> Enable verbose output from Makefile builds (useful for debugging), the same can be achived by adding `VERBOSE=1` to the `make` call.
off (default)
on

LAMMPS Configuration Options

Option Description Values
LAMMPS_SIZE_LIMIT Controls the integer sizes used by LAMMPS internally
LAMMPS_SMALLBIG (default)
32bit , 64bit
LAMMPS_SMALLSMALL
32bit , 32bit
LAMMPS_BIGBIG
64bit , 64bit
LAMMPS_MEMALIGN controls the alignment of blocks of memory allocated by LAMMPS
64 (default)
LAMMPS_EXCEPTIONS controls whether LAMMPS dies after an error or throws a C++ exception. This is particularly useful when running through the C library interface, since an error in LAMMPS then doesn't kill the parent process
off (default)
on
LAMMPS_MACHINE allows appending a machine suffix to the generate LAMMPS binary
*none* (default)
BUILD_LIB control whether to build LAMMPS as a library
off (default)
on
BUILD_EXE control whether to build LAMMPS executable
on (default)
off
BUILD_SHARED_LIBS control whether to build LAMMPS as a shared-library
off (default)
on
BUILD_DOC control whether to build LAMMPS documentation
off (default)
on
LAMMPS_LONGLONG_TO_LONG Workaround if your system or MPI version does not recognize long long data types
off (default)
on

Parallelization and Accelerator Packages

Option Description Values
BUILD_MPI control whether to build LAMMPS with MPI support. This will look for `mpicxx` in your path and use this MPI implementation.
on (default, if found)
off
BUILD_OMP control whether to build LAMMPS with OpenMP support.
on (default, if found)
off
PKG_OPT A handful of pair styles which are optimized for improved CPU performance on single or multiple cores. These include EAM, LJ, CHARMM, and Morse potentials.
off (default)
on
PKG_USER-OMP Hundreds of pair, fix, compute, bond, angle, dihedral, improper, and kspace styles which are altered to enable threading on many-core CPUs via OpenMP directives.
off (default)
on
PKG_USER-INTEL Dozens of pair, fix, bond, angle, dihedral, improper, and kspace styles which are optimized for Intel CPUs and KNLs (Knights Landing).
off (default)
on
PKG_GPU Dozens of pair styles and a version of the PPPM long-range Coulombic solver optimized for GPUs. All such styles have a “gpu” as a suffix in their style name. The GPU code can be compiled with either CUDA or OpenCL, however the OpenCL variants are no longer actively maintained and only the CUDA versions are regularly tested.
off (default)
on
PKG_KOKKOS Dozens of atom, pair, bond, angle, dihedral, improper, fix, compute styles adapted to compile using the Kokkos library which can convert them to OpenMP or CUDA code so that they run efficiently on multicore CPUs, KNLs, or GPUs.
off (default)
on

Default Packages

Option Description Values
PKG_ASPHERE Computes, time-integration fixes, and pair styles for aspherical particle models including ellipsoids, 2d lines, and 3d triangles.
off (default)
on
PKG_BODY Body-style particles with internal structure. Computes, time-integration fixes, pair styles, as well as the body styles themselves.
off (default)
on
PKG_CLASS2 Bond, angle, dihedral, improper, and pair styles for the COMPASS CLASS2 molecular force field.
off (default)
on
PKG_COLLOID Coarse-grained finite-size colloidal particles. Pair styles and fix wall styles for colloidal interactions. Includes the Fast Lubrication Dynamics (FLD) method for hydrodynamic interactions, which is a simplified approximation to Stokesian dynamics.
off (default)
on
PKG_COMPRESS Compressed output of dump files via the zlib compression library, using dump styles with a “gz” in their style name.
off (default)
on
PKG_CORESHELL Compute and pair styles that implement the adiabatic core/shell model for polarizability. The pair styles augment Born, Buckingham, and Lennard-Jones styles with core/shell capabilities. The compute temp/cs command calculates the temperature of a system with core/shell particles.
off (default)
on
PKG_DIPOLE An atom style and several pair styles for point dipole models with short-range or long-range interactions.
off (default)
on
PKG_GRANULAR Pair styles and fixes for finite-size granular particles, which interact with each other and boundaries via frictional and dissipative potentials.
off (default)
on
PKG_KSPACE A variety of long-range Coulombic solvers, as well as pair styles which compute the corresponding short-range pairwise Coulombic interactions. These include Ewald, particle-particle particle-mesh (PPPM), and multilevel summation method (MSM) solvers.
off (default)
on
PKG_MANYBODY A variety of manybody and bond-order potentials. These include (AI)REBO, BOP, EAM, EIM, Stillinger-Weber, and Tersoff potentials.
off (default)
on
PKG_MC Several fixes and a pair style that have Monte Carlo (MC) or MC-like attributes. These include fixes for creating, breaking, and swapping bonds, for performing atomic swaps, and performing grand-canonical MC (GCMC) in conjuction with dynamics.
off (default)
on
PKG_MEAM

A pair style for the modified embedded atom (MEAM) potential.

Please note that the MEAM package has been superseded by the USER-MEAMC package, which is a direct translation of the MEAM package to C++. USER-MEAMC contains additional optimizations making it run faster than MEAM on most machines, while providing the identical features and USER interface.

off (default)
on
PKG_MISC A variety of compute, fix, pair, dump styles with specialized capabilities that dont align with other packages.
off (default)
on
PKG_MOLECULE A large number of atom, pair, bond, angle, dihedral, improper styles that are used to model molecular systems with fixed covalent bonds. The pair styles include the Dreiding (hydrogen-bonding) and CHARMM force fields, and a TIP4P water model.
off (default)
on
PKG_PERI An atom style, several pair styles which implement different Peridynamics materials models, and several computes which calculate diagnostics. Peridynamics is a a particle-based meshless continuum model.
off (default)
on
PKG_QEQ Several fixes for performing charge equilibration (QEq) via different algorithms. These can be used with pair styles that perform QEq as part of their formulation.
off (default)
on
PKG_REAX A pair style which wraps a Fortran library which implements the ReaxFF potential, which is a universal reactive force field. See the USER-REAXC package for an alternate implementation in C/C++. Also a fix reax/bonds command for monitoring molecules as bonds are created and destroyed.
off (default)
on
PKG_REPLICA A collection of multi-replica methods which can be used when running multiple LAMMPS simulations (replicas). See Section 6.5 for an overview of how to run multi-replica simulations in LAMMPS. Methods in the package include nudged elastic band (NEB), parallel replica dynamics (PRD), temperature accelerated dynamics (TAD), parallel tempering, and a verlet/split algorithm for performing long-range Coulombics on one set of processors, and the remainder of the force field calcalation on another set.
off (default)
on
PKG_RIGID Fixes which enforce rigid constraints on collections of atoms or particles. This includes SHAKE and RATTLE, as well as varous rigid-body integrators for a few large bodies or many small bodies. Also several computes which calculate properties of rigid bodies.
off (default)
on
PKG_SHOCK Fixes for running impact simulations where a shock-wave passes through a material.
off (default)
on
PKG_SNAP A pair style for the spectral neighbor analysis potential (SNAP). SNAP is methodology for deriving a highly accurate classical potential fit to a large archive of quantum mechanical (DFT) data. Also several computes which analyze attributes of the potential.
off (default)
on
PKG_SRD A pair of fixes which implement the Stochastic Rotation Dynamics (SRD) method for coarse-graining of a solvent, typically around large colloidal particles.
off (default)
on

Other Packages

Option Description Values
PKG_KIM A pair_style kim command which is a wrapper on the Knowledge Base for Interatomic Models (KIM) repository of interatomic potentials, enabling any of them to be used in LAMMPS simulations.
off (default)
on
PKG_PYTHON Enable support for Python scripting inside of LAMMPS.
off (default)
on
PKG_MSCG A fix mscg command which can parameterize a Multi-Scale Coarse-Graining (MSCG) model using the open-source MS-CG library.
off (default)
on
PKG_MPIIO Support for parallel output/input of dump and restart files via the MPIIO library.
off (default)
on
PKG_POEMS A fix that wraps the Parallelizable Open source Efficient Multibody Software (POEMS) library, which is able to simulate the dynamics of articulated body systems. These are systems with multiple rigid bodies (collections of particles) whose motion is coupled by connections at hinge points.
off (default)
on
PKG_LATTE A fix command which wraps the LATTE DFTB code, so that molecular dynamics can be run with LAMMPS using density-functional tight-binding quantum forces calculated by LATTE.
off (default)
on

User Packages

Option Description Values
PKG_USER-ATC ATC stands for atoms-to-continuum. This package implements a fix atc command to either couple molecular dynamics with continuum finite element equations or perform on-the-fly conversion of atomic information to continuum fields.
off (default)
on
PKG_USER-AWPMD AWPMD stands for Antisymmetrized Wave Packet Molecular Dynamics. This package implements an atom, pair, and fix style which allows electrons to be treated as explicit particles in a classical molecular dynamics model.
off (default)
on
PKG_USER-CGDNA Several pair styles, a bond style, and integration fixes for coarse-grained models of single- and double-stranded DNA based on the oxDNA model of Doye, Louis and Ouldridge at the University of Oxford. This includes Langevin-type rigid-body integrators with improved stability.
off (default)
on
PKG_USER-CGSDK Several pair styles and an angle style which implement the coarse-grained SDK model of Shinoda, DeVane, and Klein which enables simulation of ionic liquids, electrolytes, lipids and charged amino acids.
off (default)
on
PKG_USER-COLVARS COLVARS stands for collective variables, which can be used to implement various enhanced sampling methods, including Adaptive Biasing Force, Metadynamics, Steered MD, Umbrella Sampling and Restraints. A fix colvars command is implemented which wraps a COLVARS library, which implements these methods. simulations.
off (default)
on
PKG_USER-DIFFRACTION Two computes and a fix for calculating x-ray and electron diffraction intensities based on kinematic diffraction theory.
off (default)
on
PKG_USER-DPD DPD stands for dissipative particle dynamics. This package implements coarse-grained DPD-based models for energetic, reactive molecular crystalline materials. It includes many pair styles specific to these systems, including for reactive DPD, where each particle has internal state for multiple species and a coupled set of chemical reaction ODEs are integrated each timestep. Highly accurate time integrators for isothermal, isoenergetic, isobaric and isenthalpic conditions are included. These enable long timesteps via the Shardlow splitting algorithm.
off (default)
on
PKG_USER-DRUDE Fixes, pair styles, and a compute to simulate thermalized Drude oscillators as a model of polarization.
off (default)
on
PKG_USER-EFF EFF stands for electron force field which allows a classical MD code to model electrons as particles of variable radius. This package contains atom, pair, fix and compute styles which implement the eFF as described in A. Jaramillo-Botero, J. Su, Q. An, and W.A. Goddard III, JCC, 2010. The eFF potential was first introduced by Su and Goddard, in 2007.
off (default)
on
PKG_USER-FEP FEP stands for free energy perturbation. This package provides methods for performing FEP simulations by using a fix adapt/fep command with soft-core pair potentials, which have a “soft” in their style name.
off (default)
on
PKG_USER-H5MD H5MD stands for HDF5 for MD. HDF5 is a portable, binary, self-describing file format, used by many scientific simulations. H5MD is a format for molecular simulations, built on top of HDF5. This package implements a dump h5md command to output LAMMPS snapshots in this format.
off (default)
on
PKG_USER-LB Fixes which implement a background Lattice-Boltzmann (LB) fluid, which can be used to model MD particles influenced by hydrodynamic forces.
off (default)
on
PKG_USER-MANIFOLD Several fixes and a “manifold” class which enable simulations of particles constrained to a manifold (a 2D surface within the 3D simulation box). This is done by applying the RATTLE constraint algorithm to formulate single-particle constraint functions g(xi,yi,zi) = 0 and their derivative (i.e. the normal of the manifold) n = grad(g).
off (default)
on
PKG_USER-MEAMC A pair style for the modified embedded atom (MEAM) potential translated from the Fortran version in the MEAM package to plain C++. In contrast to the MEAM package, no library needs to be compiled and the pair style can be instantiated multiple times.
off (default)
on
PKG_USER-MESO Several extensions of the the dissipative particle dynamics (DPD) method. Specifically, energy-conserving DPD (eDPD) that can model non-isothermal processes, many-body DPD (mDPD) for simulating vapor-liquid coexistence, and transport DPD (tDPD) for modeling advection-diffusion-reaction systems. The equations of motion of these DPD extensions are integrated through a modified velocity-Verlet (MVV) algorithm.
off (default)
on
PKG_USER-MGPT A pair style which provides a fast implementation of the quantum-based MGPT multi-ion potentials. The MGPT or model GPT method derives from first-principles DFT-based generalized pseudopotential theory (GPT) through a series of systematic approximations valid for mid-period transition metals with nearly half-filled d bands. The MGPT method was originally developed by John Moriarty at LLNL. The pair style in this package calculates forces and energies using an optimized matrix-MGPT algorithm due to Tomas Oppelstrup at LLNL.
off (default)
on
PKG_USER-MISC A potpourri of (mostly) unrelated features contributed to LAMMPS by users. Each feature is a single fix, compute, pair, bond, angle, dihedral, improper, or command style.
off (default)
on
PKG_USER-MOFFF Pair, angle and improper styles needed to employ the MOF-FF force field by Schmid and coworkers with LAMMPS. MOF-FF is a first principles derived force field with the primary aim to simulate MOFs and related porous framework materials, using spherical Gaussian charges. It is described in S. Bureekaew et al., Phys. Stat. Sol. B 2013, 250, 1128-1141. For the usage of MOF-FF see the example in the example directory as well as the MOF+ website.
off (default)
on
PKG_USER-MOLFILE A dump molfile command which uses molfile plugins that are bundled with the VMD molecular visualization and analysis program, to enable LAMMPS to dump snapshots in formats compatible with various molecular simulation tools.
off (default)
on
PKG_USER-NETCDF Dump styles for writing NetCDF formatted dump files. NetCDF is a portable, binary, self-describing file format developed on top of HDF5. The file contents follow the AMBER NetCDF trajectory conventions (http://ambermd.org/netcdf/nctraj.xhtml), but include extensions.
off (default)
on
PKG_USER-PHONON A fix phonon command that calculates dynamical matrices, which can then be used to compute phonon dispersion relations, directly from molecular dynamics simulations.
off (default)
on
PKG_USER-QTB Two fixes which provide a self-consistent quantum treatment of vibrational modes in a classical molecular dynamics simulation. By coupling the MD simulation to a colored thermostat, it introduces zero point energy into the system, altering the energy power spectrum and the heat capacity to account for their quantum nature. This is useful when modeling systems at temperatures lower than their classical limits or when temperatures ramp across the classical limits in a simulation.
off (default)
on
PKG_USER-QUIP A pair_style quip command which wraps the QUIP libAtoms library, which includes a variety of interatomic potentials, including Gaussian Approximation Potential (GAP) models developed by the Cambridge University group.
off (default)
on
PKG_USER-QMMM A fix qmmm command which allows LAMMPS to be used in a QM/MM simulation, currently only in combination with the Quantum ESPRESSO package.
off (default)
on
PKG_USER-REAXC A pair style which implements the ReaxFF potential in C/C++ (in contrast to the REAX package and its Fortran library). ReaxFF is universal reactive force field. See the src/USER-REAXC/README file for more info on differences between the two packages. Also two fixes for monitoring molecules as bonds are created and destroyed.
off (default)
on
PKG_USER-SMD An atom style, fixes, computes, and several pair styles which implements smoothed Mach dynamics (SMD) for solids, which is a model related to smoothed particle hydrodynamics (SPH) for liquids (see the USER-SPH package).
off (default)
on
PKG_USER-SMTBQ A pair style which implements a Second Moment Tight Binding model with QEq charge equilibration (SMTBQ) potential for the description of ionocovalent bonds in oxides.
off (default)
on
PKG_USER-SPH An atom style, fixes, computes, and several pair styles which implements smoothed particle hydrodynamics (SPH) for liquids. See the related USER-SMD package package for smooth Mach dynamics (SMD) for solids.
off (default)
on
PKG_USER-TALLY Several compute styles that can be called when pairwise interactions are calculated to tally information (forces, heat flux, energy, stress, etc) about individual interactions.
off (default)
on
PKG_USER-UEF A fix style for the integration of the equations of motion under extensional flow with proper boundary conditions, as well as several supporting compute styles and an output option.
off (default)
on
PKG_USER-VTK A dump vtk command which outputs snapshot info in the VTK format, enabling visualization by Paraview or other visualization packages.
off (default)
on

Package-Specific Configuration Options

KSPACE Package

Option Description Values
FFT

FFT library for KSPACE package

If either MKL or FFTW is selected cmake will try to locate these libraries automatically. To control which one should be used please see the options below for each FFT library.

KISS
FFTW3
FFTW2
MKL
FFT_PACK Optimization for FFT
array (default)
pointer
memcpy

MKL

Option Description Values
MKL_INCLUDE_DIRS
MKL_LIBRARIES

TODO static vs dynamic linking

FFTW2

Option Description Values
FFTW2_INCLUDE_DIRS
FFTW2_LIBRARIES

FFTW3

Option Description Values
FFTW3_INCLUDE_DIRS
FFTW3_LIBRARIES

LAPACK

TODO

PYTHON Package

USER-INTEL Package

Option Description Values
INTEL_ARCH Target architecture for USER-INTEL package
cpu (default)
knl

GPU Package

The GPU package builds a support library which can either use OpenCL or CUDA as target API.

Option Description Values
GPU_API API used by GPU package
opencl (default)
cuda
GPU_PREC Precision size used by GPU package kernels
mixed (default)
single
double
OCL_TUNE (OpenCL only) Tuning target for OpenCL driver code
generic (default)
intel (Intel CPU)
phi (Intel Xeon Phi)
fermi (NVIDIA)
kepler (NVIDIA)
cypress (AMD)
GPU_ARCH (CUDA only) CUDA SM architecture targeted by GPU package
sm_20 (Fermi)
sm_30 (Kepler)
sm_50 (Maxwell)
sm_60 (Pascal)
sm_70 (Volta)
CUDPP_OPT (CUDA only) Enable CUDA Performance Primitives Optimizations
on (default)
off
BIN2C (CUDA only) Path to bin2c executable, will automatically pick up the first one in your $PATH. (automatic)

VORONOI Package

TODO

USER-SMD Package

Requires a Eigen3 installation

Option Description Values
EIGEN3_INCLUDE_DIR

Optional Features

zlib support

Option Description Values
ZLIB_INCLUDE_DIR
ZLIB_LIBRARIES

JPEG support

Option Description Values
WITH_JPEG Enables/Disable JPEG support in LAMMPS
yes (default, if found)
no
JPEG_INCLUDE_DIR
JPEG_LIBRARIES

PNG support

(requires zlib support)

Option Description Values
WITH_PNG Enables/Disable PNG support in LAMMPS
yes (default, if found)
no
PNG_INCLUDE_DIR
PNG_LIBRARIES

GZIP support

requires gzip to be in your PATH

Option Description Values
WITH_GZIP Enables/Disable GZIP support in LAMMPS
yes (default, if found)
no
GZIP_EXECUTABLE Path to gzip executable, will automatically pick up the first one in your $PATH. (automatic)

FFMPEG support

requires ffmpeg to be in your PATH

Option Description Values
WITH_FFMPEG Enables/Disable FFMPEG support in LAMMPS
yes (default, if found)
no
FFMPEG_EXECUTABLE Path to ffmpeg executable, will automatically pick up the first one in your $PATH. (automatic)

Compilers

By default, cmake will use your environment C/C++/Fortran compilers for a build. It uses the CC, CXX and FC environment variables to detect which compilers should be used. However, these values will be cached after the first run of cmake. Subsequent runs of cmake will ignore changes in these environment variables. To ensure the correct values are used you avoid the cache by setting the CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_Fortran_COMPILER options directly.

Option Description Default
CMAKE_C_COMPILER C Compiler which should be used by CMake value of `CC` environment variable at first `cmake` run
CMAKE_CXX_COMPILER C++ compiler which should be used by CMake value of `CXX` environment variable at first `cmake` run
CMAKE_Fortran_COMPILER C++ compiler which should be used by CMake value of `FC` environment variable at first `cmake` run
CXX_COMPILER_LAUNCHER CMake will run this tool and pass the compiler and its arguments to the tool. Some example tools are distcc and ccache. (empty)

Building with GNU Compilers

cmake -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ -D CMAKE_Fortran_COMPILER=gfortran ../cmake

Building with Intel Compilers

cmake -D CMAKE_C_COMPILER=icc -D CMAKE_CXX_COMPILER=icpc -D CMAKE_Fortran_COMPILER=ifort ../cmake

Building with LLVM/Clang Compilers

cmake -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_Fortran_COMPILER=flang ../cmake

Examples