1cmake(1) General Commands Manual cmake(1)
2
3
4
6 cmake - Cross-Platform Makefile Generator.
7
9 cmake [options] <path-to-source>
10 cmake [options] <path-to-existing-build>
11
13 The "cmake" executable is the CMake command-line interface. It may be
14 used to configure projects in scripts. Project configuration settings
15 may be specified on the command line with the -D option. The -i option
16 will cause cmake to interactively prompt for such settings.
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
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 -E CMake command mode.
60
61 For true platform independence, CMake provides a list of com‐
62 mands that can be used on all systems. Run with -E help for the
63 usage information.
64
65
66 -i Run in wizard mode.
67
68 Wizard mode runs cmake interactively without a GUI. The user is
69 prompted to answer questions about the project configuration.
70 The answers are used to set cmake cache values.
71
72
73 -L[A][H]
74 List non-advanced cached variables.
75
76 List cache variables will run CMake and list all the variables
77 from the CMake cache that are not marked as INTERNAL or
78 ADVANCED. This will effectively display current CMake settings,
79 which can be then changed with -D option. Changing some of the
80 variable may result in more variables being created. If A is
81 specified, then it will display also advanced variables. If H is
82 specified, it will also display help for each variable.
83
84
85 -N View mode only.
86
87 Only load the cache. Do not actually run configure and generate
88 steps.
89
90
91 -P <file>
92 Process script mode.
93
94 Process the given cmake file as a script written in the CMake
95 language. No configure or generate step is performed and the
96 cache is not modified. If variables are defined using -D, this
97 must be done before the -P argument.
98
99
100 --graphviz=[file]
101 Generate graphviz of dependencies.
102
103 Generate a graphviz input file that will contain all the library
104 and executable dependencies in the project.
105
106
107 --debug-trycompile
108 Do not delete the try compile directories..
109
110 Do not delete the files and directories created for try_compile
111 calls. This is useful in debugging failed try_compiles.
112
113
114 --debug-output
115 Put cmake in a debug mode.
116
117 Print extra stuff during the cmake run like stack traces with
118 message(send_error ) calls.
119
120
121 --help-command cmd [file]
122 Print help for a single command and exit.
123
124 Full documentation specific to the given command is displayed.
125
126
127 --help-command-list [file]
128 List available listfile commands and exit.
129
130 The list contains all commands for which help may be obtained by
131 using the --help-command argument followed by a command name.
132 If a file is specified, the help is written into it.
133
134
135 --help-module module [file]
136 Print help for a single module and exit.
137
138 Full documentation specific to the given module is displayed.
139
140
141 --help-module-list [file]
142 List available modules and exit.
143
144 The list contains all modules for which help may be obtained by
145 using the --help-module argument followed by a module name. If
146 a file is specified, the help is written into it.
147
148
149 --copyright [file]
150 Print the CMake copyright and exit.
151
152 If a file is specified, the copyright is written into it.
153
154
155 --help Print usage information and exit.
156
157 Usage describes the basic command line interface and its
158 options.
159
160
161 --help-full [file]
162 Print full help and exit.
163
164 Full help displays most of the documentation provided by the
165 UNIX man page. It is provided for use on non-UNIX platforms,
166 but is also convenient if the man page is not installed. If a
167 file is specified, the help is written into it.
168
169
170 --help-html [file]
171 Print full help in HTML format.
172
173 This option is used by CMake authors to help produce web pages.
174 If a file is specified, the help is written into it.
175
176
177 --help-man [file]
178 Print a UNIX man page and exit.
179
180 This option is used by the cmake build to generate the UNIX man
181 page. If a file is specified, the help is written into it.
182
183
184 --version [file]
185 Show program name/version banner and exit.
186
187 If a file is specified, the version is written into it.
188
189
191 The following generators are available on this platform:
192
193
194 KDevelop3
195 Generates KDevelop 3 project files.
196
197 Project files for KDevelop 3 will be created in the top direc‐
198 tory and in every subdirectory which features a CMakeLists.txt
199 file containing a PROJECT() call. If you change the settings
200 using KDevelop cmake will try its best to keep your changes when
201 regenerating the project files. Additionally a hierarchy of UNIX
202 makefiles is generated into the build tree. Any standard UNIX-
203 style make program can build the project through the default
204 make target. A "make install" target is also provided.
205
206
207 Unix Makefiles
208 Generates standard UNIX makefiles.
209
210 A hierarchy of UNIX makefiles is generated into the build tree.
211 Any standard UNIX-style make program can build the project
212 through the default make target. A "make install" target is
213 also provided.
214
215
217 The following commands are available in CMakeLists.txt code:
218
219
220 ADD_CUSTOM_COMMAND
221 Add a custom build rule to the generated build system.
222
223 There are two main signatures for ADD_CUSTOM_COMMAND The first
224 signature is for adding a custom command to produce an output.
225
226
227 ADD_CUSTOM_COMMAND(OUTPUT output1 [output2 ...]
228 COMMAND command1 [ARGS] [args1...]
229 [COMMAND command2 [ARGS] [args2...] ...]
230 [MAIN_DEPENDENCY depend]
231 [DEPENDS [depends...]]
232 [WORKING_DIRECTORY dir]
233 [COMMENT comment] [VERBATIM] [APPEND])
234
235 This defines a new command that can be executed during the build
236 process. The outputs named should be listed as source files in
237 the target for which they are to be generated. Note that
238 MAIN_DEPENDENCY is completely optional and is used as a sugges‐
239 tion to visual studio about where to hang the custom command. In
240 makefile terms this creates a new target in the following form:
241
242
243 OUTPUT: MAIN_DEPENDENCY DEPENDS
244 COMMAND
245
246 If more than one command is specified they will be executed in
247 order. The optional ARGS argument is for backward compatibility
248 and will be ignored.
249
250
251 The second signature adds a custom command to a target such as a
252 library or executable. This is useful for performing an opera‐
253 tion before or after building the target:
254
255
256 ADD_CUSTOM_COMMAND(TARGET target
257 PRE_BUILD | PRE_LINK | POST_BUILD
258 COMMAND command1 [ARGS] [args1...]
259 [COMMAND command2 [ARGS] [args2...] ...]
260 [WORKING_DIRECTORY dir]
261 [COMMENT comment] [VERBATIM])
262
263 This defines a new command that will be associated with building
264 the specified target. When the command will happen is determined
265 by which of the following is specified:
266
267
268 PRE_BUILD - run before all other dependencies
269 PRE_LINK - run after other dependencies
270 POST_BUILD - run after the target has been built
271
272 Note that the PRE_BUILD option is only supported on Visual Stu‐
273 dio 7 or later. For all other generators PRE_BUILD will be
274 treated as PRE_LINK.
275
276
277 If WORKING_DIRECTORY is specified the command will be executed
278 in the directory given. If COMMENT is set, the value will be
279 displayed as a message before the commands are executed at build
280 time. If APPEND is specified the COMMAND and DEPENDS option val‐
281 ues are appended to the custom command for the first output
282 specified. There must have already been a previous call to this
283 command with the same output. The COMMENT, WORKING_DIRECTORY,
284 and MAIN_DEPENDENCY options are currently ignored when APPEND is
285 given, but may be used in the future.
286
287
288 If VERBATIM is given then all the arguments to the commands will
289 be passed exactly as specified no matter the build tool used.
290 Note that one level of escapes is still used by the CMake lan‐
291 guage processor before ADD_CUSTOM_TARGET even sees the argu‐
292 ments. Use of VERBATIM is recommended as it enables correct
293 behavior. When VERBATIM is not given the behavior is platform
294 specific. In the future VERBATIM may be enabled by default. The
295 only reason it is an option is to preserve compatibility with
296 older CMake code.
297
298
299 If the output of the custom command is not actually created as a
300 file on disk it should be marked as SYMBOLIC with
301 SET_SOURCE_FILES_PROPERTIES.
302
303
304 ADD_CUSTOM_TARGET
305 Add a target with no output so it will always be built.
306
307 ADD_CUSTOM_TARGET(Name [ALL] [command1 [args1...]]
308 [COMMAND command2 [args2...] ...]
309 [DEPENDS depend depend depend ... ]
310 [WORKING_DIRECTORY dir]
311 [COMMENT comment] [VERBATIM])
312
313 Adds a target with the given name that executes the given com‐
314 mands. The target has no output file and is ALWAYS CONSIDERED
315 OUT OF DATE even if the commands try to create a file with the
316 name of the target. Use ADD_CUSTOM_COMMAND to generate a file
317 with dependencies. By default nothing depends on the custom tar‐
318 get. Use ADD_DEPENDENCIES to add dependencies to or from other
319 targets. If the ALL option is specified it indicates that this
320 target should be added to the default build target so that it
321 will be run every time (the command cannot be called ALL). The
322 command and arguments are optional and if not specified an empty
323 target will be created. If WORKING_DIRECTORY is set, then the
324 command will be run in that directory. If COMMENT is set, the
325 value will be displayed as a message before the commands are
326 executed at build time. Dependencies listed with the DEPENDS
327 argument may reference files and outputs of custom commands cre‐
328 ated with ADD_CUSTOM_COMMAND.
329
330
331 If VERBATIM is given then all the arguments to the commands will
332 be passed exactly as specified no matter the build tool used.
333 Note that one level of escapes is still used by the CMake lan‐
334 guage processor before ADD_CUSTOM_TARGET even sees the argu‐
335 ments. Use of VERBATIM is recommended as it enables correct
336 behavior. When VERBATIM is not given the behavior is platform
337 specific. In the future VERBATIM may be enabled by default. The
338 only reason it is an option is to preserve compatibility with
339 older CMake code.
340
341
342 ADD_DEFINITIONS
343 Adds -D define flags to the command line of C and C++ compilers.
344
345 ADD_DEFINITIONS(-DFOO -DBAR ...)
346
347 Adds flags to command line of C and C++ compilers. This command
348 can be used to add any flag to a compile line, but the -D flag
349 is accepted most C/C++ compilers. Other flags may not be as
350 portable.
351
352
353 ADD_DEPENDENCIES
354 Add a dependency between top-level targets.
355
356 ADD_DEPENDENCIES(target-name depend-target1
357 depend-target2 ...)
358
359 Make a top-level target depend on other top-level targets. A
360 top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY,
361 or ADD_CUSTOM_TARGET. Adding dependencies with this command can
362 be used to make sure one target is built before another target.
363 See the DEPENDS option of ADD_CUSTOM_TARGET and ADD_CUSTOM_COM‐
364 MAND for adding file-level dependencies in custom rules. See
365 the OBJECT_DEPENDS option in SET_SOURCE_FILES_PROPERTIES to add
366 file-level dependencies to object files.
367
368
369 ADD_EXECUTABLE
370 Add an executable to the project using the specified source
371 files.
372
373 ADD_EXECUTABLE(exename [WIN32] [MACOSX_BUNDLE]
374 [EXCLUDE_FROM_ALL]
375 source1 source2 ... sourceN)
376
377 This command adds an executable target to the current directory.
378 The executable will be built from the list of source files spec‐
379 ified.
380
381
382 After specifying the executable name, WIN32 and/or MACOSX_BUNDLE
383 can be specified. WIN32 indicates that the executable (when com‐
384 piled on windows) is a windows app (using WinMain) not a console
385 app (using main). The variable CMAKE_MFC_FLAG be used if the
386 windows app uses MFC. This variable can be set to the following
387 values:
388
389
390 0: Use Standard Windows Libraries
391 1: Use MFC in a Static Library
392 2: Use MFC in a Shared DLL
393
394 MACOSX_BUNDLE indicates that when build on Mac OSX, executable
395 should be in the bundle form. The MACOSX_BUNDLE also allows sev‐
396 eral variables to be specified:
397
398
399 MACOSX_BUNDLE_INFO_STRING
400 MACOSX_BUNDLE_ICON_FILE
401 MACOSX_BUNDLE_GUI_IDENTIFIER
402 MACOSX_BUNDLE_LONG_VERSION_STRING
403 MACOSX_BUNDLE_BUNDLE_NAME
404 MACOSX_BUNDLE_SHORT_VERSION_STRING
405 MACOSX_BUNDLE_BUNDLE_VERSION
406 MACOSX_BUNDLE_COPYRIGHT
407
408 If EXCLUDE_FROM_ALL is given the target will not be built by
409 default. It will be built only if the user explicitly builds the
410 target or another target that requires the target depends on it.
411
412
413 ADD_LIBRARY
414 Add a library to the project using the specified source files.
415
416 ADD_LIBRARY(libname [SHARED | STATIC | MODULE]
417 [EXCLUDE_FROM_ALL]
418 source1 source2 ... sourceN)
419
420 Adds a library target. SHARED, STATIC or MODULE keywords are
421 used to set the library type. If the keyword MODULE appears,
422 the library type is set to MH_BUNDLE on systems which use dyld.
423 On systems without dyld, MODULE is treated like SHARED. If no
424 keywords appear as the second argument, the type defaults to
425 the current value of BUILD_SHARED_LIBS. If this variable is not
426 set, the type defaults to STATIC.
427
428
429 If EXCLUDE_FROM_ALL is given the target will not be built by
430 default. It will be built only if the user explicitly builds the
431 target or another target that requires the target depends on it.
432
433
434 ADD_SUBDIRECTORY
435 Add a subdirectory to the build.
436
437 ADD_SUBDIRECTORY(source_dir [binary_dir]
438 [EXCLUDE_FROM_ALL])
439
440 Add a subdirectory to the build. The source_dir specifies the
441 directory in which the source CmakeLists.txt and code files are
442 located. If it is a relative path it will be evaluated with
443 respect to the current directory (the typical usage), but it may
444 also be an absolute path. The binary_dir specifies the directory
445 in which to place the output files. If it is a relative path it
446 will be evaluated with respect to the current output directory,
447 but it may also be an absolute path. If binary_dir is not speci‐
448 fied, the value of source_dir, before expanding any relative
449 path, will be used (the typical usage). The CMakeLists.txt file
450 in the specified source directory will be processed immediately
451 by CMake before processing in the current input file continues
452 beyond this command.
453
454
455 If the EXCLUDE_FROM_ALL argument is provided then this subdirec‐
456 tory will not be included in build by default. Users will have
457 to explicitly start a build in the generated output directory.
458 This is useful for having cmake create a build system for a set
459 of examples in a project. One would want cmake to generate a
460 single build system for all the examples, but one may not want
461 the targets to show up in the main build system.
462
463
464 ADD_TEST
465 Add a test to the project with the specified arguments.
466
467 ADD_TEST(testname Exename arg1 arg2 ...)
468
469 If the ENABLE_TESTING command has been run, this command adds a
470 test target to the current directory. If ENABLE_TESTING has not
471 been run, this command does nothing. The tests are run by the
472 testing subsystem by executing Exename with the specified argu‐
473 ments. Exename can be either an executable built by this
474 project or an arbitrary executable on the system (like tclsh).
475 The test will be run with the current working directory set to
476 the CMakeList.txt files corresponding directory in the binary
477 tree.
478
479
480 AUX_SOURCE_DIRECTORY
481 Find all source files in a directory.
482
483 AUX_SOURCE_DIRECTORY(dir VARIABLE)
484
485 Collects the names of all the source files in the specified
486 directory and stores the list in the variable provided. This
487 command is intended to be used by projects that use explicit
488 template instantiation. Template instantiation files can be
489 stored in a "Templates" subdirectory and collected automatically
490 using this command to avoid manually listing all instantiations.
491
492
493 It is tempting to use this command to avoid writing the list of
494 source files for a library or executable target. While this
495 seems to work, there is no way for CMake to generate a build
496 system that knows when a new source file has been added. Nor‐
497 mally the generated build system knows when it needs to rerun
498 CMake because the CMakeLists.txt file is modified to add a new
499 source. When the source is just added to the directory without
500 modifying this file, one would have to manually rerun CMake to
501 generate a build system incorporating the new file.
502
503
504 BUILD_COMMAND
505 Get the command line that will build this project.
506
507 BUILD_COMMAND(variable MAKECOMMAND)
508
509 Sets the given variable to a string containing the command that
510 will build this project from the root of the build tree using
511 the build tool given by MAKECOMMAND. MAKECOMMAND should be
512 msdev, nmake, make or one of the end user build tools. This is
513 useful for configuring testing systems.
514
515
516 BUILD_NAME
517 Deprecated. Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER}
518 instead.
519
520 BUILD_NAME(variable)
521
522 Sets the specified variable to a string representing the plat‐
523 form and compiler settings. These values are now available
524 through the CMAKE_SYSTEM and CMAKE_CXX_COMPILER variables.
525
526
527 CMAKE_MINIMUM_REQUIRED
528 Set the minimum required version of cmake for a project.
529
530 CMAKE_MINIMUM_REQUIRED(VERSION versionNumber [FATAL_ERROR])
531
532 Let cmake know that the project requires a certain version of a
533 cmake, or newer. CMake will also try to be backwards compatible
534 to the version of cmake specified, if a newer version of cmake
535 is running. If FATAL_ERROR is given then failure to meet the
536 requirements will be considered an error instead of a warning.
537
538
539 CONFIGURE_FILE
540 Copy a file to another location and modify its contents.
541
542 CONFIGURE_FILE(InputFile OutputFile
543 [COPYONLY] [ESCAPE_QUOTES] [@ONLY])
544
545 The Input and Ouput files have to have full paths. This command
546 replaces any variables in the input file referenced as ${VAR} or
547 @VAR@ with their values as determined by CMake. If a variable
548 is not defined, it will be replaced with nothing. If COPYONLY
549 is specified, then no variable expansion will take place. If
550 ESCAPE_QUOTES is specified then any substituted quotes will be
551 C-style escaped. The file will be configured with the current
552 values of CMake variables. If @ONLY is specified, only variables
553 of the form @VAR@ will be replaces and ${VAR} will be ignored.
554 This is useful for configuring scripts that use ${VAR}. Any
555 occurrences of #cmakedefine VAR will be replaced with either
556 #define VAR or /* #undef VAR */ depending on the setting of VAR
557 in CMake
558
559
560 CREATE_TEST_SOURCELIST
561 Create a test driver and source list for building test programs.
562
563 CREATE_TEST_SOURCELIST(SourceListName DriverName
564 test1 test2 test3
565 EXTRA_INCLUDE include.h
566 FUNCTION function)
567
568 A test driver is a program that links together many small tests
569 into a single executable. This is useful when building static
570 executables with large libraries to shrink the total required
571 size. The list of source files needed to build the test driver
572 will be in SourceListName. DriverName is the name of the test
573 driver program. The rest of the arguments consist of a list of
574 test source files, can be semicolon separated. Each test source
575 file should have a function in it that is the same name as the
576 file with no extension (foo.cxx should have int foo();) Driver‐
577 Name will be able to call each of the tests by name on the com‐
578 mand line. If EXTRA_INCLUDE is specified, then the next argument
579 is included into the generated file. If FUNCTION is specified,
580 then the next argument is taken as a function name that is
581 passed a pointer to ac and av. This can be used to add extra
582 command line processing to each test. The cmake variable
583 CMAKE_TESTDRIVER_BEFORE_TESTMAIN can be set to have code that
584 will be placed directly before calling the test main function.
585 CMAKE_TESTDRIVER_AFTER_TESTMAIN can be set to have code that
586 will be placed directly after the call to the test main func‐
587 tion.
588
589
590 ELSE Starts the ELSE portion of an IF block.
591
592 ELSE(expression)
593
594 See the IF command.
595
596
597 ELSEIF Starts the ELSEIF portion of an IF block.
598
599 ELSEIF(expression)
600
601 See the IF command.
602
603
604 ENABLE_LANGUAGE
605 Set a name for the entire project.
606
607 ENABLE_LANGUAGE(languageName)
608
609 This command enables support for the named language in CMake.
610
611
612 ENABLE_TESTING
613 Enable testing for current directory and below.
614
615 ENABLE_TESTING()
616
617 Enables testing for this directory and below. See also the
618 ADD_TEST command. Note that ctest expects to find a test file
619 in the build directory root. Therefore, this command should be
620 in the source directory root.
621
622
623 ENDFOREACH
624 Ends a list of commands in a FOREACH block.
625
626 ENDFOREACH(expression)
627
628 See the FOREACH command.
629
630
631 ENDIF Ends a list of commands in an IF block.
632
633 ENDIF(expression)
634
635 See the IF command.
636
637
638 ENDMACRO
639 Ends a list of commands in a MACRO block.
640
641 ENDMACRO(expression)
642
643 See the MACRO command.
644
645
646 ENDWHILE
647 Ends a list of commands in a WHILE block.
648
649 ENDWHILE(expression)
650
651 See the WHILE command.
652
653
654 EXEC_PROGRAM
655 Run and executable program during the processing of the CMake‐
656 List.txt file.
657
658 EXEC_PROGRAM(Executable [directory in which to run]
659 [ARGS <arguments to executable>]
660 [OUTPUT_VARIABLE <var>]
661 [RETURN_VALUE <var>])
662
663 The executable is run in the optionally specified directory.
664 The executable can include arguments if it is double quoted, but
665 it is better to use the optional ARGS argument to specify argu‐
666 ments to the program. This is because cmake will then be able
667 to escape spaces in the executable path. An optional argument
668 OUTPUT_VARIABLE specifies a variable in which to store the out‐
669 put. To capture the return value of the execution, provide a
670 RETURN_VALUE. If OUTPUT_VARIABLE is specified, then no output
671 will go to the stdout/stderr of the console running cmake.
672
673
674 The EXECUTE_PROCESS command is a newer more powerful version of
675 EXEC_PROGRAM, but the old command has been kept for compatibil‐
676 ity.
677
678
679 EXECUTE_PROCESS
680 Execute one or more child processes.
681
682 EXECUTE_PROCESS(COMMAND <cmd1> [args1...]]
683 [COMMAND <cmd2> [args2...] [...]]
684 [WORKING_DIRECTORY <directory>]
685 [TIMEOUT <seconds>]
686 [RESULT_VARIABLE <variable>]
687 [OUTPUT_VARIABLE <variable>]
688 [ERROR_VARIABLE <variable>]
689 [INPUT_FILE <file>]
690 [OUTPUT_FILE <file>]
691 [ERROR_FILE <file>]
692 [OUTPUT_QUIET]
693 [ERROR_QUIET]
694 [OUTPUT_STRIP_TRAILING_WHITESPACE]
695 [ERROR_STRIP_TRAILING_WHITESPACE])
696
697 Runs the given sequence of one or more commands with the stan‐
698 dard output of each process piped to the standard input of the
699 next. A single standard error pipe is used for all processes.
700 If WORKING_DIRECTORY is given the named directory will be set as
701 the current working directory of the child processes. If TIME‐
702 OUT is given the child processes will be terminated if they do
703 not finish in the specified number of seconds (fractions are
704 allowed). If RESULT_VARIABLE is given the variable will be set
705 to contain the result of running the processes. This will be an
706 integer return code from the last child or a string describing
707 an error condition. If OUTPUT_VARIABLE or ERROR_VARIABLE are
708 given the variable named will be set with the contents of the
709 standard output and standard error pipes respectively. If the
710 same variable is named for both pipes their output will be
711 merged in the order produced. If INPUT_FILE, OUTPUT_FILE, or
712 ERROR_FILE is given the file named will be attached to the stan‐
713 dard input of the first process, standard output of the last
714 process, or standard error of all processes respectively. If
715 OUTPUT_QUIET or ERROR_QUIET is given then the standard output or
716 standard error results will be quietly ignored. If more than
717 one OUTPUT_* or ERROR_* option is given for the same pipe the
718 precedence is not specified. If no OUTPUT_* or ERROR_* options
719 are given the output will be shared with the corresponding pipes
720 of the CMake process itself.
721
722
723 The EXECUTE_PROCESS command is a newer more powerful version of
724 EXEC_PROGRAM, but the old command has been kept for compatibil‐
725 ity.
726
727
728 EXPORT_LIBRARY_DEPENDENCIES
729 Write out the dependency information for all targets of a
730 project.
731
732 EXPORT_LIBRARY_DEPENDENCIES(FILE [APPEND])
733
734 Create a file that can be included into a CMake listfile with
735 the INCLUDE command. The file will contain a number of SET com‐
736 mands that will set all the variables needed for library depen‐
737 dency information. This should be the last command in the top
738 level CMakeLists.txt file of the project. If the APPEND option
739 is specified, the SET commands will be appended to the given
740 file instead of replacing it.
741
742
743 FILE File manipulation command.
744
745 FILE(WRITE filename "message to write"... )
746 FILE(APPEND filename "message to write"... )
747 FILE(READ filename variable)
748 FILE(GLOB variable [RELATIVE path] [globbing expressions]...)
749 FILE(GLOB_RECURSE variable [RELATIVE path]
750 [globbing expressions]...)
751 FILE(REMOVE [file1 ...])
752 FILE(REMOVE_RECURSE [file1 ...])
753 FILE(MAKE_DIRECTORY [directory1 directory2 ...])
754 FILE(RELATIVE_PATH variable directory file)
755 FILE(TO_CMAKE_PATH path result)
756 FILE(TO_NATIVE_PATH path result)
757
758 WRITE will write a message into a file called 'filename'. It
759 overwrites the file if it already exists, and creates the file
760 if it does not exist.
761
762
763 APPEND will write a message into a file same as WRITE, except it
764 will append it to the end of the file
765
766
767 NOTE: When using FILE WRITE and FILE APPEND, the produced file
768 cannot be used as an input to CMake (CONFIGURE_FILE, source file
769 ...) because it will lead to an infinite loop. Use CONFIG‐
770 URE_FILE if you want to generate input files to CMake.
771
772
773 READ will read the content of a file and store it into the vari‐
774 able.
775
776
777 GLOB will generate a list of all files that match the globbing
778 expressions and store it into the variable. Globbing expressions
779 are similar to regular expressions, but much simpler. If RELA‐
780 TIVE flag is specified for an expression, the results will be
781 returned as a relative path to the given path.
782
783
784 Examples of globbing expressions include:
785
786
787 *.cxx - match all files with extension cxx
788 *.vt? - match all files with extension vta,...,vtz
789 f[3-5].txt - match files f3.txt, f4.txt, f5.txt
790
791 GLOB_RECURSE will generate similar list as the regular GLOB,
792 except it will traverse all the subdirectories of the matched
793 directory and match the files.
794
795
796 Examples of recursive globbing include:
797
798
799 /dir/*.py - match all python files in /dir and subdirecto‐
800 ries
801
802 MAKE_DIRECTORY will create the given directories, also if their
803 parent directories don't exist yet
804
805
806 REMOVE will remove the given files, also in subdirectories
807
808
809 REMOVE_RECURSE will remove the given files and directories, also
810 non-empty directories
811
812
813 RELATIVE_PATH will determine relative path from directory to the
814 given file.
815
816
817 TO_CMAKE_PATH will convert path into a cmake style path with
818 unix /. The input can be a single path or a system path like
819 "$ENV{PATH}". Note the double quotes around the ENV call
820 TO_CMAKE_PATH only takes one argument.
821
822
823 TO_NATIVE_PATH works just like TO_CMAKE_PATH, but will convert
824 from a cmake style path into the native path style \ for win‐
825 dows and / for UNIX.
826
827
828 FIND_FILE
829 Find the full path to a file.
830
831 FIND_FILE(<VAR> name1 path1 path2 ...)
832
833 This is the short-hand signature for the command that is suffi‐
834 cient in many cases. It is the same as FIND_FILE(<VAR> name1
835 PATHS path2 path2 ...)
836
837
838 FIND_FILE(
839 <VAR>
840 name | NAMES name1 [name2 ...]
841 PATHS path1 [path2 ... ENV var]
842 [PATH_SUFFIXES suffix1 [suffix2 ...]]
843 [DOC "cache documentation string"]
844 [NO_DEFAULT_PATH]
845 [NO_CMAKE_ENVIRONMENT_PATH]
846 [NO_CMAKE_PATH]
847 [NO_SYSTEM_ENVIRONMENT_PATH]
848 [NO_CMAKE_SYSTEM_PATH]
849 )
850
851 This command is used to find a full path to named file. A cache
852 entry named by <VAR> is created to store the result of this com‐
853 mand. If the full path to a file is found the result is stored
854 in the variable and the search will not be repeated unless the
855 variable is cleared. If nothing is found, the result will be
856 <VAR>-NOTFOUND, and the search will be attempted again the next
857 time FIND_FILE is invoked with the same variable. The name of
858 the full path to a file that is searched for is specified by the
859 names listed after the NAMES argument. Additional search loca‐
860 tions can be specified after the PATHS argument. If ENV var is
861 found in the PATHS section the environment variable var will be
862 read and converted from a system environment variable to a cmake
863 style list of paths. For example ENV PATH would be a way to
864 list the system path variable. The argument after DOC will be
865 used for the documentation string in the cache. PATH_SUFFIXES
866 can be used to give sub directories that will be appended to the
867 search paths.
868
869
870 If NO_DEFAULT_PATH is specified, then no additional paths are
871 added to the search. If NO_DEFAULT_PATH is not specified, the
872 search process is as follows:
873
874
875 1. Search cmake specific environment variables. This can be
876 skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
877
878
879 CMAKE_FRAMEWORK_PATH
880 CMAKE_APPBUNDLE_PATH
881 CMAKE_INCLUDE_PATH
882
883 2. Search cmake variables with the same names as the cmake spe‐
884 cific environment variables. These are intended to be used on
885 the command line with a -DVAR=value. This can be skipped if
886 NO_CMAKE_PATH is passed.
887
888
889 CMAKE_FRAMEWORK_PATH
890 CMAKE_APPBUNDLE_PATH
891 CMAKE_INCLUDE_PATH
892
893 3. Search the standard system environment variables. This can be
894 skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
895
896
897 PATH
898 INCLUDE
899
900 4. Search cmake variables defined in the Platform files for the
901 current system. This can be skipped if NO_CMAKE_SYSTEM_PATH is
902 passed.
903
904
905 CMAKE_SYSTEM_FRAMEWORK_PATH
906 CMAKE_SYSTEM_APPBUNDLE_PATH
907 CMAKE_SYSTEM_INCLUDE_PATH
908
909 5. Search the paths specified after PATHS or in the short-hand
910 version of the command.
911
912
913 On Darwin or systems supporting OSX Frameworks, the cmake vari‐
914 able CMAKE_FIND_FRAMEWORK can be set to empty or one of the
915 following:
916
917
918 "FIRST" - Try to find frameworks before standard
919 libraries or headers. This is the default on Dar‐
920 win.
921 "LAST" - Try to find frameworks after standard
922 libraries or headers.
923 "ONLY" - Only try to find frameworks.
924 "NEVER". - Never try to find frameworks.
925
926 On Darwin or systems supporting OSX Application Bundles, the
927 cmake variable CMAKE_FIND_APPBUNDLE can be set to empty or one
928 of the following:
929
930
931 "FIRST" - Try to find application bundles before standard
932 programs. This is the default on Darwin.
933 "LAST" - Try to find application bundles after standard
934 programs.
935 "ONLY" - Only try to find application bundles.
936 "NEVER". - Never try to find application bundles.
937
938 The reason the paths listed in the call to the command are
939 searched last is that most users of CMake would expect things to
940 be found first in the locations specified by their environment.
941 Projects may override this behavior by simply calling the com‐
942 mand twice:
943
944
945 FIND_FILE(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
946 FIND_FILE(<VAR> NAMES name)
947
948 Once one of these calls succeeds the result variable will be set
949 and stored in the cache so that neither call will search again.
950
951
952 FIND_LIBRARY
953 Find a library.
954
955 FIND_LIBRARY(<VAR> name1 path1 path2 ...)
956
957 This is the short-hand signature for the command that is suffi‐
958 cient in many cases. It is the same as FIND_LIBRARY(<VAR> name1
959 PATHS path2 path2 ...)
960
961
962 FIND_LIBRARY(
963 <VAR>
964 name | NAMES name1 [name2 ...]
965 PATHS path1 [path2 ... ENV var]
966 [PATH_SUFFIXES suffix1 [suffix2 ...]]
967 [DOC "cache documentation string"]
968 [NO_DEFAULT_PATH]
969 [NO_CMAKE_ENVIRONMENT_PATH]
970 [NO_CMAKE_PATH]
971 [NO_SYSTEM_ENVIRONMENT_PATH]
972 [NO_CMAKE_SYSTEM_PATH]
973 )
974
975 This command is used to find a library. A cache entry named by
976 <VAR> is created to store the result of this command. If the
977 library is found the result is stored in the variable and the
978 search will not be repeated unless the variable is cleared. If
979 nothing is found, the result will be <VAR>-NOTFOUND, and the
980 search will be attempted again the next time FIND_LIBRARY is
981 invoked with the same variable. The name of the library that is
982 searched for is specified by the names listed after the NAMES
983 argument. Additional search locations can be specified after
984 the PATHS argument. If ENV var is found in the PATHS section
985 the environment variable var will be read and converted from a
986 system environment variable to a cmake style list of paths. For
987 example ENV PATH would be a way to list the system path vari‐
988 able. The argument after DOC will be used for the documentation
989 string in the cache. PATH_SUFFIXES can be used to give sub
990 directories that will be appended to the search paths.
991
992
993 If NO_DEFAULT_PATH is specified, then no additional paths are
994 added to the search. If NO_DEFAULT_PATH is not specified, the
995 search process is as follows:
996
997
998 1. Search cmake specific environment variables. This can be
999 skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
1000
1001
1002 CMAKE_FRAMEWORK_PATH
1003 CMAKE_APPBUNDLE_PATH
1004 CMAKE_LIBRARY_PATH
1005
1006 2. Search cmake variables with the same names as the cmake spe‐
1007 cific environment variables. These are intended to be used on
1008 the command line with a -DVAR=value. This can be skipped if
1009 NO_CMAKE_PATH is passed.
1010
1011
1012 CMAKE_FRAMEWORK_PATH
1013 CMAKE_APPBUNDLE_PATH
1014 CMAKE_LIBRARY_PATH
1015
1016 3. Search the standard system environment variables. This can be
1017 skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
1018
1019
1020 PATH
1021 LIB
1022
1023 4. Search cmake variables defined in the Platform files for the
1024 current system. This can be skipped if NO_CMAKE_SYSTEM_PATH is
1025 passed.
1026
1027
1028 CMAKE_SYSTEM_FRAMEWORK_PATH
1029 CMAKE_SYSTEM_APPBUNDLE_PATH
1030 CMAKE_SYSTEM_LIBRARY_PATH
1031
1032 5. Search the paths specified after PATHS or in the short-hand
1033 version of the command.
1034
1035
1036 On Darwin or systems supporting OSX Frameworks, the cmake vari‐
1037 able CMAKE_FIND_FRAMEWORK can be set to empty or one of the
1038 following:
1039
1040
1041 "FIRST" - Try to find frameworks before standard
1042 libraries or headers. This is the default on Dar‐
1043 win.
1044 "LAST" - Try to find frameworks after standard
1045 libraries or headers.
1046 "ONLY" - Only try to find frameworks.
1047 "NEVER". - Never try to find frameworks.
1048
1049 On Darwin or systems supporting OSX Application Bundles, the
1050 cmake variable CMAKE_FIND_APPBUNDLE can be set to empty or one
1051 of the following:
1052
1053
1054 "FIRST" - Try to find application bundles before standard
1055 programs. This is the default on Darwin.
1056 "LAST" - Try to find application bundles after standard
1057 programs.
1058 "ONLY" - Only try to find application bundles.
1059 "NEVER". - Never try to find application bundles.
1060
1061 The reason the paths listed in the call to the command are
1062 searched last is that most users of CMake would expect things to
1063 be found first in the locations specified by their environment.
1064 Projects may override this behavior by simply calling the com‐
1065 mand twice:
1066
1067
1068 FIND_LIBRARY(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
1069 FIND_LIBRARY(<VAR> NAMES name)
1070
1071 Once one of these calls succeeds the result variable will be set
1072 and stored in the cache so that neither call will search again.
1073
1074
1075 If the library found is a framework, then VAR will be set to the
1076 full path to the framework <fullPath>/A.framework. When a full
1077 path to a framework is used as a library, CMake will use a
1078 -framework A, and a -F<fullPath> to link the framework to the
1079 target.
1080
1081
1082 FIND_PACKAGE
1083 Load settings for an external project.
1084
1085 FIND_PACKAGE(<name> [major.minor] [QUIET] [NO_MODULE]
1086 [[REQUIRED|COMPONENTS] [components...]])
1087
1088 Finds and loads settings from an external project. <name>_FOUND
1089 will be set to indicate whether the package was found. Settings
1090 that can be used when <name>_FOUND is true are package-specific.
1091 The package is found through several steps. Directories listed
1092 in CMAKE_MODULE_PATH are searched for files called
1093 "Find<name>.cmake". If such a file is found, it is read and
1094 processed by CMake, and is responsible for finding the package.
1095 This first step may be skipped by using the NO_MODULE option.
1096 If no such file is found, it is expected that the package is
1097 another project built by CMake that has a "<name>Config.cmake"
1098 file. A cache entry called <name>_DIR is created and is
1099 expected to be set to the directory containing this file. If
1100 the file is found, it is read and processed by CMake to load the
1101 settings of the package. If <name>_DIR has not been set during
1102 a configure step, the command will generate an error describing
1103 the problem unless the QUIET argument is specified. If
1104 <name>_DIR has been set to a directory not containing a
1105 "<name>Config.cmake" file, an error is always generated. If
1106 REQUIRED is specified and the package is not found, a
1107 FATAL_ERROR is generated and the configure step stops executing.
1108 A package-specific list of components may be listed after the
1109 REQUIRED option, or after the COMPONENTS option if no REQUIRED
1110 option is given.
1111
1112
1113 FIND_PATH
1114 Find the directory containing a file.
1115
1116 FIND_PATH(<VAR> name1 path1 path2 ...)
1117
1118 This is the short-hand signature for the command that is suffi‐
1119 cient in many cases. It is the same as FIND_PATH(<VAR> name1
1120 PATHS path2 path2 ...)
1121
1122
1123 FIND_PATH(
1124 <VAR>
1125 name | NAMES name1 [name2 ...]
1126 PATHS path1 [path2 ... ENV var]
1127 [PATH_SUFFIXES suffix1 [suffix2 ...]]
1128 [DOC "cache documentation string"]
1129 [NO_DEFAULT_PATH]
1130 [NO_CMAKE_ENVIRONMENT_PATH]
1131 [NO_CMAKE_PATH]
1132 [NO_SYSTEM_ENVIRONMENT_PATH]
1133 [NO_CMAKE_SYSTEM_PATH]
1134 )
1135
1136 This command is used to find a directory containing the named
1137 file. A cache entry named by <VAR> is created to store the
1138 result of this command. If the file in a directory is found the
1139 result is stored in the variable and the search will not be
1140 repeated unless the variable is cleared. If nothing is found,
1141 the result will be <VAR>-NOTFOUND, and the search will be
1142 attempted again the next time FIND_PATH is invoked with the same
1143 variable. The name of the file in a directory that is searched
1144 for is specified by the names listed after the NAMES argument.
1145 Additional search locations can be specified after the PATHS
1146 argument. If ENV var is found in the PATHS section the environ‐
1147 ment variable var will be read and converted from a system envi‐
1148 ronment variable to a cmake style list of paths. For example
1149 ENV PATH would be a way to list the system path variable. The
1150 argument after DOC will be used for the documentation string in
1151 the cache. PATH_SUFFIXES can be used to give sub directories
1152 that will be appended to the search paths.
1153
1154
1155 If NO_DEFAULT_PATH is specified, then no additional paths are
1156 added to the search. If NO_DEFAULT_PATH is not specified, the
1157 search process is as follows:
1158
1159
1160 1. Search cmake specific environment variables. This can be
1161 skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
1162
1163
1164 CMAKE_FRAMEWORK_PATH
1165 CMAKE_APPBUNDLE_PATH
1166 CMAKE_INCLUDE_PATH
1167
1168 2. Search cmake variables with the same names as the cmake spe‐
1169 cific environment variables. These are intended to be used on
1170 the command line with a -DVAR=value. This can be skipped if
1171 NO_CMAKE_PATH is passed.
1172
1173
1174 CMAKE_FRAMEWORK_PATH
1175 CMAKE_APPBUNDLE_PATH
1176 CMAKE_INCLUDE_PATH
1177
1178 3. Search the standard system environment variables. This can be
1179 skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
1180
1181
1182 PATH
1183 INCLUDE
1184
1185 4. Search cmake variables defined in the Platform files for the
1186 current system. This can be skipped if NO_CMAKE_SYSTEM_PATH is
1187 passed.
1188
1189
1190 CMAKE_SYSTEM_FRAMEWORK_PATH
1191 CMAKE_SYSTEM_APPBUNDLE_PATH
1192 CMAKE_SYSTEM_INCLUDE_PATH
1193
1194 5. Search the paths specified after PATHS or in the short-hand
1195 version of the command.
1196
1197
1198 On Darwin or systems supporting OSX Frameworks, the cmake vari‐
1199 able CMAKE_FIND_FRAMEWORK can be set to empty or one of the
1200 following:
1201
1202
1203 "FIRST" - Try to find frameworks before standard
1204 libraries or headers. This is the default on Dar‐
1205 win.
1206 "LAST" - Try to find frameworks after standard
1207 libraries or headers.
1208 "ONLY" - Only try to find frameworks.
1209 "NEVER". - Never try to find frameworks.
1210
1211 On Darwin or systems supporting OSX Application Bundles, the
1212 cmake variable CMAKE_FIND_APPBUNDLE can be set to empty or one
1213 of the following:
1214
1215
1216 "FIRST" - Try to find application bundles before standard
1217 programs. This is the default on Darwin.
1218 "LAST" - Try to find application bundles after standard
1219 programs.
1220 "ONLY" - Only try to find application bundles.
1221 "NEVER". - Never try to find application bundles.
1222
1223 The reason the paths listed in the call to the command are
1224 searched last is that most users of CMake would expect things to
1225 be found first in the locations specified by their environment.
1226 Projects may override this behavior by simply calling the com‐
1227 mand twice:
1228
1229
1230 FIND_PATH(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
1231 FIND_PATH(<VAR> NAMES name)
1232
1233 Once one of these calls succeeds the result variable will be set
1234 and stored in the cache so that neither call will search again.
1235
1236
1237 When searching for frameworks, if the file is specified as
1238 A/b.h, then the framework search will look for A.framework/Head‐
1239 ers/b.h. If that is found the path will be set to the path to
1240 the framework. CMake will convert this to the correct -F option
1241 to include the file.
1242
1243
1244 FIND_PROGRAM
1245 Find an executable program.
1246
1247 FIND_PROGRAM(<VAR> name1 path1 path2 ...)
1248
1249 This is the short-hand signature for the command that is suffi‐
1250 cient in many cases. It is the same as FIND_PROGRAM(<VAR> name1
1251 PATHS path2 path2 ...)
1252
1253
1254 FIND_PROGRAM(
1255 <VAR>
1256 name | NAMES name1 [name2 ...]
1257 PATHS path1 [path2 ... ENV var]
1258 [PATH_SUFFIXES suffix1 [suffix2 ...]]
1259 [DOC "cache documentation string"]
1260 [NO_DEFAULT_PATH]
1261 [NO_CMAKE_ENVIRONMENT_PATH]
1262 [NO_CMAKE_PATH]
1263 [NO_SYSTEM_ENVIRONMENT_PATH]
1264 [NO_CMAKE_SYSTEM_PATH]
1265 )
1266
1267 This command is used to find a program. A cache entry named by
1268 <VAR> is created to store the result of this command. If the
1269 program is found the result is stored in the variable and the
1270 search will not be repeated unless the variable is cleared. If
1271 nothing is found, the result will be <VAR>-NOTFOUND, and the
1272 search will be attempted again the next time FIND_PROGRAM is
1273 invoked with the same variable. The name of the program that is
1274 searched for is specified by the names listed after the NAMES
1275 argument. Additional search locations can be specified after
1276 the PATHS argument. If ENV var is found in the PATHS section
1277 the environment variable var will be read and converted from a
1278 system environment variable to a cmake style list of paths. For
1279 example ENV PATH would be a way to list the system path vari‐
1280 able. The argument after DOC will be used for the documentation
1281 string in the cache. PATH_SUFFIXES can be used to give sub
1282 directories that will be appended to the search paths.
1283
1284
1285 If NO_DEFAULT_PATH is specified, then no additional paths are
1286 added to the search. If NO_DEFAULT_PATH is not specified, the
1287 search process is as follows:
1288
1289
1290 1. Search cmake specific environment variables. This can be
1291 skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.
1292
1293
1294 CMAKE_FRAMEWORK_PATH
1295 CMAKE_APPBUNDLE_PATH
1296 CMAKE_PROGRAM_PATH
1297
1298 2. Search cmake variables with the same names as the cmake spe‐
1299 cific environment variables. These are intended to be used on
1300 the command line with a -DVAR=value. This can be skipped if
1301 NO_CMAKE_PATH is passed.
1302
1303
1304 CMAKE_FRAMEWORK_PATH
1305 CMAKE_APPBUNDLE_PATH
1306 CMAKE_PROGRAM_PATH
1307
1308 3. Search the standard system environment variables. This can be
1309 skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument.
1310
1311
1312 PATH
1313
1314
1315 4. Search cmake variables defined in the Platform files for the
1316 current system. This can be skipped if NO_CMAKE_SYSTEM_PATH is
1317 passed.
1318
1319
1320 CMAKE_SYSTEM_FRAMEWORK_PATH
1321 CMAKE_SYSTEM_APPBUNDLE_PATH
1322 CMAKE_SYSTEM_PROGRAM_PATH
1323
1324 5. Search the paths specified after PATHS or in the short-hand
1325 version of the command.
1326
1327
1328 On Darwin or systems supporting OSX Frameworks, the cmake vari‐
1329 able CMAKE_FIND_FRAMEWORK can be set to empty or one of the
1330 following:
1331
1332
1333 "FIRST" - Try to find frameworks before standard
1334 libraries or headers. This is the default on Dar‐
1335 win.
1336 "LAST" - Try to find frameworks after standard
1337 libraries or headers.
1338 "ONLY" - Only try to find frameworks.
1339 "NEVER". - Never try to find frameworks.
1340
1341 On Darwin or systems supporting OSX Application Bundles, the
1342 cmake variable CMAKE_FIND_APPBUNDLE can be set to empty or one
1343 of the following:
1344
1345
1346 "FIRST" - Try to find application bundles before standard
1347 programs. This is the default on Darwin.
1348 "LAST" - Try to find application bundles after standard
1349 programs.
1350 "ONLY" - Only try to find application bundles.
1351 "NEVER". - Never try to find application bundles.
1352
1353 The reason the paths listed in the call to the command are
1354 searched last is that most users of CMake would expect things to
1355 be found first in the locations specified by their environment.
1356 Projects may override this behavior by simply calling the com‐
1357 mand twice:
1358
1359
1360 FIND_PROGRAM(<VAR> NAMES name PATHS paths NO_DEFAULT_PATH)
1361 FIND_PROGRAM(<VAR> NAMES name)
1362
1363 Once one of these calls succeeds the result variable will be set
1364 and stored in the cache so that neither call will search again.
1365
1366
1367 FLTK_WRAP_UI
1368 Create FLTK user interfaces Wrappers.
1369
1370 FLTK_WRAP_UI(resultingLibraryName source1
1371 source2 ... sourceN )
1372
1373 Produce .h and .cxx files for all the .fl and .fld files listed.
1374 The resulting .h and .cxx files will be added to a variable
1375 named resultingLibraryName_FLTK_UI_SRCS which should be added to
1376 your library.
1377
1378
1379 FOREACH
1380 Evaluate a group of commands for each value in a list.
1381
1382 FOREACH(loop_var arg1 arg2 ...)
1383 COMMAND1(ARGS ...)
1384 COMMAND2(ARGS ...)
1385 ...
1386 ENDFOREACH(loop_var)
1387 FOREACH(loop_var RANGE total)
1388 FOREACH(loop_var RANGE start stop [step])
1389
1390 All commands between FOREACH and the matching ENDFOREACH are
1391 recorded without being invoked. Once the ENDFOREACH is evalu‐
1392 ated, the recorded list of commands is invoked once for each
1393 argument listed in the original FOREACH command. Before each
1394 iteration of the loop "${loop_var}" will be set as a variable
1395 with the current value in the list.
1396
1397
1398 Foreach can also iterate over a generated range of numbers.
1399 There are three types of this iteration:
1400
1401
1402 * When specifying single number, the range will have elements 0
1403 to "total".
1404
1405
1406 * When specifying two numbers, the range will have elements from
1407 the first number to the second number.
1408
1409
1410 * The third optional number is the increment used to iterate
1411 from the first number to the second number.
1412
1413
1414 GET_CMAKE_PROPERTY
1415 Get a property of the CMake instance.
1416
1417 GET_CMAKE_PROPERTY(VAR property)
1418
1419 Get a property from the CMake instance. The value of the prop‐
1420 erty is stored in the variable VAR. If the property is not
1421 found, CMake will report an error. Some supported properties
1422 include: VARIABLES, CACHE_VARIABLES, COMMANDS, and MACROS.
1423
1424
1425 GET_DIRECTORY_PROPERTY
1426 Get a property of the directory.
1427
1428 GET_DIRECTORY_PROPERTY(VAR [DIRECTORY dir] property)
1429
1430 Get a property from the Directory. The value of the property is
1431 stored in the variable VAR. If the property is not found, CMake
1432 will report an error. The properties include: VARIABLES,
1433 CACHE_VARIABLES, COMMANDS, MACROS, INCLUDE_DIRECTORIES,
1434 LINK_DIRECTORIES, DEFINITIONS, INCLUDE_REGULAR_EXPRESSION, LIST‐
1435 FILE_STACK, PARENT_DIRECTORY, and DEFINITION varname. If the
1436 DIRECTORY argument is provided then the property of the provided
1437 directory will be retrieved instead of the current directory.
1438 You can only get properties of a directory during or after it
1439 has been traversed by cmake.
1440
1441
1442 GET_FILENAME_COMPONENT
1443 Get a specific component of a full filename.
1444
1445 GET_FILENAME_COMPONENT(VarName FileName
1446 PATH|ABSOLUTE|NAME|EXT|NAME_WE
1447 [CACHE])
1448
1449 Set VarName to be the path (PATH), file name (NAME), file exten‐
1450 sion (EXT), file name without extension (NAME_WE) of FileName,
1451 or the full absolute (ABSOLUTE) file name without symlinks.
1452 Note that the path is converted to Unix slashes format and has
1453 no trailing slashes. The longest file extension is always con‐
1454 sidered. If the optional CACHE argument is specified, the result
1455 variable is added to the cache.
1456
1457
1458 GET_FILENAME_COMPONENT(VarName FileName
1459 PROGRAM [PROGRAM_ARGS ArgVar]
1460 [CACHE])
1461
1462 The program in FileName will be found in the system search path
1463 or left as a full path. If PROGRAM_ARGS is present with PRO‐
1464 GRAM, then any command-line arguments present in the FileName
1465 string are split from the program name and stored in ArgVar.
1466 This is used to separate a program name from its arguments in a
1467 command line string.
1468
1469
1470 GET_SOURCE_FILE_PROPERTY
1471 Get a property for a source file.
1472
1473 GET_SOURCE_FILE_PROPERTY(VAR file property)
1474
1475 Get a property from a source file. The value of the property is
1476 stored in the variable VAR. If the property is not found, VAR
1477 will be set to "NOTFOUND". Use SET_SOURCE_FILES_PROPERTIES to
1478 set property values. Source file properties usually control how
1479 the file is built. One property that is always there is LOCATION
1480
1481
1482 GET_TARGET_PROPERTY
1483 Get a property from a target.
1484
1485 GET_TARGET_PROPERTY(VAR target property)
1486
1487 Get a property from a target. The value of the property is
1488 stored in the variable VAR. If the property is not found, VAR
1489 will be set to "NOTFOUND". Use SET_TARGET_PROPERTIES to set
1490 property values. Properties are usually used to control how a
1491 target is built.
1492
1493
1494 The read-only property "<CONFIG>_LOCATION" provides the full
1495 path to the file on disk that will be created for the target
1496 when building under configuration <CONFIG> (in upper-case, such
1497 as "DEBUG_LOCATION"). The read-only property "LOCATION" speci‐
1498 fies the full path to the file on disk that will be created for
1499 the target. The path may contain a build-system-specific portion
1500 that is replaced at build time with the configuration getting
1501 built (such as "$(ConfigurationName)" in VS). This is very use‐
1502 ful for executable targets to get the path to the executable
1503 file for use in a custom command.
1504
1505
1506 The read-only property "TYPE" returns which type the specified
1507 target has (EXECUTABLE, STATIC_LIBRARY, SHARED_LIBRARY, MOD‐
1508 ULE_LIBRARY, UTILITY, INSTALL_FILES or INSTALL_PROGRAMS). This
1509 command can get properties for any target so far created. The
1510 targets do not need to be in the current CMakeLists.txt file.
1511
1512
1513 GET_TEST_PROPERTY
1514 Get a property of the test.
1515
1516 GET_TEST_PROPERTY(test VAR property)
1517
1518 Get a property from the Test. The value of the property is
1519 stored in the variable VAR. If the property is not found, CMake
1520 will report an error.
1521
1522
1523 IF Conditionally execute a group of commands.
1524
1525 IF(expression)
1526 # THEN section.
1527 COMMAND1(ARGS ...)
1528 COMMAND2(ARGS ...)
1529 ...
1530 ELSEIF(expression2)
1531 # ELSEIF section.
1532 COMMAND1(ARGS ...)
1533 COMMAND2(ARGS ...)
1534 ...
1535 ELSE(expression)
1536 # ELSE section.
1537 COMMAND1(ARGS ...)
1538 COMMAND2(ARGS ...)
1539 ...
1540 ENDIF(expression)
1541
1542 Evaluates the given expression. If the result is true, the com‐
1543 mands in the THEN section are invoked. Otherwise, the commands
1544 in the ELSE section are invoked. The ELSEIF and ELSE sections
1545 are optional. You may have multiple ELSEIF clauses. Note that
1546 the same expression must be given to IF, and ENDIF. Long
1547 expressions can be used and the order or precedence is that the
1548 EXISTS, COMMAND, and DEFINED operators will be evaluated first.
1549 Then any EQUAL, LESS, GREATER, STRLESS, STRGREATER, STREQUAL,
1550 MATCHES will be evaluated. Then NOT operators and finally AND,
1551 OR operators will be evaluated. Possible expressions are:
1552
1553
1554 IF(variable)
1555
1556 True if the variable's value is not empty, 0, N, NO, OFF, FALSE,
1557 NOTFOUND, or <variable>-NOTFOUND.
1558
1559
1560 IF(NOT variable)
1561
1562 True if the variable's value is empty, 0, N, NO, OFF, FALSE,
1563 NOTFOUND, or <variable>-NOTFOUND.
1564
1565
1566 IF(variable1 AND variable2)
1567
1568 True if both variables would be considered true individually.
1569
1570
1571 IF(variable1 OR variable2)
1572
1573 True if either variable would be considered true individually.
1574
1575
1576 IF(COMMAND command-name)
1577
1578 True if the given name is a command that can be invoked.
1579
1580
1581 IF(EXISTS file-name)
1582 IF(EXISTS directory-name)
1583
1584 True if the named file or directory exists. Behavior is well-
1585 defined only for full paths.
1586
1587
1588 IF(file1 IS_NEWER_THAN file2)
1589
1590 True if file1 is newer than file2 or if one of the two files
1591 doesn't exist. Behavior is well-defined only for full paths.
1592
1593
1594 IF(IS_DIRECTORY directory-name)
1595
1596 True if the given name is a directory. Behavior is well-defined
1597 only for full paths.
1598
1599
1600 IF(IS_ABSOLUTE path)
1601
1602 True if the given path is an absolute path.
1603
1604
1605 IF(variable MATCHES regex)
1606 IF(string MATCHES regex)
1607
1608 True if the given string or variable's value matches the given
1609 regular expression.
1610
1611
1612 IF(variable LESS number)
1613 IF(string LESS number)
1614 IF(variable GREATER number)
1615 IF(string GREATER number)
1616 IF(variable EQUAL number)
1617 IF(string EQUAL number)
1618
1619 True if the given string or variable's value is a valid number
1620 and the inequality or equality is true.
1621
1622
1623 IF(variable STRLESS string)
1624 IF(string STRLESS string)
1625 IF(variable STRGREATER string)
1626 IF(string STRGREATER string)
1627 IF(variable STREQUAL string)
1628 IF(string STREQUAL string)
1629
1630 True if the given string or variable's value is lexicographi‐
1631 cally less (or greater, or equal) than the string on the right.
1632
1633
1634 IF(DEFINED variable)
1635
1636 True if the given variable is defined. It does not matter if the
1637 variable is true or false just if it has been set.
1638
1639
1640 INCLUDE
1641 Read CMake listfile code from the given file.
1642
1643 INCLUDE(file1 [OPTIONAL])
1644 INCLUDE(module [OPTIONAL])
1645
1646 Reads CMake listfile code from the given file. Commands in the
1647 file are processed immediately as if they were written in place
1648 of the INCLUDE command. If OPTIONAL is present, then no error
1649 is raised if the file does not exist.
1650
1651
1652 If a module is specified instead of a file, the file with name
1653 <modulename>.cmake is searched in the CMAKE_MODULE_PATH.
1654
1655
1656 INCLUDE_DIRECTORIES
1657 Add include directories to the build.
1658
1659 INCLUDE_DIRECTORIES([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)
1660
1661 Add the given directories to those searched by the compiler for
1662 include files. By default the directories are appended onto the
1663 current list of directories. This default behavior can be
1664 changed by setting CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. By
1665 using BEFORE or AFTER you can select between appending and
1666 prepending, independent from the default. If the SYSTEM option
1667 is given the compiler will be told that the directories are
1668 meant as system include directories on some platforms.
1669
1670
1671 INCLUDE_EXTERNAL_MSPROJECT
1672 Include an external Microsoft project file in a workspace.
1673
1674 INCLUDE_EXTERNAL_MSPROJECT(projectname location
1675 dep1 dep2 ...)
1676
1677 Includes an external Microsoft project in the generated
1678 workspace file. Currently does nothing on UNIX.
1679
1680
1681 INCLUDE_REGULAR_EXPRESSION
1682 Set the regular expression used for dependency checking.
1683
1684 INCLUDE_REGULAR_EXPRESSION(regex_match [regex_complain])
1685
1686 Set the regular expressions used in dependency checking. Only
1687 files matching regex_match will be traced as dependencies. Only
1688 files matching regex_complain will generate warnings if they
1689 cannot be found (standard header paths are not searched). The
1690 defaults are:
1691
1692
1693 regex_match = "^.*$" (match everything)
1694 regex_complain = "^$" (match empty string only)
1695
1696 INSTALL
1697 Specify rules to run at install time.
1698
1699 This command generates installation rules for a project. Rules
1700 specified by calls to this command within a source directory are
1701 executed in order during installation. The order across direc‐
1702 tories is not defined.
1703
1704
1705 There are multiple signatures for this command. Some of them
1706 define installation properties for files and targets. Proper‐
1707 ties common to multiple signatures are covered here but they are
1708 valid only for signatures that specify them.
1709
1710
1711 DESTINATION arguments specify the directory on disk to which a
1712 file will be installed. If a full path (with a leading slash or
1713 drive letter) is given it is used directly. If a relative path
1714 is given it is interpreted relative to the value of
1715 CMAKE_INSTALL_PREFIX.
1716
1717
1718 PERMISSIONS arguments specify permissions for installed files.
1719 Valid permissions are OWNER_READ, OWNER_WRITE, OWNER_EXECUTE,
1720 GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, WORLD_WRITE,
1721 WORLD_EXECUTE, SETUID, and SETGID. Permissions that do not make
1722 sense on certain platforms are ignored on those platforms.
1723
1724
1725 The CONFIGURATIONS argument specifies a list of build configura‐
1726 tions for which the install rule applies (Debug, Release, etc.).
1727
1728
1729 The COMPONENT argument specifies an installation component name
1730 with which the install rule is associated, such as "runtime" or
1731 "development". During component-specific installation only
1732 install rules associated with the given component name will be
1733 executed. During a full installation all components are
1734 installed.
1735
1736
1737 The RENAME argument specifies a name for an installed file that
1738 may be different from the original file. Renaming is allowed
1739 only when a single file is installed by the command.
1740
1741
1742 The OPTIONAL argument specifies that it is not an error if the
1743 file to be installed does not exist.
1744
1745
1746 The TARGETS signature:
1747
1748
1749 INSTALL(TARGETS targets...
1750 [[ARCHIVE|LIBRARY|RUNTIME]
1751 [DESTINATION <dir>]
1752 [PERMISSIONS permissions...]
1753 [CONFIGURATIONS
1754 [Debug|Release|...]]
1755 [COMPONENT <component>]
1756 [OPTIONAL]
1757 ] [...])
1758
1759 The TARGETS form specifies rules for installing targets from a
1760 project. There are three kinds of target files that may be
1761 installed: archive, library, and runtime. Executables are
1762 always treated as runtime targets. Static libraries are always
1763 treated as archive targets. Module libraries are always treated
1764 as library targets. For non-DLL platforms shared libraries are
1765 treated as library targets. For DLL platforms the DLL part of a
1766 shared library is treated as a runtime target and the corre‐
1767 sponding import library is treated as an archive target. All
1768 Windows-based systems including Cygwin are DLL platforms. The
1769 ARCHIVE, LIBRARY, and RUNTIME arguments change the type of tar‐
1770 get to which the subsequent properties apply. If none is given
1771 the installation properties apply to all target types. If only
1772 one is given then only targets of that type will be installed
1773 (which can be used to install just a DLL or just an import
1774 library).
1775
1776
1777 One or more groups of properties may be specified in a single
1778 call to the TARGETS form of this command. A target may be
1779 installed more than once to different locations. Consider hypo‐
1780 thetical targets "myExe", "mySharedLib", and "myStaticLib". The
1781 code
1782
1783
1784 INSTALL(TARGETS myExe mySharedLib myStaticLib
1785 RUNTIME DESTINATION bin
1786 LIBRARY DESTINATION lib
1787 ARCHIVE DESTINATION lib/static)
1788 INSTALL(TARGETS mySharedLib DESTINATION /some/full/path)
1789
1790 will install myExe to <prefix>/bin and myStaticLib to <pre‐
1791 fix>/lib/static. On non-DLL platforms mySharedLib will be
1792 installed to <prefix>/lib and /some/full/path. On DLL platforms
1793 the mySharedLib DLL will be installed to <prefix>/bin and
1794 /some/full/path and its import library will be installed to
1795 <prefix>/lib/static and /some/full/path. On non-DLL platforms
1796 mySharedLib will be installed to <prefix>/lib and
1797 /some/full/path.
1798
1799
1800 The FILES signature:
1801
1802
1803 INSTALL(FILES files... DESTINATION <dir>
1804 [PERMISSIONS permissions...]
1805 [CONFIGURATIONS [Debug|Release|...]]
1806 [COMPONENT <component>]
1807 [RENAME <name>] [OPTIONAL])
1808
1809 The FILES form specifies rules for installing files for a
1810 project. File names given as relative paths are interpreted
1811 with respect to the current source directory. Files installed
1812 by this form are by default given permissions OWNER_WRITE,
1813 OWNER_READ, GROUP_READ, and WORLD_READ if no PERMISSIONS argu‐
1814 ment is given.
1815
1816
1817 The PROGRAMS signature:
1818
1819
1820 INSTALL(PROGRAMS files... DESTINATION <dir>
1821 [PERMISSIONS permissions...]
1822 [CONFIGURATIONS [Debug|Release|...]]
1823 [COMPONENT <component>]
1824 [RENAME <name>] [OPTIONAL])
1825
1826 The PROGRAMS form is identical to the FILES form except that the
1827 default permissions for the installed file also include
1828 OWNER_EXECUTE, GROUP_EXECUTE, and WORLD_EXECUTE. This form is
1829 intended to install programs that are not targets, such as shell
1830 scripts. Use the TARGETS form to install targets built within
1831 the project.
1832
1833
1834 The DIRECTORY signature:
1835
1836
1837 INSTALL(DIRECTORY dirs... DESTINATION <dir>
1838 [FILE_PERMISSIONS permissions...]
1839 [DIRECTORY_PERMISSIONS permissions...]
1840 [USE_SOURCE_PERMISSIONS]
1841 [CONFIGURATIONS [Debug|Release|...]]
1842 [COMPONENT <component>]
1843 [[PATTERN <pattern> | REGEX <regex>]
1844 [EXCLUDE] [PERMISSIONS permissions...]] [...])
1845
1846 The DIRECTORY form installs contents of one or more directories
1847 to a given destination. The directory structure is copied ver‐
1848 batim to the destination. The last component of each directory
1849 name is appended to the destination directory but a trailing
1850 slash may be used to avoid this because it leaves the last com‐
1851 ponent empty. Directory names given as relative paths are
1852 interpreted with respect to the current source directory. If no
1853 input directory names are given the destination directory will
1854 be created but nothing will be installed into it. The FILE_PER‐
1855 MISSIONS and DIRECTORY_PERMISSIONS options specify permissions
1856 given to files and directories in the destination. If
1857 USE_SOURCE_PERMISSIONS is specified and FILE_PERMISSIONS is not,
1858 file permissions will be copied from the source directory struc‐
1859 ture. If no permissions are specified files will be given the
1860 default permissions specified in the FILES form of the command,
1861 and the directories will be given the default permissions speci‐
1862 fied in the PROGRAMS form of the command. The PATTERN and REGEX
1863 options specify a globbing pattern or regular expression to
1864 match directories or files encountered during traversal of an
1865 input directory. The full path to an input file or directory
1866 (with forward slashes) is matched against the expression. A
1867 PATTERN will match only complete file names: the portion of the
1868 full path matching the pattern must occur at the end of the file
1869 name and be preceded by a slash. A REGEX will match any portion
1870 of the full path but it may use '/' and '$' to simulate the PAT‐
1871 TERN behavior. Options following one of these matching expres‐
1872 sions are applied only to files or directories matching them.
1873 The EXCLUDE option will skip the matched file or directory. The
1874 PERMISSIONS option overrides the permissions setting for the
1875 matched file or directory. For example the code
1876
1877
1878 INSTALL(DIRECTORY icons scripts/ DESTINATION share/myproj
1879 PATTERN "CVS" EXCLUDE
1880 PATTERN "scripts/*"
1881 PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
1882 GROUP_EXECUTE GROUP_READ)
1883
1884 will install the icons directory to share/myproj/icons and the
1885 scripts directory to share/myproj. The icons will get default
1886 file permissions, the scripts will be given specific permis‐
1887 sions, and any CVS directories will be excluded.
1888
1889
1890 The SCRIPT and CODE signature:
1891
1892
1893 INSTALL([[SCRIPT <file>] [CODE <code>]] [...])
1894
1895 The SCRIPT form will invoke the given CMake script files during
1896 installation. If the script file name is a relative path it
1897 will be interpreted with respect to the current source direc‐
1898 tory. The CODE form will invoke the given CMake code during
1899 installation. Code is specified as a single argument inside a
1900 double-quoted string. For example, the code
1901
1902
1903 INSTALL(CODE "MESSAGE(\"Sample install message.\")")
1904
1905 will print a message during installation.
1906
1907
1908 NOTE: This command supercedes the INSTALL_TARGETS command and
1909 the target properties PRE_INSTALL_SCRIPT and
1910 POST_INSTALL_SCRIPT. It also replaces the FILES forms of the
1911 INSTALL_FILES and INSTALL_PROGRAMS commands. The processing
1912 order of these install rules relative to those generated by
1913 INSTALL_TARGETS, INSTALL_FILES, and INSTALL_PROGRAMS commands is
1914 not defined.
1915
1916
1917
1918 INSTALL_FILES
1919 Old installation command. Use the INSTALL command.
1920
1921 This command has been superceded by the INSTALL command. It is
1922 provided for compatibility with older CMake code. The FILES
1923 form is directly replaced by the FILES form of the INSTALL com‐
1924 mand. The regexp form can be expressed more clearly using the
1925 GLOB form of the FILE command.
1926
1927
1928 INSTALL_FILES(<dir> extension file file ...)
1929
1930 Create rules to install the listed files with the given exten‐
1931 sion into the given directory. Only files existing in the cur‐
1932 rent source tree or its corresponding location in the binary
1933 tree may be listed. If a file specified already has an exten‐
1934 sion, that extension will be removed first. This is useful for
1935 providing lists of source files such as foo.cxx when you want
1936 the corresponding foo.h to be installed. A typical extension is
1937 '.h'.
1938
1939
1940 INSTALL_FILES(<dir> regexp)
1941
1942 Any files in the current source directory that match the regular
1943 expression will be installed.
1944
1945
1946 INSTALL_FILES(<dir> FILES file file ...)
1947
1948 Any files listed after the FILES keyword will be installed
1949 explicitly from the names given. Full paths are allowed in this
1950 form.
1951
1952
1953 The directory <dir> is relative to the installation prefix,
1954 which is stored in the variable CMAKE_INSTALL_PREFIX.
1955
1956
1957 INSTALL_PROGRAMS
1958 Old installation command. Use the INSTALL command.
1959
1960 This command has been superceded by the INSTALL command. It is
1961 provided for compatibility with older CMake code. The FILES
1962 form is directly replaced by the PROGRAMS form of the INSTALL
1963 command. The regexp form can be expressed more clearly using
1964 the GLOB form of the FILE command.
1965
1966
1967 INSTALL_PROGRAMS(<dir> file1 file2 [file3 ...])
1968 INSTALL_PROGRAMS(<dir> FILES file1 [file2 ...])
1969
1970 Create rules to install the listed programs into the given
1971 directory. Use the FILES argument to guarantee that the file
1972 list version of the command will be used even when there is only
1973 one argument.
1974
1975
1976 INSTALL_PROGRAMS(<dir> regexp)
1977
1978 In the second form any program in the current source directory
1979 that matches the regular expression will be installed.
1980
1981
1982 This command is intended to install programs that are not built
1983 by cmake, such as shell scripts. See the TARGETS form of the
1984 INSTALL command to create installation rules for targets built
1985 by cmake.
1986
1987
1988 The directory <dir> is relative to the installation prefix,
1989 which is stored in the variable CMAKE_INSTALL_PREFIX.
1990
1991
1992 INSTALL_TARGETS
1993 Old installation command. Use the INSTALL command.
1994
1995 This command has been superceded by the INSTALL command. It is
1996 provided for compatibility with older CMake code.
1997
1998
1999 INSTALL_TARGETS(<dir> [RUNTIME_DIRECTORY dir] target target)
2000
2001 Create rules to install the listed targets into the given direc‐
2002 tory. The directory <dir> is relative to the installation pre‐
2003 fix, which is stored in the variable CMAKE_INSTALL_PREFIX. If
2004 RUNTIME_DIRECTORY is specified, then on systems with special
2005 runtime files (Windows DLL), the files will be copied to that
2006 directory.
2007
2008
2009 LINK_DIRECTORIES
2010 Specify directories in which to search for libraries.
2011
2012 LINK_DIRECTORIES(directory1 directory2 ...)
2013
2014 Specify the paths in which the linker should search for
2015 libraries.
2016
2017
2018 LINK_LIBRARIES
2019 Link libraries to all targets added later.
2020
2021 LINK_LIBRARIES(library1 <debug | optimized> library2 ...)
2022
2023 This is an old CMake command for linking libraries. Use TAR‐
2024 GET_LINK_LIBRARIES unless you have a good reason for every tar‐
2025 get to link to the same set of libraries.
2026
2027
2028 Specify a list of libraries to be linked into any following tar‐
2029 gets (typically added with the ADD_EXECUTABLE or ADD_LIBRARY
2030 calls). This command is passed down to all subdirectories. The
2031 debug and optimized strings may be used to indicate that the
2032 next library listed is to be used only for that specific type of
2033 build.
2034
2035
2036 LIST List operations.
2037
2038 LIST(LENGTH <list> <output variable>)
2039 LIST(GET <list> <element index> [<element index> ...] <output
2040 variable>)
2041 LIST(APPEND <list> <element> [<element> ...])
2042 LIST(FIND <list> <value> <output variable>)
2043 LIST(INSERT <list> <element_index> <element> [<element> ...])
2044 LIST(REMOVE_ITEM <list> <value> [<value> ...])
2045 LIST(REMOVE_AT <list> <index> [<index> ...])
2046 LIST(SORT <list>)
2047 LIST(REVERSE <list>)
2048
2049 LENGTH will return a given list's length.
2050
2051
2052 GET will return list of elements specified by indices from the
2053 list.
2054
2055
2056 APPEND will append elements to the list.
2057
2058
2059 FIND will return the index of the element specified in the list
2060 or -1 if it wasn't found.
2061
2062
2063 INSERT will insert elements to the list to the specified loca‐
2064 tion.
2065
2066
2067 When specifying an index, negative value corresponds to index
2068 from the end of the list.
2069
2070
2071 REMOVE_AT and REMOVE_ITEM will remove items from the list. The
2072 difference is that REMOVE_ITEM will remove the given items,
2073 while REMOVE_AT will remove the items at the given indices.
2074
2075
2076
2077 LOAD_CACHE
2078 Load in the values from another project's CMake cache.
2079
2080 LOAD_CACHE(pathToCacheFile READ_WITH_PREFIX
2081 prefix entry1...)
2082
2083 Read the cache and store the requested entries in variables with
2084 their name prefixed with the given prefix. This only reads the
2085 values, and does not create entries in the local project's
2086 cache.
2087
2088
2089 LOAD_CACHE(pathToCacheFile [EXCLUDE entry1...]
2090 [INCLUDE_INTERNALS entry1...])
2091
2092 Load in the values from another cache and store them in the
2093 local project's cache as internal entries. This is useful for a
2094 project that depends on another project built in a different
2095 tree. EXCLUDE option can be used to provide a list of entries
2096 to be excluded. INCLUDE_INTERNALS can be used to provide a list
2097 of internal entries to be included. Normally, no internal
2098 entries are brought in. Use of this form of the command is
2099 strongly discouraged, but it is provided for backward compati‐
2100 bility.
2101
2102
2103 LOAD_COMMAND
2104 Load a command into a running CMake.
2105
2106 LOAD_COMMAND(COMMAND_NAME <loc1> [loc2 ...])
2107
2108 The given locations are searched for a library whose name is
2109 cmCOMMAND_NAME. If found, it is loaded as a module and the com‐
2110 mand is added to the set of available CMake commands. Usually,
2111 TRY_COMPILE is used before this command to compile the module.
2112 If the command is successfully loaded a variable named
2113
2114
2115 CMAKE_LOADED_COMMAND_<COMMAND_NAME>
2116
2117 will be set to the full path of the module that was loaded.
2118 Otherwise the variable will not be set.
2119
2120
2121 MACRO Start recording a macro for later invocation as a command.
2122
2123 MACRO(<name> [arg1 [arg2 [arg3 ...]]])
2124 COMMAND1(ARGS ...)
2125 COMMAND2(ARGS ...)
2126 ...
2127 ENDMACRO(<name>)
2128
2129 Define a macro named <name> that takes arguments named arg1 arg2
2130 arg3 (...). Commands listed after MACRO, but before the match‐
2131 ing ENDMACRO, are not invoked until the macro is invoked. When
2132 it is invoked, the commands recorded in the macro are first mod‐
2133 ified by replacing formal parameters (${arg1}) with the argu‐
2134 ments passed, and then invoked as normal commands. In addition
2135 to referencing the formal parameters you can reference the vari‐
2136 able ARGC which will be set to the number of arguments passed
2137 into the function as well as ARGV0 ARGV1 ARGV2 ... which will
2138 have the actual values of the arguments passed in. This facili‐
2139 tates creating macros with optional arguments. Additionally ARGV
2140 holds the list of all arguments given to the macro and ARGN
2141 holds the list of argument pass the last expected argument.
2142
2143
2144 MAKE_DIRECTORY
2145 Old directory creation command. Use the FILE command.
2146
2147 This command has been superceded by the FILE(MAKE_DIRECTORY ...)
2148 command. It is provided for compatibility with older CMake
2149 code.
2150
2151
2152 MAKE_DIRECTORY(directory)
2153
2154 Creates the specified directory. Full paths should be given.
2155 Any parent directories that do not exist will also be created.
2156 Use with care.
2157
2158
2159 MARK_AS_ADVANCED
2160 Mark cmake cached variables as advanced.
2161
2162 MARK_AS_ADVANCED([CLEAR|FORCE] VAR VAR2 VAR...)
2163
2164 Mark the named cached variables as advanced. An advanced vari‐
2165 able will not be displayed in any of the cmake GUIs unless the
2166 show advanced option is on. If CLEAR is the first argument
2167 advanced variables are changed back to unadvanced. If FORCE is
2168 the first argument, then the variable is made advanced. If nei‐
2169 ther FORCE nor CLEAR is specified, new values will be marked as
2170 advanced, but if the variable already has an advanced/non-
2171 advanced state, it will not be changed.
2172
2173
2174 MATH Mathematical expressions.
2175
2176 MATH(EXPR <output variable> <math expression>)
2177
2178 EXPR evaluates mathematical expression and return result in the
2179 output variable. Example mathematical expression is '5 * ( 10 +
2180 13 )'.
2181
2182
2183 MESSAGE
2184 Display a message to the user.
2185
2186 MESSAGE([SEND_ERROR | STATUS | FATAL_ERROR]
2187 "message to display" ...)
2188
2189 By default the message is displayed in a pop up window (CMake‐
2190 Setup), or in the stdout of cmake, or the error section of
2191 ccmake. If the first argument is SEND_ERROR then an error is
2192 raised, and the generate phase will be skipped. If the first
2193 argument is FATAL_ERROR, all processing is halted. If the first
2194 argument is STATUS then the message is displayed in the progress
2195 line for the GUI, or with a -- in the command line cmake.
2196
2197
2198 OPTION Provides an option that the user can optionally select.
2199
2200 OPTION(OPTION_VAR "help string describing option"
2201 [initial value])
2202
2203 Provide an option for the user to select as ON or OFF. If no
2204 initial value is provided, OFF is used.
2205
2206
2207 OUTPUT_REQUIRED_FILES
2208 Output a list of required source files for a specified source
2209 file.
2210
2211 OUTPUT_REQUIRED_FILES(srcfile outputfile)
2212
2213 Outputs a list of all the source files that are required by the
2214 specified srcfile. This list is written into outputfile. This is
2215 similar to writing out the dependencies for srcfile except that
2216 it jumps from .h files into .cxx, .c and .cpp files if possible.
2217
2218
2219 PROJECT
2220 Set a name for the entire project.
2221
2222 PROJECT(projectname [CXX] [C] [Java])
2223
2224 Sets the name of the project. This creates the variables pro‐
2225 jectname_BINARY_DIR and projectname_SOURCE_DIR. Optionally you
2226 can specify which languages your project supports. By default
2227 all languages are supported. If you do not have a C++ compiler,
2228 but want to build a c program with cmake, then use this option.
2229
2230
2231 QT_WRAP_CPP
2232 Create QT Wrappers.
2233
2234 QT_WRAP_CPP(resultingLibraryName DestName
2235 SourceLists ...)
2236
2237 Produce moc files for all the .h files listed in the
2238 SourceLists. The moc files will be added to the library using
2239 the DestName source list.
2240
2241
2242 QT_WRAP_UI
2243 Create QT user interfaces Wrappers.
2244
2245 QT_WRAP_UI(resultingLibraryName HeadersDestName
2246 SourcesDestName SourceLists ...)
2247
2248 Produce .h and .cxx files for all the .ui files listed in the
2249 SourceLists. The .h files will be added to the library using
2250 the HeadersDestNamesource list. The .cxx files will be added to
2251 the library using the SourcesDestNamesource list.
2252
2253
2254 REMOVE Old list item removal command. Use the LIST command.
2255
2256 This command has been superceded by the LIST(REMOVE ...) com‐
2257 mand. It is provided for compatibility with older CMake code.
2258
2259
2260 REMOVE(VAR VALUE VALUE ...)
2261
2262 Removes VALUE from the variable VAR. This is typically used to
2263 remove entries from a vector (e.g. semicolon separated list).
2264 VALUE is expanded.
2265
2266
2267 REMOVE_DEFINITIONS
2268 Removes -D define flags to the command line of C and C++ compil‐
2269 ers.
2270
2271 REMOVE_DEFINITIONS(-DFOO -DBAR ...)
2272
2273 Removes flags from command line of C and C++ compilers. This
2274 command can be used to remove any flag from a compile line, but
2275 the -D flag is accepted by most C/C++ compilers. Other flags
2276 may not be as portable.
2277
2278
2279 SEPARATE_ARGUMENTS
2280 Split space separated arguments into a semi-colon separated
2281 list.
2282
2283 SEPARATE_ARGUMENTS(VARIABLE)
2284
2285 Convert the value of VARIABLE to a semi-colon separated list.
2286 All spaces are replaced with ';'. This helps with generating
2287 command lines.
2288
2289
2290 SET Set a CMAKE variable to a given value.
2291
2292 SET(VAR [VALUE] [CACHE TYPE DOCSTRING [FORCE]])
2293
2294 Within CMake sets VAR to the value VALUE. VALUE is expanded
2295 before VAR is set to it. If CACHE is present, then the VAR is
2296 put in the cache. TYPE and DOCSTRING are required. TYPE is used
2297 by the CMake GUI to choose a widget with which the user sets a
2298 value. The value for TYPE may be one of
2299
2300
2301 FILEPATH = File chooser dialog.
2302 PATH = Directory chooser dialog.
2303 STRING = Arbitrary string.
2304 BOOL = Boolean ON/OFF checkbox.
2305 INTERNAL = No GUI entry (used for persistent variables).
2306
2307 If TYPE is INTERNAL, then the VALUE is always written into the
2308 cache, replacing any values existing in the cache. If it is not
2309 a cache variable, then this always writes into the current make‐
2310 file. The FORCE option will overwrite the cache value removing
2311 any changes by the user.
2312
2313
2314 SET(VAR VALUE1 ... VALUEN).
2315
2316 In this case VAR is set to a semicolon separated list of values.
2317
2318
2319 VAR can be an environment variable such as:
2320
2321
2322 SET( ENV{PATH} /home/martink )
2323
2324 in which case the environment variable will be set.
2325
2326
2327 SET_DIRECTORY_PROPERTIES
2328 Set a property of the directory.
2329
2330 SET_DIRECTORY_PROPERTIES(PROPERTIES prop1 value1 prop2 value2)
2331
2332 Set a property for the current directory and subdirectories. If
2333 the property is not found, CMake will report an error. The prop‐
2334 erties include: INCLUDE_DIRECTORIES, LINK_DIRECTORIES,
2335 INCLUDE_REGULAR_EXPRESSION, and ADDITIONAL_MAKE_CLEAN_FILES.
2336
2337
2338 ADDITIONAL_MAKE_CLEAN_FILES is a list of files that will be
2339 cleaned as a part of "make clean" stage.
2340
2341
2342 SET_SOURCE_FILES_PROPERTIES
2343 Source files can have properties that affect how they are built.
2344
2345 SET_SOURCE_FILES_PROPERTIES(file1 file2 ...
2346 PROPERTIES prop1 value1
2347 prop2 value2 ...)
2348
2349 Set properties on a file. The syntax for the command is to list
2350 all the files you want to change, and then provide the values
2351 you want to set next. You can make up your own properties as
2352 well. The following are used by CMake. The ABSTRACT flag
2353 (boolean) is used by some class wrapping commands. If
2354 WRAP_EXCLUDE (boolean) is true then many wrapping commands will
2355 ignore this file. If GENERATED (boolean) is true then it is not
2356 an error if this source file does not exist when it is added to
2357 a target. Obviously, it must be created (presumably by a custom
2358 command) before the target is built. If the HEADER_FILE_ONLY
2359 (boolean) property is true then dependency information is not
2360 created for that file (this is set automatically, based on the
2361 file's name's extension and is probably only used by Makefiles).
2362 OBJECT_DEPENDS (string) adds dependencies to the object file.
2363 COMPILE_FLAGS (string) is passed to the compiler as additional
2364 command line arguments when the source file is compiled. LAN‐
2365 GUAGE (string) CXX|C will change the default compiler used to
2366 compile the source file. The languages used need to be enabled
2367 in the PROJECT command. If SYMBOLIC (boolean) is set to true the
2368 build system will be informed that the source file is not actu‐
2369 ally created on disk but instead used as a symbolic name for a
2370 build rule.
2371
2372
2373 SET_TARGET_PROPERTIES
2374 Targets can have properties that affect how they are built.
2375
2376 SET_TARGET_PROPERTIES(target1 target2 ...
2377 PROPERTIES prop1 value1
2378 prop2 value2 ...)
2379
2380 Set properties on a target. The syntax for the command is to
2381 list all the files you want to change, and then provide the val‐
2382 ues you want to set next. You can use any prop value pair you
2383 want and extract it later with the GET_TARGET_PROPERTY command.
2384
2385
2386 Properties that affect the name of a target's output file are as
2387 follows. The PREFIX and SUFFIX properties override the default
2388 target name prefix (such as "lib") and suffix (such as ".so").
2389 IMPORT_PREFIX and IMPORT_SUFFIX are the equivalent properties
2390 for the import library corresponding to a DLL (for SHARED
2391 library targets). OUTPUT_NAME sets the real name of a target
2392 when it is built and can be used to help create two targets of
2393 the same name even though CMake requires unique logical target
2394 names. There is also a <CONFIG>_OUTPUT_NAME that can set the
2395 output name on a per-configuration basis. <CONFIG>_POSTFIX sets
2396 a postfix for the real name of the target when it is built under
2397 the configuration named by <CONFIG> (in upper-case, such as
2398 "DEBUG_POSTFIX"). The value of this property is initialized
2399 when the target is created to the value of the variable
2400 CMAKE_<CONFIG>_POSTFIX (except for executable targets because
2401 earlier CMake versions which did not use this variable for exe‐
2402 cutables).
2403
2404
2405 The LINK_FLAGS property can be used to add extra flags to the
2406 link step of a target. LINK_FLAGS_<CONFIG> will add to the con‐
2407 figuration <CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL,
2408 RELWITHDEBINFO. DEFINE_SYMBOL sets the name of the preprocessor
2409 symbol defined when compiling sources in a shared library. If
2410 not set here then it is set to target_EXPORTS by default (with
2411 some substitutions if the target is not a valid C identifier).
2412 This is useful for headers to know whether they are being
2413 included from inside their library our outside to properly setup
2414 dllexport/dllimport decorations. The COMPILE_FLAGS property sets
2415 additional compiler flags used to build sources within the tar‐
2416 get. It may also be used to pass additional preprocessor defi‐
2417 nitions.
2418
2419
2420 The LINKER_LANGUAGE property is used to change the tool used to
2421 link an executable or shared library. The default is set the
2422 language to match the files in the library. CXX and C are common
2423 values for this property.
2424
2425
2426 For shared libraries VERSION and SOVERSION can be used to spec‐
2427 ify the build version and api version respectively. When build‐
2428 ing or installing appropriate symlinks are created if the plat‐
2429 form supports symlinks and the linker supports so-names. If only
2430 one of both is specified the missing is assumed to have the same
2431 version number. For executables VERSION can be used to specify
2432 the build version. When building or installing appropriate sym‐
2433 links are created if the platform supports symlinks. For shared
2434 libraries and executables on Windows the VERSION attribute is
2435 parsed to extract a "major.minor" version number. These numbers
2436 are used as the image version of the binary.
2437
2438
2439 There are a few properties used to specify RPATH rules.
2440 INSTALL_RPATH is a semicolon-separated list specifying the rpath
2441 to use in installed targets (for platforms that support it).
2442 INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true
2443 will append directories in the linker search path and outside
2444 the project to the INSTALL_RPATH. SKIP_BUILD_RPATH is a boolean
2445 specifying whether to skip automatic generation of an rpath
2446 allowing the target to run from the build tree.
2447 BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link
2448 the target in the build tree with the INSTALL_RPATH. This takes
2449 precedence over SKIP_BUILD_RPATH and avoids the need for relink‐
2450 ing before installation. INSTALL_NAME_DIR is a string specify‐
2451 ing the directory portion of the "install_name" field of shared
2452 libraries on Mac OSX to use in the installed targets. When the
2453 target is created the values of the variables
2454 CMAKE_INSTALL_RPATH, CMAKE_INSTALL_RPATH_USE_LINK_PATH,
2455 CMAKE_SKIP_BUILD_RPATH, CMAKE_BUILD_WITH_INSTALL_RPATH, and
2456 CMAKE_INSTALL_NAME_DIR are used to initialize these properties.
2457
2458
2459 PROJECT_LABEL can be used to change the name of the target in an
2460 IDE like visual studio. VS_KEYWORD can be set to change the
2461 visual studio keyword, for example QT integration works better
2462 if this is set to Qt4VSv1.0.
2463
2464
2465 When a library is built CMake by default generates code to
2466 remove any existing library using all possible names. This is
2467 needed to support libraries that switch between STATIC and
2468 SHARED by a user option. However when using OUTPUT_NAME to
2469 build a static and shared library of the same name using differ‐
2470 ent logical target names the two targets will remove each
2471 other's files. This can be prevented by setting the
2472 CLEAN_DIRECT_OUTPUT property to 1.
2473
2474
2475 The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are
2476 the old way to specify CMake scripts to run before and after
2477 installing a target. They are used only when the old
2478 INSTALL_TARGETS command is used to install the target. Use the
2479 INSTALL command instead.
2480
2481
2482 The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual
2483 studio generators. If it is set to 1 the target will not be
2484 part of the default build when you select "Build Solution".
2485
2486
2487 SET_TESTS_PROPERTIES
2488 Set a property of the tests.
2489
2490 SET_TESTS_PROPERTIES(test1 [test2...] PROPERTIES prop1 value1
2491 prop2 value2)
2492
2493 Set a property for the tests. If the property is not found,
2494 CMake will report an error. The properties include:
2495
2496
2497 WILL_FAIL: If set to true, this will invert the pass/fail flag
2498 of the test.
2499
2500
2501 PASS_REGULAR_EXPRESSION: If set, the test output will be checked
2502 against the specified regular expressions and at least one of
2503 the regular expressions has to match, otherwise the test will
2504 fail.
2505
2506
2507 Example: PASS_REGULAR_EXPRESSION "TestPassed;All ok"
2508
2509 FAIL_REGULAR_EXPRESSION: If set, if the output will match to one
2510 of specified regular expressions, the test will fail.
2511
2512
2513 Example: PASS_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
2514
2515 Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect
2516 a list of regular expressions.
2517
2518
2519
2520 SITE_NAME
2521 Set the given variable to the name of the computer.
2522
2523 SITE_NAME(variable)
2524
2525
2526 SOURCE_GROUP
2527 Define a grouping for sources in the makefile.
2528
2529 SOURCE_GROUP(name [REGULAR_EXPRESSION regex] [FILES src1 src2
2530 ...])
2531
2532 Defines a group into which sources will be placed in project
2533 files. This is mainly used to setup file tabs in Visual Studio.
2534 Any file whose name is listed or matches the regular expression
2535 will be placed in this group. If a file matches multiple
2536 groups, the LAST group that explicitly lists the file will be
2537 favored, if any. If no group explicitly lists the file, the
2538 LAST group whose regular expression matches the file will be
2539 favored.
2540
2541
2542 The name of the group may contain backslashes to specify sub‐
2543 groups:
2544
2545
2546 SOURCE_GROUP(outer\\inner ...)
2547
2548 For backwards compatibility, this command is also supports the
2549 format:
2550
2551
2552 SOURCE_GROUP(name regex)
2553
2554 STRING String operations.
2555
2556 STRING(REGEX MATCH <regular_expression>
2557 <output variable> <input> [<input>...])
2558 STRING(REGEX MATCHALL <regular_expression>
2559 <output variable> <input> [<input>...])
2560 STRING(REGEX REPLACE <regular_expression>
2561 <replace_expression> <output variable>
2562 <input> [<input>...])
2563 STRING(REPLACE <match_expression>
2564 <replace_expression> <output variable>
2565 <input> [<input>...])
2566 STRING(COMPARE EQUAL <string1> <string2> <output variable>)
2567 STRING(COMPARE NOTEQUAL <string1> <string2> <output variable>)
2568 STRING(COMPARE LESS <string1> <string2> <output variable>)
2569 STRING(COMPARE GREATER <string1> <string2> <output variable>)
2570 STRING(ASCII <number> [<number> ...] <output variable>)
2571 STRING(CONFIGURE <string1> <output variable>
2572 [@ONLY] [ESCAPE_QUOTES])
2573 STRING(TOUPPER <string1> <output variable>)
2574 STRING(TOLOWER <string1> <output variable>)
2575 STRING(LENGTH <string> <output variable>)
2576 STRING(SUBSTRING <string> <begin> <length> <output variable>)
2577
2578 REGEX MATCH will match the regular expression once and store the
2579 match in the output variable.
2580
2581
2582 REGEX MATCHALL will match the regular expression as many times
2583 as possible and store the matches in the output variable as a
2584 list.
2585
2586
2587 REGEX REPLACE will match the regular expression as many times as
2588 possible and substitute the replacement expression for the match
2589 in the output. The replace expression may refer to paren-delim‐
2590 ited subexpressions of the match using \1, \2, ..., \9. Note
2591 that two backslashes (\\1) are required in CMake code to get a
2592 backslash through argument parsing.
2593
2594
2595 REPLACE will match the given expression and substitute the
2596 replacement expression for the match in the output. The replace
2597 expression may refer to paren-delimited subexpressions of the
2598 match using \1, \2, ..., \9. Note that two backslashes (\\1)
2599 are required in CMake code to get a backslash through argument
2600 parsing.
2601
2602
2603 COMPARE EQUAL/NOTEQUAL/LESS/GREATER will compare the strings and
2604 store true or false in the output variable.
2605
2606
2607 ASCII will convert all numbers into corresponding ASCII charac‐
2608 ters.
2609
2610
2611 CONFIGURE will transform a string like CONFIGURE_FILE transforms
2612 a file.
2613
2614
2615 TOUPPER/TOLOWER will convert string to upper/lower characters.
2616
2617
2618 LENGTH will return a given string's length.
2619
2620
2621 SUBSTRING will return a substring of a given string.
2622
2623
2624 SUBDIR_DEPENDS
2625 Legacy command. Does nothing.
2626
2627 SUBDIR_DEPENDS(subdir dep1 dep2 ...)
2628
2629 Does not do anything. This command used to help projects order
2630 parallel builds correctly. This functionality is now automatic.
2631
2632
2633 SUBDIRS
2634 Add a list of subdirectories to the build.
2635
2636 SUBDIRS(dir1 dir2 ...[EXCLUDE_FROM_ALL exclude_dir1
2637 exclude_dir2 ...] [PREORDER] )
2638
2639 Add a list of subdirectories to the build. The ADD_SUBDIRECTORY
2640 command should be used instead of SUBDIRS although SUBDIRS will
2641 still work. This will cause any CMakeLists.txt files in the sub
2642 directories to be processed by CMake. Any directories after the
2643 PREORDER flag are traversed first by makefile builds, the PRE‐
2644 ORDER flag has no effect on IDE projects. Any directories after
2645 the EXCLUDE_FROM_ALL marker will not be included in the top
2646 level makefile or project file. This is useful for having CMake
2647 create makefiles or projects for a set of examples in a project.
2648 You would want CMake to generate makefiles or project files for
2649 all the examples at the same time, but you would not want them
2650 to show up in the top level project or be built each time make
2651 is run from the top.
2652
2653
2654 TARGET_LINK_LIBRARIES
2655 Link a target to given libraries.
2656
2657 TARGET_LINK_LIBRARIES(target library1
2658 <debug | optimized> library2
2659 ...)
2660
2661 Specify a list of libraries to be linked into the specified tar‐
2662 get. The debug and optimized strings may be used to indicate
2663 that the next library listed is to be used only for that spe‐
2664 cific type of build
2665
2666
2667 TRY_COMPILE
2668 Try compiling some code.
2669
2670 TRY_COMPILE(RESULT_VAR bindir srcdir
2671 projectName <targetname> <CMAKE_FLAGS <Flags>>
2672 <OUTPUT_VARIABLE var>)
2673
2674 Try compiling a program. In this form, srcdir should contain a
2675 complete CMake project with a CMakeLists.txt file and all
2676 sources. The bindir and srcdir will not be deleted after this
2677 command is run. If <target name> is specified then build just
2678 that target otherwise the all or ALL_BUILD target is built.
2679
2680
2681 TRY_COMPILE(RESULT_VAR bindir srcfile
2682 <CMAKE_FLAGS <Flags>>
2683 <COMPILE_DEFINITIONS <flags> ...>
2684 <OUTPUT_VARIABLE var>)
2685
2686 Try compiling a srcfile. In this case, the user need only sup‐
2687 ply a source file. CMake will create the appropriate CMake‐
2688 Lists.txt file to build the source. In this version all files in
2689 bindir/CMakeFiles/CMakeTmp, will be cleaned automatically, for
2690 debugging a --debug-trycompile can be passed to cmake to avoid
2691 the clean. Some extra flags that can be included are,
2692 INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. COM‐
2693 PILE_DEFINITIONS are -Ddefinition that will be passed to the
2694 compile line. TRY_COMPILE creates a CMakeList.txt file on the
2695 fly that looks like this:
2696
2697
2698 ADD_DEFINITIONS( <expanded COMPILE_DEFINITIONS from calling
2699 cmake>)
2700 INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})
2701 LINK_DIRECTORIES(${LINK_DIRECTORIES})
2702 ADD_EXECUTABLE(cmTryCompileExec sources)
2703 TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})
2704
2705 In both versions of the command, if OUTPUT_VARIABLE is speci‐
2706 fied, then the output from the build process is stored in the
2707 given variable. Return the success or failure in RESULT_VAR.
2708 CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags to the
2709 cmake that is run during the build.
2710
2711
2712 TRY_RUN
2713 Try compiling and then running some code.
2714
2715 TRY_RUN(RUN_RESULT_VAR COMPILE_RESULT_VAR
2716 bindir srcfile [CMAKE_FLAGS <Flags>]
2717 [COMPILE_DEFINITIONS <flags>]
2718 [OUTPUT_VARIABLE var]
2719 [ARGS <arg1> <arg2>...])
2720
2721 Try compiling a srcfile. Return TRUE or FALSE for success or
2722 failure in COMPILE_RESULT_VAR. Then if the compile succeeded,
2723 run the executable and return its exit code in RUN_RESULT_VAR.
2724 If the executable was built, but failed to run, then
2725 RUN_RESULT_VAR will be set to FAILED_TO_RUN. OUTPUT_VARIABLE
2726 specifies the name of the variable to put all of the standard
2727 output and standard error into.
2728
2729
2730 USE_MANGLED_MESA
2731 Copy mesa headers for use in combination with system GL.
2732
2733 USE_MANGLED_MESA(PATH_TO_MESA OUTPUT_DIRECTORY)
2734
2735 The path to mesa includes, should contain gl_mangle.h. The mesa
2736 headers are copied to the specified output directory. This
2737 allows mangled mesa headers to override other GL headers by
2738 being added to the include directory path earlier.
2739
2740
2741 UTILITY_SOURCE
2742 Specify the source tree of a third-party utility.
2743
2744 UTILITY_SOURCE(cache_entry executable_name
2745 path_to_source [file1 file2 ...])
2746
2747 When a third-party utility's source is included in the distribu‐
2748 tion, this command specifies its location and name. The cache
2749 entry will not be set unless the path_to_source and all listed
2750 files exist. It is assumed that the source tree of the utility
2751 will have been built before it is needed.
2752
2753
2754 VARIABLE_REQUIRES
2755 Assert satisfaction of an option's required variables.
2756
2757 VARIABLE_REQUIRES(TEST_VARIABLE RESULT_VARIABLE
2758 REQUIRED_VARIABLE1
2759 REQUIRED_VARIABLE2 ...)
2760
2761 The first argument (TEST_VARIABLE) is the name of the variable
2762 to be tested, if that variable is false nothing else is done. If
2763 TEST_VARIABLE is true, then the next argument (RESULT_VARIABLE)
2764 is a variable that is set to true if all the required variables
2765 are set. The rest of the arguments are variables that must be
2766 true or not set to NOTFOUND to avoid an error. If any are not
2767 true, an error is reported.
2768
2769
2770 VTK_MAKE_INSTANTIATOR
2771 Deprecated. For use only in VTK 4.0.
2772
2773 VTK_MAKE_INSTANTIATOR(className outSourceList
2774 src-list1 [src-list2 ..]
2775 EXPORT_MACRO exportMacro
2776 [HEADER_LOCATION dir]
2777 [GROUP_SIZE groupSize]
2778 [INCLUDES [file1 file2 ..]])
2779
2780 Generates a new class with the given name and adds its files to
2781 the given outSourceList. It registers the classes from the
2782 other given source lists with vtkInstantiator when it is loaded.
2783 The output source list should be added to the library with the
2784 classes it registers. The EXPORT_MACRO argument must be given
2785 and followed by the export macro to use when generating the
2786 class (ex. VTK_COMMON_EXPORT). The HEADER_LOCATION option must
2787 be followed by a path. It specifies the directory in which to
2788 place the generated class's header file. The generated class
2789 implementation files always go in the build directory corre‐
2790 sponding to the CMakeLists.txt file containing the command.
2791 This is the default location for the header. The INCLUDES
2792 option can be followed by a list of zero or more files. These
2793 files will be #included by the generated instantiator header,
2794 and can be used to gain access to the specified exportMacro in
2795 the C++ code.
2796
2797
2798 VTK_WRAP_JAVA
2799 Deprecated. For use only in VTK 4.0.
2800
2801 VTK_WRAP_JAVA(resultingLibraryName SourceListName
2802 class1 class2 ...)
2803
2804 Create Java wrappers for VTK classes.
2805
2806
2807 VTK_WRAP_PYTHON
2808 Deprecated. For use only in VTK 4.0.
2809
2810 VTK_WRAP_PYTHON(resultingLibraryName SourceListName
2811 class1 class2 ...)
2812
2813 Create Python wrappers for VTK classes.
2814
2815
2816 VTK_WRAP_TCL
2817 Deprecated. For use only in VTK 4.0.
2818
2819 VTK_WRAP_TCL(resultingLibraryName [SOURCES]
2820 SourceListName class1 class2 ...
2821 [COMMANDS CommandName1 CommandName2 ...])
2822
2823 Create Tcl wrappers for VTK classes.
2824
2825
2826 WHILE Evaluate a group of commands while a condition is true
2827
2828 WHILE(condition)
2829 COMMAND1(ARGS ...)
2830 COMMAND2(ARGS ...)
2831 ...
2832 ENDWHILE(condition)
2833
2834 All commands between WHILE and the matching ENDWHILE are
2835 recorded without being invoked. Once the ENDWHILE is evaluated,
2836 the recorded list of commands is invoked as long as the condi‐
2837 tion is true. The condition is evaulated using the same logic as
2838 the IF command.
2839
2840
2841 WRITE_FILE
2842 Write a message to a file.
2843
2844 WRITE_FILE(filename "message to write"... [APPEND])
2845
2846 The first argument is the file name, the rest of the arguments
2847 are messages to write. If the argument APPEND is specified, then
2848 the message will be appended.
2849
2850
2851 NOTE 1: FILE WRITE and FILE APPEND do exactly the same as this
2852 one but add some more functionality.
2853
2854
2855 NOTE 2: When using WRITE_FILE the produced file cannot be used
2856 as an input to CMake (CONFIGURE_FILE, source file ...) because
2857 it will lead to an infinite loop. Use CONFIGURE_FILE if you want
2858 to generate input files to CMake.
2859
2860
2862 The following modules are provided with CMake. They can be used with
2863 INCLUDE(ModuleName).
2864
2865
2866 AddFileDependencies
2867 ADD_FILE_DEPENDENCIES(source_file depend_files...)
2868
2869 Adds the given files as dependencies to source_file
2870
2871
2872
2873 CheckCCompilerFlag
2874 Check whether the C compiler supports a given flag.
2875
2876 CHECK_C_COMPILER_FLAG(FLAG VARIABLE)
2877
2878
2879 FLAG - the compiler flag
2880 VARIABLE - variable to store the result
2881
2882
2883 CheckCSourceCompiles
2884 macro which checks if the source code compiles
2885
2886 CHECK_C_SOURCE_COMPILES(SOURCE VAR)
2887
2888
2889 SOURCE - source code to try to compile
2890 VAR - variable to store whether the source code compiled
2891
2892
2893
2894
2895 The following variables may be set before calling this macro to
2896 modify the way the check is run:
2897
2898
2899 CMAKE_REQUIRED_FLAGS = string of compile command line flags
2900 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
2901 (-DFOO=bar)
2902 CMAKE_REQUIRED_INCLUDES = list of include directories
2903 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
2904
2905
2906 CheckCSourceRuns
2907 macro which checks if the source code runs
2908
2909 CHECK_C_SOURCE_RUNS(SOURCE VAR)
2910
2911
2912 SOURCE - source code to try to compile
2913 VAR - variable to store size if the type exists.
2914
2915
2916
2917
2918 The following variables may be set before calling this macro to
2919 modify the way the check is run:
2920
2921
2922 CMAKE_REQUIRED_FLAGS = string of compile command line flags
2923 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
2924 (-DFOO=bar)
2925 CMAKE_REQUIRED_INCLUDES = list of include directories
2926 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
2927
2928
2929 CheckCXXCompilerFlag
2930 Check whether the CXX compiler supports a given flag.
2931
2932 CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE)
2933
2934
2935 FLAG - the compiler flag
2936 VARIABLE - variable to store the result
2937
2938
2939 CheckCXXSourceCompiles
2940 macro which checks if the source code compiles
2941
2942 CHECK_CXX_SOURCE_COMPILES(SOURCE VAR)
2943
2944
2945 SOURCE - source code to try to compile
2946 VAR - variable to store whether the source code compiled
2947
2948
2949
2950
2951 The following variables may be set before calling this macro to
2952 modify the way the check is run:
2953
2954
2955 CMAKE_REQUIRED_FLAGS = string of compile command line flags
2956 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
2957 (-DFOO=bar)
2958 CMAKE_REQUIRED_INCLUDES = list of include directories
2959 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
2960
2961
2962 CheckCXXSourceRuns
2963 macro which checks if the source code compiles
2964
2965 CHECK_CXX_SOURCE_RUNS(SOURCE VAR)
2966
2967
2968 SOURCE - source code to try to compile
2969 VAR - variable to store size if the type exists.
2970
2971
2972
2973
2974 The following variables may be set before calling this macro to
2975 modify the way the check is run:
2976
2977
2978 CMAKE_REQUIRED_FLAGS = string of compile command line flags
2979 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
2980 (-DFOO=bar)
2981 CMAKE_REQUIRED_INCLUDES = list of include directories
2982 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
2983
2984
2985 CheckFunctionExists
2986 macro which checks if the function exists
2987
2988 CHECK_FUNCTION_EXISTS(FUNCTION VARIABLE)
2989
2990
2991 FUNCTION - the name of the function
2992 VARIABLE - variable to store the result
2993
2994
2995
2996
2997 The following variables may be set before calling this macro to
2998 modify the way the check is run:
2999
3000
3001 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3002 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3003 (-DFOO=bar)
3004 CMAKE_REQUIRED_INCLUDES = list of include directories
3005 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
3006
3007
3008 CheckIncludeFile
3009 macro which checks the include file exists.
3010
3011 CHECK_INCLUDE_FILE(INCLUDE VARIABLE)
3012
3013
3014 INCLUDE - name of include file
3015 VARIABLE - variable to return result
3016
3017
3018 an optional third argument is the CFlags to add to the compile
3019 line or you can use CMAKE_REQUIRED_FLAGS
3020
3021
3022 The following variables may be set before calling this macro to
3023 modify the way the check is run:
3024
3025
3026 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3027 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3028 (-DFOO=bar)
3029 CMAKE_REQUIRED_INCLUDES = list of include directories
3030
3031
3032
3033
3034
3035 CheckIncludeFileCXX
3036 Check if the include file exists.
3037
3038 CHECK_INCLUDE_FILE_CXX(INCLUDE VARIABLE)
3039
3040
3041
3042
3043 INCLUDE - name of include file
3044 VARIABLE - variable to return result
3045
3046
3047 An optional third argument is the CFlags to add to the compile
3048 line or you can use CMAKE_REQUIRED_FLAGS.
3049
3050
3051 The following variables may be set before calling this macro to
3052 modify the way the check is run:
3053
3054
3055 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3056 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3057 (-DFOO=bar)
3058 CMAKE_REQUIRED_INCLUDES = list of include directories
3059
3060
3061
3062
3063
3064 CheckIncludeFiles
3065 Check if the files can be included
3066
3067
3068
3069
3070 CHECK_INCLUDE_FILES(INCLUDE VARIABLE)
3071
3072
3073 INCLUDE - list of files to include
3074 VARIABLE - variable to return result
3075
3076
3077
3078
3079 The following variables may be set before calling this macro to
3080 modify the way the check is run:
3081
3082
3083 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3084 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3085 (-DFOO=bar)
3086 CMAKE_REQUIRED_INCLUDES = list of include directories
3087
3088
3089 CheckLibraryExists
3090 Check if the function exists.
3091
3092 CHECK_LIBRARY_EXISTS (LIBRARY FUNCTION LOCATION VARIABLE)
3093
3094
3095 LIBRARY - the name of the library you are looking for
3096 FUNCTION - the name of the function
3097 LOCATION - location where the library should be found
3098 VARIABLE - variable to store the result
3099
3100
3101
3102
3103 The following variables may be set before calling this macro to
3104 modify the way the check is run:
3105
3106
3107 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3108 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3109 (-DFOO=bar)
3110 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
3111
3112
3113 CheckSymbolExists
3114 Check if the symbol exists in include files
3115
3116 CHECK_SYMBOL_EXISTS(SYMBOL FILES VARIABLE)
3117
3118
3119 SYMBOL - symbol
3120 FILES - include files to check
3121 VARIABLE - variable to return result
3122
3123
3124
3125
3126 The following variables may be set before calling this macro to
3127 modify the way the check is run:
3128
3129
3130 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3131 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3132 (-DFOO=bar)
3133 CMAKE_REQUIRED_INCLUDES = list of include directories
3134 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
3135
3136
3137 CheckTypeSize
3138 Check sizeof a type
3139
3140 CHECK_TYPE_SIZE(TYPE VARIABLE)
3141
3142 Check if the type exists and determine size of type. if the
3143 type exists, the size will be stored to the variable.
3144
3145
3146 VARIABLE - variable to store size if the type exists.
3147 HAVE_${VARIABLE} - does the variable exists or not
3148
3149 The following variables may be set before calling this macro to
3150 modify the way the check is run:
3151
3152
3153 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3154 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3155 (-DFOO=bar)
3156 CMAKE_REQUIRED_INCLUDES = list of include directories
3157 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
3158
3159
3160 CheckVariableExists
3161 Check if the variable exists.
3162
3163 CHECK_VARIABLE_EXISTS(VAR VARIABLE)
3164
3165 VAR - the name of the variable
3166 VARIABLE - variable to store the result
3167
3168
3169
3170
3171 This macro is only for C variables.
3172
3173
3174 The following variables may be set before calling this macro to
3175 modify the way the check is run:
3176
3177
3178 CMAKE_REQUIRED_FLAGS = string of compile command line flags
3179 CMAKE_REQUIRED_DEFINITIONS = list of macros to define
3180 (-DFOO=bar)
3181 CMAKE_REQUIRED_LIBRARIES = list of libraries to link
3182
3183
3184 CMakeBackwardCompatibilityCXX
3185 define a bunch of backwards compatibility variables
3186
3187 CMAKE_ANSI_CXXFLAGS - flag for ansi c++
3188 CMAKE_HAS_ANSI_STRING_STREAM - has <strstream>
3189 INCLUDE(TestForANSIStreamHeaders)
3190 INCLUDE(CheckIncludeFileCXX)
3191 INCLUDE(TestForSTDNamespace)
3192 INCLUDE(TestForANSIForScope)
3193
3194
3195 CMakeDependentOption
3196 Macro to provide an option dependent on other options.
3197
3198 This macro presents an option to the user only if a set of other
3199 conditions are true. When the option is not presented a default
3200 value is used, but any value set by the user is preserved for
3201 when the option is presented again. Example invocation:
3202
3203
3204 CMAKE_DEPENDENT_OPTION(USE_FOO "Use Foo" ON
3205 "USE_BAR;NOT USE_ZOT" OFF)
3206
3207 If USE_BAR is true and USE_ZOT is false, this provides an option
3208 called USE_FOO that defaults to ON. Otherwise, it sets USE_FOO
3209 to OFF. If the status of USE_BAR or USE_ZOT ever changes, any
3210 value for the USE_FOO option is saved so that when the option is
3211 re-enabled it retains its old value.
3212
3213
3214 CMakeExportBuildSettings
3215 export build settings from a project.
3216
3217 CMAKE_EXPORT_BUILD_SETTINGS(SETTINGS_FILE)
3218
3219 macro defined to export the build settings for use by another
3220 project.
3221
3222
3223 SETTINGS_FILE - the file into which the settings are to be
3224 stored.
3225
3226
3227 CMakeFindFrameworks
3228 helper module to find OSX frameworks
3229
3230
3231 CMakeImportBuildSettings
3232 import build settings from another project
3233
3234 CMAKE_IMPORT_BUILD_SETTINGS(SETTINGS_FILE)
3235
3236 macro defined to import the build settings from another project.
3237 SETTINGS_FILE is a file created by the other project's call to
3238 the CMAKE_EXPORT_BUILD_SETTINGS macro, see CMakeExportBuildSet‐
3239 tings.
3240
3241
3242 CMakeJavaInformation
3243
3244 This should be included before the _INIT variables are used to
3245 initialize the cache. Since the rule variables have if blocks
3246 on them, users can still define them here. But, it should still
3247 be after the platform file so changes can be made to those val‐
3248 ues.
3249
3250
3251 CMakePrintSystemInformation
3252 print system information
3253
3254 This file can be used for diagnostic purposes just include it in
3255 a project to see various internal CMake variables.
3256
3257
3258 CPack
3259
3260 Default output files will be CPackConfig.cmake and CPackSource‐
3261 Config.cmake. This can be overwritten with CPACK_OUTPUT_CON‐
3262 FIG_FILE and CPACK_SOURCE_OUTPUT_CONFIG_FILE.
3263
3264
3265 CTest setup CTest
3266
3267 This file configures a project to use the CTest/Dart test‐
3268 ing/dashboard process.
3269
3270
3271 Dart setup for using Dart.
3272
3273 This file configures a project to use the Dart testing/dashboard
3274 process. It is broken into 3 sections.
3275
3276
3277 Documentation
3278 DocumentationVTK.cmake
3279
3280 This file provides support for the VTK documentation framework.
3281 It relies on several tools (Doxygen, Perl, etc).
3282
3283
3284 FindASPELL
3285 Try to find ASPELL
3286
3287 Once done this will define
3288
3289
3290 ASPELL_FOUND - system has ASPELL
3291 ASPELL_INCLUDE_DIR - the ASPELL include directory
3292 ASPELL_LIBRARIES - The libraries needed to use ASPELL
3293 ASPELL_DEFINITIONS - Compiler switches required for using
3294 ASPELL
3295
3296
3297 FindAVIFile
3298 Locate AVIFILE library and include paths
3299
3300 AVIFILE (http://avifile.sourceforge.net/)is a set of libraries
3301 for i386 machines to use various AVI codecs. Support is limited
3302 beyond Linux. Windows provides native AVI support, and so
3303 doesn't need this library. This module defines
3304
3305
3306 AVIFILE_INCLUDE_DIR, where to find avifile.h , etc.
3307 AVIFILE_LIBRARIES, the libraries to link against
3308 AVIFILE_DEFINITIONS, definitions to use when compiling
3309 AVIFILE_FOUND, If false, don't try to use AVIFILE
3310
3311
3312 FindBoost
3313 Find the Boost includes and libraries.
3314
3315 The following variables are set if Boost is found. If Boost is
3316 not found, Boost_FOUND is set to false.
3317
3318
3319 Boost_FOUND - True when the Boost include directory is
3320 found.
3321 Boost_INCLUDE_DIRS - the path to where the boost include files
3322 are.
3323 Boost_LIBRARY_DIRS - The path to where the boost library files
3324 are.
3325 Boost_LIB_DIAGNOSTIC_DEFINITIONS - Only set if using Windows.
3326
3327
3328 FindBZip2
3329 Try to find BZip2
3330
3331 Once done this will define
3332
3333
3334 BZIP2_FOUND - system has BZip2
3335 BZIP2_INCLUDE_DIR - the BZip2 include directory
3336 BZIP2_LIBRARIES - Link these to use BZip2
3337 BZIP2_DEFINITIONS - Compiler switches required for using BZip2
3338 BZIP2_NEED_PREFIX - this is set if the functions are prefixed
3339 with BZ2_
3340
3341
3342 FindCABLE
3343 Find CABLE
3344
3345 This module finds if CABLE is installed and determines where the
3346 include files and libraries are. This code sets the following
3347 variables:
3348
3349
3350 CABLE the path to the cable executable
3351 CABLE_TCL_LIBRARY the path to the Tcl wrapper library
3352 CABLE_INCLUDE_DIR the path to the include directory
3353
3354
3355
3356
3357 To build Tcl wrappers, you should add shared library and link it
3358 to ${CABLE_TCL_LIBRARY}. You should also add
3359 ${CABLE_INCLUDE_DIR} as an include directory.
3360
3361
3362 FindCURL
3363 Find curl
3364
3365 Find the native CURL headers and libraries.
3366
3367
3368 CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
3369 CURL_LIBRARIES - List of libraries when using curl.
3370 CURL_FOUND - True if curl found.
3371
3372
3373 FindCurses
3374 Find the curses include file and library
3375
3376
3377
3378
3379
3380 FindCygwin
3381 this module looks for Cygwin
3382
3383
3384
3385
3386
3387 FindDart
3388 Find DART
3389
3390 This module looks for the dart testing software and sets
3391 DART_ROOT to point to where it found it.
3392
3393
3394
3395 FindDCMTK
3396 find DCMTK libraries
3397
3398
3399
3400
3401
3402 FindDoxygen
3403 This module looks for Doxygen and the path to Graphviz's dot
3404
3405 Doxygen is a documentation generation tool see http://www.doxy‐
3406 gen.org With the OS X GUI version, it likes to be installed to
3407 /Applications and it contains the doxygen executable in the bun‐
3408 dle. In the versions I've seen, it is located in Resources, but
3409 in general, more often binaries are located in MacOS. This code
3410 sets the following variables:
3411
3412
3413 DOXYGEN_EXECUTABLE = The path to the doxygen command.
3414 DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by
3415 doxygen.
3416 DOXYGEN_DOT_PATH = The path to dot not including the
3417 executable
3418 DOXYGEN = same as DOXYGEN_EXECUTABLE for backwards compatibil‐
3419 ity
3420 DOT = same as DOXYGEN_DOT_EXECUTABLE for backwards compatibil‐
3421 ity
3422
3423
3424 FindEXPAT
3425 Find expat
3426
3427 Find the native EXPAT headers and libraries.
3428
3429
3430 EXPAT_INCLUDE_DIRS - where to find expat.h, etc.
3431 EXPAT_LIBRARIES - List of libraries when using expat.
3432 EXPAT_FOUND - True if expat found.
3433
3434
3435 FindFLTK
3436 Find the native FLTK includes and library
3437
3438 The following settings are defined
3439
3440
3441 FLTK_FLUID_EXECUTABLE, where to find the Fluid tool
3442 FLTK_WRAP_UI, This enables the FLTK_WRAP_UI command
3443 FLTK_INCLUDE_DIR, where to find include files
3444 FLTK_LIBRARIES, list of fltk libraries
3445 FLTK_FOUND, Don't use FLTK if false.
3446
3447 The following settings should not be used in general.
3448
3449
3450 FLTK_BASE_LIBRARY = the full path to fltk.lib
3451 FLTK_GL_LIBRARY = the full path to fltk_gl.lib
3452 FLTK_FORMS_LIBRARY = the full path to fltk_forms.lib
3453 FLTK_IMAGES_LIBRARY = the full path to fltk_images.lib
3454
3455
3456 FindGCCXML
3457 Find the GCC-XML front-end executable.
3458
3459
3460 FindGLUT
3461 try to find glut library and include files
3462
3463 GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
3464 GLUT_LIBRARIES, the libraries to link against
3465 GLUT_FOUND, If false, do not try to use GLUT.
3466
3467 Also defined, but not for general use are:
3468
3469
3470 GLUT_glut_LIBRARY = the full path to the glut library.
3471 GLUT_Xmu_LIBRARY = the full path to the Xmu library.
3472 GLUT_Xi_LIBRARY = the full path to the Xi Library.
3473
3474
3475 FindGnuplot
3476 this module looks for gnuplot
3477
3478
3479
3480
3481
3482 FindGTK
3483 try to find GTK (and glib) and GTKGLArea
3484
3485 GTK_INCLUDE_DIR - Directories to include to use GTK
3486 GTK_LIBRARIES - Files to link against to use GTK
3487 GTK_FOUND - GTK was found
3488 GTK_GL_FOUND - GTK's GL features were found
3489
3490
3491 FindHSPELL
3492 Try to find HSPELL
3493
3494 Once done this will define
3495
3496
3497 HSPELL_FOUND - system has HSPELL
3498 HSPELL_INCLUDE_DIR - the HSPELL include directory
3499 HSPELL_LIBRARIES - The libraries needed to use HSPELL
3500 HSPELL_DEFINITIONS - Compiler switches required for using
3501 HSPELL
3502
3503
3504 FindHTMLHelp
3505 This module looks for Microsoft HTML Help Compiler
3506
3507 It defines:
3508
3509
3510 HTML_HELP_COMPILER : full path to the Compiler (hhc.exe)
3511 HTML_HELP_INCLUDE_PATH : include path to the API (htmlhelp.h)
3512 HTML_HELP_LIBRARY : full path to the library (html‐
3513 help.lib)
3514
3515
3516
3517
3518
3519 FindImageMagick
3520 Find Image Magick
3521
3522 This module finds if ImageMagick tools are installed and deter‐
3523 mines where the executables are. This code sets the following
3524 variables:
3525
3526
3527 IMAGEMAGICK_CONVERT_EXECUTABLE =
3528 the full path to the 'convert' utility
3529 IMAGEMAGICK_MOGRIFY_EXECUTABLE =
3530 the full path to the 'mogrify' utility
3531 IMAGEMAGICK_IMPORT_EXECUTABLE =
3532 the full path to the 'import' utility
3533 IMAGEMAGICK_MONTAGE_EXECUTABLE =
3534 the full path to the 'montage' utility
3535 IMAGEMAGICK_COMPOSITE_EXECUTABLE =
3536 the full path to the 'composite' utility
3537
3538
3539
3540
3541
3542 FindITK
3543 Find an ITK installation or build tree.
3544
3545
3546 FindJasper
3547 Try to find the Jasper JPEG2000 library
3548
3549 Once done this will define
3550
3551
3552 JASPER_FOUND - system has Jasper
3553 JASPER_INCLUDE_DIR - the Jasper include directory
3554 JASPER_LIBRARIES - The libraries needed to use Jasper
3555
3556
3557 FindJava
3558 Find Java
3559
3560 This module finds if Java is installed and determines where the
3561 include files and libraries are. This code sets the following
3562 variables:
3563
3564
3565 JAVA_RUNTIME = the full path to the Java runtime
3566 JAVA_COMPILE = the full path to the Java compiler
3567 JAVA_ARCHIVE = the full path to the Java archiver
3568
3569
3570
3571
3572
3573 FindJNI
3574 Find JNI java libraries.
3575
3576 This module finds if Java is installed and determines where the
3577 include files and libraries are. It also determines what the
3578 name of the library is. This code sets the following variables:
3579
3580
3581
3582 JAVA_AWT_LIB_PATH = the path to the jawt library
3583 JAVA_JVM_LIB_PATH = the path to the jvm library
3584 JAVA_INCLUDE_PATH = the include path to jni.h
3585 JAVA_INCLUDE_PATH2 = the include path to jni_md.h
3586 JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
3587
3588
3589
3590
3591
3592 FindJPEG
3593 Find JPEG
3594
3595 Find the native JPEG includes and library This module defines
3596
3597
3598 JPEG_INCLUDE_DIR, where to find jpeglib.h, etc.
3599 JPEG_LIBRARIES, the libraries needed to use JPEG.
3600 JPEG_FOUND, If false, do not try to use JPEG.
3601
3602 also defined, but not for general use are
3603
3604
3605 JPEG_LIBRARY, where to find the JPEG library.
3606
3607
3608 FindKDE3
3609 Find the KDE3 include and library dirs, KDE preprocessors and
3610 define a some macros
3611
3612
3613
3614
3615 This module defines the following variables: KDE3_DEFINITIONS
3616 - compiler definitions required for compiling KDE software
3617 KDE3_INCLUDE_DIR - the KDE include directory
3618 KDE3_INCLUDE_DIRS - the KDE and the Qt include directory,
3619 for use with INCLUDE_DIRECTORIES() KDE3_LIB_DIR -
3620 the directory where the KDE libraries are installed, for use
3621 with LINK_DIRECTORIES() QT_AND_KDECORE_LIBS - this contains
3622 both the Qt and the kdecore library KDE3_DCOPIDL_EXECUTABLE -
3623 the dcopidl executable KDE3_DCOPIDL2CPP_EXECUTABLE - the
3624 dcopidl2cpp executable KDE3_KCFGC_EXECUTABLE - the kcon‐
3625 fig_compiler executable KDE3_FOUND - set to TRUE
3626 if all of the above has been found
3627
3628
3629 The following user adjustable options are provided:
3630
3631
3632 KDE3_BUILD_TESTS - enable this to build KDE testcases
3633
3634
3635
3636
3637
3638 It also adds the following macros (from KDE3Macros.cmake)
3639 SRCS_VAR is always the variable which contains the list of
3640 source files for your application or library.
3641
3642
3643 KDE3_AUTOMOC(file1 ... fileN)
3644
3645
3646 Call this if you want to have automatic moc file handling.
3647 This means if you include "foo.moc" in the source file
3648 foo.cpp
3649 a moc file for the header foo.h will be created automati‐
3650 cally.
3651 You can set the property SKIP_AUTOMAKE using
3652 SET_SOURCE_FILES_PROPERTIES()
3653 to exclude some files in the list from being processed.
3654
3655
3656
3657
3658 KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN )
3659
3660
3661 If you don't use the KDE3_AUTOMOC() macro, for the files
3662 listed here moc files will be created (named "foo.moc.cpp")
3663
3664
3665
3666
3667 KDE3_ADD_DCOP_SKELS(SRCS_VAR header1.h ... headerN.h )
3668
3669
3670 Use this to generate DCOP skeletions from the listed head‐
3671 ers.
3672
3673
3674
3675
3676 KDE3_ADD_DCOP_STUBS(SRCS_VAR header1.h ... headerN.h )
3677
3678
3679 Use this to generate DCOP stubs from the listed headers.
3680
3681
3682
3683
3684 KDE3_ADD_UI_FILES(SRCS_VAR file1.ui ... fileN.ui )
3685
3686
3687 Use this to add the Qt designer ui files to your applica‐
3688 tion/library.
3689
3690
3691
3692
3693 KDE3_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc ... fileN.kcfgc )
3694
3695
3696 Use this to add KDE kconfig compiler files to your applica‐
3697 tion/library.
3698
3699
3700
3701
3702 KDE3_INSTALL_LIBTOOL_FILE(target)
3703
3704
3705 This will create and install a simple libtool file for the
3706 given target.
3707
3708
3709
3710
3711 KDE3_ADD_EXECUTABLE(name file1 ... fileN )
3712
3713
3714 Currently identical to ADD_EXECUTABLE(), may provide some
3715 advanced features in the future.
3716
3717
3718
3719
3720 KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN )
3721
3722
3723 Create a KDE plugin (KPart, kioslave, etc.) from the given
3724 source files.
3725 If WITH_PREFIX is given, the resulting plugin will have the
3726 prefix "lib", otherwise it won't.
3727 It creates and installs an appropriate libtool la-file.
3728
3729
3730
3731
3732 KDE3_ADD_KDEINIT_EXECUTABLE(name file1 ... fileN )
3733
3734
3735 Create a KDE application in the form of a module loadable
3736 via kdeinit.
3737 A library named kdeinit_<name> will be created and a small
3738 executable which links to it.
3739
3740
3741
3742
3743 The option KDE3_ENABLE_FINAL to enable all-in-one compilation is
3744 no longer supported.
3745
3746
3747
3748
3749
3750 Author: Alexander Neundorf <neundorf@kde.org>
3751
3752
3753 FindKDE4
3754 /opt/kde
3755
3756 Find KDE4 and provide all necessary variables and macros to com‐
3757 pile software for it. It looks for KDE 4 in the following direc‐
3758 tories in the given order:
3759
3760
3761 Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for
3762 more information. They are installed with the KDE 4 libraries in
3763 $KDEDIRS/share/apps/cmake/modules/.
3764
3765
3766 Author: Alexander Neundorf <neundorf@kde.org>
3767
3768
3769 FindLATEX
3770 Find Latex
3771
3772 This module finds if Latex is installed and determines where the
3773 executables are. This code sets the following variables:
3774
3775
3776
3777 LATEX_COMPILER: path to the LaTeX compiler
3778 PDFLATEX_COMPILER: path to the PdfLaTeX compiler
3779 BIBTEX_COMPILER: path to the BibTeX compiler
3780 MAKEINDEX_COMPILER: path to the MakeIndex compiler
3781 DVIPS_CONVERTER: path to the DVIPS converter
3782 PS2PDF_CONVERTER: path to the PS2PDF converter
3783 LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
3784
3785
3786
3787
3788
3789 FindLibXml2
3790 Try to find LibXml2
3791
3792 Once done this will define
3793
3794
3795 LIBXML2_FOUND - system has LibXml2
3796 LIBXML2_INCLUDE_DIR - the LibXml2 include directory
3797 LIBXML2_LIBRARIES - the libraries needed to use LibXml2
3798 LIBXML2_DEFINITIONS - Compiler switches required for using
3799 LibXml2
3800
3801
3802
3803
3804 Copyright (c) 2006, Alexander Neundorf <neundorf@kde.org> This
3805 code is available under the BSD license, see licenses/BSD for
3806 details.
3807
3808
3809 FindLibXslt
3810 Try to find LibXslt
3811
3812 Once done this will define
3813
3814
3815 LIBXSLT_FOUND - system has LibXslt
3816 LIBXSLT_INCLUDE_DIR - the LibXslt include directory
3817 LIBXSLT_LIBRARIES - Link these to LibXslt
3818 LIBXSLT_DEFINITIONS - Compiler switches required for using
3819 LibXslt
3820
3821
3822 FindMatlab
3823 this module looks for Matlab
3824
3825 Defines:
3826
3827
3828 MATLAB_INCLUDE_DIR: include path for mex.h, engine.h
3829 MATLAB_LIBRARIES: required libraries: libmex, etc
3830 MATLAB_MEX_LIBRARY: path to libmex.lib
3831 MATLAB_MX_LIBRARY: path to libmx.lib
3832 MATLAB_ENG_LIBRARY: path to libeng.lib
3833
3834
3835 FindMFC
3836 Find MFC on Windows
3837
3838 Find the native MFC - i.e. decide if this is an MS VC box.
3839
3840
3841 MFC_FOUND - Was MFC support found
3842
3843 You don't need to include anything or link anything to use it.
3844
3845
3846 FindMotif
3847 Try to find Motif (or lesstif)
3848
3849 Once done this will define:
3850
3851
3852 MOTIF_FOUND - system has MOTIF
3853 MOTIF_INCLUDE_DIR - incude paths to use Motif
3854 MOTIF_LIBRARIES - Link these to use Motif
3855
3856
3857 FindMPEG
3858 Find the native MPEG includes and library
3859
3860 This module defines
3861
3862
3863 MPEG_INCLUDE_DIR, where to find MPEG.h, etc.
3864 MPEG_LIBRARIES, the libraries required to use MPEG.
3865 MPEG_FOUND, If false, do not try to use MPEG.
3866
3867 also defined, but not for general use are
3868
3869
3870 MPEG_mpeg2_LIBRARY, where to find the MPEG library.
3871 MPEG_vo_LIBRARY, where to find the vo library.
3872
3873
3874 FindMPEG2
3875 Find the native MPEG2 includes and library
3876
3877 This module defines
3878
3879
3880 MPEG2_INCLUDE_DIR, path to mpeg2dec/mpeg2.h, etc.
3881 MPEG2_LIBRARIES, the libraries required to use MPEG2.
3882 MPEG2_FOUND, If false, do not try to use MPEG2.
3883
3884 also defined, but not for general use are
3885
3886
3887 MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
3888 MPEG2_vo_LIBRARY, where to find the vo library.
3889
3890
3891 FindMPI
3892 Find MPI
3893
3894 This module looks for MPI (Message Passing Interface) support it
3895 will define the following values
3896
3897
3898 MPI_INCLUDE_PATH = where mpi.h can be found
3899 MPI_LIBRARY = the library to link in (mpi mpich etc)
3900
3901
3902 FindOpenAL
3903 Locate OpenAL
3904
3905 This module defines
3906
3907
3908 OPENAL_LIBRARY
3909 OPENAL_FOUND, if false, do not try to link to OpenAL
3910 OPENAL_INCLUDE_DIR, where to find the headers
3911
3912
3913 $OPENALDIR is an environment variable that would correspond to
3914 the ./configure --prefix=$OPENALDIR used in building OpenAL.
3915
3916
3917
3918
3919 Created by Eric Wing. This was influenced by the FindSDL.cmake
3920 module. On OSX, this will prefer the Framework version (if
3921 found) over others. People will have to manually change the
3922 cache values of OPENAL_LIBRARY to override this selection.
3923 Tiger will include OpenAL as part of the System. But for now, we
3924 have to look around. Other (Unix) systems should be able to uti‐
3925 lize the non-framework paths.
3926
3927
3928 FindOpenGL
3929 Try to find OpenGL
3930
3931 Once done this will define
3932
3933
3934
3935 OPENGL_FOUND - system has OpenGL
3936 OPENGL_XMESA_FOUND - system has XMESA
3937 OPENGL_GLU_FOUND - system has GLU
3938 OPENGL_INCLUDE_DIR - the GL include directory
3939 OPENGL_LIBRARIES - Link these to use OpenGL and GLU
3940
3941
3942 If you want to use just GL you can use these values
3943
3944
3945 OPENGL_gl_LIBRARY - Path to OpenGL Library
3946 OPENGL_glu_LIBRARY - Path to GLU Library
3947
3948
3949 On OSX default to using the framework version of opengl People
3950 will have to change the cache values of OPENGL_glu_LIBRARY and
3951 OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
3952
3953
3954 FindOpenSSL
3955 Try to find the OpenSSL encryption library
3956
3957 Once done this will define
3958
3959
3960 OPENSSL_FOUND - system has the OpenSSL library
3961 OPENSSL_INCLUDE_DIR - the OpenSSL include directory
3962 OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
3963
3964
3965 FindPerl
3966 Find perl
3967
3968 this module looks for Perl
3969
3970
3971 PERL_EXECUTABLE - the full path to perl
3972 PERL_FOUND - If false, don't attempt to use perl.
3973
3974
3975 FindPerlLibs
3976 Find Perl libraries
3977
3978 This module finds if PERL is installed and determines where the
3979 include files and libraries are. It also determines what the
3980 name of the library is. This code sets the following variables:
3981
3982
3983 PERL_INCLUDE_PATH = path to where perl.h is found
3984 PERL_EXECUTABLE = full path to the perl binary
3985
3986
3987
3988
3989
3990 FindPHP4
3991 Find PHP4
3992
3993 This module finds if PHP4 is installed and determines where the
3994 include files and libraries are. It also determines what the
3995 name of the library is. This code sets the following variables:
3996
3997
3998 PHP4_INCLUDE_PATH = path to where php.h can be found
3999 PHP4_EXECUTABLE = full path to the php4 binary
4000
4001
4002
4003
4004
4005 FindPhysFS
4006 Locate PhysFS library
4007
4008 This module defines
4009
4010
4011 PHYSFS_LIBRARY, the name of the library to link with
4012 PHYSFS_FOUND, if false, do not try to link to PHYSFS
4013 PHYSFS_INCLUDE_DIR, where to find PHYSFS/PHYSFS.h
4014
4015
4016
4017
4018 $PHYSFSDIR is an environment variable that would correspond to
4019 the ./configure --prefix=$PHYSFSDIR used in building PHYSFS.
4020
4021
4022 Created by Eric Wing. This was influenced by the FindSDL.cmake
4023 module, but with modifications to recognize OS X frameworks.
4024
4025
4026 FindPike
4027 Find Pike
4028
4029 This module finds if PIKE is installed and determines where the
4030 include files and libraries are. It also determines what the
4031 name of the library is. This code sets the following variables:
4032
4033
4034 PIKE_INCLUDE_PATH = path to where program.h is found
4035 PIKE_EXECUTABLE = full path to the pike binary
4036
4037
4038
4039
4040
4041 FindPkgConfig
4042 a pkg-config module for CMake
4043
4044
4045
4046
4047 Usage:
4048
4049
4050 pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
4051 checks for all the given modules
4052
4053
4054
4055
4056 pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
4057 checks for given modules and uses the first working one
4058
4059
4060
4061
4062 When the 'REQUIRED' argument was set, macros will fail with an
4063 error when module(s) could not be found
4064
4065
4066 It sets the following variables:
4067
4068
4069 PKG_CONFIG_FOUND ... true iff pkg-config works on the
4070 system
4071 PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config pro‐
4072 gram
4073 <PREFIX>_FOUND ... set to 1 iff module(s) exist
4074
4075
4076
4077
4078 For the following variables two sets of values exist; first one
4079 is the common one and has the given PREFIX. The second set con‐
4080 tains flags which are given out when pkgconfig was called with
4081 the '--static' option.
4082
4083
4084 <XPREFIX>_LIBRARIES ... only the libraries (w/o the
4085 '-l')
4086 <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o
4087 the '-L')
4088 <XPREFIX>_LDFLAGS ... all required linker flags
4089 <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
4090 <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o
4091 the '-I')
4092 <XPREFIX>_CFLAGS ... all required cflags
4093 <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
4094
4095
4096
4097
4098 <XPREFIX> = <PREFIX> for common case
4099 <XPREFIX> = <PREFIX>_STATIC for static linking
4100
4101
4102
4103
4104 There are some special variables whose prefix depends on the
4105 count of given modules. When there is only one module, <PREFIX>
4106 stays unchanged. When there are multiple modules, the prefix
4107 will be changed to <PREFIX>_<MODNAME>:
4108
4109
4110 <XPREFIX>_VERSION ... version of the module
4111 <XPREFIX>_PREFIX ... prefix-directory of the module
4112 <XPREFIX>_INCLUDEDIR ... include-dir of the module
4113 <XPREFIX>_LIBDIR ... lib-dir of the module
4114
4115
4116
4117
4118 <XPREFIX> = <PREFIX> when |MODULES| == 1, else
4119 <XPREFIX> = <PREFIX>_<MODNAME>
4120
4121
4122
4123
4124 A <MODULE> parameter can have the following formats:
4125
4126
4127 {MODNAME} ... matches any version
4128 {MODNAME}>={VERSION} ... at least version <VERSION> is
4129 required
4130 {MODNAME}={VERSION} ... exactly version <VERSION> is
4131 required
4132 {MODNAME}<={VERSION} ... modules must not be newer than <VER‐
4133 SION>
4134
4135
4136
4137
4138 Examples
4139
4140
4141 pkg_check_modules (GLIB2 glib-2.0)
4142
4143
4144
4145
4146 pkg_check_modules (GLIB2 glib-2.0>=2.10)
4147 requires at least version 2.10 of glib2 and defines e.g.
4148 GLIB2_VERSION=2.10.3
4149
4150
4151
4152
4153 pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
4154 requires both glib2 and gtk2, and defines e.g.
4155 FOO_glib-2.0_VERSION=2.10.3
4156 FOO_gtk+-2.0_VERSION=2.8.20
4157
4158
4159
4160
4161 pkg_check_modules (XRENDER REQUIRED xrender)
4162 defines e.g.:
4163 XRENDER_LIBRARIES=Xrender;X11
4164 XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
4165
4166
4167
4168
4169 pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
4170
4171
4172 FindPNG
4173 Find the native PNG includes and library
4174
4175
4176
4177
4178
4179 FindPythonInterp
4180 Find python interpreter
4181
4182 This module finds if Python interpreter is installed and deter‐
4183 mines where the executables are. This code sets the following
4184 variables:
4185
4186
4187 PYTHONINTERP_FOUND - Was the Python executable found
4188 PYTHON_EXECUTABLE - path to the Python interpreter
4189
4190
4191
4192
4193
4194 FindPythonLibs
4195 Find python libraries
4196
4197 This module finds if Python is installed and determines where
4198 the include files and libraries are. It also determines what the
4199 name of the library is. This code sets the following variables:
4200
4201
4202 PYTHON_LIBRARIES = path to the python library
4203 PYTHON_INCLUDE_PATH = path to where Python.h is found
4204 PYTHON_DEBUG_LIBRARIES = path to the debug library
4205
4206
4207
4208
4209
4210 FindQt Searches for all installed versions of QT.
4211
4212 This should only be used if your project can work with multiple
4213 versions of QT. If not, you should just directly use FindQt4 or
4214 FindQt3. If multiple versions of QT are found on the machine,
4215 then The user must set the option DESIRED_QT_VERSION to the ver‐
4216 sion they want to use. If only one version of qt is found on
4217 the machine, then the DESIRED_QT_VERSION is set to that version
4218 and the matching FindQt3 or FindQt4 module is included. Once
4219 the user sets DESIRED_QT_VERSION, then the FindQt3 or FindQt4
4220 module is included.
4221
4222
4223 QT_REQUIRED if this is set to TRUE then if CMake can
4224 not find QT4 or QT3 an error is raised
4225 and a message is sent to the user.
4226
4227
4228
4229
4230 DESIRED_QT_VERSION OPTION is created
4231 QT4_INSTALLED is set to TRUE if qt4 is found.
4232 QT3_INSTALLED is set to TRUE if qt3 is found.
4233
4234
4235 FindQt3
4236 Locate Qt include paths and libraries
4237
4238 This module defines:
4239
4240
4241 QT_INCLUDE_DIR - where to find qt.h, etc.
4242 QT_LIBRARIES - the libraries to link against to use Qt.
4243 QT_DEFINITIONS - definitions to use when
4244 compiling code that uses Qt.
4245 QT_FOUND - If false, don't try to use Qt.
4246
4247
4248
4249
4250 If you need the multithreaded version of Qt, set QT_MT_REQUIRED
4251 to TRUE
4252
4253
4254 Also defined, but not for general use are:
4255
4256
4257 QT_MOC_EXECUTABLE, where to find the moc tool.
4258 QT_UIC_EXECUTABLE, where to find the uic tool.
4259 QT_QT_LIBRARY, where to find the Qt library.
4260 QT_QTMAIN_LIBRARY, where to find the qtmain
4261 library. This is only required by Qt3 on Windows.
4262
4263
4264 FindQt4
4265 Find QT 4
4266
4267 This module can be used to find Qt4. The most important issue is
4268 that the Qt4 qmake is available via the system path. This qmake
4269 is then used to detect basically everything else. This module
4270 defines a number of key variables and macros. First is
4271 QT_USE_FILE which is the path to a CMake file that can be
4272 included to compile Qt 4 applications and libraries. By
4273 default, the QtCore and QtGui libraries are loaded. This behav‐
4274 ior can be changed by setting one or more of the following
4275 variables to true:
4276
4277
4278 QT_DONT_USE_QTCORE
4279 QT_DONT_USE_QTGUI
4280 QT_USE_QT3SUPPORT
4281 QT_USE_QTASSISTANT
4282 QT_USE_QTDESIGNER
4283 QT_USE_QTMOTIF
4284 QT_USE_QTMAIN
4285 QT_USE_QTNETWORK
4286 QT_USE_QTNSPLUGIN
4287 QT_USE_QTOPENGL
4288 QT_USE_QTSQL
4289 QT_USE_QTXML
4290 QT_USE_QTSVG
4291 QT_USE_QTTEST
4292 QT_USE_QTUITOOLS
4293 QT_USE_QTDBUS
4294 QT_USE_QTSCRIPT
4295
4296
4297
4298
4299 All the libraries required are stored in a variable called
4300 QT_LIBRARIES. Add this variable to your TARGET_LINK_LIBRARIES.
4301
4302
4303
4304 macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...)
4305 macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...)
4306 macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...)
4307 macro QT4_AUTOMOC(inputfile ... )
4308 macro QT4_GENERATE_MOC(inputfile outputfile )
4309
4310
4311
4312
4313 macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
4314 create a the interface header and implementation files
4315 with the
4316 given basename from the given interface xml file and add
4317 it to
4318 the list of sources
4319
4320
4321
4322
4323 macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
4324 create the interface header and implementation files
4325 for all listed interface xml files
4326 the name will be automatically determined from the name
4327 of the xml file
4328
4329
4330
4331
4332 macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader par‐
4333 entclassname [basename] )
4334 create a dbus adaptor (header and implementation file)
4335 from the xml file
4336 describing the interface, and add it to the list of
4337 sources. The adaptor
4338 forwards the calls to a parent class, defined in parent‐
4339 header and named
4340 parentclassname. The name of the generated files will be
4341 <basename>adaptor.{cpp,h} where basename is the basename
4342 of the xml file.
4343
4344
4345
4346
4347 macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] )
4348 generate the xml interface file from the given header.
4349 If the optional argument interfacename is omitted, the
4350 name of the
4351 interface file is constructed from the basename of the
4352 header with
4353 the suffix .xml appended.
4354
4355
4356
4357
4358 QT_FOUND If false, don't try to use Qt.
4359 QT4_FOUND If false, don't try to use Qt 4.
4360
4361
4362
4363
4364 QT_EDITION Set to the edition of Qt (i.e. Desktop‐
4365 Light)
4366 QT_EDITION_DESKTOPLIGHT True if QT_EDITION == DesktopLight
4367 QT_QTCORE_FOUND True if QtCore was found.
4368 QT_QTGUI_FOUND True if QtGui was found.
4369 QT_QT3SUPPORT_FOUND True if Qt3Support was found.
4370 QT_QTASSISTANT_FOUND True if QtAssistant was found.
4371 QT_QTDBUS_FOUND True if QtDBus was found.
4372 QT_QTDESIGNER_FOUND True if QtDesigner was found.
4373 QT_QTDESIGNERCOMPONENTS True if QtDesignerComponents was
4374 found.
4375 QT_QTMOTIF_FOUND True if QtMotif was found.
4376 QT_QTNETWORK_FOUND True if QtNetwork was found.
4377 QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found.
4378 QT_QTOPENGL_FOUND True if QtOpenGL was found.
4379 QT_QTSQL_FOUND True if QtSql was found.
4380 QT_QTXML_FOUND True if QtXml was found.
4381 QT_QTSVG_FOUND True if QtSvg was found.
4382 QT_QTSCRIPT_FOUND True if QtScript was found.
4383 QT_QTTEST_FOUND True if QtTest was found.
4384 QT_QTUITOOLS_FOUND True if QtUiTools was found.
4385
4386 QT_DEFINITIONS Definitions to use when compiling code that
4387 uses Qt.
4388
4389 QT_INCLUDES List of paths to all include directories of
4390 Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR
4391 are
4392 always in this variable even if NOTFOUND,
4393 all other INCLUDE_DIRS are
4394 only added if they are found.
4395
4396 QT_INCLUDE_DIR Path to "include" of Qt4
4397 QT_QT_INCLUDE_DIR Path to "include/Qt"
4398 QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support"
4399 QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant"
4400 QT_QTCORE_INCLUDE_DIR Path to "include/QtCore"
4401 QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner"
4402 QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDe‐
4403 signer"
4404 QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus"
4405 QT_QTGUI_INCLUDE_DIR Path to "include/QtGui"
4406 QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif"
4407 QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork"
4408 QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin"
4409 QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL"
4410 QT_QTSQL_INCLUDE_DIR Path to "include/QtSql"
4411 QT_QTXML_INCLUDE_DIR Path to "include/QtXml"
4412 QT_QTSVG_INCLUDE_DIR Path to "include/QtSvg"
4413 QT_QTSCRIPT_INCLUDE_DIR Path to "include/QtScript"
4414 QT_QTTEST_INCLUDE_DIR Path to "include/QtTest"
4415
4416 QT_LIBRARY_DIR Path to "lib" of Qt4
4417
4418
4419
4420
4421 QT_PLUGINS_DIR Path to "plugins" for Qt4
4422
4423
4424 For every library of Qt there are three variables:
4425
4426
4427 QT_QTFOO_LIBRARY_RELEASE, which contains the full path to the
4428 release version
4429 QT_QTFOO_LIBRARY_DEBUG, which contains the full path to the
4430 debug version
4431 QT_QTFOO_LIBRARY, the full path to the release version if
4432 available, otherwise to the debug version
4433
4434
4435
4436
4437 So there are the following variables: The Qt3Support library:
4438 QT_QT3SUPPORT_LIBRARY
4439
4440
4441 QT_QT3SUPPORT_LIBRARY_RELEASE
4442 QT_QT3SUPPORT_DEBUG
4443
4444
4445
4446
4447 The QtAssistant library: QT_QTASSISTANT_LIBRARY
4448
4449
4450 QT_QTASSISTANT_LIBRARY_RELEASE
4451 QT_QTASSISTANT_LIBRARY_DEBUG
4452
4453
4454
4455
4456 The QtCore library: QT_QTCORE_LIBRARY
4457
4458
4459 QT_QTCORE_LIBRARY_RELEASE
4460 QT_QTCORE_LIBRARY_DEBUG
4461
4462
4463
4464
4465 The QtDBus library: QT_QTDBUS_LIBRARY
4466
4467
4468 QT_QTDBUS_LIBRARY_RELEASE
4469 QT_QTDBUS_LIBRARY_DEBUG
4470
4471
4472
4473
4474 The QtDesigner library: QT_QTDESIGNER_LIBRARY
4475
4476
4477 QT_QTDESIGNER_LIBRARY_RELEASE
4478 QT_QTDESIGNER_LIBRARY_DEBUG
4479
4480
4481
4482
4483 The QtDesignerComponents library: QT_QTDESIGNERCOMPO‐
4484 NENTS_LIBRARY
4485
4486
4487 QT_QTDESIGNERCOMPO‐
4488 NENTS_LIBRARY_RELEASE
4489 QT_QTDESIGNERCOMPO‐
4490 NENTS_LIBRARY_DEBUG
4491
4492
4493
4494
4495 The QtGui library: QT_QTGUI_LIBRARY
4496
4497
4498 QT_QTGUI_LIBRARY_RELEASE
4499 QT_QTGUI_LIBRARY_DEBUG
4500
4501
4502
4503
4504 The QtMotif library: QT_QTMOTIF_LIBRARY
4505
4506
4507 QT_QTMOTIF_LIBRARY_RELEASE
4508 QT_QTMOTIF_LIBRARY_DEBUG
4509
4510
4511
4512
4513 The QtNetwork library: QT_QTNETWORK_LIBRARY
4514
4515
4516 QT_QTNETWORK_LIBRARY_RELEASE
4517 QT_QTNETWORK_LIBRARY_DEBUG
4518
4519
4520
4521
4522 The QtNsPLugin library: QT_QTNSPLUGIN_LIBRARY
4523
4524
4525 QT_QTNSPLUGIN_LIBRARY_RELEASE
4526 QT_QTNSPLUGIN_LIBRARY_DEBUG
4527
4528
4529
4530
4531 The QtOpenGL library: QT_QTOPENGL_LIBRARY
4532
4533
4534 QT_QTOPENGL_LIBRARY_RELEASE
4535 QT_QTOPENGL_LIBRARY_DEBUG
4536
4537
4538
4539
4540 The QtSql library: QT_QTSQL_LIBRARY
4541
4542
4543 QT_QTSQL_LIBRARY_RELEASE
4544 QT_QTSQL_LIBRARY_DEBUG
4545
4546
4547
4548
4549 The QtXml library: QT_QTXML_LIBRARY
4550
4551
4552 QT_QTXML_LIBRARY_RELEASE
4553 QT_QTXML_LIBRARY_DEBUG
4554
4555
4556
4557
4558 The QtSvg library: QT_QTSVG_LIBRARY
4559
4560
4561 QT_QTSVG_LIBRARY_RELEASE
4562 QT_QTSVG_LIBRARY_DEBUG
4563
4564
4565
4566
4567 The QtScript library: QT_QTSCRIPT_LIBRARY
4568
4569
4570 QT_QTSCRIPT_LIBRARY_RELEASE
4571 QT_QTSCRIPT_LIBRARY_DEBUG
4572
4573
4574
4575
4576 The QtTest library: QT_QTTEST_LIBRARY
4577
4578
4579 QT_QTTEST_LIBRARY_RELEASE
4580 QT_QTTEST_LIBRARY_DEBUG
4581
4582
4583
4584
4585 The qtmain library for Windows QT_QTMAIN_LIBRARY
4586
4587
4588 QT_QTMAIN_LIBRARY_RELEASE
4589 QT_QTMAIN_LIBRARY_DEBUG
4590
4591
4592
4593
4594 The QtUiTools library: QT_QTUITOOLS_LIBRARY
4595
4596
4597 QT_QTUITOOLS_LIBRARY_RELEASE
4598 QT_QTUITOOLS_LIBRARY_DEBUG
4599
4600
4601 also defined, but NOT for general use are
4602
4603
4604 QT_MOC_EXECUTABLE Where to find the moc tool.
4605 QT_UIC_EXECUTABLE Where to find the uic tool.
4606 QT_UIC3_EXECUTABLE Where to find the uic3 tool.
4607 QT_RCC_EXECUTABLE Where to find the rcc tool
4608 QT_DBUSCPP2XML_EXECUTABLE Where to find the qdbuscpp2xml
4609 tool.
4610 QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp
4611 tool.
4612
4613 QT_DOC_DIR Path to "doc" of Qt4
4614 QT_MKSPECS_DIR Path to "mkspecs" of Qt4
4615
4616
4617
4618
4619
4620
4621
4622 These are around for backwards compatibility they will be set
4623
4624
4625 QT_WRAP_CPP Set true if QT_MOC_EXECUTABLE is found
4626 QT_WRAP_UI Set true if QT_UIC_EXECUTABLE is found
4627
4628
4629 These variables do _NOT_ have any effect anymore (compared to
4630 FindQt.cmake)
4631
4632
4633 QT_MT_REQUIRED Qt4 is now always multithreaded
4634
4635
4636 These variables are set to "" Because Qt structure changed
4637 (They make no sense in Qt4)
4638
4639
4640 QT_QT_LIBRARY Qt-Library is now split
4641
4642
4643 FindRuby
4644 Find Ruby
4645
4646 This module finds if Ruby is installed and determines where the
4647 include files and libraries are. It also determines what the
4648 name of the library is. This code sets the following variables:
4649
4650
4651 RUBY_INCLUDE_PATH = path to where ruby.h can be found
4652 RUBY_EXECUTABLE = full path to the ruby binary
4653
4654
4655 FindSDL
4656 Locate the SDL library
4657
4658 This module defines
4659
4660
4661 SDL_LIBRARY, the library to link against
4662 SDL_FOUND, if false, do not try to link to SDL
4663 SDL_INCLUDE_DIR, where to find SDL.h
4664
4665
4666
4667
4668 Don't forget to include SDLmain.h and SDLmain.m your project for
4669 the OS X framework based version. (Other versions link to
4670 -lSDLmain which this module will try to find on your behalf.)
4671 Also for OS X, this module will automatically add the -frame‐
4672 work Cocoa on your behalf. $SDLDIR is an environment variable
4673 that would correspond to the ./configure --prefix=$SDLDIR used
4674 in building SDL. l.e.galup 9-20-02
4675
4676
4677 Modified by Eric Wing. Added new modifications to recognize OS
4678 X frameworks and additional Unix paths (FreeBSD, etc). Also
4679 corrected the header search path to follow "proper" SDL guide‐
4680 lines. Added a search for SDLmain which is needed by some plat‐
4681 forms. Added a search for threads which is needed by some plat‐
4682 forms. Added needed compile switches for MinGW.
4683
4684
4685 On OSX, this will prefer the Framework version (if found) over
4686 others. People will have to manually change the cache values of
4687 SDL_LIBRARY to override this selection.
4688
4689
4690 Note that the header path has changed from SDL/SDL.h to just
4691 SDL.h This needed to change because "proper" SDL convention is
4692 #include "SDL.h", not <SDL/SDL.h>. This is done for portability
4693 reasons because not all systems place things in SDL/ (see Free‐
4694 BSD).
4695
4696
4697 FindSDL_image
4698 Locate SDL_image library
4699
4700 This module defines
4701
4702
4703 SDLIMAGE_LIBRARY, the library to link against
4704 SDLIMAGE_FOUND, if false, do not try to link to SDL
4705 SDLIMAGE_INCLUDE_DIR, where to find SDL/SDL.h
4706
4707
4708
4709
4710 $SDLDIR is an environment variable that would correspond to the
4711 ./configure --prefix=$SDLDIR used in building SDL.
4712
4713
4714 Created by Eric Wing. This was influenced by the FindSDL.cmake
4715 module, but with modifications to recognize OS X frameworks and
4716 additional Unix paths (FreeBSD, etc).
4717
4718
4719 FindSDL_mixer
4720 Locate the SDL_mixer library
4721
4722 This module defines
4723
4724
4725 SDLMIXER_LIBRARY, library to link against
4726 SDLMIXER_FOUND, if false, do not try to link to SDL
4727 SDLMIXER_INCLUDE_DIR, where to find SDL/SDL.h
4728
4729
4730
4731
4732 $SDLDIR is an environment variable that would correspond to the
4733 ./configure --prefix=$SDLDIR used in building SDL.
4734
4735
4736 Created by Eric Wing. This was influenced by the FindSDL.cmake
4737 module, but with modifications to recognize OS X frameworks and
4738 additional Unix paths (FreeBSD, etc).
4739
4740
4741 FindSDL_net
4742 Locate the SDL_net library
4743
4744 This module defines
4745
4746
4747 SDLNET_LIBRARY, the library to link against
4748 SDLNET_FOUND, if false, do not try to link against
4749 SDLNET_INCLUDE_DIR, where to find the headers
4750
4751
4752 $SDLDIR is an environment variable that would correspond to the
4753 ./configure --prefix=$SDLDIR used in building SDL.
4754
4755
4756
4757
4758 Created by Eric Wing. This was influenced by the FindSDL.cmake
4759 module, but with modifications to recognize OS X frameworks and
4760 additional Unix paths (FreeBSD, etc). On OSX, this will prefer
4761 the Framework version (if found) over others. People will have
4762 to manually change the cache values of SDLNET_LIBRARY to over‐
4763 ride this selection.
4764
4765
4766 FindSDL_sound
4767 Locates the SDL_sound library
4768
4769 This module depends on SDL being found and must be called AFTER
4770 FindSDL.cmake is called.
4771
4772
4773 This module defines SDL_SOUND_INCLUDE_DIR, where to find
4774 SDL_sound.h SDL_SOUND_FOUND, if false, do not try to link to SDL
4775 SDL_SOUND_LIBRARIES, this contains the list of libraries that
4776 you need to link against. This is a read-only variable and is
4777 marked INTERNAL. SDL_SOUND_EXTRAS, this is an optional variable
4778 for you to add your own flags to SDL_SOUND_LIBRARIES. This is
4779 prepended to SDL_SOUND_LIBRARIES. This is available mostly for
4780 cases this module failed to anticipate for and you must add
4781 additional flags. This is marked as ADVANCED.
4782
4783
4784 This module also defines (but you shouldn't need to use
4785 directly) SDL_SOUND_LIBRARY, the name of just the SDL_sound
4786 library you would link against. Use SDL_SOUND_LIBRARIES for you
4787 link instructions and not this one. And might define the follow‐
4788 ing as needed
4789
4790
4791 MIKMOD_LIBRARY
4792 MODPLUG_LIBRARY
4793 OGG_LIBRARY
4794 VORBIS_LIBRARY
4795 SMPEG_LIBRARY
4796 FLAC_LIBRARY
4797 SPEEX_LIBRARY
4798
4799
4800
4801
4802 Typically, you should not use these variables directly, and you
4803 should use SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY
4804 and the other audio libraries (if needed) to successfully com‐
4805 pile on your system .
4806
4807
4808 Created by Eric Wing.
4809
4810
4811 This module is a bit more complicated than the other FindSDL*
4812 family modules. The reason is that SDL_sound can be compiled in
4813 a large variety of different ways which are independent of plat‐
4814 form. SDL_sound may dynamically link against other 3rd party
4815 libraries to get additional codec support, such as Ogg Vorbis,
4816 SMPEG, ModPlug, MikMod, FLAC, Speex, and potentially others.
4817 Under some circumstances which I don't fully understand, there
4818 seems to be a requirement that dependent libraries of libraries
4819 you use must also be explicitly linked against in order to suc‐
4820 cessfully compile. SDL_sound does not currently have any system
4821 in place to know how it was compiled. So this CMake module does
4822 the hard work in trying to discover which 3rd party libraries
4823 are required for building (if any).
4824
4825
4826 This module uses a brute force approach to create a test program
4827 that uses SDL_sound, and then tries to build it. If the build
4828 fails, it parses the error output for known symbol names to fig‐
4829 ure out which libraries are needed. Responds to the $SDLDIR and
4830 $SDLSOUNDDIR environmental variable that would correspond to the
4831 ./configure --prefix=$SDLDIR used in building SDL.
4832
4833
4834 On OSX, this will prefer the Framework version (if found) over
4835 others. People will have to manually change the cache values of
4836 SDL_LIBRARY to override this selection.
4837
4838
4839
4840 FindSDL_ttf
4841 Locate SDL_ttf library
4842
4843 This module defines
4844
4845
4846 SDLTTF_LIBRARY, the library to link against
4847 SDLTTF_FOUND, if false, do not try to link to SDL
4848 SDLTTF_INCLUDE_DIR, where to find SDL/SDL.h
4849
4850
4851 $SDLDIR is an environment variable that would correspond to the
4852 ./configure --prefix=$SDLDIR used in building SDL. Created by
4853 Eric Wing. This was influenced by the FindSDL.cmake module, but
4854 with modifications to recognize OS X frameworks and additional
4855 Unix paths (FreeBSD, etc). On OSX, this will prefer the Frame‐
4856 work version (if found) over others. People will have to manu‐
4857 ally change the cache values of SDLTTF_LIBRARY to override this
4858 selection.
4859
4860
4861 FindSelfPackers
4862 Find upx
4863
4864 This module looks for some executable packers (i.e. softwares
4865 that compress executables or shared libs into on-the-fly self-
4866 extracting executables or shared libs. Examples:
4867
4868
4869 UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
4870
4871
4872 FindSubversion
4873 Extract information from a subversion working copy
4874
4875 The module defines the following variables:
4876
4877
4878 Subversion_SVN_EXECUTABLE - path to svn command line client
4879 Subversion_VERSION_SVN - version of svn command line client
4880 Subversion_FOUND - true if the command line client was found
4881
4882 If the command line client executable is found the macro
4883
4884
4885 Subversion_WC_INFO(<dir> <var-prefix>)
4886
4887 is defined to extract information of a subversion working copy
4888 at a given location. The macro defines the following variables:
4889
4890
4891 <var-prefix>_WC_URL - url of the repository (at <dir>)
4892 <var-prefix>_WC_ROOT - root url of the repository
4893 <var-prefix>_WC_REVISION - current revision
4894 <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
4895 <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
4896 <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
4897 <var-prefix>_WC_LAST_CHANGED_LOG - last log of base revision
4898 <var-prefix>_WC_INFO - output of command `svn info <dir>'
4899
4900 Example usage:
4901
4902
4903 FIND_PACKAGE(Subversion)
4904 IF(Subversion_FOUND)
4905 Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
4906 MESSAGE("Current revision is ${Project_WC_REVISION}")
4907 ENDIF(Subversion_FOUND)
4908
4909
4910 FindSWIG
4911 Find SWIG
4912
4913 This module finds an installed SWIG. It sets the following
4914 variables:
4915
4916
4917 SWIG_FOUND - set to true if SWIG is found
4918 SWIG_DIR - the directory where swig is installed
4919 SWIG_EXECUTABLE - the path to the swig executable
4920
4921
4922 FindTCL
4923 Find Tcl includes and libraries.
4924
4925 This module finds if TCL is installed and determines where the
4926 include files and libraries are. It also determines what the
4927 name of the library is. This code sets the following variables:
4928
4929
4930 TCL_LIBRARY = path to Tcl library (tcl tcl80)
4931 TCL_LIBRARY_DEBUG = path to Tcl library (debug)
4932 TCL_STUB_LIBRARY = path to Tcl stub library
4933 TCL_STUB_LIBRARY_DEBUG = path to debug stub library
4934 TCL_INCLUDE_PATH = path to where tcl.h can be found
4935 TCL_TCLSH = path to tclsh binary (tcl tcl80)
4936 TK_LIBRARY = path to Tk library (tk tk80 etc)
4937 TK_LIBRARY_DEBUG = path to Tk library (debug)
4938 TK_STUB_LIBRARY = path to Tk stub library
4939 TK_STUB_LIBRARY_DEBUG = path to debug Tk stub library
4940 TK_INCLUDE_PATH = path to where tk.h can be found
4941 TK_INTERNAL_PATH = path to where tkWinInt.h is found
4942 TK_WISH = full path to the wish executable
4943
4944
4945 FindTclsh
4946 Find tclsh
4947
4948 This module finds if TCL is installed and determines where the
4949 include files and libraries are. It also determines what the
4950 name of the library is. This code sets the following variables:
4951
4952
4953 TCL_TCLSH = the path to the tclsh executable
4954
4955 In cygwin, look for the cygwin version first. Don't look for it
4956 later to avoid finding the cygwin version on a Win32 build.
4957
4958
4959 FindThreads
4960 This module determines the thread library of the system.
4961
4962 The following variables are set
4963
4964
4965 CMAKE_THREAD_LIBS_INIT - the thread library
4966 CMAKE_USE_SPROC_INIT - are we using sproc?
4967 CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
4968 CMAKE_USE_PTHREADS_INIT - are we using pthreads
4969 CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
4970
4971
4972 FindTIFF
4973 Find TIFF library
4974
4975 Find the native TIFF includes and library This module defines
4976
4977
4978 TIFF_INCLUDE_DIR, where to find tiff.h, etc.
4979 TIFF_LIBRARIES, libraries to link against to use TIFF.
4980 TIFF_FOUND, If false, do not try to use TIFF.
4981
4982 also defined, but not for general use are
4983
4984
4985 TIFF_LIBRARY, where to find the TIFF library.
4986
4987
4988 FindUnixCommands
4989 Find unix commands from cygwin
4990
4991 This module looks for some usual Unix commands.
4992
4993
4994
4995 FindVTK
4996 Find a VTK installation or build tree.
4997
4998 The following variables are set if VTK is found. If VTK is not
4999 found, VTK_FOUND is set to false.
5000
5001
5002 VTK_FOUND - Set to true when VTK is found.
5003 VTK_USE_FILE - CMake file to use VTK.
5004 VTK_MAJOR_VERSION - The VTK major version number.
5005 VTK_MINOR_VERSION - The VTK minor version number
5006 (odd non-release).
5007 VTK_BUILD_VERSION - The VTK patch level
5008 (meaningless for odd minor).
5009 VTK_INCLUDE_DIRS - Include directories for VTK
5010 VTK_LIBRARY_DIRS - Link directories for VTK libraries
5011 VTK_KITS - List of VTK kits, in CAPS
5012 (COMMON,IO,) etc.
5013 VTK_LANGUAGES - List of wrapped languages, in CAPS
5014 (TCL, PYHTON,) etc.
5015
5016 The following cache entries must be set by the user to locate
5017 VTK:
5018
5019
5020 VTK_DIR - The directory containing VTKConfig.cmake.
5021 This is either the root of the build tree,
5022 or the lib/vtk directory. This is the
5023 only cache entry.
5024
5025 The following variables are set for backward compatibility and
5026 should not be used in new code:
5027
5028
5029 USE_VTK_FILE - The full path to the UseVTK.cmake file.
5030 This is provided for backward
5031 compatibility. Use VTK_USE_FILE
5032 instead.
5033
5034
5035
5036
5037
5038 FindWget
5039 Find wget
5040
5041 This module looks for wget. This module defines the following
5042 values:
5043
5044
5045 WGET_EXECUTABLE: the full path to the wget tool.
5046 WGET_FOUND: True if wget has been found.
5047
5048
5049 FindWish
5050 Find wish installation
5051
5052 This module finds if TCL is installed and determines where the
5053 include files and libraries are. It also determines what the
5054 name of the library is. This code sets the following variables:
5055
5056
5057 TK_WISH = the path to the wish executable
5058
5059
5060
5061
5062 if UNIX is defined, then it will look for the cygwin version
5063 first
5064
5065
5066 FindwxWidgets
5067 Find a wxWidgets (a.k.a., wxWindows) installation.
5068
5069 This module finds if wxWidgets is installed and selects a
5070 default configuration to use.
5071
5072
5073 The following variables are searched for and set to defaults in
5074 case of multiple choices. Change them if the defaults are not
5075 desired:
5076
5077
5078 wxWidgets_ROOT_DIR - Base wxWidgets directory
5079 (e.g., C:/wxWidgets-2.6.3).
5080 wxWidgets_LIB_DIR - Path to wxWidgets libraries
5081 (e.g., C:/wxWid‐
5082 gets-2.6.3/lib/vc_lib).
5083 wxWidgets_CONFIGURATION - Configuration to use
5084 (e.g., msw, mswd, mswu, mswunivud,
5085 etc.)
5086 wxWidgets_USE_LIBS - Libraries to use besides the common
5087 required ones; set to base and core
5088 by
5089 default. You couls also list them in
5090 FIND_PACKAGE(wxWidgets REQUIRED
5091 <components>)
5092
5093
5094
5095
5096 The following are set after configuration is done:
5097
5098
5099 wxWidgets_FOUND - Set to TRUE if wxWidgets was
5100 found.
5101 wxWidgets_INCLUDE_DIRS - Include directories for WIN32
5102 i.e., where to find "wx/wx.h" and
5103 "wx/setup.h"; possibly empty for
5104 unices.
5105 wxWidgets_LIBRARIES - Path to the wxWidgets libraries.
5106 wxWidgets_LIBRARY_DIRS - compile time link dirs, useful
5107 for
5108 rpath on UNIX. Typically an empty
5109 string
5110 in WIN32 environment.
5111 wxWidgets_DEFINITIONS - Contains defines required to com‐
5112 pile/link
5113 against WX, e.g. -DWXUSINGDLL
5114 wxWidgets_CXX_FLAGS - Include dirs and ompiler flags
5115 for
5116 unices, empty on WIN32. Esen‐
5117 tially
5118 "`wx-config --cxxflags`".
5119 wxWidgets_USE_FILE - convenience include file
5120
5121
5122
5123
5124 Sample usage:
5125
5126
5127 SET(wxWidgets_USE_LIBS base core gl net)
5128 FIND_PACKAGE(wxWidgets)
5129 IF(wxWidgets_FOUND)
5130 INCLUDE(${wxWidgets_USE_FILE})
5131 # and for each of your dependant executable/library tar‐
5132 gets:
5133 TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
5134 ENDIF(wxWidgets_FOUND)
5135
5136
5137
5138
5139 Sample usage with monolithic wx build:
5140
5141
5142 SET(wxWidgets_USE_LIBS msw26 expat jpeg gl png regex tiff
5143 zlib)
5144 ...
5145
5146
5147 FindwxWindows
5148 Find wxWindows (wxWidgets) installation
5149
5150 This module finds if wxWindows/wxWidgets is installed and deter‐
5151 mines where the include files and libraries are. It also deter‐
5152 mines what the name of the library is. Please note this file is
5153 DEPRECATED and replaced by FindwxWidgets.cmake. This code sets
5154 the following variables:
5155
5156
5157
5158 WXWINDOWS_FOUND = system has WxWindows
5159 WXWINDOWS_LIBRARIES = path to the wxWindows libraries
5160 on Unix/Linux with additional
5161 linker flags from
5162 "wx-config --libs"
5163 CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows,
5164 essentially "`wx-config
5165 --cxxflags`"
5166 on Linux
5167 WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and
5168 "wx/setup.h"
5169 WXWINDOWS_LINK_DIRECTORIES = link directories, useful for
5170 rpath on
5171 Unix
5172 WXWINDOWS_DEFINITIONS = extra defines
5173
5174
5175
5176
5177 OPTIONS If you need OpenGL support please
5178
5179
5180 SET(WXWINDOWS_USE_GL 1)
5181
5182 in your CMakeLists.txt *before* you include this file.
5183
5184
5185 HAVE_ISYSTEM - true required to replace -I by -isystem on
5186 g++
5187
5188
5189
5190
5191 For convenience include Use_wxWindows.cmake in your project's
5192 CMakeLists.txt using INCLUDE(Use_wxWindows).
5193
5194
5195 USAGE
5196
5197
5198 SET(WXWINDOWS_USE_GL 1)
5199 FIND_PACKAGE(wxWindows)
5200
5201
5202
5203
5204 NOTES wxWidgets 2.6.x is supported for monolithic builds e.g.
5205 compiled in wx/build/msw dir as:
5206
5207
5208 nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONO‐
5209 LITHIC=1
5210
5211
5212
5213
5214 DEPRECATED
5215
5216
5217 CMAKE_WX_CAN_COMPILE
5218 WXWINDOWS_LIBRARY
5219 CMAKE_WX_CXX_FLAGS
5220 WXWINDOWS_INCLUDE_PATH
5221
5222
5223
5224
5225 AUTHOR Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw>
5226 (07/2003-01/2006)
5227
5228
5229 FindX11
5230 Find X11 installation
5231
5232 Try to find X11 on UNIX systems. The following values are
5233 defined
5234
5235
5236 X11_FOUND - True if X11 is available
5237 X11_INCLUDE_DIR - include directories to use X11
5238 X11_LIBRARIES - link against these to use X11
5239
5240
5241 FindXMLRPC
5242 Find xmlrpc
5243
5244 Find the native XMLRPC headers and libraries.
5245
5246
5247 XMLRPC_INCLUDE_DIRS - where to find xmlrpc.h, etc.
5248 XMLRPC_LIBRARIES - List of libraries when using xml‐
5249 rpc.
5250 XMLRPC_FOUND - True if xmlrpc found.
5251
5252 XMLRPC modules may be specified as components for this find mod‐
5253 ule. Modules may be listed by running "xmlrpc-c-config". Mod‐
5254 ules include:
5255
5256
5257 c++ C++ wrapper code
5258 libwww-client libwww-based client
5259 cgi-server CGI-based server
5260 abyss-server ABYSS-based server
5261
5262 Typical usage:
5263
5264
5265 FIND_PACKAGE(XMLRPC REQUIRED libwww-client)
5266
5267
5268 FindZLIB
5269 Find zlib
5270
5271 Find the native ZLIB includes and library
5272
5273
5274 ZLIB_INCLUDE_DIR - where to find zlib.h, etc.
5275 ZLIB_LIBRARIES - List of libraries when using zlib.
5276 ZLIB_FOUND - True if zlib found.
5277
5278
5279 InstallRequiredSystemLibraries
5280
5281 By including this file, all files in the
5282 CMAKE_INSTALL_DEBUG_LIBRARIES, will be installed with
5283 INSTALL_PROGRAMS into /bin for WIN32 and /lib for non-win32. If
5284 CMAKE_SKIP_INSTALL_RULES is set to TRUE before including this
5285 file, then the INSTALL command is not called. The use can use
5286 the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a custom
5287 install command and install them into any directory they want.
5288 If it is the MSVC compiler, then the microsoft run time
5289 libraries will be found add automatically added to the
5290 CMAKE_INSTALL_DEBUG_LIBRARIES, and installed. If
5291 CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC com‐
5292 piler, then the debug libraries are installed when available. If
5293 CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time
5294 libraries are installed as well as the CRT run time libraries.
5295
5296
5297 MacroAddFileDependencies
5298 MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
5299
5300 MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
5301
5302
5303 TestBigEndian
5304 Define macro to determine endian type
5305
5306 Check if the system is big endian or little endian
5307
5308
5309 TEST_BIG_ENDIAN(VARIABLE)
5310 VARIABLE - variable to store the result to
5311
5312
5313
5314
5315
5316 TestCXXAcceptsFlag
5317 Test CXX compiler for a flag
5318
5319 Check if the CXX compiler accepts a flag
5320
5321
5322 Macro CHECK_CXX_ACCEPTS_FLAG(FLAGS VARIABLE) -
5323 checks if the function exists
5324 FLAGS - the flags to try
5325 VARIABLE - variable to store the result
5326
5327
5328
5329
5330
5331 TestForANSIForScope
5332 Check for ANSI for scope support
5333
5334 Check if the compiler supports std:: on stl classes.
5335
5336
5337 CMAKE_NO_STD_NAMESPACE - holds result
5338
5339
5340
5341
5342
5343 TestForANSIStreamHeaders
5344 Test for compiler support of ANSI stream headers iostream, etc.
5345
5346 check if we they have the standard ansi stream files (without
5347 the .h)
5348
5349
5350 CMAKE_NO_ANSI_STREAM_HEADERS - defined by the results
5351
5352
5353
5354
5355
5356 TestForSSTREAM
5357
5358 # - Test for std:: namespace support check if the compiler sup‐
5359 ports std:: on stl classes
5360
5361
5362 CMAKE_NO_STD_NAMESPACE - defined by the results
5363
5364
5365
5366
5367
5368 TestForSTDNamespace
5369 Test for std:: namespace support
5370
5371 check if the compiler supports std:: on stl classes
5372
5373
5374 CMAKE_NO_STD_NAMESPACE - defined by the results
5375
5376
5377
5378
5379
5380 Use_wxWindows
5381 ---------------------------------------------------
5382
5383
5384
5385
5386 This convenience include finds if wxWindows is installed and set
5387 the appropriate libs, incdirs, flags etc. author Jan Woetzel
5388 <jw -at- mip.informatik.uni-kiel.de> (07/2003)
5389
5390
5391 USAGE:
5392
5393
5394 just include Use_wxWindows.cmake
5395 in your projects CMakeLists.txt
5396
5397 INCLUDE( ${CMAKE_MODULE_PATH}/Use_wxWindows.cmake)
5398
5399
5400 if you are sure you need GL then
5401
5402
5403 SET(WXWINDOWS_USE_GL 1)
5404
5405 *before* you include this file.
5406
5407
5408 16.Feb.2004: changed INCLUDE to FIND_PACKAGE to read from users
5409 own non-system CMAKE_MODULE_PATH (Jan Woetzel JW) 07/2006: re‐
5410 write as FindwxWidgets.cmake, kept for backward compatibilty JW
5411
5412
5413 UseEcos
5414 This module defines variables and macros required to build eCos
5415 application.
5416
5417 This file contains the following macros: ECOS_ADD_INCLUDE_DIREC‐
5418 TORIES() - add the eCos include dirs ECOS_ADD_EXECUTABLE(name
5419 source1 ... sourceN ) - create an eCos executable
5420 ECOS_ADJUST_DIRECTORY(VAR source1 ... sourceN ) - adjusts the
5421 path of the source files and puts the result into VAR
5422
5423
5424 Macros for selecting the toolchain: ECOS_USE_ARM_ELF_TOOLS()
5425 - enable the ARM ELF toolchain for the directory where it is
5426 called ECOS_USE_I386_ELF_TOOLS() - enable the i386 ELF
5427 toolchain for the directory where it is called
5428 ECOS_USE_PPC_EABI_TOOLS() - enable the PowerPC toolchain
5429 for the directory where it is called
5430
5431
5432 It contains the following variables: ECOS_DEFINITIONS ECOSCON‐
5433 FIG_EXECUTABLE for internal use only:
5434
5435
5436 ECOS_ADD_TARGET_LIB
5437
5438
5439 UsePkgConfig
5440 pkg-config module for CMake
5441
5442
5443
5444
5445 Defines the following macros:
5446
5447
5448 PKGCONFIG(package includedir libdir linkflags cflags)
5449
5450
5451 Calling PKGCONFIG will fill the desired information into the 4
5452 given arguments, e.g. PKGCONFIG(libart-2.0 LIBART_INCLUDE_DIR
5453 LIBART_LINK_DIR LIBART_LINK_FLAGS LIBART_CFLAGS) if pkg-config
5454 was NOT found or the specified software package doesn't exist,
5455 the variable will be empty when the function returns, otherwise
5456 they will contain the respective information
5457
5458
5459
5460 UseQt4 Use Module for QT4
5461
5462 Sets up C and C++ to use Qt 4. It is assumed that FindQt.cmake
5463 has already been loaded. See FindQt.cmake for information on
5464 how to load Qt 4 into your CMake project.
5465
5466
5467 UseSWIG
5468 SWIG module for CMake
5469
5470 Defines the following macros:
5471
5472
5473 SWIG_ADD_MODULE(name language [ files ])
5474 - Define swig module with given name and specified language
5475 SWIG_LINK_LIBRARIES(name [ libraries ])
5476 - Link libraries to swig module
5477
5478 All other macros are for internal use only. To get the actual
5479 name of the swig module, use: ${SWIG_MODULE_name_REAL_NAME}. Set
5480 Source files properties such as CPLUSPLUS and SWIG_FLAGS to
5481 specify special behavior of SWIG. Also global CMAKE_SWIG_FLAGS
5482 can be used to add special flags to all swig calls. Another spe‐
5483 cial variable is CMAKE_SWIG_OUTDIR, it allows one to specify
5484 where to write all the swig generated module (swig -outdir
5485 option) The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS
5486 may be used to specify extra dependencies for the generated mod‐
5487 ules.
5488
5489
5490 UsewxWidgets
5491 Convenience include for using wxWidgets library
5492
5493 Finds if wxWidgets is installed and set the appropriate libs,
5494 incdirs, flags etc. INCLUDE_DIRECTORIES, LINK_DIRECTORIES and
5495 ADD_DEFINITIONS are called.
5496
5497
5498 USAGE
5499
5500
5501 SET( wxWidgets_USE_LIBS gl xml xrc ) # optionally: more than
5502 wx std libs
5503 FIND_PACKAGE(wxWidgets REQUIRED)
5504 INCLUDE( ${xWidgets_USE_FILE} )
5505 ... add your targets here, e.g. ADD_EXECUTABLE/ ADD_LIBRARY
5506 ...
5507 TARGET_LINK_LIBRARIERS( <yourWxDependantTarget> ${wxWid‐
5508 gets_LIBRARIES})
5509
5510
5511
5512
5513 DEPRECATED
5514
5515
5516 LINK_LIBRARIES is not called in favor of adding dependencies
5517 per target.
5518
5519
5520
5521
5522 AUTHOR
5523
5524
5525 Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
5526
5527
5528 cmake_install
5529
5530 Install script for directory: /build‐
5531 dir/build/BUILD/cmake-2.4.8/Modules
5532
5533
5535 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights
5536 reserved.
5537
5538
5539 Redistribution and use in source and binary forms, with or without mod‐
5540 ification, are permitted provided that the following conditions are
5541 met:
5542
5543
5544 * Redistributions of source code must retain the above copyright
5545 notice, this list of conditions and the following disclaimer.
5546
5547
5548 * Redistributions in binary form must reproduce the above copy‐
5549 right notice, this list of conditions and the following dis‐
5550 claimer in the documentation and/or other materials provided
5551 with the distribution.
5552
5553
5554 * The names of Kitware, Inc., the Insight Consortium, or the names
5555 of any consortium members, or of any contributors, may not be
5556 used to endorse or promote products derived from this software
5557 without specific prior written permission.
5558
5559
5560 * Modified source versions must be plainly marked as such, and
5561 must not be misrepresented as being the original software.
5562
5563
5564 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS
5565 IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
5566 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTIC‐
5567 ULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBU‐
5568 TORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEM‐
5569 PLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PRO‐
5570 CUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROF‐
5571 ITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIA‐
5572 BILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEG‐
5573 LIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFT‐
5574 WARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5575
5576
5578 ccmake(1), ctest(1)
5579
5580
5581 The following resources are available to get help using CMake:
5582
5583
5584 Home Page
5585 http://www.cmake.org
5586
5587 The primary starting point for learning about CMake.
5588
5589
5590 Frequently Asked Questions
5591 http://www.cmake.org/Wiki/CMake_FAQ
5592
5593 A Wiki is provided containing answers to frequently asked ques‐
5594 tions.
5595
5596
5597 Online Documentation
5598 http://www.cmake.org/HTML/Documentation.html
5599
5600 Links to available documentation may be found on this web page.
5601
5602
5603 Mailing List
5604 http://www.cmake.org/HTML/MailingLists.html
5605
5606 For help and discussion about using cmake, a mailing list is
5607 provided at cmake@cmake.org. The list is member-post-only but
5608 one may sign up on the CMake web page. Please first read the
5609 full documentation at http://www.cmake.org before posting ques‐
5610 tions to the list.
5611
5612
5613 Summary of helpful links:
5614
5615
5616 Home: http://www.cmake.org
5617 Docs: http://www.cmake.org/HTML/Documentation.html
5618 Mail: http://www.cmake.org/HTML/MailingLists.html
5619 FAQ: http://www.cmake.org/Wiki/CMake_FAQ
5620
5621
5623 This manual page was generated by the "--help-man" option.
5624
5625
5626
5627
5628cmake 2.4-patch 8 April 24, 2008 cmake(1)