Environment variables

ZenMake supports some environment variables that can be used. Most of examples are for POSIX platforms (Linux/MacOS) with gcc and clang installed. Also see bash-like substitutions.

AR
Set archive-maintaining program.
CC

Set C compiler. It can be name of installed a system compiler or any path to existing compiler. It overrides values from build config if present. Example:

CC=clang zenmake build -B
CXX

Set C++ compiler. It can be name of installed a system compiler or any path to existing compiler. It overrides values from build config if present. Example:

CXX=clang++ zenmake build -B
DC

Set D compiler. It can be name of installed a system compiler or any path to existing compiler. It overrides values from build config if present. Example:

DC=ldc2 zenmake build -B
FC

Set Fortran compiler. It can be name of installed a system compiler or any path to existing compiler. It overrides values from build config if present. Example:

FC=gfortran zenmake build -B
AS

Set Assembler. It can be name of installed a system compiler or any path to existing compiler. It overrides values from build config if present. Example:

AS=gcc zenmake build -B
ARFLAGS
Flags to give the archive-maintaining program.
CFLAGS

Extra flags to give to the C compiler. Example:

CFLAGS='-O3 -fPIC' zenmake build -B
CXXFLAGS

Extra flags to give to the C++ compiler. Example:

CXXFLAGS='-O3 -fPIC' zenmake build -B
CPPFLAGS
Extra flags added at the end of compilation commands for C/C++.
DFLAGS

Extra flags to give to the D compiler. Example:

DFLAGS='-O' zenmake build -B
FCFLAGS

Extra flags to give to the Fortran compiler. Example:

FCFLAGS='-O0' zenmake build -B
ASFLAGS

Extra flags to give to the Assembler. Example:

ASFLAGS='-Os' zenmake build -B
LINKFLAGS

Extra list of linker flags for C/C++/D/Fortran. Example:

LINKFLAGS='-Wl,--as-needed' zenmake build -B
LDFLAGS

Extra list of linker flags at the end of the link command for C/C++/D/Fortran. Example:

LDFLAGS='-Wl,--as-needed' zenmake build -B
ASLINKFLAGS

Extra list of linker flags for Assembler files. Example:

ASLINKFLAGS='-s' zenmake build -B
JOBS

Default value for the amount of parallel jobs. Has no effect when -j is provided on the command line. Example:

JOBS=2 zenmake build
NUMBER_OF_PROCESSORS
Default value for the amount of parallel jobs when the JOBS environment variable is not provided; it is usually set on windows systems. Has no effect when -j is provided on the command line.
NOCOLOR

When set to a non-empty value, colors in console outputs are disabled. Has no effect when --color is provided on the command line. Example:

NOCOLOR=1 zenmake build
NOSYNC

When set to a non-empty value, console outputs are displayed in an asynchronous manner; console text outputs may appear faster on some platforms. Example:

NOSYNC=1 zenmake build
BUILDROOT

A path to the root of a project build directory. The path can be absolute or relative to the current directory. See also buildroot. Example:

BUILDROOT=bld zenmake build
DESTDIR

Default installation base directory when --destdir is not provided on the command line. It’s mostly for installing to a temporary directory. For example it can be used to create deb/rpm/etc packages. Example:

DESTDIR=dest zenmake install
PREFIX

Set value of built-in variable prefix as the installation prefix. This path is always considered as an absolute path or as a relative path to DESTDIR. Example:

PREFIX=/usr zenmake install
EXEC_PREFIX
Set value of built-in variable execprefix as the installation prefix for machine-specific files.
BINDIR

Set value of built-in variable bindir as the directory for installing executable programs that users can run. This path is always considered as an absolute path or as a relative path to DESTDIR. Example:

