1CMAKE-ENV-VARIABLES(7)               CMake              CMAKE-ENV-VARIABLES(7)
2
3
4

NAME

6       cmake-env-variables - CMake Environment Variables Reference
7
8       This  page  lists  environment  variables  that have special meaning to
9       CMake.
10
11       For general information on environment variables, see  the  Environment
12       Variables section in the cmake-language manual.
13

ENVIRONMENT VARIABLES THAT CONTROL THE BUILD

15   CMAKE_BUILD_PARALLEL_LEVEL
16       This  is  a CMake Environment Variable. Its initial value is taken from
17       the calling process environment.
18
19       Specifies the maximum number of concurrent processes to use when build‐
20       ing using the cmake --build command line Build Tool Mode.
21
22       If  this variable is defined empty the native build tool’s default num‐
23       ber is used.
24
25   CMAKE_CONFIG_TYPE
26       This is a CMake Environment Variable. Its initial value is  taken  from
27       the calling process environment.
28
29       The  default  build  configuration  for Build Tool Mode and ctest build
30       handler when there is no explicit configuration given.
31
32   CMAKE_EXPORT_COMPILE_COMMANDS
33       This is a CMake Environment Variable. Its initial value is  taken  from
34       the calling process environment.
35
36       The  default  value  for CMAKE_EXPORT_COMPILE_COMMANDS when there is no
37       explicit configuration given on the first  run  while  creating  a  new
38       build tree.  On later runs in an existing build tree the value persists
39       in the cache as CMAKE_EXPORT_COMPILE_COMMANDS.
40
41   CMAKE_GENERATOR
42       This is a CMake Environment Variable. Its initial value is  taken  from
43       the calling process environment.
44
45       Specifies  the CMake default generator to use when no generator is sup‐
46       plied with -G. If the provided value doesn’t name a generator known  by
47       CMake,  the internal default is used.  Either way the resulting genera‐
48       tor selection is stored in the CMAKE_GENERATOR variable.
49
50       Some generators may be additionally configured  using  the  environment
51       variables:
52
53       · CMAKE_GENERATOR_PLATFORM
54
55       · CMAKE_GENERATOR_TOOLSET
56
57       · CMAKE_GENERATOR_INSTANCE
58
59   CMAKE_GENERATOR_INSTANCE
60       This  is  a CMake Environment Variable. Its initial value is taken from
61       the calling process environment.
62
63       Default  value  for  CMAKE_GENERATOR_INSTANCE  if  no  Cache  entry  is
64       present. This value is only applied if CMAKE_GENERATOR is set.
65
66   CMAKE_GENERATOR_PLATFORM
67       This  is  a CMake Environment Variable. Its initial value is taken from
68       the calling process environment.
69
70       Default value for CMAKE_GENERATOR_PLATFORM if no Cache entry is present
71       and  no  value  is specified by cmake(1) -A option.  This value is only
72       applied if CMAKE_GENERATOR is set.
73
74   CMAKE_GENERATOR_TOOLSET
75       This is a CMake Environment Variable. Its initial value is  taken  from
76       the calling process environment.
77
78       Default  value for CMAKE_GENERATOR_TOOLSET if no Cache entry is present
79       and no value is specified by cmake(1) -T option.  This  value  is  only
80       applied if CMAKE_GENERATOR is set.
81
82   CMAKE_<LANG>_COMPILER_LAUNCHER
83       This  is  a CMake Environment Variable. Its initial value is taken from
84       the calling process environment.
85
86       Default compiler launcher to use for the specified language. Will  only
87       be used by CMake to initialize the variable on the first configuration.
88       Afterwards, it is available through the cache setting of  the  variable
89       of  the same name. For any configuration run (including the first), the
90       environment  variable  will  be  ignored   if   the   CMAKE_<LANG>_COM‐
91       PILER_LAUNCHER variable is defined.
92
93   CMAKE_MSVCIDE_RUN_PATH
94       This  is  a CMake Environment Variable. Its initial value is taken from
95       the calling process environment.
96
97       Extra PATH locations for custom commands when  using  Visual  Studio  9
98       2008 (or above) generators.
99
100       The  CMAKE_MSVCIDE_RUN_PATH environment variable sets the default value
101       for the CMAKE_MSVCIDE_RUN_PATH variable if not already explicitly set.
102
103   CMAKE_NO_VERBOSE
104       Disables verbose output from CMake when VERBOSE environment variable is
105       set.
106
107       Only your build tool of choice will still print verbose output when you
108       start to actually build your project.
109
110   CMAKE_OSX_ARCHITECTURES
111       This is a CMake Environment Variable. Its initial value is  taken  from
112       the calling process environment.
113
114       Target specific architectures for macOS.
115
116       The CMAKE_OSX_ARCHITECTURES environment variable sets the default value
117       for the CMAKE_OSX_ARCHITECTURES  variable.  See  OSX_ARCHITECTURES  for
118       more information.
119
120   DESTDIR
121       This  is  a CMake Environment Variable. Its initial value is taken from
122       the calling process environment.
123
124       On UNIX one can use the DESTDIR mechanism  in  order  to  relocate  the
125       whole  installation.   DESTDIR means DESTination DIRectory.  It is com‐
126       monly  used  by  makefile  users  in  order  to  install  software   at
127       non-default location.  It is usually invoked like this:
128
129          make DESTDIR=/home/john install
130
131       which  will  install the concerned software using the installation pre‐
132       fix, e.g.  /usr/local prepended with the DESTDIR  value  which  finally
133       gives /home/john/usr/local.
134
135       WARNING: DESTDIR may not be used on Windows because installation prefix
136       usually contains a drive letter like in C:/Program Files  which  cannot
137       be prepended with some other prefix.
138
139   LDFLAGS
140       This  is  a CMake Environment Variable. Its initial value is taken from
141       the calling process environment.
142
143       Will only be used by CMake on the first configuration to determine  the
144       default  linker  flags,  after which the value for LDFLAGS is stored in
145       the           cache           as           CMAKE_EXE_LINKER_FLAGS_INIT,
146       CMAKE_SHARED_LINKER_FLAGS_INIT, and CMAKE_MODULE_LINKER_FLAGS_INIT. For
147       any configuration run (including the first), the  environment  variable
148       will be ignored if the equivalent  CMAKE_<TYPE>_LINKER_FLAGS_INIT vari‐
149       able is defined.
150
151   MACOSX_DEPLOYMENT_TARGET
152       This is a CMake Environment Variable. Its initial value is  taken  from
153       the calling process environment.
154
155       Specify  the  minimum version of macOS on which the target binaries are
156       to be deployed.
157
158       The MACOSX_DEPLOYMENT_TARGET  environment  variable  sets  the  default
159       value for the CMAKE_OSX_DEPLOYMENT_TARGET variable.
160
161   <PackageName>_ROOT
162       This  is  a CMake Environment Variable. Its initial value is taken from
163       the calling process environment.
164
165       Calls to find_package(<PackageName>) will search in prefixes  specified
166       by  the <PackageName>_ROOT environment variable, where <PackageName> is
167       the name given to the find_package() call and _ROOT  is  literal.   For
168       example,  find_package(Foo)  will  search  prefixes  specified  in  the
169       Foo_ROOT environment variable (if set).  See policy CMP0074.
170
171       This variable may hold a single prefix or a list of prefixes  separated
172       by : on UNIX or ; on Windows (the same as the PATH environment variable
173       convention on those platforms).
174
175       See also the <PackageName>_ROOT CMake variable.
176
177   VERBOSE
178       Activates verbose output from CMake and your build tools of choice when
179       you start to actually build your project.
180
181       Note that any given value is ignored. It’s just checked for existence.
182
183       See also Build Tool Mode and CMAKE_NO_VERBOSE environment variable
184

