1ccmake(1)                   General Commands Manual                  ccmake(1)
2
3
4

NAME

6         ccmake - Curses Interface for CMake.
7

SYNOPSIS

9         ccmake <path-to-source>
10         ccmake <path-to-existing-build>
11

DESCRIPTION

13       The "ccmake" executable is the CMake curses interface.  Project config‐
14       uration settings may  be  specified  interactively  through  this  GUI.
15       Brief  instructions are provided at the bottom of the terminal when the
16       program is running.
17
18
19       CMake is a cross-platform build  system  generator.   Projects  specify
20       their  build process with platform-independent CMake listfiles included
21       in each directory of a source tree with the name CMakeLists.txt.  Users
22       build  a project by using CMake to generate a build system for a native
23       tool on their platform.
24
25

OPTIONS

27       -C <initial-cache>
28              Pre-load a script to populate the cache.
29
30              When cmake is first run in an empty build  tree,  it  creates  a
31              CMakeCache.txt  file and populates it with customizable settings
32              for the project.  This option may be used to specify a file from
33              which  to  load  cache entries before the first pass through the
34              project's cmake listfiles.  The  loaded  entries  take  priority
35              over  the  project's default values.  The given file should be a
36              CMake script containing SET commands that use the CACHE  option,
37              not a cache-format file.
38
39
40       -D <var>:<type>=<value>
41              Create a cmake cache entry.
42
43              When  cmake  is  first  run in an empty build tree, it creates a
44              CMakeCache.txt file and populates it with customizable  settings
45              for  the  project.  This option may be used to specify a setting
46              that takes priority  over  the  project's  default  value.   The
47              option may be repeated for as many cache entries as desired.
48
49
50       -G <generator-name>
51              Specify a makefile generator.
52
53              CMake may support multiple native build systems on certain plat‐
54              forms.  A makefile generator is  responsible  for  generating  a
55              particular build system.  Possible generator names are specified
56              in the Generators section.
57
58
59       --copyright [file]
60              Print the CMake copyright and exit.
61
62              If a file is specified, the copyright is written into it.
63
64
65       --help Print usage information and exit.
66
67              Usage  describes  the  basic  command  line  interface  and  its
68              options.
69
70
71       --help-full [file]
72              Print full help and exit.
73
74              Full  help  displays  most  of the documentation provided by the
75              UNIX man page.  It is provided for use  on  non-UNIX  platforms,
76              but  is  also convenient if the man page is not installed.  If a
77              file is specified, the help is written into it.
78
79
80       --help-html [file]
81              Print full help in HTML format.
82
83              This option is used by CMake authors to help produce web  pages.
84              If a file is specified, the help is written into it.
85
86
87       --help-man [file]
88              Print a UNIX man page and exit.
89
90              This  option is used by the cmake build to generate the UNIX man
91              page.  If a file is specified, the help is written into it.
92
93
94       --version [file]
95              Show program name/version banner and exit.
96
97              If a file is specified, the version is written into it.
98
99

GENERATORS

101       The following generators are available on this platform:
102
103
104       KDevelop3
105              Generates KDevelop 3 project files.
106
107              Project files for KDevelop 3 will be created in the  top  direc‐
108              tory  and  in every subdirectory which features a CMakeLists.txt
109              file containing a PROJECT() call. If  you  change  the  settings
110              using KDevelop cmake will try its best to keep your changes when
111              regenerating the project files. Additionally a hierarchy of UNIX
112              makefiles  is generated into the build tree.  Any standard UNIX-
113              style make program can build the  project  through  the  default
114              make target.  A "make install" target is also provided.
115
116
117       Unix Makefiles
118              Generates standard UNIX makefiles.
119
120              A  hierarchy of UNIX makefiles is generated into the build tree.
121              Any standard UNIX-style  make  program  can  build  the  project
122              through  the  default  make  target.  A "make install" target is
123              also provided.
124
125

COMMANDS