BINDIR=/usr/bin zenmake install
SBINDIR
Set value of built-in variable sbindir as the directory for installing executable programs that can be run, but are only generally useful to system administrators. This path is always considered as an absolute path or as a relative path to DESTDIR.
LIBEXECDIR
Set value of built-in variable libexecdir as the directory for installing executable programs to be run by other programs rather than by users. This path is always considered as an absolute path or as a relative path to DESTDIR.
LIBDIR
Set value of built-in variable libdir as the installation directory for object files and libraries of object code. This path is always considered as an absolute path or as a relative path to DESTDIR.
SYSCONFDIR
Set value of built-in variable sysconfdir as the installation directory for read-only single-machine data. This path is always considered as an absolute path or as a relative path to DESTDIR.
SHAREDSTATEDIR
Set value of built-in variable sharedstatedir as the installation directory for modifiable architecture-independent data. This path is always considered as an absolute path or as a relative path to DESTDIR.
LOCALSTATEDIR
Set value of built-in variable localstatedir as the installation directory for modifiable single-machine data. This path is always considered as an absolute path or as a relative path to DESTDIR.
INCLUDEDIR
Set value of built-in variable includedir as the installation directory for C header files. This path is always considered as an absolute path or as a relative path to DESTDIR.
DATAROOTDIR
Set value of built-in variable datarootdir as the installation root directory for read-only architecture-independent data. This path is always considered as an absolute path or as a relative path to DESTDIR.
DATADIR
Set value of built-in variable datadir as the installation directory for read-only architecture-independent data. This path is always considered as an absolute path or as a relative path to DESTDIR.
APPDATADIR
Set value of built-in variable appdatadir as the installation directory for read-only architecture-independent application data. This path is always considered as an absolute path or as a relative path to DESTDIR.
DOCDIR
Set value of built-in variable docdir as the installation directory for documentation. This path is always considered as an absolute path or as a relative path to DESTDIR.
MANDIR
Set value of built-in variable mandir as the installation directory for man documentation. This path is always considered as an absolute path or as a relative path to DESTDIR.
INFODIR
Set value of built-in variable infodir as the installation directory for info documentation. This path is always considered as an absolute path or as a relative path to DESTDIR.
LOCALEDIR
Set value of built-in variable localedir as the installation directory for locale-dependent data. This path is always considered as an absolute path or as a relative path to DESTDIR.
QT5_BINDIR
Set the bin directory of the installed Qt5 toolkit. This directory must contain such tools like qmake, moc, uic, etc. This path must be absolute native path or path relative to the current working directory but last variant is not recommended. This variable can be especially useful for standalone installation of Qt5, for example on Windows. The PATH and QT5_SEARCH_ROOT environment variables are ignored if QT5_BINDIR is not empty.
QT5_LIBDIR
Set the library directory of the installed Qt5 toolkit. This path must be absolute native path or path relative to the current working directory but last variant is not recommended. Usually you don’t need to use this variable if you set the QT5_BINDIR variable.
QT5_INCLUDES
Set the directory with ‘includes’ of the installed Qt5 toolkit. This path must be absolute native path or path relative to the current working directory but last variant is not recommended. Usually you don’t need to use this variable if you set the QT5_BINDIR variable. This variable has no effect on systems with pkg-config/pkgconf installed (while you don’t turn on the QT5_NO_PKGCONF).
QT5_SEARCH_ROOT

Set the root directory to search for installed Qt5 toolkit(s). ZenMake will try to find the bin directories of all Qt5 toolkits in this directory recursively. Dot not set this variable to path like / or C:\ because it will slow down the detection very much. Qt5 toolkits found in this directory have priority over values from the PATH environment variable. You can set more than one directories using path separator (; on Windows and : on other OS) like this:

QT5_SEARCH_ROOT=/usr/local/qt:/usr/local/opt/qt zenmake

It defaults to C:\Qt on Windows. Usually you don’t need to use this variable on Linux.

QT5_MIN_VER
Set minimum version of Qt5. For example it can be 5.1 or 5.1.2.
QT5_MAX_VER
Set maximum version of Qt5. For example it can be 5.12 or 5.12.2.
QT5_USE_HIGHEST_VER
By default ZenMake will use first useful version of Qt5. When this variable set to a ‘True’, ‘true’, ‘yes’ or non-zero number then ZenMake will try to use the highest version of Qt5 among found versions.
QT5_NO_PKGCONF
When set to a ‘True’, ‘true’, ‘yes’ or non-zero number, ZenMake will not use pkg-config/pkgconf to configure building with Qt5. Usually you don’t need to use this variable.
QT5_{MOC,UIC,RCC,LRELEASE,LUPDATE}
These variables can be used to specify full file paths to Qt5 tools moc, uic, rcc, lrelease and lupdate. Usually you don’t need to use these variables.
ZM_CACHE_CFGACTIONS

When set to a ‘True’, ‘true’, ‘yes’ or non-zero number, ZenMake tries to use a cache for some configuration actions. Has no effect when --cache-cfg-actions is provided on the command line. It can speed up next runs of some configuration actions but also it can ignore changes in toolchains, system paths, etc. In general, it is safe to use it if there were no changes in the current system. Example:

ZM_CACHE_CFGACTIONS=1 zenmake configure