ENVIRONMENT VARIABLES FOR LANGUAGES

186   ASM<DIALECT>
187       This  is  a CMake Environment Variable. Its initial value is taken from
188       the calling process environment.
189
190       Preferred executable for compiling a specific dialect of assembly  lan‐
191       guage  files.  ASM<DIALECT>  can  be ASM, ASM_NASM (Netwide Assembler),
192       ASM_MASM (Microsoft Assembler) or ASM-ATT (Assembler AT&T).  Will  only
193       be  used  by CMake on the first configuration to determine ASM<DIALECT>
194       compiler, after which the value for ASM<DIALECT> is stored in the cache
195       as  CMAKE_ASM<DIALECT>_COMPILER. For subsequent configuration runs, the
196       environment    variable    will    be    ignored    in     favor     of
197       CMAKE_ASM<DIALECT>_COMPILER.
198
199   ASM<DIALECT>FLAGS
200       This  is  a CMake Environment Variable. Its initial value is taken from
201       the calling process environment.
202
203       Default compilation flags to be used when compiling a specific  dialect
204       of  an  assembly language. ASM<DIALECT>FLAGS can be ASMFLAGS, ASM_NASM‐
205       FLAGS, ASM_MASMFLAGS or ASM-ATTFLAGS. Will only be used by CMake on the
206       first  configuration  to  determine  ASM_<DIALECT>  default compilation
207       flags, after which the value for ASM<DIALECT>FLAGS  is  stored  in  the
208       cache  as  CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>.  For any con‐
209       figuration run (including the first), the environment variable will  be
210       ignored,  if the CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS> variable
211       is defined.
212
213   CC
214       This is a CMake Environment Variable. Its initial value is  taken  from
215       the calling process environment.
216
217       Preferred  executable for compiling C language files. Will only be used
218       by CMake on the first configuration  to  determine  C  compiler,  after
219       which  the value for CC is stored in the cache as CMAKE_C_COMPILER. For
220       any configuration run (including the first), the  environment  variable
221       will be ignored if the CMAKE_C_COMPILER variable is defined.
222
223   CFLAGS
224       This  is  a CMake Environment Variable. Its initial value is taken from
225       the calling process environment.
226
227       Default compilation flags to be used when compiling C files. Will  only
228       be  used  by  CMake  on the first configuration to determine CC default
229       compilation flags, after which the value for CFLAGS is  stored  in  the
230       cache  as  CMAKE_C_FLAGS.  For  any  configuration  run  (including the
231       first), the environment variable will be ignored if  the  CMAKE_C_FLAGS
232       variable is defined.
233
234   CSFLAGS
235       This  is  a CMake Environment Variable. Its initial value is taken from
236       the calling process environment.
237
238       Preferred executable for compiling CSharp language files. Will only  be
239       used  by  CMake  on the first configuration to determine CSharp default
240       compilation flags, after which the value for CSFLAGS is stored  in  the
241       cache  as  CMAKE_CSharp_FLAGS. For any configuration run (including the
242       first),   the   environment   variable   will   be   ignored   if   the
243       CMAKE_CSharp_FLAGS variable is defined.
244
245   CUDACXX
246       This  is  a CMake Environment Variable. Its initial value is taken from
247       the calling process environment.
248
249       Preferred executable for compiling CUDA language files.  Will  only  be
250       used  by  CMake  on the first configuration to determine CUDA compiler,
251       after  which  the  value  for  CUDA  is  stored   in   the   cache   as
252       CMAKE_CUDA_COMPILER.  For  any configuration run (including the first),
253       the environment variable will be  ignored  if  the  CMAKE_CUDA_COMPILER
254       variable is defined.
255
256   CUDAFLAGS
257       This  is  a CMake Environment Variable. Its initial value is taken from
258       the calling process environment.
259
260       Default compilation flags to be used when compiling  CUDA  files.  Will
261       only  be  used  by  CMake  on the first configuration to determine CUDA
262       default compilation flags, after  which  the  value  for  CUDAFLAGS  is
263       stored  in  the  cache  as  CMAKE_CUDA_FLAGS. For any configuration run
264       (including the first), the environment variable will be ignored if  the
265       CMAKE_CUDA_FLAGS variable is defined.
266
267   CUDAHOSTCXX
268       This  is  a CMake Environment Variable. Its initial value is taken from
269       the calling process environment.
270
271       Preferred executable for compiling host code when compiling  CUDA  lan‐
272       guage  files.  Will only be used by CMake on the first configuration to
273       determine CUDA host compiler, after which the value for CUDAHOSTCXX  is
274       stored  in the cache as CMAKE_CUDA_HOST_COMPILER. For any configuration
275       run (including the first), the environment variable will be ignored  if
276       the CMAKE_CUDA_HOST_COMPILER variable is defined.
277
278       This environment variable is primarily meant for use with projects that
279       enable CUDA as a first-class language.  The FindCUDA module  will  also
280       use it to initialize its CUDA_HOST_COMPILER setting.
281
282   CXX
283       This  is  a CMake Environment Variable. Its initial value is taken from
284       the calling process environment.
285
286       Preferred executable for compiling CXX language  files.  Will  only  be
287       used  by  CMake  on  the first configuration to determine CXX compiler,
288       after which the value for CXX is stored in the cache as  CMAKE_CXX_COM‐
289       PILER. For any configuration run (including the first), the environment
290       variable will be ignored if the CMAKE_CXX_COMPILER variable is defined.
291
292   CXXFLAGS
293       This is a CMake Environment Variable. Its initial value is  taken  from
294       the calling process environment.
295
296       Default  compilation  flags  to be used when compiling CXX (C++) files.
297       Will only be used by CMake on the first configuration to determine  CXX
298       default compilation flags, after which the value for CXXFLAGS is stored
299       in the cache as CMAKE_CXX_FLAGS. For any configuration run (  including
300       the   first),   the   environment  variable  will  be  ignored  if  the
301       CMAKE_CXX_FLAGS variable is defined.
302
303   FC
304       This is a CMake Environment Variable. Its initial value is  taken  from
305       the calling process environment.
306
307       Preferred executable for compiling Fortran language files. Will only be
308       used by CMake on the first configuration to determine Fortran compiler,
309       after  which the value for Fortran is stored in the cache as CMAKE_For‐
310       tran_COMPILER. For any configuration run  (including  the  first),  the
311       environment  variable  will  be  ignored  if the CMAKE_Fortran_COMPILER
312       variable is defined.
313
314   FFLAGS
315       This is a CMake Environment Variable. Its initial value is  taken  from
316       the calling process environment.
317
318       Default compilation flags to be used when compiling Fortran files. Will
319       only be used by CMake on the first configuration to  determine  Fortran
320       default  compilation  flags, after which the value for FFLAGS is stored
321       in the cache as CMAKE_Fortran_FLAGS. For any configuration run (includ‐
322       ing  the  first),  the  environment  variable  will  be  ignored if the
323       CMAKE_Fortran_FLAGS variable is defined.
324
325   RC
326       This is a CMake Environment Variable. Its initial value is  taken  from
327       the calling process environment.
328
329       Preferred executable for compiling resource files. Will only be used by
330       CMake on the first configuration to determine resource compiler,  after
331       which the value for RC is stored in the cache as CMAKE_RC_COMPILER. For
332       any configuration run (including the first), the  environment  variable
333       will be ignored if the CMAKE_RC_COMPILER variable is defined.
334
335   RCFLAGS
336       This  is  a CMake Environment Variable. Its initial value is taken from
337       the calling process environment.
338
339       Default compilation flags to be used  when  compiling  resource  files.
340       Will  only  be  used  by  CMake on the first configuration to determine
341       resource default compilation flags, after which the value  for  RCFLAGS
342       is  stored  in  the  cache as CMAKE_RC_FLAGS. For any configuration run
343       (including the first), the environment variable will be ignored if  the
344       CMAKE_RC_FLAGS variable is defined.
345
346   SWIFTC
347       This  is  a CMake Environment Variable. Its initial value is taken from
348       the calling process environment.
349
350       Preferred executable for compiling Swift language files. Will  only  be
351       used  by  CMake on the first configuration to determine Swift compiler,
352       after  which  the  value  for  SWIFTC  is  stored  in  the   cache   as
353       CMAKE_Swift_COMPILER.  For any configuration run (including the first),
354       the environment variable will be ignored  if  the  CMAKE_Swift_COMPILER
355       variable is defined.
356

