-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2023-05-30-14_04_43.log
4552 lines (4552 loc) · 249 KB
/
2023-05-30-14_04_43.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
+ source ../common/common_cmake.sh
++ source /root/mugen/libs/locallibs/common_lib.sh
+++ python3 --version
+++ '[' 0 -eq 0 ']'
+++ source /root/mugen/libs/locallibs/common_lib_python.sh
+ main
++ type -t post_test
+ '[' -n function ']'
+ trap post_test EXIT INT HUP TERM
+ rpm -qa
+ grep expect
++ type -t config_params
+ '[' -n '' ']'
++ type -t pre_test
+ '[' -n function ']'
+ pre_test
+ LOG_INFO 'Start to prepare the test environment.'
+ message='Start to prepare the test environment.'
+ python3 /root/mugen/libs/locallibs/mugen_log.py --level info --message 'Start to prepare the test environment.'
Tue May 30 14:04:51 2023 - INFO - Start to prepare the test environment.
+ deploy_env
+ DNF_INSTALL 'cmake gcc-c++ ninja-build make'
+ pkgs='cmake gcc-c++ ninja-build make'
+ node=1
+ '[' -z '' ']'
+ tmpfile=
++ python3 /root/mugen/libs/locallibs/rpm_manage.py install --pkgs 'cmake gcc-c++ ninja-build make' --node 1 --tempfile ''
+ tmpfile2=/tmp/tmpqudw8loi
+ '[' -z '' ']'
+ tmpfile=/tmp/tmpqudw8loi
+ mkdir build
+ cd build
++ awk '{print$3}' /etc/openEuler-release
+ VERSION_ID=23.03
+ LOG_INFO 'Finish preparing the test environment.'
+ message='Finish preparing the test environment.'
+ python3 /root/mugen/libs/locallibs/mugen_log.py --level info --message 'Finish preparing the test environment.'
Tue May 30 14:07:09 2023 - INFO - Finish preparing the test environment.
++ type -t run_test
+ '[' -n function ']'
+ run_test
+ LOG_INFO 'Start to run test.'
+ message='Start to run test.'
+ python3 /root/mugen/libs/locallibs/mugen_log.py --level info --message 'Start to run test.'
Tue May 30 14:07:10 2023 - INFO - Start to run test.
+ ccmake3 -help
+ grep -E 'Usage|ccmake <path-to-source>'
Usage
ccmake <path-to-source>
+ CHECK_RESULT 0
+ actual_result=0
+ expect_result=0
+ mode=0
+ error_log=
+ exit_mode=0
+ '[' -z 0 ']'
+ '[' 0 -eq 0 ']'
+ test 0x '!=' 0x
+ return 0
+ grep 'ccmake version'
+ ccmake3 -version
ccmake version 3.24.3
+ CHECK_RESULT 0
+ actual_result=0
+ expect_result=0
+ mode=0
+ error_log=
+ exit_mode=0
+ '[' -z 0 ']'
+ '[' 0 -eq 0 ']'
+ test 0x '!=' 0x
+ return 0
+ ccmake3 --help-full
+ grep variable
This option may be used to remove one or more variables from the
variable and otherwise falls back to a builtin default selection.
``CMAKE_GENERATOR_TOOLSET`` variable for details.
``CMAKE_GENERATOR_PLATFORM`` variable for details.
``CMAKE_TOOLCHAIN_FILE`` variable.
``CMAKE_INSTALL_PREFIX`` variable. Must be an absolute path.
List non-advanced cached variables.
List ``CACHE`` variables will run CMake and list all the variables from
changed with ``-D`` option. Changing some of the variables may result
in more variables being created. If ``A`` is specified, then it will
display also advanced variables. If ``H`` is specified, it will also
display help for each variable.
``CMAKE_MESSAGE_LOG_LEVEL`` as a cache variable instead.
If both the command line option and the variable are given, the command line
``CMAKE_MESSAGE_CONTEXT_SHOW`` as a cache variable instead.
See also the ``CMAKE_FIND_DEBUG_MODE`` variable for debugging
as the result variable, where ``<var>`` is an entry in the given
Like ``--debug-find``, but limiting scope to the specified variable names.
Like ``--trace``, but with variables expanded.
Print a warning when an uninitialized variable is used.
unused variables. In CMake versions 3.3 through 3.18 the option was broken.
Don't find variables that are declared on the command line, but not
Find problems with variable usage in system files.
Normally, unused and uninitialized variables are searched for only
Ignore target property ``COMPILE_WARNING_AS_ERROR`` and variable
generator and the build directory, and a list of variables and other
specified by the preset (variables, generator, etc.) can all be overridden by
a variable called ``MYVAR`` to ``1``, but the user sets it to ``2`` with a
The ``CMAKE_BUILD_PARALLEL_LEVEL`` environment variable, if set,
specific cache variable will be evaluated to decide, if package restoration
``CMAKE_VS_NUGET_PACKAGE_RESTORE`` variable to ``OFF``.
This option can be omitted if ``VERBOSE`` environment variable or
``CMAKE_VERBOSE_MAKEFILE`` cached variable is set.
This option can be omitted if ``VERBOSE`` environment variable is set.
is not modified. If variables are defined using ``-D``, this must be
in the set of ``CMAKE_ARGV<n>`` variables passed to the
interpreting options/environment variables and treat the next argument as
Display the current environment variables.
``--help-variable <var> [<f>]``
Print help for one variable and exit.
The ``cmake-variables(7)`` manual entry for ``<var>`` is
``--help-variable-list [<f>]``
List variables with help available and exit.
The list contains all variables for which help may be obtained by
using the ``--help-variable`` option followed by a variable name.
``--help-variables [<f>]``
Print cmake-variables manual and exit.
The ``cmake-variables(7)`` manual is printed in a
This option can also be enabled by setting the environment variable
``CTEST_OUTPUT_ON_FAILURE`` environment variable
``CTEST_PARALLEL_LEVEL`` environment variable.
Define a variable for script mode.
Pass in variable values on the command line. Use in conjunction
with ``-S`` to pass variable values to a dashboard script. Parsing ``-D``
arguments as variable values is only attempted if the value
the environment variable ``DASHBOARD_TEST_FROM_CTEST`` is set.
``--help-variable <var> [<f>]``
Print help for one variable and exit.
The ``cmake-variables(7)`` manual entry for ``<var>`` is
``--help-variable-list [<f>]``
List variables with help available and exit.
The list contains all variables for which help may be obtained by
using the ``--help-variable`` option followed by a variable name.
``--help-variables [<f>]``
Print cmake-variables manual and exit.
The ``cmake-variables(7)`` manual is printed in a
The module uses variables to obtain a value for each setting
arguments or from variables set in the script.
``CTEST_CHECKOUT_COMMAND`` variable, if set, to initialize the source
* CTest Script variable: ``CTEST_BINARY_DIRECTORY``
* ``CTest`` module variable: ``PROJECT_BINARY_DIR``
* CTest Script variable: ``CTEST_SOURCE_DIRECTORY``
* ``CTest`` module variable: ``PROJECT_SOURCE_DIR``
* CTest Script variable: ``CTEST_BZR_COMMAND``
* ``CTest`` module variable: none
* CTest Script variable: ``CTEST_BZR_UPDATE_OPTIONS``
* ``CTest`` module variable: none
* CTest Script variable: ``CTEST_CVS_COMMAND``
* ``CTest`` module variable: ``CVSCOMMAND``
* CTest Script variable: ``CTEST_CVS_UPDATE_OPTIONS``
* ``CTest`` module variable: ``CVS_UPDATE_OPTIONS``
* CTest Script variable: ``CTEST_GIT_COMMAND``
* ``CTest`` module variable: ``GITCOMMAND``
* CTest Script variable: ``CTEST_GIT_INIT_SUBMODULES``
* ``CTest`` module variable: ``CTEST_GIT_INIT_SUBMODULES``
* CTest Script variable: ``CTEST_GIT_UPDATE_CUSTOM``
* ``CTest`` module variable: ``CTEST_GIT_UPDATE_CUSTOM``
* CTest Script variable: ``CTEST_GIT_UPDATE_OPTIONS``
* ``CTest`` module variable: ``GIT_UPDATE_OPTIONS``
* CTest Script variable: ``CTEST_HG_COMMAND``
* ``CTest`` module variable: none
* CTest Script variable: ``CTEST_HG_UPDATE_OPTIONS``
* ``CTest`` module variable: none
* CTest Script variable: ``CTEST_P4_CLIENT``
* ``CTest`` module variable: ``CTEST_P4_CLIENT``
* CTest Script variable: ``CTEST_P4_COMMAND``
* ``CTest`` module variable: ``P4COMMAND``
* CTest Script variable: ``CTEST_P4_OPTIONS``
* ``CTest`` module variable: ``CTEST_P4_OPTIONS``
* CTest Script variable: none
* ``CTest`` module variable: ``CTEST_P4_UPDATE_CUSTOM``
* CTest Script variable: ``CTEST_P4_UPDATE_OPTIONS``
* ``CTest`` module variable: ``CTEST_P4_UPDATE_OPTIONS``
* CTest Script variable: ``CTEST_SVN_COMMAND``
* ``CTest`` module variable: ``SVNCOMMAND``
* CTest Script variable: ``CTEST_SVN_OPTIONS``
* ``CTest`` module variable: ``CTEST_SVN_OPTIONS``
* CTest Script variable: ``CTEST_SVN_UPDATE_OPTIONS``
* ``CTest`` module variable: ``SVN_UPDATE_OPTIONS``
* CTest Script variable: ``CTEST_UPDATE_COMMAND``
* ``CTest`` module variable: ``<VCS>COMMAND``
* CTest Script variable: ``CTEST_UPDATE_OPTIONS``
* ``CTest`` module variable: ``<VCS>_UPDATE_OPTIONS``
* CTest Script variable: none, detected from source tree
* ``CTest`` module variable: ``UPDATE_TYPE`` if set,
* CTest Script variable: ``CTEST_UPDATE_VERSION_ONLY``
When this variable is set to a non-empty string, CTest will report the value
version that is checked out. Use of this variable supersedes
``UpdateVersionOnly``. Like ``UpdateVersionOnly``, using this variable tells
* CTest Script variable: ``CTEST_UPDATE_VERSION_OVERRIDE``
* CTest Script variable: ``CTEST_NIGHTLY_START_TIME``
* ``CTest`` module variable: ``NIGHTLY_START_TIME`` if set,
* CTest Script variable: ``CTEST_CONFIGURE_COMMAND``
* ``CTest`` module variable: ``CMAKE_COMMAND``
* CTest Script variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
* ``CTest`` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
* CTest Script variable: ``CTEST_CONFIGURATION_TYPE``
* ``CTest`` module variable: ``DEFAULT_CTEST_CONFIGURATION_TYPE``,
initialized by the ``CMAKE_CONFIG_TYPE`` environment variable
* CTest Script variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
* ``CTest`` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
* CTest Script variable: ``CTEST_BUILD_COMMAND``
* ``CTest`` module variable: ``MAKECOMMAND``,
with CTest via environment variables and files to report
* CTest Script variable: ``CTEST_USE_LAUNCHERS``
* ``CTest`` module variable: ``CTEST_USE_LAUNCHERS``
* CTest Script variable: ``CTEST_RESOURCE_SPEC_FILE``
* ``CTest`` module variable: ``CTEST_RESOURCE_SPEC_FILE``
* CTest Script variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
* ``CTest`` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
* CTest Script variable: ``CTEST_TEST_LOAD``
* ``CTest`` module variable: ``CTEST_TEST_LOAD``
* CTest Script variable: ``CTEST_TEST_TIMEOUT``
* ``CTest`` module variable: ``DART_TESTING_TIMEOUT``
* CTest Script variable: ``CTEST_COVERAGE_COMMAND``
* ``CTest`` module variable: ``COVERAGE_COMMAND``
* CTest Script variable: ``CTEST_COVERAGE_EXTRA_FLAGS``
* ``CTest`` module variable: ``COVERAGE_EXTRA_FLAGS``
* CTest Script variable: ``CTEST_MEMORYCHECK_COMMAND``
* ``CTest`` module variable: ``MEMORYCHECK_COMMAND``
* CTest Script variable: ``CTEST_MEMORYCHECK_COMMAND_OPTIONS``
* ``CTest`` module variable: ``MEMORYCHECK_COMMAND_OPTIONS``
* CTest Script variable: ``CTEST_MEMORYCHECK_TYPE``
* ``CTest`` module variable: ``MEMORYCHECK_TYPE``
* CTest Script variable: ``CTEST_MEMORYCHECK_SANITIZER_OPTIONS``
* ``CTest`` module variable: ``MEMORYCHECK_SANITIZER_OPTIONS``
* CTest Script variable: ``CTEST_MEMORYCHECK_SUPPRESSIONS_FILE``
* ``CTest`` module variable: ``MEMORYCHECK_SUPPRESSIONS_FILE``
* CTest Script variable: none
* ``CTest`` module variable: none
* CTest Script variable: none
* ``CTest`` module variable: ``PURIFYCOMMAND``
* CTest Script variable: none
* ``CTest`` module variable: ``VALGRIND_COMMAND``
* CTest Script variable: none
* ``CTest`` module variable: ``VALGRIND_COMMAND_OPTIONS``
* CTest Script variable: none
* ``CTest`` module variable: ``DRMEMORY_COMMAND``
* CTest Script variable: none
* ``CTest`` module variable: ``DRMEMORY_COMMAND_OPTIONS``
* CTest Script variable: none
* ``CTest`` module variable: ``CUDA_SANITIZER_COMMAND``
* CTest Script variable: none
* ``CTest`` module variable: ``CUDA_SANITIZER_COMMAND_OPTIONS``
* CTest Script variable: ``CTEST_BUILD_NAME``
* ``CTest`` module variable: ``BUILDNAME``
* CTest Script variable: none, detected from server
* ``CTest`` module variable: ``CTEST_CDASH_VERSION``
* CTest Script variable: none,
* ``CTest`` module variable: ``CTEST_SUBMIT_RETRY_COUNT``
* CTest Script variable: none,
* ``CTest`` module variable: ``CTEST_SUBMIT_RETRY_DELAY``
* CTest Script variable: ``CTEST_CURL_OPTIONS``
* ``CTest`` module variable: ``CTEST_CURL_OPTIONS``
* CTest Script variable: ``CTEST_DROP_LOCATION``
* ``CTest`` module variable: ``DROP_LOCATION`` if set,
* CTest Script variable: ``CTEST_DROP_METHOD``
* ``CTest`` module variable: ``DROP_METHOD`` if set,
* CTest Script variable: ``CTEST_DROP_SITE``
* ``CTest`` module variable: ``DROP_SITE`` if set,
* CTest Script variable: ``CTEST_DROP_SITE_PASSWORD``
* ``CTest`` module variable: ``DROP_SITE_PASSWORD`` if set,
* CTest Script variable: ``CTEST_DROP_SITE_USER``
* ``CTest`` module variable: ``DROP_SITE_USER`` if set,
* CTest Script variable: ``CTEST_DROP_SITE_CDASH``
* ``CTest`` module variable: ``CTEST_DROP_SITE_CDASH``
* CTest Script variable: ``CTEST_SCP_COMMAND``
* ``CTest`` module variable: ``SCPCOMMAND``
* CTest Script variable: ``CTEST_SITE``
* ``CTest`` module variable: ``SITE``,
* CTest Script variable: ``CTEST_SUBMIT_URL``
* ``CTest`` module variable: ``SUBMIT_URL`` if set,
* CTest Script variable: ``CTEST_SUBMIT_INACTIVITY_TIMEOUT``
* ``CTest`` module variable: ``CTEST_SUBMIT_INACTIVITY_TIMEOUT``
* CTest Script variable: ``CTEST_TRIGGER_SITE``
* ``CTest`` module variable: ``TRIGGER_SITE`` if set,
:ref:`environment variables <ctest-resource-environment-variables>` as
the :ref:`environment variables <ctest-resource-environment-variables>` to
:ref:`environment variables <ctest-resource-environment-variables>`)
``CTEST_RESOURCE_GROUP_COUNT`` environment variable to find out whether or not
resource allocation is activated. This variable will always (and only) be
activated, then the ``CTEST_RESOURCE_GROUP_COUNT`` variable will not exist,
variables. See the Environment Variables section below for
information to the test executable as a series of environment variables. For
The following variables are passed to the test process:
This variable will only be defined if ``ctest(1)`` has been given a
this variable will not be defined.
group for a given resource type. This variable consists of a series of
Because some platforms have case-insensitive names for environment variables,
variable.
to be used can be selected through the ``CPACK_GENERATOR`` variable
the ``CPACK_GENERATOR`` variable determines the default set of
Set a CPack variable. This will override any value set for ``<var>`` in the
Override/define the value of the ``CPACK_PACKAGE_NAME`` variable used
for packaging. Any value set for this variable in the ``CPackConfig.cmake``
variable used for packaging. It will override a value set in the
``--help-variable <var> [<f>]``
Print help for one variable and exit.
The ``cmake-variables(7)`` manual entry for ``<var>`` is
``--help-variable-list [<f>]``
List variables with help available and exit.
The list contains all variables for which help may be obtained by
using the ``--help-variable`` option followed by a variable name.
``--help-variables [<f>]``
Print cmake-variables manual and exit.
The ``cmake-variables(7)`` manual is printed in a
``--help-variable <var> [<f>]``
Print help for one variable and exit.
The ``cmake-variables(7)`` manual entry for ``<var>`` is
``--help-variable-list [<f>]``
List variables with help available and exit.
The list contains all variables for which help may be obtained by
using the ``--help-variable`` option followed by a variable name.
``--help-variables [<f>]``
Print cmake-variables manual and exit.
The ``cmake-variables(7)`` manual is printed in a
This option may be used to remove one or more variables from the
variable and otherwise falls back to a builtin default selection.
``CMAKE_GENERATOR_TOOLSET`` variable for details.
``CMAKE_GENERATOR_PLATFORM`` variable for details.
``CMAKE_TOOLCHAIN_FILE`` variable.
``CMAKE_INSTALL_PREFIX`` variable. Must be an absolute path.
``--help-variable <var> [<f>]``
Print help for one variable and exit.
The ``cmake-variables(7)`` manual entry for ``<var>`` is
``--help-variable-list [<f>]``
List variables with help available and exit.
The list contains all variables for which help may be obtained by
using the ``--help-variable`` option followed by a variable name.
``--help-variables [<f>]``
Print cmake-variables manual and exit.
The ``cmake-variables(7)`` manual is printed in a
The ``BUILD_SHARED_LIBS`` variable may be enabled to change the
``CMAKE_INCLUDE_CURRENT_DIR`` variable can be enabled to conveniently
all targets. The variable ``CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE``
``CMAKE_DEBUG_TARGET_PROPERTIES`` variable documentation:
requirements. The ``CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE`` variable
``CMAKE_BUILD_TYPE`` variable. For multi-configuration generators
at configure time by the ``CMAKE_CONFIGURATION_TYPES`` variable,
just like other variables in that any string comparisons made with their
In multi-config generators, the ``CMAKE_CONFIGURATION_TYPES`` variable
``CMAKE_BUILD_TYPE`` variable at configure time and cannot be changed
defines a set of compiler and linker flag variables for the language in use.
These variables follow the convention ``CMAKE_<LANG>_FLAGS_<CONFIG>``,
a custom configuration type, make sure these variables are set appropriately,
typically as cache variables.
the scope of a cmake variable.
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
cmake_host_system_information(RESULT <variable> QUERY WINDOWS_REGISTRY <key> ...)
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
queried. The list of queried values is stored in ``<variable>``.
Read :file:`/etc/os-release` file and define the given ``<variable>``
into a list of read variables
Get the ``<name>`` variable (see man 5 os-release) if it exists in the
into man 5 os-release variables.
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>
ought to be assigned to CMake variables using this naming
convention. Example, the ``ID`` variable from the manual becomes
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_RESULT
``CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>`` variables in this list.
cmake_host_system_information(RESULT <variable>
entity is stored in ``<variable>``.
the variable specified with sub-option ``ERROR_VARIABLE``.
``CMAKE_SIZEOF_VOID_P`` variable. If not defined, fallback to
rules: If ``CMAKE_SIZEOF_VOID_P`` variable is defined. Use the
following view depending of the content of this variable:
If ``CMAKE_SIZEOF_VOID_P`` variable is not defined, rely on
variable holds an empty string.
``cmake_language`` does not introduce a new variable or policy scope.
Specify a variable in which to store the identification for the
``DIRECTORY`` option is given), this stores an empty string in the variable.
canceled. The ``deferred_message`` variable reference is not evaluated
In order to evaluate variable references immediately when scheduling a
specified by the ``CMAKE_PROJECT_TOP_LEVEL_INCLUDES`` variable.
list in their ``CMAKE_PROJECT_TOP_LEVEL_INCLUDES`` variable, but
Because some methods expect certain variables to be set in the calling scope,
function. This ensures it does not introduce a new variable scope.
If the provider command fulfills the request, it must set the same variable
the request. If the provider returns without setting this variable, CMake
for this method. When the user sets such a variable, they are explicitly
to preserve variables that may be overwritten by a call to
# not any of the variables the FindGTest module may define.
``CMAKE_MINIMUM_REQUIRED_VERSION`` variable to ``<min>``.
the ``CMAKE_MINIMUM_REQUIRED_VERSION`` variable won't be set
and defines a set of variables which hold the values of the
``ARGV#`` variables of the calling function. The parsing starts with
``<multi_value_keywords>`` a variable composed of the given ``<prefix>``
variables will then hold the respective value from the argument list
All remaining arguments are collected in a variable
values at all are collected in a variable
the following variables::
You can then continue and process these variables.
Always the name of a variable. For commands that expect a ``<path-var>``
as input, the variable must exist and it is expected to hold a single path.
The name of a variable into which the result of a command will be written.
in-place, or in a separate variable named after an ``OUTPUT_VARIABLE``
variable.
takes literal strings as input, not the names of variables.
conversion is stored in the ``<out-var>`` variable.
takes a literal string as input, not the name of a variable.
stored in the ``<out-var>`` variable.
takes a literal string as input, not the name of a variable.
``CMAKE_POLICY_DEFAULT_CMP<NNNN>`` variable sets a default).
cmake_policy(GET CMP<NNNN> <variable>)
The output ``<variable>`` value will be ``OLD`` or ``NEW`` if the
variable values referenced as ``@VAR@`` or ``${VAR}`` in the input
file content. Each variable reference will be replaced with the
current value of the variable, or the empty string if the variable
line after the variable name, if any, is processed as above.
Copy the file without replacing any variable references or other
Restrict variable replacement to references of the form ``@VAR@``.
[RESULT_VARIABLE <variable>]
[RESULTS_VARIABLE <variable>]
[OUTPUT_VARIABLE <variable>]
[ERROR_VARIABLE <variable>]
The variable will be set to contain the result of last child process.
``RESULTS_VARIABLE <variable>``
The variable will be set to contain the result of all processes as a
The variable named will be set with the contents of the standard output
and standard error pipes, respectively. If the same variable is named
See the ``CMAKE_EXECUTE_PROCESS_COMMAND_ECHO`` variable for a way
the configured variables.
The output will be duplicated, it will be sent into the configured variables
file(READ <filename> <variable>
``<variable>``. Optionally start from the given ``<offset>`` and
file(STRINGS <filename> <variable> [<options>...])
``<variable>``. Binary data in the file are ignored. Carriage return
Limit the number of total bytes to store in the ``<variable>``.
stores a list in the variable ``myfile`` in which each item is a line
file(<HASH> <filename> <variable>)
store it in a ``<variable>``. The supported ``<HASH>`` algorithm names
file(TIMESTAMP <filename> <variable> [<format>] [UTC])
and store it in ``<variable>``. Should the command be unable to obtain a
timestamp variable will be set to the empty string ("").
Name of the variable in which to store the list of resolved dependencies.
Name of the variable in which to store the list of unresolved dependencies.
If this variable is not specified, and there are any unresolved dependencies,
This function accepts several variables that determine which tool is used for
.. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM
If this variable is not specified, it is determined automatically by system
.. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL
If this variable is not specified, it is determined automatically by system
.. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND
If this variable is not specified, it is determined by the value of
variable values referenced as ``@VAR@`` or ``${VAR}`` contained therein. The
Restrict variable replacement to references of the form ``@VAR@``.
file(GLOB <variable>
file(GLOB_RECURSE <variable> [FOLLOW_SYMLINKS]
store it into the ``<variable>``. Globbing expressions are similar to
Set ``<result>`` variable to ``0`` on success or an error message otherwise.
If ``RESULT <result>`` is used, the result variable will be
Set ``<result>`` variable to ``0`` on success or an error message otherwise.
The environment variable ``CMAKE_INSTALL_MODE`` can override the
file(SIZE <filename> <variable>)
``<variable>`` variable. Requires that ``<filename>`` is a valid path
file(READ_SYMLINK <linkname> <variable>)
points to in the result ``<variable>``. If ``<linkname>`` does not exist or
The ``<result>`` variable, if specified, receives the status of the operation.
environment variables. On Windows, the ``USERPROFILE`` environment variable
is used, falling back to the ``HOME`` environment variable if ``USERPROFILE``
file(RELATIVE_PATH <variable> <directory> <file>)
store it in the ``<variable>``.
file(TO_CMAKE_PATH "<path>" <variable>)
file(TO_NATIVE_PATH "<path>" <variable>)
``LOG <variable>``
Store a human-readable log of the operation in a variable.
``STATUS <variable>``
Store the resulting status of the operation in a variable.
option is not specified, the value of the ``CMAKE_NETRC`` variable
is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will
of the ``CMAKE_TLS_VERIFY`` variable will be used instead.
variable will be used instead.
[RESULT_VARIABLE <variable>]
``RESULT_VARIABLE`` option. Otherwise result will be stored in ``<variable>``
A cache entry, or a normal variable if ``NO_CACHE`` is specified,
If the full path to a file is found the result is stored in the variable
and the search will not be repeated unless the variable is cleared.
variable.
The result of the search will be stored in a normal variable rather than
If the variable is already set before the call (as a normal or cache
variable) then the search will not occur.
with the same variable.
``<PackageName>_ROOT`` CMake variable and the
``<PackageName>_ROOT`` environment variable.
The package root variables are maintained as a stack, so if called from
* ``<prefix>/include/<arch>`` if ``CMAKE_LIBRARY_ARCHITECTURE`` is set, and ``<prefix>/include`` for each ``<prefix>`` in the ``<PackageName>_ROOT`` CMake variable and the ``<PackageName>_ROOT`` environment variable if called from within a find module loaded by ``find_package(<PackageName>)``
2. Search paths specified in cmake-specific cache variables.
3. Search paths specified in cmake-specific environment variables.
5. Search the standard system environment variables.
6. Search cmake variables defined in the Platform files
The platform paths that these variables contain are locations that
``CMAKE_SYSTEM_IGNORE_PREFIX_PATH`` variables can also cause some
Added ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable
``CMAKE_FIND_APPBUNDLE`` variables determine the order of
The CMake variable ``CMAKE_FIND_ROOT_PATH`` specifies one or more
from this re-rooting, because that variable is always a path on the host system.
The ``CMAKE_SYSROOT`` variable can also be used to specify exactly one
effects. See the documentation for that variable for more.
These variables are especially useful when cross-compiling to
Do not use the ``CMAKE_FIND_ROOT_PATH`` variable.
Once one of the calls succeeds the result variable will be set
A cache entry, or a normal variable if ``NO_CACHE`` is specified,
If the library is found the result is stored in the variable
and the search will not be repeated unless the variable is cleared.
variable.
The result of the search will be stored in a normal variable rather than
If the variable is already set before the call (as a normal or cache
variable) then the search will not occur.
with the same variable.
``<PackageName>_ROOT`` CMake variable and the
``<PackageName>_ROOT`` environment variable.
The package root variables are maintained as a stack, so if called from
* ``<prefix>/lib/<arch>`` if ``CMAKE_LIBRARY_ARCHITECTURE`` is set, and ``<prefix>/lib`` for each ``<prefix>`` in the ``<PackageName>_ROOT`` CMake variable and the ``<PackageName>_ROOT`` environment variable if called from within a find module loaded by ``find_package(<PackageName>)``
2. Search paths specified in cmake-specific cache variables.
3. Search paths specified in cmake-specific environment variables.
5. Search the standard system environment variables.
6. Search cmake variables defined in the Platform files
The platform paths that these variables contain are locations that
``CMAKE_SYSTEM_IGNORE_PREFIX_PATH`` variables can also cause some
Added ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable
``CMAKE_FIND_APPBUNDLE`` variables determine the order of
The CMake variable ``CMAKE_FIND_ROOT_PATH`` specifies one or more
from this re-rooting, because that variable is always a path on the host system.
The ``CMAKE_SYSROOT`` variable can also be used to specify exactly one
effects. See the documentation for that variable for more.
These variables are especially useful when cross-compiling to
Do not use the ``CMAKE_FIND_ROOT_PATH`` variable.
Once one of the calls succeeds the result variable will be set
If the ``CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX`` variable is set all
``lib${CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}/``. This variable overrides
A user may set the ``CMAKE_FIND_PACKAGE_PREFER_CONFIG`` variable
Regardless of the mode used, a ``<PackageName>_FOUND`` variable will be
package-specific information may be provided through other variables and
variable.
is stored in the cmake variable ``<PackageName>_CONFIG``.
``<PackageName>_CONSIDERED_CONFIGS`` variable, and the associated versions
in the ``<PackageName>_CONSIDERED_VERSIONS`` variable.
``CMAKE_LIBRARY_ARCHITECTURE`` variable is set. ``lib*`` includes one
``CMAKE_SIZEOF_VOID_P`` variable. If not defined, fall back to
rules: If the ``CMAKE_SIZEOF_VOID_P`` variable is defined, use the
following view depending on the content of this variable:
If the ``CMAKE_SIZEOF_VOID_P`` variable is not defined, rely on the
variables determine the order of preference.
variable and the ``<PackageName>_ROOT`` environment variable,
The package root variables are maintained as a stack so if
2. Search paths specified in cmake-specific cache variables. These
3. Search paths specified in cmake-specific environment variables.
5. Search the standard system environment variables. This can be
setting the variable ``CMAKE_FIND_USE_PACKAGE_REGISTRY``
to ``FALSE`` or the deprecated variable
7. Search cmake variables defined in the Platform files for the
The platform paths that these variables contain are locations that
variable to ``FALSE`` or the deprecated variable
``CMAKE_SYSTEM_IGNORE_PREFIX_PATH`` variables can also cause some
Added the ``CMAKE_FIND_USE_<CATEGORY>`` variables to globally disable
The CMake variable ``CMAKE_FIND_ROOT_PATH`` specifies one or more
from this re-rooting, because that variable is always a path on the host system.
The ``CMAKE_SYSROOT`` variable can also be used to specify exactly one
effects. See the documentation for that variable for more.
These variables are especially useful when cross-compiling to
Do not use the ``CMAKE_FIND_ROOT_PATH`` variable.
Once one of the calls succeeds the result variable will be set
By default the value stored in the result variable will be the path at
variable may be set to ``TRUE`` before calling ``find_package`` in order
* Setting the ``CMAKE_DISABLE_FIND_PACKAGE_<PackageName>`` variable
* Setting the ``CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>`` variable
Setting both variables to ``TRUE`` simultaneously is an error.
variables have been defined:
When a version range is specified, the above version variables will hold
variables:
included or excluded. Currently, the only supported value for this variable
included or excluded. The supported values for this variable are
variable ``PACKAGE_FIND_VERSION_COMPLETE`` will be defined and will hold
sets these variables:
These variables are checked by the ``find_package`` command to determine
is acceptable the following variables are set:
one is chosen: unless the variable ``CMAKE_FIND_PACKAGE_SORT_ORDER``
the two variables ``CMAKE_FIND_PACKAGE_SORT_ORDER`` and
defines variables to provide information about the call arguments (and
When a version range is specified, the above version variables will hold
variables:
included or excluded. The possible values for this variable are
variable ``<PackageName>_FIND_VERSION_COMPLETE`` will be defined and will hold
request detailed by these variables; see the find module for details.
A cache entry, or a normal variable if ``NO_CACHE`` is specified,
If the file in a directory is found the result is stored in the variable
and the search will not be repeated unless the variable is cleared.
variable.
The result of the search will be stored in a normal variable rather than
If the variable is already set before the call (as a normal or cache
variable) then the search will not occur.
with the same variable.
``<PackageName>_ROOT`` CMake variable and the
``<PackageName>_ROOT`` environment variable.
The package root variables are maintained as a stack, so if called from
* ``<prefix>/include/<arch>`` if ``CMAKE_LIBRARY_ARCHITECTURE`` is set, and ``<prefix>/include`` for each ``<prefix>`` in the ``<PackageName>_ROOT`` CMake variable and the ``<PackageName>_ROOT`` environment variable if called from within a find module loaded by ``find_package(<PackageName>)``
2. Search paths specified in cmake-specific cache variables.
3. Search paths specified in cmake-specific environment variables.
5. Search the standard system environment variables.
6. Search cmake variables defined in the Platform files
The platform paths that these variables contain are locations that
``CMAKE_SYSTEM_IGNORE_PREFIX_PATH`` variables can also cause some
Added ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable
``CMAKE_FIND_APPBUNDLE`` variables determine the order of
The CMake variable ``CMAKE_FIND_ROOT_PATH`` specifies one or more
from this re-rooting, because that variable is always a path on the host system.
The ``CMAKE_SYSROOT`` variable can also be used to specify exactly one
effects. See the documentation for that variable for more.
These variables are especially useful when cross-compiling to
Do not use the ``CMAKE_FIND_ROOT_PATH`` variable.
Once one of the calls succeeds the result variable will be set
A cache entry, or a normal variable if ``NO_CACHE`` is specified,
If the program is found the result is stored in the variable
and the search will not be repeated unless the variable is cleared.
variable.
The result of the search will be stored in a normal variable rather than
If the variable is already set before the call (as a normal or cache
variable) then the search will not occur.
with the same variable.
``<PackageName>_ROOT`` CMake variable and the
``<PackageName>_ROOT`` environment variable.
The package root variables are maintained as a stack, so if called from
* ``<prefix>/[s]bin`` for each ``<prefix>`` in the ``<PackageName>_ROOT`` CMake variable and the ``<PackageName>_ROOT`` environment variable if called from within a find module loaded by ``find_package(<PackageName>)``
2. Search paths specified in cmake-specific cache variables.
3. Search paths specified in cmake-specific environment variables.
5. Search the standard system environment variables.
6. Search cmake variables defined in the Platform files
The platform paths that these variables contain are locations that
``CMAKE_SYSTEM_IGNORE_PREFIX_PATH`` variables can also cause some
Added ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable
``CMAKE_FIND_APPBUNDLE`` variables determine the order of
The CMake variable ``CMAKE_FIND_ROOT_PATH`` specifies one or more
from this re-rooting, because that variable is always a path on the host system.
The ``CMAKE_SYSROOT`` variable can also be used to specify exactly one
effects. See the documentation for that variable for more.
These variables are especially useful when cross-compiling to
Do not use the ``CMAKE_FIND_ROOT_PATH`` variable.
Once one of the calls succeeds the result variable will be set
At the beginning of each iteration the variable ``<loop_var>`` will be set
separated list of list-valued variables. The ``foreach``
separated list of list-valued variables. The ``foreach``
iteration variables as follows:
``loop_var_N`` variables to the current item from the
- if multiple variable names passed, their count should match
the lists variables count;
variable is not defined for the current iteration.
``ARGC`` variable which will be set to the number of arguments passed
the ``<property>`` is stored in the variable ``<var>``.
get_directory_property(<variable> [DIRECTORY <dir>] <prop-name>)
Stores a property of directory scope in the named ``<variable>``.
get_directory_property(<variable> [DIRECTORY <dir>]
Get a variable definition from a directory. This form is useful to
get a variable definition from another directory.
If the optional ``CACHE`` argument is specified, the result variable is
optional ``CACHE`` argument is specified, the result variable is added to the
get_property(<variable>
The first argument specifies the variable in which to store the result.
If the ``SET`` option is given the variable is set to a boolean
option is given the variable is set to a boolean value indicating
If ``BRIEF_DOCS`` or ``FULL_DOCS`` is given then the variable is set to a
constants, it is treated as a variable or string (see Variable Expansion
``if(<variable>)``
True if given a variable that is defined to a value that is not a false
constant. False otherwise, including if the variable is undefined.
Note that macro arguments are not variables.
happens to be a variable name that is affected by ``CMP0054``'s
True if a variable, cache variable or environment variable
with given ``<name>`` is defined. The value of the variable
* Macro arguments are not variables.
variable. The expression ``if(DEFINED someName)`` will evaluate to true
if either a cache or non-cache variable ``someName`` exists. In
evaluate to true if a cache variable ``someName`` exists. Both expressions
need to be tested if you need to know whether a non-cache variable exists:
Added support for ``CACHE{<name>}`` variables.
``if(<variable|string> IN_LIST <variable>)``
True if the given element is contained in the named list variable.
``if(<variable|string> MATCHES regex)``
True if the given string or variable's value matches the given regular
``()`` groups are captured in ``CMAKE_MATCH_<n>`` variables.
``if(<variable|string> LESS <variable|string>)``
True if the given string or variable's value is a valid number and less
``if(<variable|string> GREATER <variable|string>)``
True if the given string or variable's value is a valid number and greater
``if(<variable|string> EQUAL <variable|string>)``
True if the given string or variable's value is a valid number and equal
``if(<variable|string> LESS_EQUAL <variable|string>)``
True if the given string or variable's value is a valid number and less
``if(<variable|string> GREATER_EQUAL <variable|string>)``
True if the given string or variable's value is a valid number and greater
``if(<variable|string> STRLESS <variable|string>)``
True if the given string or variable's value is lexicographically less
than the string or variable on the right.
``if(<variable|string> STRGREATER <variable|string>)``
True if the given string or variable's value is lexicographically greater
than the string or variable on the right.
``if(<variable|string> STREQUAL <variable|string>)``
True if the given string or variable's value is lexicographically equal
to the string or variable on the right.
``if(<variable|string> STRLESS_EQUAL <variable|string>)``
True if the given string or variable's value is lexicographically less
than or equal to the string or variable on the right.
``if(<variable|string> STRGREATER_EQUAL <variable|string>)``
True if the given string or variable's value is lexicographically greater
than or equal to the string or variable on the right.
``if(<variable|string> VERSION_LESS <variable|string>)``
``if(<variable|string> VERSION_GREATER <variable|string>)``
``if(<variable|string> VERSION_EQUAL <variable|string>)``
``if(<variable|string> VERSION_LESS_EQUAL <variable|string>)``
``if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)``
``if(<variable|string> PATH_EQUAL <variable|string>)``
the ``${}`` variable evaluation syntax, and for convenience evaluates
variables named by its arguments as shown in the above signatures.
Note that normal variable evaluation with ``${}`` applies before the if
and is evaluated according to the ``if(<variable>)`` case documented
above-documented condition syntax accepts ``<variable|string>``:
a defined variable, if so the variable's value is used, otherwise the
they are defined variables, if so their defined values are used otherwise
tested to see if they are defined variables, if so their defined values are
variables, if so their defined values are used otherwise the original value
variable and it is dereferenced.
such, otherwise they are assumed to be variables and are dereferenced.
To prevent ambiguity, potential variable or keyword names can be
A quoted or bracketed variable or keyword will be interpreted as a
condition syntax accepts ``<variable|string>``.
``RESULT_VARIABLE`` is given the variable ``<var>`` will be set to the
``CMAKE_CURRENT_LIST_FILE`` variable documentation).
If no arguments given, ``include_guard`` has the same scope as a variable,
new values for the list within the current CMake variable scope. Similar to
the ``set()`` command, the LIST command creates new variable values in
variables, and therefore cannot be used in LIST commands.)
list(LENGTH <list> <output variable>)
list(GET <list> <element index> [<element index> ...] <output variable>)
list(JOIN <list> <glue> <output variable>)
list(SUBLIST <list> <begin> <length> <output variable>)
list(FIND <list> <value> <output variable>)
Appends elements to the list. If no variable named ``<list>`` exists in the
has length 0. If no variable named ``<list>`` exists in the
If no variable name is given, removes exactly one element. Otherwise,
with `N` variable names provided, assign the last `N` elements' values
to the given variables and then remove the last `N` values from
If no variable name is given, removes exactly one element. Otherwise,
with `N` variable names provided, assign the first `N` elements' values
to the given variables and then remove the first `N` values from
Insert elements to the 0th position in the list. If no variable named
[OUTPUT_VARIABLE <output variable>])
in-place or in the specified output variable.
are true variables in the usual CMake sense. In a macro, they are not,
``CMAKE_CURRENT_FUNCTION_LIST_LINE`` variables are not
Since ``ARGN``, ``ARGC``, ``ARGV``, ``ARGV0`` etc. are not variables,
if(ARGV1) # ARGV1 is not a variable
if(DEFINED ARGV2) # ARGV2 is not a variable
if(ARGC GREATER 2) # ARGC is not a variable
foreach(loop_var IN LISTS ARGN) # ARGN is not a variable
third case, the proper way to check if an optional variable was
Note that if you have a variable with the same name in the scope from
existing variable instead of the arguments. For example:
If you want true CMake variables and/or better CMake scope control you
Mark cmake cached variables as advanced.
cached variables.
An advanced variable will not be displayed in any
then advanced variables are changed back to unadvanced.
then the variables are made advanced.
variable already has an advanced/non-advanced state,
math(EXPR <variable> "<expression>" [OUTPUT_FORMAT <format>])
Evaluates a mathematical ``<expression>`` and sets ``<variable>`` to the
CMake Deprecation Error or Warning if variable
``CMAKE_MESSAGE_LOG_LEVEL`` variable can be set instead.
Note that the command line option takes precedence over the cache variable.
by the content of the ``CMAKE_MESSAGE_INDENT`` variable (converted to
list variable to a dot-separated string. The message context will always
variable to true. See the ``CMAKE_MESSAGE_CONTEXT`` documentation for
The ``CMAKE_MESSAGE_INDENT`` variable can also be used to add
option(<variable> "<help_text>" [value])
If ``<variable>`` is already set as a normal or cache variable,
In CMake project mode, a boolean cache variable is created with the option
value. In CMake script mode, a boolean variable is set with the option value.
separate_arguments(<variable> <mode> [PROGRAM [SEPARATE_ARGS]] <args>)
and stores this list in semicolon-separated standard form in ``<variable>``.
``<variable>`` will be empty. Otherwise, ``<variable>`` is a list of 2
arguments will be split as well and stored in ``<variable>``.
Set a normal, cache, or environment variable to a given value.
See the :ref:`cmake-language(7) variables <CMake Language Variables>`
documentation for the scopes and interaction of normal variables
a :ref:`semicolon-separated list <CMake Language Lists>` to form the actual variable
value to be set. Zero arguments will cause normal variables to be
unset. See the ``unset()`` command to unset variables explicitly.
set(<variable> <value>... [PARENT_SCOPE])
Sets the given ``<variable>`` in the current function or directory scope.
If the ``PARENT_SCOPE`` option is given the variable will be set in
creates a new scope. This command will set the value of a variable
to the case at hand). The previous state of the variable's value stays the
set(<variable> <value>... CACHE <type> <docstring> [FORCE])
Sets the given cache ``<variable>`` (cache entry). Since cache entries
They may be used to store variables persistently across runs.
The content of the cache variable will not be directly accessible if a normal
variable of the same name already exists (see :ref:`rules of variable
to ``OLD``, any normal variable binding in the current scope will be removed.
set(ENV{<variable>} [<value>])
Subsequent calls of ``$ENV{<variable>}`` will return this new value.
If no argument is given after ``ENV{<variable>}`` or if ``<value>`` is
environment variable.
Set the given variable to the name of the computer.
site_name(variable)
On UNIX-like platforms, if the variable ``HOSTNAME`` is set, its value
string(FIND <string> <substring> <output_variable> [REVERSE])
The index stored in ``<output_variable>`` will also be counted in bytes,
<replace_string> <output_variable>
with ``<replace_string>`` and store the result in the ``<output_variable>``.
<output_variable> <input> [<input>...])
``<output_variable>``.
<output_variable> <input> [<input>...])
matches in the ``<output_variable>`` as a list.
<replacement_expression> <output_variable>
``if(MATCHES)``, save subgroup matches in the variables
string(APPEND <string_variable> [<input>...])
string(PREPEND <string_variable> [<input>...])
string(CONCAT <output_variable> [<input>...])
the result in the named ``<output_variable>``.
string(JOIN <glue> <output_variable> [<input>...])
string and store the result in the named ``<output_variable>``.
string(TOLOWER <string> <output_variable>)
string(TOUPPER <string> <output_variable>)
string(LENGTH <string> <output_variable>)
Store in an ``<output_variable>`` a given string's length in bytes.
result stored in ``<output_variable>`` will *not* be the number of characters.
string(SUBSTRING <string> <begin> <length> <output_variable>)
Store in an ``<output_variable>`` a substring of a given ``<string>``. If
string(STRIP <string> <output_variable>)
Store in an ``<output_variable>`` a substring of a given ``<string>`` with
string(GENEX_STRIP <string> <output_variable>)
from the input ``<string>`` and store the result in the ``<output_variable>``.
string(REPEAT <string> <count> <output_variable>)
string(COMPARE LESS <string1> <string2> <output_variable>)
string(COMPARE GREATER <string1> <string2> <output_variable>)
string(COMPARE EQUAL <string1> <string2> <output_variable>)
string(COMPARE NOTEQUAL <string1> <string2> <output_variable>)
string(COMPARE LESS_EQUAL <string1> <string2> <output_variable>)
string(COMPARE GREATER_EQUAL <string1> <string2> <output_variable>)
Compare the strings and store true or false in the ``<output_variable>``.
string(<HASH> <output_variable> <input>)
string(ASCII <number> [<number> ...] <output_variable>)
string(HEX <string> <output_variable>)
and store the concatenated hex digits in the ``<output_variable>``. Letters in
string(CONFIGURE <string> <output_variable>
string(MAKE_C_IDENTIFIER <string> <output_variable>)
underscore and store the result in the ``<output_variable>``. If the first
[RANDOM_SEED <seed>] <output_variable>)
string(TIMESTAMP <output_variable> [<format_string>] [UTC])
and/or time to the ``<output_variable>``.
If the command is unable to obtain a timestamp, the ``<output_variable>``
If the ``SOURCE_DATE_EPOCH`` environment variable is set,
string(UUID <output_variable> NAMESPACE <namespace> NAME <name>
``<error-variable>`` and the ``<out-var>`` will be set to
occurs, the ``<error-variable>`` will be set to ``NOTFOUND``.
string(JSON <out-var> [ERROR_VARIABLE <error-variable>]
string(JSON <out-var> [ERROR_VARIABLE <error-variable>]
string(JSON <out-var> [ERROR_VARIABLE <error-variable>]
string(JSON <out-var> [ERROR_VARIABLE <error-variable>]
string(JSON <out-var> [ERROR_VARIABLE <error-variable>]
Unset a variable, cache variable, or environment variable.
unset(<variable> [CACHE | PARENT_SCOPE])
Removes a normal variable from the current scope, causing it
to become undefined. If ``CACHE`` is present, then a cache variable
is removed instead of a normal variable. Note that when evaluating
for a normal variable with that name. If no such normal variable exists,
unsetting a normal variable can expose a cache variable that was previously
hidden. To force a variable reference of the form ``${VAR}`` to return an
empty string, use ``set(<variable> "")``, which clears the normal variable
If ``PARENT_SCOPE`` is present then the variable is removed from the scope
unset(ENV{<variable>})
Removes ``<variable>`` from the currently available
Subsequent calls of ``$ENV{<variable>}`` will return the empty string.
variable_watch
Watch the CMake variable for change.
variable_watch(<variable> [<command>])
If the specified ``<variable>`` changes and no ``<command>`` is given,
``COMMAND(<variable> <access> <value> <current_list_file> <stack>)``
``<variable>``
Name of the variable being accessed.
values are only used when the variable has never been set. Once set,
variable is later unset.
The value of the variable. On a modification, this is the new
(modified) value of the variable. On removal, the value is empty.
Also note that an ``if(DEFINED)`` query on the variable does not
Only non-cache variables can be watched using this command. Access to
cache variables is never watched. However, the existence of a cache
variable ``var`` causes accesses to the non-cache variable ``var`` to
not use the ``UNKNOWN_`` prefix, even if a non-cache variable ``var``
``CMAKE_CROSSCOMPILING`` variable is not set to true).
:variable:`CMAKE_CURRENT_BINARY_DIR`, and any relative paths inside the
``DEPFILE`` should also be relative to :variable:`CMAKE_CURRENT_BINARY_DIR`.
``CMAKE_CROSSCOMPILING`` variable is not set to true).
variable ``BUILD_SHARED_LIBS`` is ``ON``. For ``SHARED`` and
``CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP`` variables.
aux_source_directory(<dir> <variable>)
and stores the list in the ``<variable>`` provided. This command is
build_command(<variable>
Sets the given ``<variable>`` to a command-line string of the form::
build_command(<cachevariable> <makecommand>)
It sets the given ``<cachevariable>`` to a command-line string as
``CMAKE_TESTDRIVER_BEFORE_TESTMAIN`` cmake variable can be set to
[INITIALIZE_FROM_VARIABLE <variable>])
VARIABLE = documents a CMake language variable
CACHED_VARIABLE = documents a CMake cache variable
The ``INITIALIZE_FROM_VARIABLE`` option specifies a variable from which the
The ``<variable>`` name must end with the property name and must not begin
variables that are created by the project command. Example languages
If the ``CMAKE_EXPORT_NO_PACKAGE_REGISTRY`` variable
``CMAKE_EXPORT_PACKAGE_REGISTRY`` variable to add build directories
resulting .h and .cxx files will be added to a variable named
get_source_file_property(<variable> <file>
stored in the specified ``<variable>``. If the source property is not found,
will set ``variable`` to ``NOTFOUND``, whereas inherited properties will search
command and if still unable to find the property, ``variable`` will be set to
the variable ``<VAR>``. If the target property is not found, the behavior
the variable ``VAR``. If the test property is not found, the behavior
The environment variable ``CMAKE_INSTALL_MODE`` can override the
of the ``CMAKE_INSTALL_PREFIX`` variable.
mechanism explained in the ``CMAKE_INSTALL_PREFIX`` variable
``CMAKE_INSTALL_DEFAULT_COMPONENT_NAME`` variable.
installation. Use the ``CMAKE_INSTALL_MESSAGE`` variable
appropriate variable from ``GNUInstallDirs``, or set to a built-in
default value if that variable is not defined. The same is true for file
The following table shows the target types with their associated variables and
path that begins with the appropriate ``GNUInstallDirs`` variable.
the appropriate cache variables. The following example shows a static library
corresponding variable from ``GNUInstallDirs``, or by using a
built-in default if that variable is not defined. See the table below for
the supported file types and their corresponding variables and built-in
``CMAKE_INSTALL_DATAROOTDIR`` as the variable and ``share`` as the built-in
path that begins with the appropriate ``GNUInstallDirs`` variable.
the appropriate cache variables. The following example shows how to follow
automatically by taking the corresponding variable from
``GNUInstallDirs``, or by using a built-in default if that variable
corresponding variables and built-in defaults. Projects can provide a
``CMAKE_INSTALL_DATAROOTDIR`` as the variable and ``share`` as the built-in
path that begins with the appropriate ``GNUInstallDirs`` variable.
the appropriate cache variables.
script accepts several variables:
Set this variable to install only a single CPack component as opposed to all
Set this variable to change the build type if you are using a multi-config
This is an environment variable rather than a CMake variable. It allows you
Reads the cache and store the requested entries in variables with their
Sets the name of the project, and stores it in the variable
variable ``CMAKE_PROJECT_NAME``.
Also sets the variables:
Further variables are set by the optional arguments described in the following.
If any of these arguments is not used, then the corresponding variables are
and sets the variables
``CMakeLists.txt``, then the version is also stored in the variable
Sets the variables
then the description is also stored in the variable ``CMAKE_PROJECT_DESCRIPTION``.
Added the ``<PROJECT-NAME>_DESCRIPTION`` variable.
Sets the variables
then the URL also is stored in the variable ``CMAKE_PROJECT_HOMEPAGE_URL``.
The variables set through the ``VERSION``, ``DESCRIPTION`` and ``HOMEPAGE_URL``
A number of variables can be defined by the user to specify files to include
* Set the various project-specific variables detailed in the Synopsis
* Set the variables describing the host and target platforms.
Language-specific variables might or might not be set at this point.
On the first run, the only language-specific variables that might be
language-specific variables cached from a previous run may be set.
if set. The variable is ignored by CMake thereafter.
variables, then an error will be reported by CMake. If the use of the feature requires
of a ``${list}`` variable, be sure to use an explicitly quoted
``CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP`` variables.
CMake variables describing platform settings, and those listed by the
``CMAKE_TRY_COMPILE_PLATFORM_VARIABLES`` variable, are propagated
variable). The success or failure of the ``try_compile``, i.e. ``TRUE`` or
The above example shows how values for variables
Use after ``COPY_FILE`` to capture into variable ``<var>`` any error
project, depending on the ``CMAKE_TRY_COMPILE_TARGET_TYPE`` variable.
Store the output from the build process in the given variable.
If set, the following variables are passed in to the generated
Set the ``CMAKE_TRY_COMPILE_CONFIGURATION`` variable to choose
Set the ``CMAKE_TRY_COMPILE_TARGET_TYPE`` variable to specify
Set the ``CMAKE_TRY_COMPILE_PLATFORM_VARIABLES`` variable to specify
variables that must be propagated into the test project. This variable is
then the language standard variables are honored:
system customization cache variables are also propagated into the test project.
The ``CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES`` variable may be
set to disable passing platform variables into the test project.
The example in ``try_compile()`` shows how values for variables
Report the compile step build output in a given variable.
in the given variable. This option exists for legacy reasons. Prefer
Report the output from running the executable in a given variable.
Set the ``CMAKE_TRY_COMPILE_CONFIGURATION`` variable to choose
the ``CMAKE_CROSSCOMPILING`` variable to detect whether CMake is in
``CMAKE_CROSSCOMPILING_EMULATOR`` variable is set. Instead it
will create cache variables which must be filled by the user or by
variables will have to be set manually to the output of the executable.
block checking the ``CMAKE_CROSSCOMPILING`` variable and
The ``CTEST_BUILD_COMMAND`` variable may be set to explicitly
``CTEST_BINARY_DIRECTORY`` variable is used.
specified the ``CTEST_BUILD_CONFIGURATION`` variable will be checked.