127       The following commands are available in CMakeLists.txt code:
128
129
130       ADD_CUSTOM_COMMAND
131              Add a custom build rule to the generated build system.
132
133              There are two main signatures for ADD_CUSTOM_COMMAND  The  first
134              signature is for adding a custom command to produce an output.
135
136
137                ADD_CUSTOM_COMMAND(OUTPUT output1 [output2 ...]
138                                   COMMAND command1 [ARGS] [args1...]
139                                   [COMMAND command2 [ARGS] [args2...] ...]
140                                   [MAIN_DEPENDENCY depend]
141                                   [DEPENDS [depends...]]
142                                   [WORKING_DIRECTORY dir]
143                                   [COMMENT comment] [VERBATIM] [APPEND])
144
145              This defines a new command that can be executed during the build
146              process. The outputs named should be listed as source  files  in
147              the  target  for  which  they  are  to  be  generated. Note that
148              MAIN_DEPENDENCY is completely optional and is used as a  sugges‐
149              tion to visual studio about where to hang the custom command. In
150              makefile terms this creates a new target in the following form:
151
152
153                OUTPUT: MAIN_DEPENDENCY DEPENDS
154                        COMMAND
155
156              If more than one command is specified they will be  executed  in
157              order.  The optional ARGS argument is for backward compatibility
158              and will be ignored.
159
160
161              The second signature adds a custom command to a target such as a
162              library  or  executable. This is useful for performing an opera‐
163              tion before or after building the target:
164
165
166                ADD_CUSTOM_COMMAND(TARGET target
167                                   PRE_BUILD | PRE_LINK | POST_BUILD
168                                   COMMAND command1 [ARGS] [args1...]
169                                   [COMMAND command2 [ARGS] [args2...] ...]
170                                   [WORKING_DIRECTORY dir]
171                                   [COMMENT comment] [VERBATIM])
172
173              This defines a new command that will be associated with building
174              the specified target. When the command will happen is determined
175              by which of the following is specified:
176
177
178                PRE_BUILD - run before all other dependencies
179                PRE_LINK - run after other dependencies
180                POST_BUILD - run after the target has been built
181
182              Note that the PRE_BUILD option is only supported on Visual  Stu‐
183              dio  7  or  later.  For  all  other generators PRE_BUILD will be
184              treated as PRE_LINK.
185
186
187              If WORKING_DIRECTORY is specified the command will  be  executed
188              in  the  directory  given.  If COMMENT is set, the value will be
189              displayed as a message before the commands are executed at build
190              time. If APPEND is specified the COMMAND and DEPENDS option val‐
191              ues are appended to the custom  command  for  the  first  output
192              specified.  There must have already been a previous call to this
193              command with the same output.  The  COMMENT,  WORKING_DIRECTORY,
194              and MAIN_DEPENDENCY options are currently ignored when APPEND is
195              given, but may be used in the future.
196
197
198              If VERBATIM is given then all the arguments to the commands will
199              be  passed  exactly  as specified no matter the build tool used.
200              Note that one level of escapes is still used by the  CMake  lan‐
201              guage  processor  before  ADD_CUSTOM_TARGET  even sees the argu‐
202              ments. Use of VERBATIM is  recommended  as  it  enables  correct
203              behavior.  When  VERBATIM  is not given the behavior is platform
204              specific. In the future VERBATIM may be enabled by default.  The
205              only  reason  it  is an option is to preserve compatibility with
206              older CMake code.
207
208
209              If the output of the custom command is not actually created as a
210              file   on   disk   it   should   be   marked  as  SYMBOLIC  with
211              SET_SOURCE_FILES_PROPERTIES.
212
213
214       ADD_CUSTOM_TARGET
215              Add a target with no output so it will always be built.
216
217                ADD_CUSTOM_TARGET(Name [ALL] [command1 [args1...]]
218                                  [COMMAND command2 [args2...] ...]
219                                  [DEPENDS depend depend depend ... ]
220                                  [WORKING_DIRECTORY dir]
221                                  [COMMENT comment] [VERBATIM])
222
223              Adds a target with the given name that executes the  given  com‐
224              mands.  The  target  has no output file and is ALWAYS CONSIDERED
225              OUT OF DATE even if the commands try to create a file  with  the
226              name  of  the  target. Use ADD_CUSTOM_COMMAND to generate a file
227              with dependencies. By default nothing depends on the custom tar‐
228              get.  Use  ADD_DEPENDENCIES to add dependencies to or from other
229              targets. If the ALL option is specified it indicates  that  this
230              target  should  be  added to the default build target so that it
231              will be run every time (the command cannot be called  ALL).  The
232              command and arguments are optional and if not specified an empty
233              target will be created. If WORKING_DIRECTORY is  set,  then  the
234              command  will  be  run in that directory. If COMMENT is set, the
235              value will be displayed as a message  before  the  commands  are
236              executed  at  build  time.  Dependencies listed with the DEPENDS
237              argument may reference files and outputs of custom commands cre‐
238              ated with ADD_CUSTOM_COMMAND.
239
240
241              If VERBATIM is given then all the arguments to the commands will
242              be passed exactly as specified no matter the  build  tool  used.
243              Note  that  one level of escapes is still used by the CMake lan‐
244              guage processor before ADD_CUSTOM_TARGET  even  sees  the  argu‐
245              ments.  Use  of  VERBATIM  is  recommended as it enables correct
246              behavior. When VERBATIM is not given the  behavior  is  platform
247              specific.  In the future VERBATIM may be enabled by default. The
248              only reason it is an option is to  preserve  compatibility  with
249              older CMake code.
250
251
252       ADD_DEFINITIONS
253              Adds -D define flags to the command line of C and C++ compilers.
254
255                ADD_DEFINITIONS(-DFOO -DBAR ...)
256
257              Adds flags to command line of C and C++ compilers.  This command
258              can be used to add any flag to a compile line, but the  -D  flag
259              is  accepted  most  C/C++  compilers.  Other flags may not be as
260              portable.
261
262
263       ADD_DEPENDENCIES
264              Add a dependency between top-level targets.
265
266                ADD_DEPENDENCIES(target-name depend-target1
267                                 depend-target2 ...)
268
269              Make a top-level target depend on other  top-level  targets.   A
270              top-level  target is one created by ADD_EXECUTABLE, ADD_LIBRARY,
271              or ADD_CUSTOM_TARGET.  Adding dependencies with this command can
272              be  used to make sure one target is built before another target.
273              See the DEPENDS option of ADD_CUSTOM_TARGET and  ADD_CUSTOM_COM‐
274              MAND  for  adding  file-level dependencies in custom rules.  See
275              the OBJECT_DEPENDS option in SET_SOURCE_FILES_PROPERTIES to  add
276              file-level dependencies to object files.
277
278
279       ADD_EXECUTABLE
280              Add  an  executable  to  the  project using the specified source
281              files.
282
283                ADD_EXECUTABLE(exename         [WIN32]         [MACOSX_BUNDLE]
284              [EXCLUDE_FROM_ALL]
285                               source1 source2 ... sourceN)
286
287              This command adds an executable target to the current directory.
288              The executable will be built from the list of source files spec‐
289              ified.
290
291
292              After specifying the executable name, WIN32 and/or MACOSX_BUNDLE
293              can be specified. WIN32 indicates that the executable (when com‐
294              piled on windows) is a windows app (using WinMain) not a console
295              app (using main). The variable CMAKE_MFC_FLAG  be  used  if  the
296              windows  app uses MFC. This variable can be set to the following
297              values:
298
299
300               0: Use Standard Windows Libraries
301               1: Use MFC in a Static Library
302               2: Use MFC in a Shared DLL
303
304              MACOSX_BUNDLE indicates that when build on Mac  OSX,  executable
305              should be in the bundle form. The MACOSX_BUNDLE also allows sev‐
306              eral variables to be specified:
307
308
309                MACOSX_BUNDLE_INFO_STRING
310                MACOSX_BUNDLE_ICON_FILE
311                MACOSX_BUNDLE_GUI_IDENTIFIER
312                MACOSX_BUNDLE_LONG_VERSION_STRING
313                MACOSX_BUNDLE_BUNDLE_NAME
314                MACOSX_BUNDLE_SHORT_VERSION_STRING
315                MACOSX_BUNDLE_BUNDLE_VERSION
316                MACOSX_BUNDLE_COPYRIGHT
317
318              If EXCLUDE_FROM_ALL is given the target will  not  be  built  by
319              default. It will be built only if the user explicitly builds the
320              target or another target that requires the target depends on it.
321
322
323       ADD_LIBRARY
324              Add a library to the project using the specified source files.
325
326                ADD_LIBRARY(libname    [SHARED    |    STATIC    |     MODULE]
327              [EXCLUDE_FROM_ALL]
328                            source1 source2 ... sourceN)
329
330              Adds  a  library  target.  SHARED, STATIC or MODULE keywords are
331              used to set the library type.  If the  keyword  MODULE  appears,
332              the  library type is set to MH_BUNDLE on systems which use dyld.
333              On systems without dyld, MODULE is treated like SHARED.   If  no
334              keywords  appear   as  the second argument, the type defaults to
335              the current value of BUILD_SHARED_LIBS.  If this variable is not
336              set, the type defaults to STATIC.
337
338
339              If  EXCLUDE_FROM_ALL  is  given  the target will not be built by
340              default. It will be built only if the user explicitly builds the
341              target or another target that requires the target depends on it.
342
343
344       ADD_SUBDIRECTORY
345              Add a subdirectory to the build.
346
347                ADD_SUBDIRECTORY(source_dir [binary_dir]
348                                 [EXCLUDE_FROM_ALL])
349
350              Add  a  subdirectory  to the build. The source_dir specifies the
351              directory in which the source CmakeLists.txt and code files  are
352              located.  If  it  is  a  relative path it will be evaluated with
353              respect to the current directory (the typical usage), but it may
354              also be an absolute path. The binary_dir specifies the directory
355              in which to place the output files. If it is a relative path  it
356              will  be evaluated with respect to the current output directory,
357              but it may also be an absolute path. If binary_dir is not speci‐
358              fied,  the  value  of  source_dir, before expanding any relative
359              path, will be used (the typical usage). The CMakeLists.txt  file
360              in  the specified source directory will be processed immediately
361              by CMake before processing in the current input  file  continues
362              beyond this command.
363
364
365              If the EXCLUDE_FROM_ALL argument is provided then this subdirec‐
366              tory will not be included in build by default. Users  will  have
367              to  explicitly  start a build in the generated output directory.
368              This is useful for having cmake create a build system for a  set
369              of  examples  in  a  project. One would want cmake to generate a
370              single build system for all the examples, but one may  not  want
371              the targets to show up in the main build system.
372
373
374       ADD_TEST
375              Add a test to the project with the specified arguments.
376
377                ADD_TEST(testname Exename arg1 arg2 ...)
378
379              If  the ENABLE_TESTING command has been run, this command adds a
380              test target to the current directory. If ENABLE_TESTING has  not
381              been  run,  this command does nothing.  The tests are run by the
382              testing subsystem by executing Exename with the specified  argu‐
383              ments.   Exename  can  be  either  an  executable  built by this
384              project or an arbitrary executable on the system  (like  tclsh).
385              The  test  will be run with the current working directory set to
386              the CMakeList.txt files corresponding directory  in  the  binary
387              tree.
388
389
390       AUX_SOURCE_DIRECTORY
391              Find all source files in a directory.
392
393                AUX_SOURCE_DIRECTORY(dir VARIABLE)
394
395              Collects  the  names  of  all  the source files in the specified
396              directory and stores the list in the  variable  provided.   This
397              command  is  intended  to  be used by projects that use explicit
398              template instantiation.  Template  instantiation  files  can  be
399              stored in a "Templates" subdirectory and collected automatically
400              using this command to avoid manually listing all instantiations.
401
402
403              It is tempting to use this command to avoid writing the list  of
404              source  files  for  a  library or executable target.  While this
405              seems to work, there is no way for CMake  to  generate  a  build
406              system  that  knows when a new source file has been added.  Nor‐
407              mally the generated build system knows when it  needs  to  rerun
408              CMake  because  the CMakeLists.txt file is modified to add a new
409              source.  When the source is just added to the directory  without
410              modifying  this  file, one would have to manually rerun CMake to
411              generate a build system incorporating the new file.
412
413
414       BUILD_COMMAND
415              Get the command line that will build this project.
416
417                BUILD_COMMAND(variable MAKECOMMAND)
418
419              Sets the given variable to a string containing the command  that
420              will  build  this  project from the root of the build tree using
421              the build tool given  by  MAKECOMMAND.   MAKECOMMAND  should  be
422              msdev,  nmake, make or one of the end user build tools.  This is
423              useful for configuring testing systems.
424
425
426       BUILD_NAME
427              Deprecated.   Use  ${CMAKE_SYSTEM}   and   ${CMAKE_CXX_COMPILER}
428              instead.
429
430                BUILD_NAME(variable)
431
432              Sets  the  specified variable to a string representing the plat‐
433              form and compiler settings.   These  values  are  now  available
434              through the CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables.
435
436
437       CMAKE_MINIMUM_REQUIRED
438              Set the minimum required version of cmake for a project.
439
440                CMAKE_MINIMUM_REQUIRED(VERSION versionNumber [FATAL_ERROR])
441
442              Let  cmake know that the project requires a certain version of a
443              cmake, or newer.  CMake will also try to be backwards compatible
444              to  the  version of cmake specified, if a newer version of cmake
445              is running.  If FATAL_ERROR is given then failure  to  meet  the
446              requirements will be considered an error instead of a warning.
447
448
449       CONFIGURE_FILE
450              Copy a file to another location and modify its contents.
451
452                CONFIGURE_FILE(InputFile OutputFile
453                               [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
454
455              The Input and Ouput files have to have full paths.  This command
456              replaces any variables in the input file referenced as ${VAR} or
457              @VAR@  with  their values as determined by CMake.  If a variable
458              is not defined, it will be replaced with nothing.   If  COPYONLY
459              is  specified,  then  no variable expansion will take place.  If
460              ESCAPE_QUOTES is specified then any substituted quotes  will  be
461              C-style  escaped.   The file will be configured with the current
462              values of CMake variables. If @ONLY is specified, only variables
463              of  the  form @VAR@ will be replaces and ${VAR} will be ignored.
464              This is useful for configuring  scripts  that  use  ${VAR}.  Any
465              occurrences  of  #cmakedefine  VAR  will be replaced with either
466              #define VAR or /* #undef VAR */ depending on the setting of  VAR
467              in CMake
468
469
470       CREATE_TEST_SOURCELIST
471              Create a test driver and source list for building test programs.
472
473                CREATE_TEST_SOURCELIST(SourceListName DriverName
474                                       test1 test2 test3
475                                       EXTRA_INCLUDE include.h
476                                       FUNCTION function)
477
478              A  test driver is a program that links together many small tests
479              into a single executable.  This is useful when  building  static
480              executables  with  large  libraries to shrink the total required
481              size.  The list of source files needed to build the test  driver
482              will  be  in SourceListName.  DriverName is the name of the test
483              driver program.  The rest of the arguments consist of a list  of
484              test source files, can be semicolon separated.  Each test source
485              file should have a function in it that is the same name  as  the
486              file  with no extension (foo.cxx should have int foo();) Driver‐
487              Name will be able to call each of the tests by name on the  com‐
488              mand line. If EXTRA_INCLUDE is specified, then the next argument
489              is included into the generated file. If FUNCTION  is  specified,
490              then  the  next  argument  is  taken  as a function name that is
491              passed a pointer to ac and av.  This can be used  to  add  extra
492              command  line  processing  to  each  test.  The  cmake  variable
493              CMAKE_TESTDRIVER_BEFORE_TESTMAIN can be set to  have  code  that
494              will  be  placed directly before calling the test main function.
495              CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set  to  have  code  that
496              will  be  placed  directly after the call to the test main func‐
497              tion.
498
499
500       ELSE   Starts the ELSE portion of an IF block.
501
502                ELSE(expression)
503
504              See the IF command.
505
506
507       ELSEIF Starts the ELSEIF portion of an IF block.
508
509                ELSEIF(expression)
510
511              See the IF command.
512
513
514       ENABLE_LANGUAGE
515              Set a name for the entire project.
516
517                ENABLE_LANGUAGE(languageName)
518
519              This command enables support for the named language in CMake.
520
521
522       ENABLE_TESTING
523              Enable testing for current directory and below.
524
525                ENABLE_TESTING()
526
527              Enables testing for this directory  and  below.   See  also  the
528              ADD_TEST  command.   Note that ctest expects to find a test file
529              in the build directory root.  Therefore, this command should  be
530              in the source directory root.
531
532
533       ENDFOREACH
534              Ends a list of commands in a FOREACH block.
535
536                ENDFOREACH(expression)
537
538              See the FOREACH command.
539
540
541       ENDIF  Ends a list of commands in an IF block.
542
543                ENDIF(expression)
544
545              See the IF command.
546
547
548       ENDMACRO
549              Ends a list of commands in a MACRO block.
550
551                ENDMACRO(expression)
552
553              See the MACRO command.
554
555
556       ENDWHILE
557              Ends a list of commands in a WHILE block.
558
559                ENDWHILE(expression)
560
561              See the WHILE command.
562
563
564       EXEC_PROGRAM
565              Run  and  executable program during the processing of the CMake‐
566              List.txt file.
567
568                EXEC_PROGRAM(Executable [directory in which to run]
569                             [ARGS <arguments to executable>]
570                             [OUTPUT_VARIABLE <var>]
571                             [RETURN_VALUE <var>])
572
573              The executable is run in  the  optionally  specified  directory.
574              The executable can include arguments if it is double quoted, but
575              it is better to use the optional ARGS argument to specify  argu‐
576              ments  to the program.   This is because cmake will then be able
577              to escape spaces in the executable path.  An  optional  argument
578              OUTPUT_VARIABLE  specifies a variable in which to store the out‐
579              put. To capture the return value of  the  execution,  provide  a
580              RETURN_VALUE.  If  OUTPUT_VARIABLE  is specified, then no output
581              will go to the stdout/stderr of the console running cmake.
582
583
584              The EXECUTE_PROCESS command is a newer more powerful version  of
585              EXEC_PROGRAM,  but the old command has been kept for compatibil‐
586              ity.
587
588
589       EXECUTE_PROCESS
590              Execute one or more child processes.
591
592                EXECUTE_PROCESS(COMMAND <cmd1> [args1...]]
593                                [COMMAND <cmd2> [args2...] [...]]
594                                [WORKING_DIRECTORY <directory>]
595                                [TIMEOUT <seconds>]
596                                [RESULT_VARIABLE <variable>]
597                                [OUTPUT_VARIABLE <variable>]
598                                [ERROR_VARIABLE <variable>]
599                                [INPUT_FILE <file>]
600                                [OUTPUT_FILE <file>]
601                                [ERROR_FILE <file>]
602                                [OUTPUT_QUIET]
603                                [ERROR_QUIET]
604                                [OUTPUT_STRIP_TRAILING_WHITESPACE]
605                                [ERROR_STRIP_TRAILING_WHITESPACE])
606
607              Runs the given sequence of one or more commands with  the  stan‐
608              dard  output  of each process piped to the standard input of the
609              next.  A single standard error pipe is used for  all  processes.
610              If WORKING_DIRECTORY is given the named directory will be set as
611              the current working directory of the child processes.  If  TIME‐
612              OUT  is  given the child processes will be terminated if they do
613              not finish in the specified number  of  seconds  (fractions  are
614              allowed).   If RESULT_VARIABLE is given the variable will be set
615              to contain the result of running the processes.  This will be an
616              integer  return  code from the last child or a string describing
617              an error condition.  If OUTPUT_VARIABLE  or  ERROR_VARIABLE  are
618              given  the  variable  named will be set with the contents of the
619              standard output and standard error pipes respectively.   If  the
620              same  variable  is  named  for  both  pipes their output will be
621              merged in the order produced.  If  INPUT_FILE,  OUTPUT_FILE,  or
622              ERROR_FILE is given the file named will be attached to the stan‐
623              dard input of the first process, standard  output  of  the  last
624              process,  or  standard  error of all processes respectively.  If
625              OUTPUT_QUIET or ERROR_QUIET is given then the standard output or
626              standard  error  results  will be quietly ignored.  If more than
627              one OUTPUT_* or ERROR_* option is given for the  same  pipe  the
628              precedence  is not specified.  If no OUTPUT_* or ERROR_* options
629              are given the output will be shared with the corresponding pipes
630              of the CMake process itself.
631
632
633              The  EXECUTE_PROCESS command is a newer more powerful version of
634              EXEC_PROGRAM, but the old command has been kept for  compatibil‐
635              ity.
636
637
638       EXPORT_LIBRARY_DEPENDENCIES
639              Write  out  the  dependency  information  for  all  targets of a
640              project.
641
642                EXPORT_LIBRARY_DEPENDENCIES(FILE [APPEND])
643
644              Create a file that can be included into a  CMake  listfile  with
645              the INCLUDE command.  The file will contain a number of SET com‐
646              mands that will set all the variables needed for library  depen‐
647              dency  information.   This should be the last command in the top
648              level CMakeLists.txt file of the project.  If the APPEND  option
649              is  specified,  the  SET  commands will be appended to the given
650              file instead of replacing it.
651
652
653       FILE   File manipulation command.
654
655                FILE(WRITE filename "message to write"... )
656                FILE(APPEND filename "message to write"... )
657                FILE(READ filename variable)
658                FILE(GLOB variable [RELATIVE path] [globbing expressions]...)
659                FILE(GLOB_RECURSE variable [RELATIVE path]
660                     [globbing expressions]...)
661                FILE(REMOVE [file1 ...])
662                FILE(REMOVE_RECURSE [file1 ...])
663                FILE(MAKE_DIRECTORY [directory1 directory2 ...])
664                FILE(RELATIVE_PATH variable directory file)
665                FILE(TO_CMAKE_PATH path result)
666                FILE(TO_NATIVE_PATH path result)
667
668              WRITE will write a message into a  file  called  'filename'.  It
669              overwrites  the  file if it already exists, and creates the file
670              if it does not exist.
671
672
673              APPEND will write a message into a file same as WRITE, except it
674              will append it to the end of the file
675
676
677              NOTE:  When  using FILE WRITE and FILE APPEND, the produced file
678              cannot be used as an input to CMake (CONFIGURE_FILE, source file
679              ...)  because  it  will  lead  to  an infinite loop. Use CONFIG‐
680              URE_FILE if you want to generate input files to CMake.
681
682
683              READ will read the content of a file and store it into the vari‐
684              able.
685
686
687              GLOB  will  generate a list of all files that match the globbing
688              expressions and store it into the variable. Globbing expressions
689              are  similar  to regular expressions, but much simpler. If RELA‐
690              TIVE flag is specified for an expression, the  results  will  be
691              returned as a relative path to the given path.
692
693
694              Examples of globbing expressions include:
695
696
697                 *.cxx      - match all files with extension cxx
698                 *.vt?      - match all files with extension vta,...,vtz
699                 f[3-5].txt - match files f3.txt, f4.txt, f5.txt
700
701              GLOB_RECURSE  will  generate  similar  list as the regular GLOB,
702              except it will traverse all the subdirectories  of  the  matched
703              directory and match the files.
704
705
706              Examples of recursive globbing include:
707
708
709                 /dir/*.py   -  match all python files in /dir and subdirecto‐
710              ries
711
712              MAKE_DIRECTORY will create the given directories, also if  their
713              parent directories don't exist yet
714
715
716              REMOVE will remove the given files, also in subdirectories
717
718
719              REMOVE_RECURSE will remove the given files and directories, also
720              non-empty directories
721
722
723              RELATIVE_PATH will determine relative path from directory to the
724              given file.
725
726
727              TO_CMAKE_PATH  will  convert  path  into a cmake style path with
728              unix /.  The input can be a single path or a  system  path  like
729              "$ENV{PATH}".   Note  the  double  quotes  around  the  ENV call
730              TO_CMAKE_PATH only takes  one argument.
731
732
733              TO_NATIVE_PATH works just like TO_CMAKE_PATH, but  will  convert
734              from   a  cmake style path into the native path style \ for win‐
735              dows and / for UNIX.
736
737
738       FIND_FILE
739              Find the full path to a file.
740
741                 FIND_FILE(<VAR> name1 path1 path2 ...)
742
743              This is the short-hand signature for the command that is  suffi‐
744              cient  in  many  cases.  It is the same as FIND_FILE(<VAR> name1
745              PATHS path2 path2 ...)
746
747
748                 FIND_FILE(
749                           <VAR>
750                           name | NAMES name1 [name2 ...]
751                           PATHS path1 [path2 ... ENV var]
752                           [PATH_SUFFIXES suffix1 [suffix2 ...]]
753                           [DOC "cache documentation string"]
754                           [NO_DEFAULT_PATH]
755                           [NO_CMAKE_ENVIRONMENT_PATH]
756                           [NO_CMAKE_PATH]
757                           [NO_SYSTEM_ENVIRONMENT_PATH]
758                           [NO_CMAKE_SYSTEM_PATH]
759                          )
760
761              This command is used to find a full path to named file. A  cache
762              entry named by <VAR> is created to store the result of this com‐
763              mand.  If the full path to a file is found the result is  stored
764              in  the  variable and the search will not be repeated unless the
765              variable is cleared.  If nothing is found, the  result  will  be
766              <VAR>-NOTFOUND,  and the search will be attempted again the next
767              time FIND_FILE is invoked with the same variable.  The  name  of
768              the full path to a file that is searched for is specified by the
769              names listed after the NAMES argument.   Additional search loca‐
770              tions  can be specified after the PATHS argument.  If ENV var is
771              found in the PATHS section the environment variable var will  be
772              read and converted from a system environment variable to a cmake
773              style list of paths.  For example ENV PATH would  be  a  way  to
774              list  the  system  path variable. The argument after DOC will be
775              used for the documentation string in the  cache.   PATH_SUFFIXES
776              can be used to give sub directories that will be appended to the
777              search paths.
778
779
780              If NO_DEFAULT_PATH is specified, then no  additional  paths  are
781              added  to  the  search. If NO_DEFAULT_PATH is not specified, the
782              search process is as follows:
783
784
785              1. Search cmake specific environment  variables.   This  can  be
786              skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
787
788
789                 CMAKE_FRAMEWORK_PATH
790                 CMAKE_APPBUNDLE_PATH
791                 CMAKE_INCLUDE_PATH
792
793              2.  Search cmake variables with the same names as the cmake spe‐
794              cific environment variables.  These are intended to be  used  on
795              the  command  line  with  a -DVAR=value.  This can be skipped if
796              NO_CMAKE_PATH is passed.
797
798
799                 CMAKE_FRAMEWORK_PATH
800                 CMAKE_APPBUNDLE_PATH
801                 CMAKE_INCLUDE_PATH
802
803              3. Search the standard system environment variables. This can be
804              skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
805
806
807                 PATH
808                 INCLUDE
809
810              4.  Search cmake variables defined in the Platform files for the
811              current system.  This can be skipped if NO_CMAKE_SYSTEM_PATH  is
812              passed.
813
814
815                 CMAKE_SYSTEM_FRAMEWORK_PATH
816                 CMAKE_SYSTEM_APPBUNDLE_PATH
817                 CMAKE_SYSTEM_INCLUDE_PATH
818
819              5.  Search  the paths specified after PATHS or in the short-hand
820              version of the command.
821
822
823              On Darwin or systems supporting OSX Frameworks, the cmake  vari‐
824              able     CMAKE_FIND_FRAMEWORK  can be set to empty or one of the
825              following:
826
827
828                 "FIRST"  - Try to find frameworks before standard
829                            libraries or headers. This is the default on  Dar‐
830              win.
831                 "LAST"   - Try to find frameworks after standard
832                            libraries or headers.
833                 "ONLY"   - Only try to find frameworks.
834                 "NEVER". - Never try to find frameworks.
835
836              On  Darwin  or  systems  supporting OSX Application Bundles, the
837              cmake variable CMAKE_FIND_APPBUNDLE can be set to empty  or  one
838              of the following:
839
840
841                 "FIRST"  - Try to find application bundles before standard
842                            programs. This is the default on Darwin.
843                 "LAST"   - Try to find application bundles after standard
844                            programs.
845                 "ONLY"   - Only try to find application bundles.
846                 "NEVER". - Never try to find application bundles.
847
848              The  reason  the  paths  listed  in  the call to the command are
849              searched last is that most users of CMake would expect things to
850              be  found first in the locations specified by their environment.
851              Projects may override this behavior by simply calling  the  com‐
852              mand twice:
853
854
855                 FIND_FILE(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
856                 FIND_FILE(<VAR> NAMES name)
857
858              Once one of these calls succeeds the result variable will be set
859              and stored in the cache so that neither call will search again.
860
861
862       FIND_LIBRARY
863              Find a library.
864
865                 FIND_LIBRARY(<VAR> name1 path1 path2 ...)
866
867              This is the short-hand signature for the command that is  suffi‐
868              cient in many cases.  It is the same as FIND_LIBRARY(<VAR> name1
869              PATHS path2 path2 ...)
870
871
872                 FIND_LIBRARY(
873                           <VAR>
874                           name | NAMES name1 [name2 ...]
875                           PATHS path1 [path2 ... ENV var]
876                           [PATH_SUFFIXES suffix1 [suffix2 ...]]
877                           [DOC "cache documentation string"]
878                           [NO_DEFAULT_PATH]
879                           [NO_CMAKE_ENVIRONMENT_PATH]
880                           [NO_CMAKE_PATH]
881                           [NO_SYSTEM_ENVIRONMENT_PATH]
882                           [NO_CMAKE_SYSTEM_PATH]
883                          )
884
885              This command is used to find a library. A cache entry  named  by
886              <VAR>  is  created  to store the result of this command.  If the
887              library is found the result is stored in the  variable  and  the
888              search  will not be repeated unless the variable is cleared.  If
889              nothing is found, the result will  be  <VAR>-NOTFOUND,  and  the
890              search  will  be  attempted  again the next time FIND_LIBRARY is
891              invoked with the same variable.  The name of the library that is
892              searched  for  is  specified by the names listed after the NAMES
893              argument.   Additional search locations can be  specified  after
894              the  PATHS  argument.   If ENV var is found in the PATHS section
895              the environment variable var will be read and converted  from  a
896              system environment variable to a cmake style list of paths.  For
897              example ENV PATH would be a way to list the  system  path  vari‐
898              able.  The argument after DOC will be used for the documentation
899              string in the cache.  PATH_SUFFIXES can  be  used  to  give  sub
900              directories that will be appended to the search paths.
901
902
903              If  NO_DEFAULT_PATH  is  specified, then no additional paths are
904              added to the search. If NO_DEFAULT_PATH is  not  specified,  the
905              search process is as follows:
906
907
908              1.  Search  cmake  specific  environment variables.  This can be
909              skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
910
911
912                 CMAKE_FRAMEWORK_PATH
913                 CMAKE_APPBUNDLE_PATH
914                 CMAKE_LIBRARY_PATH
915
916              2. Search cmake variables with the same names as the cmake  spe‐
917              cific  environment  variables.  These are intended to be used on
918              the command line with a -DVAR=value.  This  can  be  skipped  if
919              NO_CMAKE_PATH is passed.
920
921
922                 CMAKE_FRAMEWORK_PATH
923                 CMAKE_APPBUNDLE_PATH
924                 CMAKE_LIBRARY_PATH
925
926              3. Search the standard system environment variables. This can be
927              skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
928
929
930                 PATH
931                 LIB
932
933              4. Search cmake variables defined in the Platform files for  the
934              current  system.  This can be skipped if NO_CMAKE_SYSTEM_PATH is
935              passed.
936
937
938                 CMAKE_SYSTEM_FRAMEWORK_PATH
939                 CMAKE_SYSTEM_APPBUNDLE_PATH
940                 CMAKE_SYSTEM_LIBRARY_PATH
941
942              5. Search the paths specified after PATHS or in  the  short-hand
943              version of the command.
944
945
946              On  Darwin or systems supporting OSX Frameworks, the cmake vari‐
947              able    CMAKE_FIND_FRAMEWORK can be set to empty or one  of  the
948              following:
949
950
951                 "FIRST"  - Try to find frameworks before standard
952                            libraries  or headers. This is the default on Dar‐
953              win.
954                 "LAST"   - Try to find frameworks after standard
955                            libraries or headers.
956                 "ONLY"   - Only try to find frameworks.
957                 "NEVER". - Never try to find frameworks.
958
959              On Darwin or systems supporting  OSX  Application  Bundles,  the
960              cmake  variable  CMAKE_FIND_APPBUNDLE can be set to empty or one
961              of the following:
962
963
964                 "FIRST"  - Try to find application bundles before standard
965                            programs. This is the default on Darwin.
966                 "LAST"   - Try to find application bundles after standard
967                            programs.
968                 "ONLY"   - Only try to find application bundles.
969                 "NEVER". - Never try to find application bundles.
970
971              The reason the paths listed in  the  call  to  the  command  are
972              searched last is that most users of CMake would expect things to
973              be found first in the locations specified by their  environment.
974              Projects  may  override this behavior by simply calling the com‐
975              mand twice:
976
977
978                 FIND_LIBRARY(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
979                 FIND_LIBRARY(<VAR> NAMES name)
980
981              Once one of these calls succeeds the result variable will be set
982              and stored in the cache so that neither call will search again.
983
984
985              If the library found is a framework, then VAR will be set to the
986              full path to the framework <fullPath>/A.framework. When  a  full
987              path  to  a  framework  is  used  as a library, CMake will use a
988              -framework A, and a -F<fullPath> to link the  framework  to  the
989              target.
990
991
992       FIND_PACKAGE
993              Load settings for an external project.
994
995                FIND_PACKAGE(<name> [major.minor] [QUIET] [NO_MODULE]
996                             [[REQUIRED|COMPONENTS] [components...]])
997
998              Finds and loads settings from an external project.  <name>_FOUND
999              will be set to indicate whether the package was found.  Settings
1000              that can be used when <name>_FOUND is true are package-specific.
1001              The package is found through several steps.  Directories  listed
1002              in    CMAKE_MODULE_PATH    are   searched   for   files   called
1003              "Find<name>.cmake".  If such a file is found,  it  is  read  and
1004              processed  by CMake, and is responsible for finding the package.
1005              This first step may be skipped by using  the  NO_MODULE  option.
1006              If  no  such  file  is found, it is expected that the package is
1007              another project built by CMake that has  a  "<name>Config.cmake"
1008              file.   A  cache  entry  called  <name>_DIR  is  created  and is
1009              expected to be set to the directory containing  this  file.   If
1010              the file is found, it is read and processed by CMake to load the
1011              settings of the package.  If <name>_DIR has not been set  during
1012              a  configure step, the command will generate an error describing
1013              the  problem  unless  the  QUIET  argument  is  specified.    If
1014              <name>_DIR  has  been  set  to  a  directory  not  containing  a
1015              "<name>Config.cmake" file, an error  is  always  generated.   If
1016              REQUIRED   is   specified  and  the  package  is  not  found,  a
1017              FATAL_ERROR is generated and the configure step stops executing.
1018              A  package-specific  list  of components may be listed after the
1019              REQUIRED option, or after the COMPONENTS option if  no  REQUIRED
1020              option is given.
1021
1022
1023       FIND_PATH
1024              Find the directory containing a file.
1025
1026                 FIND_PATH(<VAR> name1 path1 path2 ...)
1027
1028              This  is the short-hand signature for the command that is suffi‐
1029              cient in many cases.  It is the same  as  FIND_PATH(<VAR>  name1
1030              PATHS path2 path2 ...)
1031
1032
1033                 FIND_PATH(
1034                           <VAR>
1035                           name | NAMES name1 [name2 ...]
1036                           PATHS path1 [path2 ... ENV var]
1037                           [PATH_SUFFIXES suffix1 [suffix2 ...]]
1038                           [DOC "cache documentation string"]
1039                           [NO_DEFAULT_PATH]
1040                           [NO_CMAKE_ENVIRONMENT_PATH]
1041                           [NO_CMAKE_PATH]
1042                           [NO_SYSTEM_ENVIRONMENT_PATH]
1043                           [NO_CMAKE_SYSTEM_PATH]
1044                          )
1045
1046              This  command  is  used to find a directory containing the named
1047              file. A cache entry named by  <VAR>  is  created  to  store  the
1048              result of this command.  If the file in a directory is found the
1049              result is stored in the variable and  the  search  will  not  be
1050              repeated  unless  the variable is cleared.  If nothing is found,
1051              the result will  be  <VAR>-NOTFOUND,  and  the  search  will  be
1052              attempted again the next time FIND_PATH is invoked with the same
1053              variable.  The name of the file in a directory that is  searched
1054              for  is  specified by the names listed after the NAMES argument.
1055              Additional search locations can be  specified  after  the  PATHS
1056              argument.  If ENV var is found in the PATHS section the environ‐
1057              ment variable var will be read and converted from a system envi‐
1058              ronment  variable  to  a cmake style list of paths.  For example
1059              ENV PATH would be a way to list the system  path  variable.  The
1060              argument  after DOC will be used for the documentation string in
1061              the cache.  PATH_SUFFIXES can be used to  give  sub  directories
1062              that will be appended to the search paths.
1063
1064
1065              If  NO_DEFAULT_PATH  is  specified, then no additional paths are
1066              added to the search. If NO_DEFAULT_PATH is  not  specified,  the
1067              search process is as follows:
1068
1069
1070              1.  Search  cmake  specific  environment variables.  This can be
1071              skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
1072
1073
1074                 CMAKE_FRAMEWORK_PATH
1075                 CMAKE_APPBUNDLE_PATH
1076                 CMAKE_INCLUDE_PATH
1077
1078              2. Search cmake variables with the same names as the cmake  spe‐
1079              cific  environment  variables.  These are intended to be used on
1080              the command line with a -DVAR=value.  This  can  be  skipped  if
1081              NO_CMAKE_PATH is passed.
1082
1083
1084                 CMAKE_FRAMEWORK_PATH
1085                 CMAKE_APPBUNDLE_PATH
1086                 CMAKE_INCLUDE_PATH
1087
1088              3. Search the standard system environment variables. This can be
1089              skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
1090
1091
1092                 PATH
1093                 INCLUDE
1094
1095              4. Search cmake variables defined in the Platform files for  the
1096              current  system.  This can be skipped if NO_CMAKE_SYSTEM_PATH is
1097              passed.
1098
1099
1100                 CMAKE_SYSTEM_FRAMEWORK_PATH
1101                 CMAKE_SYSTEM_APPBUNDLE_PATH
1102                 CMAKE_SYSTEM_INCLUDE_PATH
1103
1104              5. Search the paths specified after PATHS or in  the  short-hand
1105              version of the command.
1106
1107
1108              On  Darwin or systems supporting OSX Frameworks, the cmake vari‐
1109              able    CMAKE_FIND_FRAMEWORK can be set to empty or one  of  the
1110              following:
1111
1112
1113                 "FIRST"  - Try to find frameworks before standard
1114                            libraries  or headers. This is the default on Dar‐
1115              win.
1116                 "LAST"   - Try to find frameworks after standard
1117                            libraries or headers.
1118                 "ONLY"   - Only try to find frameworks.
1119                 "NEVER". - Never try to find frameworks.
1120
1121              On Darwin or systems supporting  OSX  Application  Bundles,  the
1122              cmake  variable  CMAKE_FIND_APPBUNDLE can be set to empty or one
1123              of the following:
1124
1125
1126                 "FIRST"  - Try to find application bundles before standard
1127                            programs. This is the default on Darwin.
1128                 "LAST"   - Try to find application bundles after standard
1129                            programs.
1130                 "ONLY"   - Only try to find application bundles.
1131                 "NEVER". - Never try to find application bundles.
1132
1133              The reason the paths listed in  the  call  to  the  command  are
1134              searched last is that most users of CMake would expect things to
1135              be found first in the locations specified by their  environment.
1136              Projects  may  override this behavior by simply calling the com‐
1137              mand twice:
1138
1139
1140                 FIND_PATH(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
1141                 FIND_PATH(<VAR> NAMES name)
1142
1143              Once one of these calls succeeds the result variable will be set
1144              and stored in the cache so that neither call will search again.
1145
1146
1147              When  searching  for  frameworks,  if  the  file is specified as
1148              A/b.h, then the framework search will look for A.framework/Head‐
1149              ers/b.h.  If  that  is found the path will be set to the path to
1150              the framework. CMake will convert this to the correct -F  option
1151              to include the file.
1152
1153
1154       FIND_PROGRAM
1155              Find an executable program.
1156
1157                 FIND_PROGRAM(<VAR> name1 path1 path2 ...)
1158
1159              This  is the short-hand signature for the command that is suffi‐
1160              cient in many cases.  It is the same as FIND_PROGRAM(<VAR> name1
1161              PATHS path2 path2 ...)
1162
1163
1164                 FIND_PROGRAM(
1165                           <VAR>
1166                           name | NAMES name1 [name2 ...]
1167                           PATHS path1 [path2 ... ENV var]
1168                           [PATH_SUFFIXES suffix1 [suffix2 ...]]
1169                           [DOC "cache documentation string"]
1170                           [NO_DEFAULT_PATH]
1171                           [NO_CMAKE_ENVIRONMENT_PATH]
1172                           [NO_CMAKE_PATH]
1173                           [NO_SYSTEM_ENVIRONMENT_PATH]
1174                           [NO_CMAKE_SYSTEM_PATH]
1175                          )
1176
1177              This  command  is used to find a program. A cache entry named by
1178              <VAR> is created to store the result of this  command.   If  the
1179              program  is  found  the result is stored in the variable and the
1180              search will not be repeated unless the variable is cleared.   If
1181              nothing  is  found,  the  result will be <VAR>-NOTFOUND, and the
1182              search will be attempted again the  next  time  FIND_PROGRAM  is
1183              invoked with the same variable.  The name of the program that is
1184              searched for is specified by the names listed  after  the  NAMES
1185              argument.    Additional  search locations can be specified after
1186              the PATHS argument.  If ENV var is found in  the  PATHS  section
1187              the  environment  variable var will be read and converted from a
1188              system environment variable to a cmake style list of paths.  For
1189              example  ENV  PATH  would be a way to list the system path vari‐
1190              able. The argument after DOC will be used for the  documentation
1191              string  in  the  cache.   PATH_SUFFIXES  can be used to give sub
1192              directories that will be appended to the search paths.
1193
1194
1195              If NO_DEFAULT_PATH is specified, then no  additional  paths  are
1196              added  to  the  search. If NO_DEFAULT_PATH is not specified, the
1197              search process is as follows:
1198
1199
1200              1. Search cmake specific environment  variables.   This  can  be
1201              skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
1202
1203
1204                 CMAKE_FRAMEWORK_PATH
1205                 CMAKE_APPBUNDLE_PATH
1206                 CMAKE_PROGRAM_PATH
1207
1208              2.  Search cmake variables with the same names as the cmake spe‐
1209              cific environment variables.  These are intended to be  used  on
1210              the  command  line  with  a -DVAR=value.  This can be skipped if
1211              NO_CMAKE_PATH is passed.
1212
1213
1214                 CMAKE_FRAMEWORK_PATH
1215                 CMAKE_APPBUNDLE_PATH
1216                 CMAKE_PROGRAM_PATH
1217
1218              3. Search the standard system environment variables. This can be
1219              skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
1220
1221
1222                 PATH
1223
1224
1225              4.  Search cmake variables defined in the Platform files for the
1226              current system.  This can be skipped if NO_CMAKE_SYSTEM_PATH  is
1227              passed.
1228
1229
1230                 CMAKE_SYSTEM_FRAMEWORK_PATH
1231                 CMAKE_SYSTEM_APPBUNDLE_PATH
1232                 CMAKE_SYSTEM_PROGRAM_PATH
1233
1234              5.  Search  the paths specified after PATHS or in the short-hand
1235              version of the command.
1236
1237
1238              On Darwin or systems supporting OSX Frameworks, the cmake  vari‐
1239              able     CMAKE_FIND_FRAMEWORK  can be set to empty or one of the
1240              following:
1241
1242
1243                 "FIRST"  - Try to find frameworks before standard
1244                            libraries or headers. This is the default on  Dar‐
1245              win.
1246                 "LAST"   - Try to find frameworks after standard
1247                            libraries or headers.
1248                 "ONLY"   - Only try to find frameworks.
1249                 "NEVER". - Never try to find frameworks.
1250
1251              On  Darwin  or  systems  supporting OSX Application Bundles, the
1252              cmake variable CMAKE_FIND_APPBUNDLE can be set to empty  or  one
1253              of the following:
1254
1255
1256                 "FIRST"  - Try to find application bundles before standard
1257                            programs. This is the default on Darwin.
1258                 "LAST"   - Try to find application bundles after standard
1259                            programs.
1260                 "ONLY"   - Only try to find application bundles.
1261                 "NEVER". - Never try to find application bundles.
1262
1263              The  reason  the  paths  listed  in  the call to the command are
1264              searched last is that most users of CMake would expect things to
1265              be  found first in the locations specified by their environment.
1266              Projects may override this behavior by simply calling  the  com‐
1267              mand twice:
1268
1269
1270                 FIND_PROGRAM(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
1271                 FIND_PROGRAM(<VAR> NAMES name)
1272
1273              Once one of these calls succeeds the result variable will be set
1274              and stored in the cache so that neither call will search again.
1275
1276
1277       FLTK_WRAP_UI
1278              Create FLTK user interfaces Wrappers.
1279
1280                FLTK_WRAP_UI(resultingLibraryName source1
1281                             source2 ... sourceN )
1282
1283              Produce .h and .cxx files for all the .fl and .fld files listed.
1284              The  resulting  .h  and  .cxx  files will be added to a variable
1285              named resultingLibraryName_FLTK_UI_SRCS which should be added to
1286              your library.
1287
1288
1289       FOREACH
1290              Evaluate a group of commands for each value in a list.
1291
1292                FOREACH(loop_var arg1 arg2 ...)
1293                  COMMAND1(ARGS ...)
1294                  COMMAND2(ARGS ...)
1295                  ...
1296                ENDFOREACH(loop_var)
1297                FOREACH(loop_var RANGE total)
1298                FOREACH(loop_var RANGE start stop [step])
1299
1300              All  commands  between  FOREACH  and the matching ENDFOREACH are
1301              recorded without being invoked.  Once the ENDFOREACH  is  evalu‐
1302              ated,  the  recorded  list  of commands is invoked once for each
1303              argument listed in the original FOREACH  command.   Before  each
1304              iteration  of  the  loop "${loop_var}" will be set as a variable
1305              with the current value in the list.
1306
1307
1308              Foreach can also iterate over  a  generated  range  of  numbers.
1309              There are three types of this iteration:
1310
1311
1312              *  When specifying single number, the range will have elements 0
1313              to "total".
1314
1315
1316              * When specifying two numbers, the range will have elements from
1317              the first number to the second number.
1318
1319
1320              *  The  third  optional  number is the increment used to iterate
1321              from the first number to the second number.
1322
1323
1324       GET_CMAKE_PROPERTY
1325              Get a property of the CMake instance.
1326
1327                GET_CMAKE_PROPERTY(VAR property)
1328
1329              Get a property from the CMake instance.  The value of the  prop‐
1330              erty  is  stored  in  the  variable  VAR. If the property is not
1331              found, CMake will report an  error.  Some  supported  properties
1332              include: VARIABLES, CACHE_VARIABLES, COMMANDS, and MACROS.
1333
1334
1335       GET_DIRECTORY_PROPERTY
1336              Get a property of the directory.
1337
1338                GET_DIRECTORY_PROPERTY(VAR [DIRECTORY dir] property)
1339
1340              Get a property from the Directory.  The value of the property is
1341              stored in the variable VAR. If the property is not found,  CMake
1342              will   report  an  error.  The  properties  include:  VARIABLES,
1343              CACHE_VARIABLES,    COMMANDS,    MACROS,    INCLUDE_DIRECTORIES,
1344              LINK_DIRECTORIES, DEFINITIONS, INCLUDE_REGULAR_EXPRESSION, LIST‐
1345              FILE_STACK, PARENT_DIRECTORY, and DEFINITION  varname.   If  the
1346              DIRECTORY argument is provided then the property of the provided
1347              directory will be retrieved instead of  the  current  directory.
1348              You  can  only  get properties of a directory during or after it
1349              has been traversed by cmake.
1350
1351
1352       GET_FILENAME_COMPONENT
1353              Get a specific component of a full filename.
1354
1355                GET_FILENAME_COMPONENT(VarName FileName
1356                                       PATH|ABSOLUTE|NAME|EXT|NAME_WE
1357                                       [CACHE])
1358
1359              Set VarName to be the path (PATH), file name (NAME), file exten‐
1360              sion  (EXT),  file name without extension (NAME_WE) of FileName,
1361              or the full absolute  (ABSOLUTE)  file  name  without  symlinks.
1362              Note  that  the path is converted to Unix slashes format and has
1363              no trailing slashes. The longest file extension is  always  con‐
1364              sidered. If the optional CACHE argument is specified, the result
1365              variable is added to the cache.
1366
1367
1368                GET_FILENAME_COMPONENT(VarName FileName
1369                                       PROGRAM [PROGRAM_ARGS ArgVar]
1370                                       [CACHE])
1371
1372              The program in FileName will be found in the system search  path
1373              or  left  as  a full path.  If PROGRAM_ARGS is present with PRO‐
1374              GRAM, then any command-line arguments present  in  the  FileName
1375              string  are  split  from  the program name and stored in ArgVar.
1376              This is used to separate a program name from its arguments in  a
1377              command line string.
1378
1379
1380       GET_SOURCE_FILE_PROPERTY
1381              Get a property for a source file.
1382
1383                GET_SOURCE_FILE_PROPERTY(VAR file property)
1384
1385              Get a property from a source file.  The value of the property is
1386              stored in the variable VAR.  If the property is not  found,  VAR
1387              will  be  set to "NOTFOUND".  Use SET_SOURCE_FILES_PROPERTIES to
1388              set property values.  Source file properties usually control how
1389              the file is built. One property that is always there is LOCATION
1390
1391
1392       GET_TARGET_PROPERTY
1393              Get a property from a target.
1394
1395                GET_TARGET_PROPERTY(VAR target property)
1396
1397              Get  a  property  from  a target.   The value of the property is
1398              stored in the variable VAR.  If the property is not  found,  VAR
1399              will  be  set  to  "NOTFOUND".  Use SET_TARGET_PROPERTIES to set
1400              property values.  Properties are usually used to control  how  a
1401              target is built.
1402
1403
1404              The  read-only  property  "<CONFIG>_LOCATION"  provides the full
1405              path to the file on disk that will be  created  for  the  target
1406              when  building under configuration <CONFIG> (in upper-case, such
1407              as "DEBUG_LOCATION"). The read-only property  "LOCATION"  speci‐
1408              fies  the full path to the file on disk that will be created for
1409              the target. The path may contain a build-system-specific portion
1410              that  is  replaced  at build time with the configuration getting
1411              built (such as "$(ConfigurationName)" in VS). This is very  use‐
1412              ful  for  executable  targets  to get the path to the executable
1413              file for use in a custom command.
1414
1415
1416              The read-only property "TYPE" returns which type  the  specified
1417              target  has  (EXECUTABLE,  STATIC_LIBRARY,  SHARED_LIBRARY, MOD‐
1418              ULE_LIBRARY, UTILITY, INSTALL_FILES or  INSTALL_PROGRAMS).  This
1419              command  can  get  properties for any target so far created. The
1420              targets do not need to be in the current CMakeLists.txt file.
1421
1422
1423       GET_TEST_PROPERTY
1424              Get a property of the test.
1425
1426                GET_TEST_PROPERTY(test VAR property)
1427
1428              Get a property from the Test.  The  value  of  the  property  is
1429              stored  in the variable VAR. If the property is not found, CMake
1430              will report an error.
1431
1432
1433       IF     Conditionally execute a group of commands.
1434
1435                IF(expression)
1436                  # THEN section.
1437                  COMMAND1(ARGS ...)
1438                  COMMAND2(ARGS ...)
1439                  ...
1440                ELSEIF(expression2)
1441                  # ELSEIF section.
1442                  COMMAND1(ARGS ...)
1443                  COMMAND2(ARGS ...)
1444                  ...
1445                ELSE(expression)
1446                  # ELSE section.
1447                  COMMAND1(ARGS ...)
1448                  COMMAND2(ARGS ...)
1449                  ...
1450                ENDIF(expression)
1451
1452              Evaluates the given expression.  If the result is true, the com‐
1453              mands  in the THEN section are invoked.  Otherwise, the commands
1454              in the ELSE section are invoked.  The ELSEIF and  ELSE  sections
1455              are  optional.  You  may have multiple ELSEIF clauses. Note that
1456              the same expression must  be  given  to  IF,  and  ENDIF.   Long
1457              expressions  can be used and the order or precedence is that the
1458              EXISTS, COMMAND, and DEFINED operators will be evaluated  first.
1459              Then  any  EQUAL,  LESS, GREATER, STRLESS, STRGREATER, STREQUAL,
1460              MATCHES will be evaluated. Then NOT operators and  finally  AND,
1461              OR operators will be evaluated. Possible expressions are:
1462
1463
1464                IF(variable)
1465
1466              True if the variable's value is not empty, 0, N, NO, OFF, FALSE,
1467              NOTFOUND, or <variable>-NOTFOUND.
1468
1469
1470                IF(NOT variable)
1471
1472              True if the variable's value is empty, 0,  N,  NO,  OFF,  FALSE,
1473              NOTFOUND, or <variable>-NOTFOUND.
1474
1475
1476                IF(variable1 AND variable2)
1477
1478              True if both variables would be considered true individually.
1479
1480
1481                IF(variable1 OR variable2)
1482
1483              True if either variable would be considered true individually.
1484
1485
1486                IF(COMMAND command-name)
1487
1488              True if the given name is a command that can be invoked.
1489
1490
1491                IF(EXISTS file-name)
1492                IF(EXISTS directory-name)
1493
1494              True  if  the named file or directory exists.  Behavior is well-
1495              defined only for full paths.
1496
1497
1498                IF(file1 IS_NEWER_THAN file2)
1499
1500              True if file1 is newer than file2 or if one  of  the  two  files
1501              doesn't exist. Behavior is well-defined only for full paths.
1502
1503
1504                IF(IS_DIRECTORY directory-name)
1505
1506              True if the given name is a directory.  Behavior is well-defined
1507              only for full paths.
1508
1509
1510                IF(IS_ABSOLUTE path)
1511
1512              True if the given path is an absolute path.
1513
1514
1515                 IF(variable MATCHES regex)
1516                IF(string MATCHES regex)
1517
1518              True if the given string or variable's value matches  the  given
1519              regular expression.
1520
1521
1522                IF(variable LESS number)
1523                IF(string LESS number)
1524                IF(variable GREATER number)
1525                IF(string GREATER number)
1526                IF(variable EQUAL number)
1527                IF(string EQUAL number)
1528
1529              True  if  the given string or variable's value is a valid number
1530              and the inequality or equality is true.
1531
1532
1533                IF(variable STRLESS string)
1534                IF(string STRLESS string)
1535                IF(variable STRGREATER string)
1536                IF(string STRGREATER string)
1537                IF(variable STREQUAL string)
1538                IF(string STREQUAL string)
1539
1540              True if the given string or variable's  value  is  lexicographi‐
1541              cally less (or greater, or equal) than the string on the right.
1542
1543
1544                IF(DEFINED variable)
1545
1546              True if the given variable is defined. It does not matter if the
1547              variable is true or false just if it has been set.
1548
1549
1550       INCLUDE
1551              Read CMake listfile code from the given file.
1552
1553                INCLUDE(file1 [OPTIONAL])
1554                INCLUDE(module [OPTIONAL])
1555
1556              Reads CMake listfile code from the given file.  Commands in  the
1557              file  are processed immediately as if they were written in place
1558              of the INCLUDE command.  If OPTIONAL is present, then  no  error
1559              is raised if the file does not exist.
1560
1561
1562              If  a  module is specified instead of a file, the file with name
1563              <modulename>.cmake is searched in the CMAKE_MODULE_PATH.
1564
1565
1566       INCLUDE_DIRECTORIES
1567              Add include directories to the build.
1568
1569                INCLUDE_DIRECTORIES([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)
1570
1571              Add the given directories to those searched by the compiler  for
1572              include  files. By default the directories are appended onto the
1573              current list  of  directories.  This  default  behavior  can  be
1574              changed  by  setting  CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. By
1575              using BEFORE or AFTER  you  can  select  between  appending  and
1576              prepending,  independent  from the default. If the SYSTEM option
1577              is given the compiler will be  told  that  the  directories  are
1578              meant as system include directories on some platforms.
1579
1580
1581       INCLUDE_EXTERNAL_MSPROJECT
1582              Include an external Microsoft project file in a workspace.
1583
1584                INCLUDE_EXTERNAL_MSPROJECT(projectname location
1585                                           dep1 dep2 ...)
1586
1587              Includes   an   external  Microsoft  project  in  the  generated
1588              workspace file.  Currently does nothing on UNIX.
1589
1590
1591       INCLUDE_REGULAR_EXPRESSION
1592              Set the regular expression used for dependency checking.
1593
1594                INCLUDE_REGULAR_EXPRESSION(regex_match [regex_complain])
1595
1596              Set the regular expressions used in dependency  checking.   Only
1597              files matching regex_match will be traced as dependencies.  Only
1598              files matching regex_complain will  generate  warnings  if  they
1599              cannot  be  found (standard header paths are not searched).  The
1600              defaults are:
1601
1602
1603                regex_match    = "^.*$" (match everything)
1604                regex_complain = "^$" (match empty string only)
1605
1606       INSTALL
1607              Specify rules to run at install time.
1608
1609              This command generates installation rules for a project.   Rules
1610              specified by calls to this command within a source directory are
1611              executed in order during installation.  The order across  direc‐
1612              tories is not defined.
1613
1614
1615              There  are  multiple  signatures for this command.  Some of them
1616              define installation properties for files and  targets.   Proper‐
1617              ties common to multiple signatures are covered here but they are
1618              valid only for signatures that specify them.
1619
1620
1621              DESTINATION arguments specify the directory on disk to  which  a
1622              file will be installed.  If a full path (with a leading slash or
1623              drive letter) is given it is used directly.  If a relative  path
1624              is   given   it   is   interpreted  relative  to  the  value  of
1625              CMAKE_INSTALL_PREFIX.
1626
1627
1628              PERMISSIONS arguments specify permissions for  installed  files.
1629              Valid  permissions  are  OWNER_READ, OWNER_WRITE, OWNER_EXECUTE,
1630              GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, WORLD_WRITE,
1631              WORLD_EXECUTE, SETUID, and SETGID.  Permissions that do not make
1632              sense on certain platforms are ignored on those platforms.
1633
1634
1635              The CONFIGURATIONS argument specifies a list of build configura‐
1636              tions for which the install rule applies (Debug, Release, etc.).
1637
1638
1639              The  COMPONENT argument specifies an installation component name
1640              with which the install rule is associated, such as "runtime"  or
1641              "development".    During  component-specific  installation  only
1642              install rules associated with the given component name  will  be
1643              executed.    During  a  full  installation  all  components  are
1644              installed.
1645
1646
1647              The RENAME argument specifies a name for an installed file  that
1648              may  be  different  from the original file.  Renaming is allowed
1649              only when a single file is installed by the command.
1650
1651
1652              The OPTIONAL argument specifies that it is not an error  if  the
1653              file to be installed does not exist.
1654
1655
1656              The TARGETS signature:
1657
1658
1659                INSTALL(TARGETS targets...
1660                        [[ARCHIVE|LIBRARY|RUNTIME]
1661                                            [DESTINATION <dir>]
1662                                            [PERMISSIONS permissions...]
1663                                            [CONFIGURATIONS
1664              [Debug|Release|...]]
1665                                            [COMPONENT <component>]
1666                                            [OPTIONAL]
1667                                           ] [...])
1668
1669              The TARGETS form specifies rules for installing targets  from  a
1670              project.   There  are  three  kinds  of target files that may be
1671              installed:  archive,  library,  and  runtime.   Executables  are
1672              always  treated  as runtime targets. Static libraries are always
1673              treated as archive targets. Module libraries are always  treated
1674              as  library  targets. For non-DLL platforms shared libraries are
1675              treated as library targets. For DLL platforms the DLL part of  a
1676              shared  library  is  treated  as a runtime target and the corre‐
1677              sponding import library is treated as  an  archive  target.  All
1678              Windows-based  systems  including  Cygwin are DLL platforms. The
1679              ARCHIVE, LIBRARY, and RUNTIME arguments change the type of  tar‐
1680              get  to which the subsequent properties apply.  If none is given
1681              the installation properties apply to all target types.  If  only
1682              one  is  given  then only targets of that type will be installed
1683              (which can be used to install just  a  DLL  or  just  an  import
1684              library).
1685
1686
1687              One  or  more  groups of properties may be specified in a single
1688              call to the TARGETS form of  this  command.   A  target  may  be
1689              installed more than once to different locations.  Consider hypo‐
1690              thetical targets "myExe", "mySharedLib", and "myStaticLib".  The
1691              code
1692
1693
1694                  INSTALL(TARGETS myExe mySharedLib myStaticLib
1695                          RUNTIME DESTINATION bin
1696                          LIBRARY DESTINATION lib
1697                          ARCHIVE DESTINATION lib/static)
1698                  INSTALL(TARGETS mySharedLib DESTINATION /some/full/path)
1699
1700              will  install  myExe  to  <prefix>/bin  and myStaticLib to <pre‐
1701              fix>/lib/static.   On  non-DLL  platforms  mySharedLib  will  be
1702              installed to <prefix>/lib and /some/full/path.  On DLL platforms
1703              the mySharedLib  DLL  will  be  installed  to  <prefix>/bin  and
1704              /some/full/path  and  its  import  library  will be installed to
1705              <prefix>/lib/static and /some/full/path.  On  non-DLL  platforms
1706              mySharedLib    will    be    installed   to   <prefix>/lib   and
1707              /some/full/path.
1708
1709
1710              The FILES signature:
1711
1712
1713                INSTALL(FILES files... DESTINATION <dir>
1714                        [PERMISSIONS permissions...]
1715                        [CONFIGURATIONS [Debug|Release|...]]
1716                        [COMPONENT <component>]
1717                        [RENAME <name>] [OPTIONAL])
1718
1719              The FILES form  specifies  rules  for  installing  files  for  a
1720              project.   File  names  given  as relative paths are interpreted
1721              with respect to the current source directory.   Files  installed
1722              by  this  form  are  by  default  given permissions OWNER_WRITE,
1723              OWNER_READ, GROUP_READ, and WORLD_READ if no  PERMISSIONS  argu‐
1724              ment is given.
1725
1726
1727              The PROGRAMS signature:
1728
1729
1730                INSTALL(PROGRAMS files... DESTINATION <dir>
1731                        [PERMISSIONS permissions...]
1732                        [CONFIGURATIONS [Debug|Release|...]]
1733                        [COMPONENT <component>]
1734                        [RENAME <name>] [OPTIONAL])
1735
1736              The PROGRAMS form is identical to the FILES form except that the
1737              default  permissions  for  the  installed  file   also   include
1738              OWNER_EXECUTE,  GROUP_EXECUTE,  and WORLD_EXECUTE.  This form is
1739              intended to install programs that are not targets, such as shell
1740              scripts.   Use  the TARGETS form to install targets built within
1741              the project.
1742
1743
1744              The DIRECTORY signature:
1745
1746
1747                INSTALL(DIRECTORY dirs... DESTINATION <dir>
1748                        [FILE_PERMISSIONS permissions...]
1749                        [DIRECTORY_PERMISSIONS permissions...]
1750                        [USE_SOURCE_PERMISSIONS]
1751                        [CONFIGURATIONS [Debug|Release|...]]
1752                        [COMPONENT <component>]
1753                        [[PATTERN <pattern> | REGEX <regex>]
1754                         [EXCLUDE] [PERMISSIONS permissions...]] [...])
1755
1756              The DIRECTORY form installs contents of one or more  directories
1757              to  a given destination.  The directory structure is copied ver‐
1758              batim to the destination.  The last component of each  directory
1759              name  is  appended  to  the destination directory but a trailing
1760              slash may be used to avoid this because it leaves the last  com‐
1761              ponent  empty.   Directory  names  given  as  relative paths are
1762              interpreted with respect to the current source directory.  If no
1763              input  directory  names are given the destination directory will
1764              be created but nothing will be installed into it.  The FILE_PER‐
1765              MISSIONS  and  DIRECTORY_PERMISSIONS options specify permissions
1766              given  to  files  and  directories  in  the   destination.    If
1767              USE_SOURCE_PERMISSIONS is specified and FILE_PERMISSIONS is not,
1768              file permissions will be copied from the source directory struc‐
1769              ture.   If  no permissions are specified files will be given the
1770              default permissions specified in the FILES form of the  command,
1771              and the directories will be given the default permissions speci‐
1772              fied in the PROGRAMS form of the command.  The PATTERN and REGEX
1773              options  specify  a  globbing  pattern  or regular expression to
1774              match directories or files encountered during  traversal  of  an
1775              input  directory.   The  full path to an input file or directory
1776              (with forward slashes) is matched  against  the  expression.   A
1777              PATTERN  will match only complete file names: the portion of the
1778              full path matching the pattern must occur at the end of the file
1779              name and be preceded by a slash.  A REGEX will match any portion
1780              of the full path but it may use '/' and '$' to simulate the PAT‐
1781              TERN  behavior.  Options following one of these matching expres‐
1782              sions are applied only to files or  directories  matching  them.
1783              The EXCLUDE option will skip the matched file or directory.  The
1784              PERMISSIONS option overrides the  permissions  setting  for  the
1785              matched file or directory.  For example the code
1786
1787
1788                INSTALL(DIRECTORY icons scripts/ DESTINATION share/myproj
1789                        PATTERN "CVS" EXCLUDE
1790                        PATTERN "scripts/*"
1791                        PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
1792                                    GROUP_EXECUTE GROUP_READ)
1793
1794              will  install  the icons directory to share/myproj/icons and the
1795              scripts directory to share/myproj.  The icons will  get  default
1796              file  permissions,  the  scripts  will be given specific permis‐
1797              sions, and any CVS directories will be excluded.
1798
1799
1800              The SCRIPT and CODE signature:
1801
1802
1803                INSTALL([[SCRIPT <file>] [CODE <code>]] [...])
1804
1805              The SCRIPT form will invoke the given CMake script files  during
1806              installation.   If  the  script  file name is a relative path it
1807              will be interpreted with respect to the  current  source  direc‐
1808              tory.   The  CODE  form  will invoke the given CMake code during
1809              installation.  Code is specified as a single argument  inside  a
1810              double-quoted string.  For example, the code
1811
1812
1813                INSTALL(CODE "MESSAGE(\"Sample install message.\")")
1814
1815              will print a message during installation.
1816
1817
1818              NOTE:  This  command  supercedes the INSTALL_TARGETS command and
1819              the      target      properties      PRE_INSTALL_SCRIPT      and
1820              POST_INSTALL_SCRIPT.   It  also  replaces the FILES forms of the
1821              INSTALL_FILES and  INSTALL_PROGRAMS  commands.   The  processing
1822              order  of  these  install  rules  relative to those generated by
1823              INSTALL_TARGETS, INSTALL_FILES, and INSTALL_PROGRAMS commands is
1824              not defined.
1825
1826
1827
1828       INSTALL_FILES
1829              Old installation command.  Use the INSTALL command.
1830
1831              This  command has been superceded by the INSTALL command.  It is
1832              provided for compatibility with older  CMake  code.   The  FILES
1833              form  is directly replaced by the FILES form of the INSTALL com‐
1834              mand.  The regexp form can be expressed more clearly  using  the
1835              GLOB form of the FILE command.
1836
1837
1838                INSTALL_FILES(<dir> extension file file ...)
1839
1840              Create  rules  to install the listed files with the given exten‐
1841              sion into the given directory.  Only files existing in the  cur‐
1842              rent  source  tree  or  its corresponding location in the binary
1843              tree may be listed.  If a file specified already has  an  exten‐
1844              sion,  that extension will be removed first.  This is useful for
1845              providing lists of source files such as foo.cxx  when  you  want
1846              the  corresponding foo.h to be installed. A typical extension is
1847              '.h'.
1848
1849
1850                INSTALL_FILES(<dir> regexp)
1851
1852              Any files in the current source directory that match the regular
1853              expression will be installed.
1854
1855
1856                INSTALL_FILES(<dir> FILES file file ...)
1857
1858              Any  files  listed  after  the  FILES  keyword will be installed
1859              explicitly from the names given.  Full paths are allowed in this
1860              form.
1861
1862
1863              The  directory  <dir>  is  relative  to the installation prefix,
1864              which is stored in the variable CMAKE_INSTALL_PREFIX.
1865
1866
1867       INSTALL_PROGRAMS
1868              Old installation command.  Use the INSTALL command.
1869
1870              This command has been superceded by the INSTALL command.  It  is
1871              provided  for  compatibility  with  older CMake code.  The FILES
1872              form is directly replaced by the PROGRAMS form  of  the  INSTALL
1873              command.   The  regexp  form can be expressed more clearly using
1874              the GLOB form of the FILE command.
1875
1876
1877                INSTALL_PROGRAMS(<dir> file1 file2 [file3 ...])
1878                INSTALL_PROGRAMS(<dir> FILES file1 [file2 ...])
1879
1880              Create rules to install  the  listed  programs  into  the  given
1881              directory.   Use  the  FILES argument to guarantee that the file
1882              list version of the command will be used even when there is only
1883              one argument.
1884
1885
1886                INSTALL_PROGRAMS(<dir> regexp)
1887
1888              In  the  second form any program in the current source directory
1889              that matches the regular expression will be installed.
1890
1891
1892              This command is intended to install programs that are not  built
1893              by  cmake,  such  as shell scripts.  See the TARGETS form of the
1894              INSTALL command to create installation rules for  targets  built
1895              by cmake.
1896
1897
1898              The  directory  <dir>  is  relative  to the installation prefix,
1899              which is stored in the variable CMAKE_INSTALL_PREFIX.
1900
1901
1902       INSTALL_TARGETS
1903              Old installation command.  Use the INSTALL command.
1904
1905              This command has been superceded by the INSTALL command.  It  is
1906              provided for compatibility with older CMake code.
1907
1908
1909                INSTALL_TARGETS(<dir> [RUNTIME_DIRECTORY dir] target target)
1910
1911              Create rules to install the listed targets into the given direc‐
1912              tory.  The directory <dir> is relative to the installation  pre‐
1913              fix,  which  is  stored in the variable CMAKE_INSTALL_PREFIX. If
1914              RUNTIME_DIRECTORY is specified, then  on  systems  with  special
1915              runtime  files  (Windows  DLL), the files will be copied to that
1916              directory.
1917
1918
1919       LINK_DIRECTORIES
1920              Specify directories in which to search for libraries.
1921
1922                LINK_DIRECTORIES(directory1 directory2 ...)
1923
1924              Specify  the  paths  in  which  the  linker  should  search  for
1925              libraries.
1926
1927
1928       LINK_LIBRARIES
1929              Link libraries to all targets added later.
1930
1931                LINK_LIBRARIES(library1 <debug | optimized> library2 ...)
1932
1933              This  is  an  old CMake command for linking libraries.  Use TAR‐
1934              GET_LINK_LIBRARIES unless you have a good reason for every  tar‐
1935              get to link to the same set of libraries.
1936
1937
1938              Specify a list of libraries to be linked into any following tar‐
1939              gets (typically added with  the  ADD_EXECUTABLE  or  ADD_LIBRARY
1940              calls).  This command is passed down to all subdirectories.  The
1941              debug and optimized strings may be used  to  indicate  that  the
1942              next library listed is to be used only for that specific type of
1943              build.
1944
1945
1946       LIST   List operations.
1947
1948                LIST(LENGTH <list> <output variable>)
1949                LIST(GET <list> <element index> [<element index> ...]  <output
1950              variable>)
1951                LIST(APPEND <list> <element> [<element> ...])
1952                LIST(FIND <list> <value> <output variable>)
1953                LIST(INSERT <list> <element_index> <element> [<element> ...])
1954                LIST(REMOVE_ITEM <list> <value> [<value> ...])
1955                LIST(REMOVE_AT <list> <index> [<index> ...])
1956                LIST(SORT <list>)
1957                LIST(REVERSE <list>)
1958
1959              LENGTH will return a given list's length.
1960
1961
1962              GET  will  return list of elements specified by indices from the
1963              list.
1964
1965
1966              APPEND will append elements to the list.
1967
1968
1969              FIND will return the index of the element specified in the  list
1970              or -1 if it wasn't found.
1971
1972
1973              INSERT  will  insert elements to the list to the specified loca‐
1974              tion.
1975
1976
1977              When specifying an index, negative value  corresponds  to  index
1978              from the end of the list.
1979
1980
1981              REMOVE_AT  and  REMOVE_ITEM will remove items from the list. The
1982              difference is that REMOVE_ITEM  will  remove  the  given  items,
1983              while REMOVE_AT will remove the items at the given indices.
1984
1985
1986
1987       LOAD_CACHE
1988              Load in the values from another project's CMake cache.
1989
1990                LOAD_CACHE(pathToCacheFile READ_WITH_PREFIX
1991                           prefix entry1...)
1992
1993              Read the cache and store the requested entries in variables with
1994              their name prefixed with the given prefix.  This only reads  the
1995              values,  and  does  not  create  entries  in the local project's
1996              cache.
1997
1998
1999                LOAD_CACHE(pathToCacheFile [EXCLUDE entry1...]
2000                           [INCLUDE_INTERNALS entry1...])
2001
2002              Load in the values from another cache  and  store  them  in  the
2003              local project's cache as internal entries.  This is useful for a
2004              project that depends on another project  built  in  a  different
2005              tree.   EXCLUDE  option can be used to provide a list of entries
2006              to be excluded.  INCLUDE_INTERNALS can be used to provide a list
2007              of  internal  entries  to  be  included.   Normally, no internal
2008              entries are brought in.  Use of this  form  of  the  command  is
2009              strongly  discouraged,  but it is provided for backward compati‐
2010              bility.
2011
2012
2013       LOAD_COMMAND
2014              Load a command into a running CMake.
2015
2016                LOAD_COMMAND(COMMAND_NAME <loc1> [loc2 ...])
2017
2018              The given locations are searched for a  library  whose  name  is
2019              cmCOMMAND_NAME.  If found, it is loaded as a module and the com‐
2020              mand is added to the set of available CMake commands.   Usually,
2021              TRY_COMPILE  is  used before this command to compile the module.
2022              If the command is successfully loaded a variable named
2023
2024
2025                CMAKE_LOADED_COMMAND_<COMMAND_NAME>
2026
2027              will be set to the full path of  the  module  that  was  loaded.
2028              Otherwise the variable will not be set.
2029
2030
2031       MACRO  Start recording a macro for later invocation as a command.
2032
2033                MACRO(<name> [arg1 [arg2 [arg3 ...]]])
2034                  COMMAND1(ARGS ...)
2035                  COMMAND2(ARGS ...)
2036                  ...
2037                ENDMACRO(<name>)
2038
2039              Define a macro named <name> that takes arguments named arg1 arg2
2040              arg3 (...).  Commands listed after MACRO, but before the  match‐
2041              ing  ENDMACRO, are not invoked until the macro is invoked.  When
2042              it is invoked, the commands recorded in the macro are first mod‐
2043              ified  by  replacing  formal parameters (${arg1}) with the argu‐
2044              ments passed, and then invoked as normal commands.  In  addition
2045              to referencing the formal parameters you can reference the vari‐
2046              able ARGC which will be set to the number  of  arguments  passed
2047              into  the  function  as well as ARGV0 ARGV1 ARGV2 ... which will
2048              have the actual values of the arguments passed in. This  facili‐
2049              tates creating macros with optional arguments. Additionally ARGV
2050              holds the list of all arguments given  to  the  macro  and  ARGN
2051              holds the list of argument pass the last expected argument.
2052
2053
2054       MAKE_DIRECTORY
2055              Old directory creation command.  Use the FILE command.
2056
2057              This command has been superceded by the FILE(MAKE_DIRECTORY ...)
2058              command.  It is provided  for  compatibility  with  older  CMake
2059              code.
2060
2061
2062                MAKE_DIRECTORY(directory)
2063
2064              Creates  the  specified  directory.  Full paths should be given.
2065              Any parent directories that do not exist will also  be  created.
2066              Use with care.
2067
2068
2069       MARK_AS_ADVANCED
2070              Mark cmake cached variables as advanced.
2071
2072                MARK_AS_ADVANCED([CLEAR|FORCE] VAR VAR2 VAR...)
2073
2074              Mark  the named cached variables as advanced.  An advanced vari‐
2075              able will not be displayed in any of the cmake GUIs  unless  the
2076              show  advanced  option  is  on.   If CLEAR is the first argument
2077              advanced variables are changed back to unadvanced.  If FORCE  is
2078              the first argument, then the variable is made advanced.  If nei‐
2079              ther FORCE nor CLEAR is specified, new values will be marked  as
2080              advanced,  but  if  the  variable  already  has an advanced/non-
2081              advanced state, it will not be changed.
2082
2083
2084       MATH   Mathematical expressions.
2085
2086                MATH(EXPR <output variable> <math expression>)
2087
2088              EXPR evaluates mathematical expression and return result in  the
2089              output  variable. Example mathematical expression is '5 * ( 10 +
2090              13 )'.
2091
2092
2093       MESSAGE
2094              Display a message to the user.
2095
2096                MESSAGE([SEND_ERROR | STATUS | FATAL_ERROR]
2097                        "message to display" ...)
2098
2099              By default the message is displayed in a pop up  window  (CMake‐
2100              Setup),  or  in  the  stdout  of  cmake, or the error section of
2101              ccmake. If the first argument is SEND_ERROR  then  an  error  is
2102              raised,  and  the  generate phase will be skipped.  If the first
2103              argument is FATAL_ERROR, all processing is halted. If the  first
2104              argument is STATUS then the message is displayed in the progress
2105              line for the GUI, or with a -- in the command line cmake.
2106
2107
2108       OPTION Provides an option that the user can optionally select.
2109
2110                OPTION(OPTION_VAR "help string describing option"
2111                       [initial value])
2112
2113              Provide an option for the user to select as ON or  OFF.   If  no
2114              initial value is provided, OFF is used.
2115
2116
2117       OUTPUT_REQUIRED_FILES
2118              Output  a  list  of required source files for a specified source
2119              file.
2120
2121                OUTPUT_REQUIRED_FILES(srcfile outputfile)
2122
2123              Outputs a list of all the source files that are required by  the
2124              specified srcfile. This list is written into outputfile. This is
2125              similar to writing out the dependencies for srcfile except  that
2126              it jumps from .h files into .cxx, .c and .cpp files if possible.
2127
2128
2129       PROJECT
2130              Set a name for the entire project.
2131
2132                PROJECT(projectname [CXX] [C] [Java])
2133
2134              Sets  the  name of the project.  This creates the variables pro‐
2135              jectname_BINARY_DIR and projectname_SOURCE_DIR.  Optionally  you
2136              can  specify  which languages your project supports.  By default
2137              all languages are supported.  If you do not have a C++ compiler,
2138              but want to build a c program with cmake, then use this option.
2139
2140
2141       QT_WRAP_CPP
2142              Create QT Wrappers.
2143
2144                QT_WRAP_CPP(resultingLibraryName DestName
2145                            SourceLists ...)
2146
2147              Produce   moc   files  for  all  the  .h  files  listed  in  the
2148              SourceLists.  The moc files will be added to the  library  using
2149              the DestName source list.
2150
2151
2152       QT_WRAP_UI
2153              Create QT user interfaces Wrappers.
2154
2155                QT_WRAP_UI(resultingLibraryName HeadersDestName
2156                           SourcesDestName SourceLists ...)
2157
2158              Produce  .h  and  .cxx files for all the .ui files listed in the
2159              SourceLists.  The .h files will be added to  the  library  using
2160              the HeadersDestNamesource list.  The .cxx files will be added to
2161              the library using the SourcesDestNamesource list.
2162
2163
2164       REMOVE Old list item removal command.  Use the LIST command.
2165
2166              This command has been superceded by the  LIST(REMOVE  ...)  com‐
2167              mand.  It is provided for compatibility with older CMake code.
2168
2169
2170                REMOVE(VAR VALUE VALUE ...)
2171
2172              Removes  VALUE from the variable VAR.  This is typically used to
2173              remove entries from a vector (e.g.  semicolon  separated  list).
2174              VALUE is expanded.
2175
2176
2177       REMOVE_DEFINITIONS
2178              Removes -D define flags to the command line of C and C++ compil‐
2179              ers.
2180
2181                REMOVE_DEFINITIONS(-DFOO -DBAR ...)
2182
2183              Removes flags from command line of C and  C++  compilers.   This
2184              command  can be used to remove any flag from a compile line, but
2185              the -D flag is accepted by most C/C++  compilers.   Other  flags
2186              may not be as portable.
2187
2188
2189       SEPARATE_ARGUMENTS
2190              Split  space  separated  arguments  into  a semi-colon separated
2191              list.
2192
2193                SEPARATE_ARGUMENTS(VARIABLE)
2194
2195              Convert the value of VARIABLE to a  semi-colon  separated  list.
2196              All  spaces  are  replaced with ';'.  This helps with generating
2197              command lines.
2198
2199
2200       SET    Set a CMAKE variable to a given value.
2201
2202                SET(VAR [VALUE] [CACHE TYPE DOCSTRING [FORCE]])
2203
2204              Within CMake sets VAR to the value  VALUE.   VALUE  is  expanded
2205              before  VAR  is set to it.  If CACHE is present, then the VAR is
2206              put in the cache. TYPE and DOCSTRING are required. TYPE is  used
2207              by  the  CMake GUI to choose a widget with which the user sets a
2208              value.  The value for TYPE may be one of
2209
2210
2211                FILEPATH = File chooser dialog.
2212                PATH     = Directory chooser dialog.
2213                STRING   = Arbitrary string.
2214                BOOL     = Boolean ON/OFF checkbox.
2215                INTERNAL = No GUI entry (used for persistent variables).
2216
2217              If TYPE is INTERNAL, then the VALUE is always written  into  the
2218              cache, replacing any values existing in the cache.  If it is not
2219              a cache variable, then this always writes into the current make‐
2220              file.  The  FORCE option will overwrite the cache value removing
2221              any changes by the user.
2222
2223
2224                SET(VAR VALUE1 ... VALUEN).
2225
2226              In this case VAR is set to a semicolon separated list of values.
2227
2228
2229              VAR can be an environment variable such as:
2230
2231
2232                SET( ENV{PATH} /home/martink )
2233
2234              in which case the environment variable will be set.
2235
2236
2237       SET_DIRECTORY_PROPERTIES
2238              Set a property of the directory.
2239
2240                SET_DIRECTORY_PROPERTIES(PROPERTIES prop1 value1 prop2 value2)
2241
2242              Set a property for the current directory and subdirectories.  If
2243              the property is not found, CMake will report an error. The prop‐
2244              erties    include:    INCLUDE_DIRECTORIES,     LINK_DIRECTORIES,
2245              INCLUDE_REGULAR_EXPRESSION, and ADDITIONAL_MAKE_CLEAN_FILES.
2246
2247
2248              ADDITIONAL_MAKE_CLEAN_FILES  is  a  list  of  files that will be
2249              cleaned as a part of "make clean" stage.
2250
2251
2252       SET_SOURCE_FILES_PROPERTIES
2253              Source files can have properties that affect how they are built.
2254
2255                SET_SOURCE_FILES_PROPERTIES(file1 file2 ...
2256                                            PROPERTIES prop1 value1
2257                                            prop2 value2 ...)
2258
2259              Set properties on a file. The syntax for the command is to  list
2260              all  the  files  you want to change, and then provide the values
2261              you want to set next.  You can make up your  own  properties  as
2262              well.   The  following  are  used  by  CMake.  The ABSTRACT flag
2263              (boolean)  is  used  by  some  class   wrapping   commands.   If
2264              WRAP_EXCLUDE  (boolean) is true then many wrapping commands will
2265              ignore this file. If GENERATED (boolean) is true then it is  not
2266              an  error if this source file does not exist when it is added to
2267              a target.  Obviously, it must be created (presumably by a custom
2268              command)  before  the  target is built.  If the HEADER_FILE_ONLY
2269              (boolean) property is true then dependency  information  is  not
2270              created  for  that file (this is set automatically, based on the
2271              file's name's extension and is probably only used by Makefiles).
2272              OBJECT_DEPENDS  (string)  adds  dependencies to the object file.
2273              COMPILE_FLAGS (string) is passed to the compiler  as  additional
2274              command  line  arguments when the source file is compiled.  LAN‐
2275              GUAGE (string) CXX|C will change the default  compiler  used  to
2276              compile  the  source file. The languages used need to be enabled
2277              in the PROJECT command. If SYMBOLIC (boolean) is set to true the
2278              build  system will be informed that the source file is not actu‐
2279              ally created on disk but instead used as a symbolic name  for  a
2280              build rule.
2281
2282
2283       SET_TARGET_PROPERTIES
2284              Targets can have properties that affect how they are built.
2285
2286                SET_TARGET_PROPERTIES(target1 target2 ...
2287                                      PROPERTIES prop1 value1
2288                                      prop2 value2 ...)
2289
2290              Set  properties  on  a  target. The syntax for the command is to
2291              list all the files you want to change, and then provide the val‐
2292              ues  you  want to set next.  You can use any prop value pair you
2293              want and extract it later with the GET_TARGET_PROPERTY command.
2294
2295
2296              Properties that affect the name of a target's output file are as
2297              follows.   The PREFIX and SUFFIX properties override the default
2298              target name prefix (such as "lib") and suffix (such  as  ".so").
2299              IMPORT_PREFIX  and  IMPORT_SUFFIX  are the equivalent properties
2300              for the import  library  corresponding  to  a  DLL  (for  SHARED
2301              library  targets).   OUTPUT_NAME  sets the real name of a target
2302              when it is built and can be used to help create two  targets  of
2303              the  same  name even though CMake requires unique logical target
2304              names.  There is also a <CONFIG>_OUTPUT_NAME that  can  set  the
2305              output name on a per-configuration basis.  <CONFIG>_POSTFIX sets
2306              a postfix for the real name of the target when it is built under
2307              the  configuration  named  by  <CONFIG>  (in upper-case, such as
2308              "DEBUG_POSTFIX").  The value of  this  property  is  initialized
2309              when  the  target  is  created  to  the  value  of  the variable
2310              CMAKE_<CONFIG>_POSTFIX (except for  executable  targets  because
2311              earlier  CMake versions which did not use this variable for exe‐
2312              cutables).
2313
2314
2315              The LINK_FLAGS property can be used to add extra  flags  to  the
2316              link  step of a target. LINK_FLAGS_<CONFIG> will add to the con‐
2317              figuration <CONFIG>, for example,  DEBUG,  RELEASE,  MINSIZEREL,
2318              RELWITHDEBINFO.  DEFINE_SYMBOL sets the name of the preprocessor
2319              symbol defined when compiling sources in a  shared  library.  If
2320              not  set  here then it is set to target_EXPORTS by default (with
2321              some substitutions if the target is not a valid  C  identifier).
2322              This  is  useful  for  headers  to  know  whether they are being
2323              included from inside their library our outside to properly setup
2324              dllexport/dllimport decorations. The COMPILE_FLAGS property sets
2325              additional compiler flags used to build sources within the  tar‐
2326              get.   It may also be used to pass additional preprocessor defi‐
2327              nitions.
2328
2329
2330              The LINKER_LANGUAGE property is used to change the tool used  to
2331              link  an  executable  or  shared library. The default is set the
2332              language to match the files in the library. CXX and C are common
2333              values for this property.
2334
2335
2336              For  shared libraries VERSION and SOVERSION can be used to spec‐
2337              ify the build version and api version respectively. When  build‐
2338              ing  or installing appropriate symlinks are created if the plat‐
2339              form supports symlinks and the linker supports so-names. If only
2340              one of both is specified the missing is assumed to have the same
2341              version number. For executables VERSION can be used  to  specify
2342              the  build version. When building or installing appropriate sym‐
2343              links are created if the platform supports symlinks. For  shared
2344              libraries  and  executables  on Windows the VERSION attribute is
2345              parsed to extract a "major.minor" version number. These  numbers
2346              are used as the image version of the binary.
2347
2348
2349              There  are  a  few  properties  used  to  specify  RPATH  rules.
2350              INSTALL_RPATH is a semicolon-separated list specifying the rpath
2351              to  use  in  installed  targets (for platforms that support it).
2352              INSTALL_RPATH_USE_LINK_PATH is a boolean that  if  set  to  true
2353              will  append  directories  in the linker search path and outside
2354              the project to the INSTALL_RPATH. SKIP_BUILD_RPATH is a  boolean
2355              specifying  whether  to  skip  automatic  generation of an rpath
2356              allowing   the   target   to   run   from   the   build    tree.
2357              BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link
2358              the target in the build tree with the INSTALL_RPATH.  This takes
2359              precedence over SKIP_BUILD_RPATH and avoids the need for relink‐
2360              ing before installation.  INSTALL_NAME_DIR is a string  specify‐
2361              ing  the directory portion of the "install_name" field of shared
2362              libraries on Mac OSX to use in the installed targets.  When  the
2363              target    is    created    the    values    of   the   variables
2364              CMAKE_INSTALL_RPATH,          CMAKE_INSTALL_RPATH_USE_LINK_PATH,
2365              CMAKE_SKIP_BUILD_RPATH,    CMAKE_BUILD_WITH_INSTALL_RPATH,   and
2366              CMAKE_INSTALL_NAME_DIR are used to initialize these properties.
2367
2368
2369              PROJECT_LABEL can be used to change the name of the target in an
2370              IDE  like  visual  studio.   VS_KEYWORD can be set to change the
2371              visual studio keyword, for example QT integration  works  better
2372              if this is set to Qt4VSv1.0.
2373
2374
2375              When  a  library  is  built  CMake  by default generates code to
2376              remove any existing library using all possible names.   This  is
2377              needed  to  support  libraries  that  switch  between STATIC and
2378              SHARED by a user option.   However  when  using  OUTPUT_NAME  to
2379              build a static and shared library of the same name using differ‐
2380              ent logical target  names  the  two  targets  will  remove  each
2381              other's   files.    This   can   be  prevented  by  setting  the
2382              CLEAN_DIRECT_OUTPUT property to 1.
2383
2384
2385              The PRE_INSTALL_SCRIPT and  POST_INSTALL_SCRIPT  properties  are
2386              the  old  way  to  specify CMake scripts to run before and after
2387              installing  a  target.   They  are  used  only  when   the   old
2388              INSTALL_TARGETS  command is used to install the target.  Use the
2389              INSTALL command instead.
2390
2391
2392              The EXCLUDE_FROM_DEFAULT_BUILD property is used  by  the  visual
2393              studio  generators.   If  it  is set to 1 the target will not be
2394              part of the default build when you select "Build Solution".
2395
2396
2397       SET_TESTS_PROPERTIES
2398              Set a property of the tests.
2399
2400                SET_TESTS_PROPERTIES(test1 [test2...] PROPERTIES prop1  value1
2401              prop2 value2)
2402
2403              Set  a  property  for  the  tests. If the property is not found,
2404              CMake will report an error. The properties include:
2405
2406
2407              WILL_FAIL: If set to true, this will invert the  pass/fail  flag
2408              of the test.
2409
2410
2411              PASS_REGULAR_EXPRESSION: If set, the test output will be checked
2412              against the specified regular expressions and at  least  one  of
2413              the  regular  expressions  has to match, otherwise the test will
2414              fail.
2415
2416
2417                Example: PASS_REGULAR_EXPRESSION "TestPassed;All ok"
2418
2419              FAIL_REGULAR_EXPRESSION: If set, if the output will match to one
2420              of specified regular expressions, the test will fail.
2421
2422
2423                Example: PASS_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
2424
2425              Both  PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect
2426              a list of regular expressions.
2427
2428
2429
2430       SITE_NAME
2431              Set the given variable to the name of the computer.
2432
2433                SITE_NAME(variable)
2434
2435
2436       SOURCE_GROUP
2437              Define a grouping for sources in the makefile.
2438
2439                SOURCE_GROUP(name [REGULAR_EXPRESSION regex] [FILES src1  src2
2440              ...])
2441
2442              Defines  a  group  into  which sources will be placed in project
2443              files.  This is mainly used to setup file tabs in Visual Studio.
2444              Any  file whose name is listed or matches the regular expression
2445              will be placed in  this  group.   If  a  file  matches  multiple
2446              groups,  the  LAST  group that explicitly lists the file will be
2447              favored, if any.  If no group explicitly  lists  the  file,  the
2448              LAST  group  whose  regular  expression matches the file will be
2449              favored.
2450
2451
2452              The name of the group may contain backslashes  to  specify  sub‐
2453              groups:
2454
2455
2456                SOURCE_GROUP(outer\\inner ...)
2457
2458              For  backwards  compatibility, this command is also supports the
2459              format:
2460
2461
2462                SOURCE_GROUP(name regex)
2463
2464       STRING String operations.
2465
2466                STRING(REGEX MATCH <regular_expression>
2467                       <output variable> <input> [<input>...])
2468                STRING(REGEX MATCHALL <regular_expression>
2469                       <output variable> <input> [<input>...])
2470                STRING(REGEX REPLACE <regular_expression>
2471                       <replace_expression> <output variable>
2472                       <input> [<input>...])
2473                STRING(REPLACE <match_expression>
2474                       <replace_expression> <output variable>
2475                       <input> [<input>...])
2476                STRING(COMPARE EQUAL <string1> <string2> <output variable>)
2477                STRING(COMPARE NOTEQUAL <string1> <string2> <output variable>)
2478                STRING(COMPARE LESS <string1> <string2> <output variable>)
2479                STRING(COMPARE GREATER <string1> <string2> <output variable>)
2480                STRING(ASCII <number> [<number> ...] <output variable>)
2481                STRING(CONFIGURE <string1> <output variable>
2482                       [@ONLY] [ESCAPE_QUOTES])
2483                STRING(TOUPPER <string1> <output variable>)
2484                STRING(TOLOWER <string1> <output variable>)
2485                STRING(LENGTH <string> <output variable>)
2486                STRING(SUBSTRING <string> <begin> <length> <output variable>)
2487
2488              REGEX MATCH will match the regular expression once and store the
2489              match in the output variable.
2490
2491
2492              REGEX  MATCHALL  will match the regular expression as many times
2493              as possible and store the matches in the output  variable  as  a
2494              list.
2495
2496
2497              REGEX REPLACE will match the regular expression as many times as
2498              possible and substitute the replacement expression for the match
2499              in the output.  The replace expression may refer to paren-delim‐
2500              ited subexpressions of the match using \1, \2,  ...,  \9.   Note
2501              that  two  backslashes (\\1) are required in CMake code to get a
2502              backslash through argument parsing.
2503
2504
2505              REPLACE will match  the  given  expression  and  substitute  the
2506              replacement expression for the match in the output.  The replace
2507              expression may refer to paren-delimited  subexpressions  of  the
2508              match  using  \1,  \2, ..., \9.  Note that two backslashes (\\1)
2509              are required in CMake code to get a backslash  through  argument
2510              parsing.
2511
2512
2513              COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and
2514              store true or false in the output variable.
2515
2516
2517              ASCII will convert all numbers into corresponding ASCII  charac‐
2518              ters.
2519
2520
2521              CONFIGURE will transform a string like CONFIGURE_FILE transforms
2522              a file.
2523
2524
2525              TOUPPER/TOLOWER will convert string to upper/lower characters.
2526
2527
2528              LENGTH will return a given string's length.
2529
2530
2531              SUBSTRING will return a substring of a given string.
2532
2533
2534       SUBDIR_DEPENDS
2535              Legacy command.  Does nothing.
2536
2537                SUBDIR_DEPENDS(subdir dep1 dep2 ...)
2538
2539              Does not do anything.  This command used to help projects  order
2540              parallel builds correctly.  This functionality is now automatic.
2541
2542
2543       SUBDIRS
2544              Add a list of subdirectories to the build.
2545
2546                SUBDIRS(dir1     dir2     ...[EXCLUDE_FROM_ALL    exclude_dir1
2547              exclude_dir2 ...] [PREORDER] )
2548
2549              Add a list of subdirectories to the build. The  ADD_SUBDIRECTORY
2550              command  should be used instead of SUBDIRS although SUBDIRS will
2551              still work. This will cause any CMakeLists.txt files in the  sub
2552              directories to be processed by CMake.  Any directories after the
2553              PREORDER flag are traversed first by makefile builds,  the  PRE‐
2554              ORDER flag has no effect on IDE projects.  Any directories after
2555              the EXCLUDE_FROM_ALL marker will not  be  included  in  the  top
2556              level  makefile or project file. This is useful for having CMake
2557              create makefiles or projects for a set of examples in a project.
2558              You  would want CMake to generate makefiles or project files for
2559              all the examples at the same time, but you would not  want  them
2560              to  show  up in the top level project or be built each time make
2561              is run from the top.
2562
2563
2564       TARGET_LINK_LIBRARIES
2565              Link a target to given libraries.
2566
2567                TARGET_LINK_LIBRARIES(target library1
2568                                      <debug | optimized> library2
2569                                      ...)
2570
2571              Specify a list of libraries to be linked into the specified tar‐
2572              get.   The  debug  and optimized strings may be used to indicate
2573              that the next library listed is to be used only  for  that  spe‐
2574              cific type of build
2575
2576
2577       TRY_COMPILE
2578              Try compiling some code.
2579
2580                TRY_COMPILE(RESULT_VAR bindir srcdir
2581                            projectName <targetname> <CMAKE_FLAGS <Flags>>
2582                            <OUTPUT_VARIABLE var>)
2583
2584              Try  compiling a program.  In this form, srcdir should contain a
2585              complete CMake  project  with  a  CMakeLists.txt  file  and  all
2586              sources.  The  bindir  and srcdir will not be deleted after this
2587              command is run. If <target name> is specified  then  build  just
2588              that target otherwise the all or ALL_BUILD target is built.
2589
2590
2591                TRY_COMPILE(RESULT_VAR bindir srcfile
2592                            <CMAKE_FLAGS <Flags>>
2593                            <COMPILE_DEFINITIONS <flags> ...>
2594                            <OUTPUT_VARIABLE var>)
2595
2596              Try  compiling a srcfile.  In this case, the user need only sup‐
2597              ply a source file.  CMake will  create  the  appropriate  CMake‐
2598              Lists.txt file to build the source. In this version all files in
2599              bindir/CMakeFiles/CMakeTmp, will be cleaned  automatically,  for
2600              debugging  a  --debug-trycompile can be passed to cmake to avoid
2601              the  clean.  Some  extra  flags  that   can  be  included   are,
2602              INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES.  COM‐
2603              PILE_DEFINITIONS are -Ddefinition that will  be  passed  to  the
2604              compile  line.   TRY_COMPILE creates a CMakeList.txt file on the
2605              fly that looks like this:
2606
2607
2608                ADD_DEFINITIONS( <expanded  COMPILE_DEFINITIONS  from  calling
2609              cmake>)
2610                INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})
2611                LINK_DIRECTORIES(${LINK_DIRECTORIES})
2612                ADD_EXECUTABLE(cmTryCompileExec sources)
2613                TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})
2614
2615              In  both  versions  of the command, if OUTPUT_VARIABLE is speci‐
2616              fied, then the output from the build process is  stored  in  the
2617              given  variable.  Return  the  success or failure in RESULT_VAR.
2618              CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE  flags  to  the
2619              cmake that is run during the build.
2620
2621
2622       TRY_RUN
2623              Try compiling and then running some code.
2624
2625                TRY_RUN(RUN_RESULT_VAR COMPILE_RESULT_VAR
2626                        bindir srcfile [CMAKE_FLAGS <Flags>]
2627                        [COMPILE_DEFINITIONS <flags>]
2628                        [OUTPUT_VARIABLE var]
2629                        [ARGS <arg1> <arg2>...])
2630
2631              Try  compiling  a  srcfile.  Return TRUE or FALSE for success or
2632              failure in COMPILE_RESULT_VAR.  Then if the  compile  succeeded,
2633              run  the  executable and return its exit code in RUN_RESULT_VAR.
2634              If  the  executable  was  built,  but  failed   to   run,   then
2635              RUN_RESULT_VAR  will  be  set  to FAILED_TO_RUN. OUTPUT_VARIABLE
2636              specifies the name of the variable to put all  of  the  standard
2637              output and standard error into.
2638
2639
2640       USE_MANGLED_MESA
2641              Copy mesa headers for use in combination with system GL.
2642
2643                USE_MANGLED_MESA(PATH_TO_MESA OUTPUT_DIRECTORY)
2644
2645              The path to mesa includes, should contain gl_mangle.h.  The mesa
2646              headers are copied to  the  specified  output  directory.   This
2647              allows  mangled  mesa  headers  to  override other GL headers by
2648              being added to the include directory path earlier.
2649
2650
2651       UTILITY_SOURCE
2652              Specify the source tree of a third-party utility.
2653
2654                UTILITY_SOURCE(cache_entry executable_name
2655                               path_to_source [file1 file2 ...])
2656
2657              When a third-party utility's source is included in the distribu‐
2658              tion,  this  command specifies its location and name.  The cache
2659              entry will not be set unless the path_to_source and  all  listed
2660              files  exist.  It is assumed that the source tree of the utility
2661              will have been built before it is needed.
2662
2663
2664       VARIABLE_REQUIRES
2665              Assert satisfaction of an option's required variables.
2666
2667                VARIABLE_REQUIRES(TEST_VARIABLE RESULT_VARIABLE
2668                                  REQUIRED_VARIABLE1
2669                                  REQUIRED_VARIABLE2 ...)
2670
2671              The first argument (TEST_VARIABLE) is the name of  the  variable
2672              to be tested, if that variable is false nothing else is done. If
2673              TEST_VARIABLE is true, then the next argument  (RESULT_VARIABLE)
2674              is  a variable that is set to true if all the required variables
2675              are set. The rest of the arguments are variables  that  must  be
2676              true  or  not set to NOTFOUND to avoid an error.  If any are not
2677              true, an error is reported.
2678
2679
2680       VTK_MAKE_INSTANTIATOR
2681              Deprecated.  For use only in VTK 4.0.
2682
2683                VTK_MAKE_INSTANTIATOR(className outSourceList
2684                                      src-list1 [src-list2 ..]
2685                                      EXPORT_MACRO exportMacro
2686                                      [HEADER_LOCATION dir]
2687                                      [GROUP_SIZE groupSize]
2688                                      [INCLUDES [file1 file2 ..]])
2689
2690              Generates a new class with the given name and adds its files  to
2691              the  given  outSourceList.   It  registers  the classes from the
2692              other given source lists with vtkInstantiator when it is loaded.
2693              The  output  source list should be added to the library with the
2694              classes it registers.  The EXPORT_MACRO argument must  be  given
2695              and  followed  by  the  export  macro to use when generating the
2696              class (ex. VTK_COMMON_EXPORT).  The HEADER_LOCATION option  must
2697              be  followed  by a path.  It specifies the directory in which to
2698              place the generated class's header  file.  The  generated  class
2699              implementation  files  always  go  in the build directory corre‐
2700              sponding to the  CMakeLists.txt  file  containing  the  command.
2701              This  is  the  default  location  for  the header.  The INCLUDES
2702              option can be followed by a list of zero or more  files.   These
2703              files  will  be  #included by the generated instantiator header,
2704              and can be used to gain access to the specified  exportMacro  in
2705              the C++ code.
2706
2707
2708       VTK_WRAP_JAVA
2709              Deprecated.  For use only in VTK 4.0.
2710
2711                VTK_WRAP_JAVA(resultingLibraryName SourceListName
2712                              class1 class2 ...)
2713
2714              Create Java wrappers for VTK classes.
2715
2716
2717       VTK_WRAP_PYTHON
2718              Deprecated.  For use only in VTK 4.0.
2719
2720                VTK_WRAP_PYTHON(resultingLibraryName SourceListName
2721                                class1 class2 ...)
2722
2723              Create Python wrappers for VTK classes.
2724
2725
2726       VTK_WRAP_TCL
2727              Deprecated.  For use only in VTK 4.0.
2728
2729                VTK_WRAP_TCL(resultingLibraryName [SOURCES]
2730                             SourceListName class1 class2 ...
2731                             [COMMANDS CommandName1 CommandName2 ...])
2732
2733              Create Tcl wrappers for VTK classes.
2734
2735
2736       WHILE  Evaluate a group of commands while a condition is true
2737
2738                WHILE(condition)
2739                  COMMAND1(ARGS ...)
2740                  COMMAND2(ARGS ...)
2741                  ...
2742                ENDWHILE(condition)
2743
2744              All  commands  between  WHILE  and  the  matching  ENDWHILE  are
2745              recorded without being invoked.  Once the ENDWHILE is evaluated,
2746              the  recorded  list of commands is invoked as long as the condi‐
2747              tion is true. The condition is evaulated using the same logic as
2748              the IF command.
2749
2750
2751       WRITE_FILE
2752              Write a message to a file.
2753
2754                WRITE_FILE(filename "message to write"... [APPEND])
2755
2756              The  first  argument is the file name, the rest of the arguments
2757              are messages to write. If the argument APPEND is specified, then
2758              the message will be appended.
2759
2760
2761              NOTE  1:  FILE WRITE and FILE APPEND do exactly the same as this
2762              one but add some more functionality.
2763
2764
2765              NOTE 2: When using WRITE_FILE the produced file cannot  be  used
2766              as  an  input to CMake (CONFIGURE_FILE, source file ...) because
2767              it will lead to an infinite loop. Use CONFIGURE_FILE if you want
2768              to generate input files to CMake.
2769
2770

MODULES

2772       The  following  modules  are provided with CMake. They can be used with
2773       INCLUDE(ModuleName).
2774
2775
2777       Copyright (c) 2002  Kitware,  Inc.,  Insight  Consortium.   All  rights
2778       reserved.
2779
2780
2781       Redistribution and use in source and binary forms, with or without mod‐
2782       ification, are permitted provided that  the  following  conditions  are
2783       met:
2784
2785
2786       *      Redistributions  of  source code must retain the above copyright
2787              notice, this list of conditions and the following disclaimer.
2788
2789
2790       *      Redistributions in binary form must reproduce  the  above  copy‐
2791              right  notice,  this  list  of conditions and the following dis‐
2792              claimer in the documentation  and/or  other  materials  provided
2793              with the distribution.
2794
2795
2796       *      The names of Kitware, Inc., the Insight Consortium, or the names
2797              of any consortium members, or of any contributors,  may  not  be
2798              used  to  endorse or promote products derived from this software
2799              without specific prior written permission.
2800
2801
2802       *      Modified source versions must be plainly  marked  as  such,  and
2803              must not be misrepresented as being the original software.
2804
2805
2806       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS
2807       IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  LIMITED
2808       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTIC‐
2809       ULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBU‐
2810       TORS  BE  LIABLE  FOR  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEM‐
2811       PLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  LIMITED  TO,  PRO‐
2812       CUREMENT  OF  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROF‐
2813       ITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIA‐
2814       BILITY,  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEG‐
2815       LIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF  THIS  SOFT‐
2816       WARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2817
2818

SEE ALSO

2820       cmake(1), ctest(1)
2821
2822
2823       The following resources are available to get help using CMake:
2824
2825
2826       Home Page
2827              http://www.cmake.org
2828
2829              The primary starting point for learning about CMake.
2830
2831
2832       Frequently Asked Questions
2833              http://www.cmake.org/Wiki/CMake_FAQ
2834
2835              A  Wiki is provided containing answers to frequently asked ques‐
2836              tions.
2837
2838
2839       Online Documentation
2840              http://www.cmake.org/HTML/Documentation.html
2841
2842              Links to available documentation may be found on this web page.
2843
2844
2845       Mailing List
2846              http://www.cmake.org/HTML/MailingLists.html
2847
2848              For help and discussion about using cmake,  a  mailing  list  is
2849              provided  at  cmake@cmake.org.  The list is member-post-only but
2850              one may sign up on the CMake web page.  Please  first  read  the
2851              full  documentation at http://www.cmake.org before posting ques‐
2852              tions to the list.
2853
2854
2855       Summary of helpful links:
2856
2857
2858         Home: http://www.cmake.org
2859         Docs: http://www.cmake.org/HTML/Documentation.html
2860         Mail: http://www.cmake.org/HTML/MailingLists.html
2861         FAQ:  http://www.cmake.org/Wiki/CMake_FAQ
2862
2863

AUTHOR

2865       This manual page was generated by the "--help-man" option.
2866
2867
2868
2869
2870ccmake 2.4-patch 8              April 24, 2008                       ccmake(1)
Impressum