ENVIRONMENT VARIABLES FOR CTEST

358   CTEST_INTERACTIVE_DEBUG_MODE
359       This  is  a CMake Environment Variable. Its initial value is taken from
360       the calling process environment.
361
362       Environment variable that will exist and be set to 1 when a  test  exe‐
363       cuted by ctest(1) is run in interactive mode.
364
365   CTEST_OUTPUT_ON_FAILURE
366       This  is  a CMake Environment Variable. Its initial value is taken from
367       the calling process environment.
368
369       Boolean environment variable that controls  if  the  output  should  be
370       logged for failed tests. Set the value to 1, True, or ON to enable out‐
371       put on failure.  See ctest(1) for more information on controlling  out‐
372       put of failed tests.
373
374   CTEST_PARALLEL_LEVEL
375       This  is  a CMake Environment Variable. Its initial value is taken from
376       the calling process environment.
377
378       Specify the number of tests for CTest to run in parallel. See  ctest(1)
379       for more information on parallel test execution.
380
381   CTEST_PROGRESS_OUTPUT
382       This  is  a CMake Environment Variable. Its initial value is taken from
383       the calling process environment.
384
385       Boolean environment variable that  affects  how  ctest  command  output
386       reports  overall  progress.   When  set to 1, TRUE, ON or anything else
387       that evaluates to boolean true,  progress  is  reported  by  repeatedly
388       updating  the  same  line.  This greatly reduces the overall verbosity,
389       but is only supported when output is sent directly to a  terminal.   If
390       the  environment  variable  is not set or has a value that evaluates to
391       false, output is reported normally with each test having its own  start
392       and end lines logged to the output.
393
394       The  --progress  option to ctest overrides this environment variable if
395       both are given.
396
397   CTEST_USE_LAUNCHERS_DEFAULT
398       This is a CMake Environment Variable. Its initial value is  taken  from
399       the calling process environment.
400
401       Initializes the CTEST_USE_LAUNCHERS variable if not already defined.
402
403   DASHBOARD_TEST_FROM_CTEST
404       This  is  a CMake Environment Variable. Its initial value is taken from
405       the calling process environment.
406
407       Environment variable that will exist when a test executed  by  ctest(1)
408       is  run in non-interactive mode.  The value will be equal to CMAKE_VER‐
409       SION.
410
412       2000-2020 Kitware, Inc. and Contributors
413
414
415
416
4173.17.2                           Apr 28, 2020           CMAKE-ENV-VARIABLES(7)
Impressum