Help: Apply syntax highlighting to project commands
* Replace most "::" by ".. code-block:: cmake" * Header sentence in imperative voice, detailed command description in present tense.
This commit is contained in:
parent
2459b5e832
commit
adbaadf0ee
@ -1,9 +1,9 @@
|
|||||||
add_compile_definitions
|
add_compile_definitions
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Adds preprocessor definitions to the compilation of source files.
|
Add preprocessor definitions to the compilation of source files.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_compile_definitions(<definition> ...)
|
add_compile_definitions(<definition> ...)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
add_compile_options
|
add_compile_options
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Adds options to the compilation of source files.
|
Add options to the compilation of source files.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_compile_options(<option> ...)
|
add_compile_options(<option> ...)
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@ There are two main signatures for ``add_custom_command``.
|
|||||||
Generating Files
|
Generating Files
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The first signature is for adding a custom command to produce an output::
|
The first signature is for adding a custom command to produce an output:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_custom_command(OUTPUT output1 [output2 ...]
|
add_custom_command(OUTPUT output1 [output2 ...]
|
||||||
COMMAND command1 [ARGS] [args1...]
|
COMMAND command1 [ARGS] [args1...]
|
||||||
@ -200,7 +202,7 @@ before or after building the target. The command becomes part of the
|
|||||||
target and will only execute when the target itself is built. If the
|
target and will only execute when the target itself is built. If the
|
||||||
target is already built, the command will not execute.
|
target is already built, the command will not execute.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_custom_command(TARGET <target>
|
add_custom_command(TARGET <target>
|
||||||
PRE_BUILD | PRE_LINK | POST_BUILD
|
PRE_BUILD | PRE_LINK | POST_BUILD
|
||||||
|
@ -3,7 +3,7 @@ add_custom_target
|
|||||||
|
|
||||||
Add a target with no output so it will always be built.
|
Add a target with no output so it will always be built.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_custom_target(Name [ALL] [command1 [args1...]]
|
add_custom_target(Name [ALL] [command1 [args1...]]
|
||||||
[COMMAND command2 [args2...] ...]
|
[COMMAND command2 [args2...] ...]
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
add_definitions
|
add_definitions
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Adds -D define flags to the compilation of source files.
|
Add -D define flags to the compilation of source files.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_definitions(-DFOO -DBAR ...)
|
add_definitions(-DFOO -DBAR ...)
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ add_dependencies
|
|||||||
|
|
||||||
Add a dependency between top-level targets.
|
Add a dependency between top-level targets.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_dependencies(<target> [<target-dependency>]...)
|
add_dependencies(<target> [<target-dependency>]...)
|
||||||
|
|
||||||
Make a top-level ``<target>`` depend on other top-level targets to
|
Makes a top-level ``<target>`` depend on other top-level targets to
|
||||||
ensure that they build before ``<target>`` does. A top-level target
|
ensure that they build before ``<target>`` does. A top-level target
|
||||||
is one created by one of the :command:`add_executable`,
|
is one created by one of the :command:`add_executable`,
|
||||||
:command:`add_library`, or :command:`add_custom_target` commands
|
:command:`add_library`, or :command:`add_custom_target` commands
|
||||||
|
@ -3,7 +3,7 @@ add_executable
|
|||||||
|
|
||||||
Add an executable to the project using the specified source files.
|
Add an executable to the project using the specified source files.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_executable(<name> [WIN32] [MACOSX_BUNDLE]
|
add_executable(<name> [WIN32] [MACOSX_BUNDLE]
|
||||||
[EXCLUDE_FROM_ALL]
|
[EXCLUDE_FROM_ALL]
|
||||||
@ -47,7 +47,7 @@ within IDE.
|
|||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_executable(<name> IMPORTED [GLOBAL])
|
add_executable(<name> IMPORTED [GLOBAL])
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ properties for more information.
|
|||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_executable(<name> ALIAS <target>)
|
add_executable(<name> ALIAS <target>)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Add a library to the project using the specified source files.
|
|||||||
Normal Libraries
|
Normal Libraries
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_library(<name> [STATIC | SHARED | MODULE]
|
add_library(<name> [STATIC | SHARED | MODULE]
|
||||||
[EXCLUDE_FROM_ALL]
|
[EXCLUDE_FROM_ALL]
|
||||||
@ -67,7 +67,7 @@ within IDE.
|
|||||||
Imported Libraries
|
Imported Libraries
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_library(<name> <SHARED|STATIC|MODULE|OBJECT|UNKNOWN> IMPORTED
|
add_library(<name> <SHARED|STATIC|MODULE|OBJECT|UNKNOWN> IMPORTED
|
||||||
[GLOBAL])
|
[GLOBAL])
|
||||||
@ -92,7 +92,7 @@ for more information.
|
|||||||
Object Libraries
|
Object Libraries
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_library(<name> OBJECT <src>...)
|
add_library(<name> OBJECT <src>...)
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ consider adding at least one real source file to any target that references
|
|||||||
Alias Libraries
|
Alias Libraries
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_library(<name> ALIAS <target>)
|
add_library(<name> ALIAS <target>)
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ installed or exported.
|
|||||||
Interface Libraries
|
Interface Libraries
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_library(<name> INTERFACE [IMPORTED [GLOBAL]])
|
add_library(<name> INTERFACE [IMPORTED [GLOBAL]])
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
add_link_options
|
add_link_options
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Adds options to the link of shared library, module and executable targets.
|
Add options to the link of shared library, module and executable targets.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_link_options(<option> ...)
|
add_link_options(<option> ...)
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@ add_subdirectory
|
|||||||
|
|
||||||
Add a subdirectory to the build.
|
Add a subdirectory to the build.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_subdirectory(source_dir [binary_dir]
|
add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL])
|
||||||
[EXCLUDE_FROM_ALL])
|
|
||||||
|
|
||||||
Add a subdirectory to the build. The source_dir specifies the
|
Adds a subdirectory to the build. The source_dir specifies the
|
||||||
directory in which the source CMakeLists.txt and code files are
|
directory in which the source CMakeLists.txt and code files are
|
||||||
located. If it is a relative path it will be evaluated with respect
|
located. If it is a relative path it will be evaluated with respect
|
||||||
to the current directory (the typical usage), but it may also be an
|
to the current directory (the typical usage), but it may also be an
|
||||||
|
@ -3,13 +3,13 @@ add_test
|
|||||||
|
|
||||||
Add a test to the project to be run by :manual:`ctest(1)`.
|
Add a test to the project to be run by :manual:`ctest(1)`.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_test(NAME <name> COMMAND <command> [<arg>...]
|
add_test(NAME <name> COMMAND <command> [<arg>...]
|
||||||
[CONFIGURATIONS <config>...]
|
[CONFIGURATIONS <config>...]
|
||||||
[WORKING_DIRECTORY <dir>])
|
[WORKING_DIRECTORY <dir>])
|
||||||
|
|
||||||
Add a test called ``<name>``. The test name may not contain spaces,
|
Adds a test called ``<name>``. The test name may not contain spaces,
|
||||||
quotes, or other characters special in CMake syntax. The options are:
|
quotes, or other characters special in CMake syntax. The options are:
|
||||||
|
|
||||||
``COMMAND``
|
``COMMAND``
|
||||||
@ -39,7 +39,9 @@ The ``COMMAND`` and ``WORKING_DIRECTORY`` options may use "generator
|
|||||||
expressions" with the syntax ``$<...>``. See the
|
expressions" with the syntax ``$<...>``. See the
|
||||||
:manual:`cmake-generator-expressions(7)` manual for available expressions.
|
:manual:`cmake-generator-expressions(7)` manual for available expressions.
|
||||||
|
|
||||||
Example usage::
|
Example usage:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_test(NAME mytest
|
add_test(NAME mytest
|
||||||
COMMAND testDriver --config $<CONFIGURATION>
|
COMMAND testDriver --config $<CONFIGURATION>
|
||||||
@ -57,7 +59,7 @@ file produced by target ``myexe``.
|
|||||||
|
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_test(<name> <command> [<arg>...])
|
add_test(<name> <command> [<arg>...])
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ aux_source_directory
|
|||||||
|
|
||||||
Find all source files in a directory.
|
Find all source files in a directory.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
aux_source_directory(<dir> <variable>)
|
aux_source_directory(<dir> <variable>)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ create_test_sourcelist
|
|||||||
|
|
||||||
Create a test driver and source list for building test programs.
|
Create a test driver and source list for building test programs.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
create_test_sourcelist(sourceListName driverName
|
create_test_sourcelist(sourceListName driverName
|
||||||
test1 test2 test3
|
test1 test2 test3
|
||||||
|
@ -3,7 +3,7 @@ define_property
|
|||||||
|
|
||||||
Define and document custom properties.
|
Define and document custom properties.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
define_property(<GLOBAL | DIRECTORY | TARGET | SOURCE |
|
define_property(<GLOBAL | DIRECTORY | TARGET | SOURCE |
|
||||||
TEST | VARIABLE | CACHED_VARIABLE>
|
TEST | VARIABLE | CACHED_VARIABLE>
|
||||||
@ -11,7 +11,7 @@ Define and document custom properties.
|
|||||||
BRIEF_DOCS <brief-doc> [docs...]
|
BRIEF_DOCS <brief-doc> [docs...]
|
||||||
FULL_DOCS <full-doc> [docs...])
|
FULL_DOCS <full-doc> [docs...])
|
||||||
|
|
||||||
Define one property in a scope for use with the :command:`set_property` and
|
Defines one property in a scope for use with the :command:`set_property` and
|
||||||
:command:`get_property` commands. This is primarily useful to associate
|
:command:`get_property` commands. This is primarily useful to associate
|
||||||
documentation with property names that may be retrieved with the
|
documentation with property names that may be retrieved with the
|
||||||
:command:`get_property` command. The first argument determines the kind of
|
:command:`get_property` command. The first argument determines the kind of
|
||||||
|
@ -3,12 +3,12 @@ enable_language
|
|||||||
|
|
||||||
Enable a language (CXX/C/Fortran/etc)
|
Enable a language (CXX/C/Fortran/etc)
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
enable_language(<lang> [OPTIONAL] )
|
enable_language(<lang> [OPTIONAL] )
|
||||||
|
|
||||||
This command enables support for the named language in CMake. This is
|
Enables support for the named language in CMake. This is
|
||||||
the same as the project command but does not create any of the extra
|
the same as the :command:`project` command but does not create any of the extra
|
||||||
variables that are created by the project command. Example languages
|
variables that are created by the project command. Example languages
|
||||||
are ``CXX``, ``C``, ``CUDA``, ``Fortran``, and ``ASM``.
|
are ``CXX``, ``C``, ``CUDA``, ``Fortran``, and ``ASM``.
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ enable_testing
|
|||||||
|
|
||||||
Enable testing for current directory and below.
|
Enable testing for current directory and below.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ export
|
|||||||
|
|
||||||
Export targets from the build tree for use by outside projects.
|
Export targets from the build tree for use by outside projects.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>])
|
export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>])
|
||||||
|
|
||||||
Create a file ``<filename>`` that may be included by outside projects to
|
Creates a file ``<filename>`` that may be included by outside projects to
|
||||||
import targets from the current project's build tree. This is useful
|
import targets from the current project's build tree. This is useful
|
||||||
during cross-compiling to build utility executables that can run on
|
during cross-compiling to build utility executables that can run on
|
||||||
the host platform in one project and then import them into another
|
the host platform in one project and then import them into another
|
||||||
@ -25,7 +25,7 @@ export targets from an installation tree.
|
|||||||
The properties set on the generated IMPORTED targets will have the
|
The properties set on the generated IMPORTED targets will have the
|
||||||
same values as the final values of the input TARGETS.
|
same values as the final values of the input TARGETS.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
|
export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
|
||||||
[APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])
|
[APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])
|
||||||
@ -49,7 +49,7 @@ unspecified.
|
|||||||
transitive usage requirements of other targets that link to the
|
transitive usage requirements of other targets that link to the
|
||||||
object libraries in their implementation.
|
object libraries in their implementation.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
export(PACKAGE <PackageName>)
|
export(PACKAGE <PackageName>)
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ wide installations, it is not desirable to write the user package
|
|||||||
registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable
|
registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable
|
||||||
is enabled, the ``export(PACKAGE)`` command will do nothing.
|
is enabled, the ``export(PACKAGE)`` command will do nothing.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
export(TARGETS [target1 [target2 [...]]] [ANDROID_MK <filename>])
|
export(TARGETS [target1 [target2 [...]]] [ANDROID_MK <filename>])
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ fltk_wrap_ui
|
|||||||
|
|
||||||
Create FLTK user interfaces Wrappers.
|
Create FLTK user interfaces Wrappers.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
fltk_wrap_ui(resultingLibraryName source1
|
fltk_wrap_ui(resultingLibraryName source1
|
||||||
source2 ... sourceN )
|
source2 ... sourceN )
|
||||||
|
@ -3,11 +3,11 @@ get_source_file_property
|
|||||||
|
|
||||||
Get a property for a source file.
|
Get a property for a source file.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
get_source_file_property(VAR file property)
|
get_source_file_property(VAR file property)
|
||||||
|
|
||||||
Get a property from a source file. The value of the property is
|
Gets a property from a source file. The value of the property is
|
||||||
stored in the variable ``VAR``. If the source property is not found, the
|
stored in the variable ``VAR``. If the source property is not found, the
|
||||||
behavior depends on whether it has been defined to be an ``INHERITED`` property
|
behavior depends on whether it has been defined to be an ``INHERITED`` property
|
||||||
or not (see :command:`define_property`). Non-inherited properties will set
|
or not (see :command:`define_property`). Non-inherited properties will set
|
||||||
|
@ -3,7 +3,7 @@ get_target_property
|
|||||||
|
|
||||||
Get a property from a target.
|
Get a property from a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
get_target_property(VAR target property)
|
get_target_property(VAR target property)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ get_test_property
|
|||||||
|
|
||||||
Get a property of the test.
|
Get a property of the test.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
get_test_property(test property VAR)
|
get_test_property(test property VAR)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ include_directories
|
|||||||
|
|
||||||
Add include directories to the build.
|
Add include directories to the build.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
include_directories([AFTER|BEFORE] [SYSTEM] dir1 [dir2 ...])
|
include_directories([AFTER|BEFORE] [SYSTEM] dir1 [dir2 ...])
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ include_external_msproject
|
|||||||
|
|
||||||
Include an external Microsoft project file in a workspace.
|
Include an external Microsoft project file in a workspace.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
include_external_msproject(projectname location
|
include_external_msproject(projectname location
|
||||||
[TYPE projectTypeGUID]
|
[TYPE projectTypeGUID]
|
||||||
|
@ -3,11 +3,11 @@ include_regular_expression
|
|||||||
|
|
||||||
Set the regular expression used for dependency checking.
|
Set the regular expression used for dependency checking.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
include_regular_expression(regex_match [regex_complain])
|
include_regular_expression(regex_match [regex_complain])
|
||||||
|
|
||||||
Set the regular expressions used in dependency checking. Only files
|
Sets the regular expressions used in dependency checking. Only files
|
||||||
matching ``regex_match`` will be traced as dependencies. Only files
|
matching ``regex_match`` will be traced as dependencies. Only files
|
||||||
matching ``regex_complain`` will generate warnings if they cannot be found
|
matching ``regex_complain`` will generate warnings if they cannot be found
|
||||||
(standard header paths are not searched). The defaults are:
|
(standard header paths are not searched). The defaults are:
|
||||||
|
@ -101,7 +101,7 @@ Installing Targets
|
|||||||
|
|
||||||
.. _TARGETS:
|
.. _TARGETS:
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
install(TARGETS targets... [EXPORT <export-name>]
|
install(TARGETS targets... [EXPORT <export-name>]
|
||||||
[[ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|
|
[[ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|
|
||||||
@ -305,7 +305,7 @@ Installing Files
|
|||||||
.. _FILES:
|
.. _FILES:
|
||||||
.. _PROGRAMS:
|
.. _PROGRAMS:
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
install(<FILES|PROGRAMS> files... DESTINATION <dir>
|
install(<FILES|PROGRAMS> files... DESTINATION <dir>
|
||||||
[PERMISSIONS permissions...]
|
[PERMISSIONS permissions...]
|
||||||
@ -340,7 +340,7 @@ Installing Directories
|
|||||||
|
|
||||||
.. _DIRECTORY:
|
.. _DIRECTORY:
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
install(DIRECTORY dirs... DESTINATION <dir>
|
install(DIRECTORY dirs... DESTINATION <dir>
|
||||||
[FILE_PERMISSIONS permissions...]
|
[FILE_PERMISSIONS permissions...]
|
||||||
@ -424,7 +424,7 @@ Custom Installation Logic
|
|||||||
.. _CODE:
|
.. _CODE:
|
||||||
.. _SCRIPT:
|
.. _SCRIPT:
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
install([[SCRIPT <file>] [CODE <code>]]
|
install([[SCRIPT <file>] [CODE <code>]]
|
||||||
[COMPONENT <component>] [EXCLUDE_FROM_ALL] [...])
|
[COMPONENT <component>] [EXCLUDE_FROM_ALL] [...])
|
||||||
@ -447,7 +447,7 @@ Installing Exports
|
|||||||
|
|
||||||
.. _EXPORT:
|
.. _EXPORT:
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
install(EXPORT <export-name> DESTINATION <dir>
|
install(EXPORT <export-name> DESTINATION <dir>
|
||||||
[NAMESPACE <namespace>] [[FILE <name>.cmake]|
|
[NAMESPACE <namespace>] [[FILE <name>.cmake]|
|
||||||
|
@ -3,11 +3,11 @@ link_directories
|
|||||||
|
|
||||||
Add directories in which the linker will look for libraries.
|
Add directories in which the linker will look for libraries.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
link_directories([AFTER|BEFORE] directory1 [directory2 ...])
|
link_directories([AFTER|BEFORE] directory1 [directory2 ...])
|
||||||
|
|
||||||
Add the paths in which the linker should search for libraries.
|
Adds the paths in which the linker should search for libraries.
|
||||||
Relative paths given to this command are interpreted as relative to
|
Relative paths given to this command are interpreted as relative to
|
||||||
the current source directory, see :policy:`CMP0015`.
|
the current source directory, see :policy:`CMP0015`.
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ link_libraries
|
|||||||
|
|
||||||
Link libraries to all targets added later.
|
Link libraries to all targets added later.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
link_libraries([item1 [item2 [...]]]
|
link_libraries([item1 [item2 [...]]]
|
||||||
[[debug|optimized|general] <item>] ...)
|
[[debug|optimized|general] <item>] ...)
|
||||||
|
@ -3,21 +3,20 @@ load_cache
|
|||||||
|
|
||||||
Load in the values from another project's CMake cache.
|
Load in the values from another project's CMake cache.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
load_cache(pathToCacheFile READ_WITH_PREFIX
|
load_cache(pathToCacheFile READ_WITH_PREFIX prefix entry1...)
|
||||||
prefix entry1...)
|
|
||||||
|
|
||||||
Read the cache and store the requested entries in variables with their
|
Reads the cache and store the requested entries in variables with their
|
||||||
name prefixed with the given prefix. This only reads the values, and
|
name prefixed with the given prefix. This only reads the values, and
|
||||||
does not create entries in the local project's cache.
|
does not create entries in the local project's cache.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
load_cache(pathToCacheFile [EXCLUDE entry1...]
|
load_cache(pathToCacheFile [EXCLUDE entry1...]
|
||||||
[INCLUDE_INTERNALS entry1...])
|
[INCLUDE_INTERNALS entry1...])
|
||||||
|
|
||||||
Load in the values from another cache and store them in the local
|
Loads in the values from another cache and store them in the local
|
||||||
project's cache as internal entries. This is useful for a project
|
project's cache as internal entries. This is useful for a project
|
||||||
that depends on another project built in a different tree. ``EXCLUDE``
|
that depends on another project built in a different tree. ``EXCLUDE``
|
||||||
option can be used to provide a list of entries to be excluded.
|
option can be used to provide a list of entries to be excluded.
|
||||||
|
@ -3,10 +3,9 @@ qt_wrap_cpp
|
|||||||
|
|
||||||
Create Qt Wrappers.
|
Create Qt Wrappers.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
qt_wrap_cpp(resultingLibraryName DestName
|
qt_wrap_cpp(resultingLibraryName DestName SourceLists ...)
|
||||||
SourceLists ...)
|
|
||||||
|
|
||||||
Produce moc files for all the .h files listed in the SourceLists. The
|
Produces moc files for all the .h files listed in the SourceLists. The
|
||||||
moc files will be added to the library using the ``DestName`` source list.
|
moc files will be added to the library using the ``DestName`` source list.
|
||||||
|
@ -3,12 +3,12 @@ qt_wrap_ui
|
|||||||
|
|
||||||
Create Qt user interfaces Wrappers.
|
Create Qt user interfaces Wrappers.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
qt_wrap_ui(resultingLibraryName HeadersDestName
|
qt_wrap_ui(resultingLibraryName HeadersDestName
|
||||||
SourcesDestName SourceLists ...)
|
SourcesDestName SourceLists ...)
|
||||||
|
|
||||||
Produce .h and .cxx files for all the .ui files listed in the
|
Produces .h and .cxx files for all the .ui files listed in the
|
||||||
``SourceLists``. The .h files will be added to the library using the
|
``SourceLists``. The .h files will be added to the library using the
|
||||||
``HeadersDestNamesource`` list. The .cxx files will be added to the
|
``HeadersDestNamesource`` list. The .cxx files will be added to the
|
||||||
library using the ``SourcesDestNamesource`` list.
|
library using the ``SourcesDestNamesource`` list.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
remove_definitions
|
remove_definitions
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Removes -D define flags added by :command:`add_definitions`.
|
Remove -D define flags added by :command:`add_definitions`.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
remove_definitions(-DFOO -DBAR ...)
|
remove_definitions(-DFOO -DBAR ...)
|
||||||
|
|
||||||
|
@ -3,13 +3,13 @@ set_source_files_properties
|
|||||||
|
|
||||||
Source files can have properties that affect how they are built.
|
Source files can have properties that affect how they are built.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
set_source_files_properties([file1 [file2 [...]]]
|
set_source_files_properties([file1 [file2 [...]]]
|
||||||
PROPERTIES prop1 value1
|
PROPERTIES prop1 value1
|
||||||
[prop2 value2 [...]])
|
[prop2 value2 [...]])
|
||||||
|
|
||||||
Set properties associated with source files using a key/value paired
|
Sets properties associated with source files using a key/value paired
|
||||||
list. See :ref:`Source File Properties` for the list of properties known
|
list. See :ref:`Source File Properties` for the list of properties known
|
||||||
to CMake. Source file properties are visible only to targets added
|
to CMake. Source file properties are visible only to targets added
|
||||||
in the same directory (CMakeLists.txt).
|
in the same directory (CMakeLists.txt).
|
||||||
|
@ -3,13 +3,13 @@ set_target_properties
|
|||||||
|
|
||||||
Targets can have properties that affect how they are built.
|
Targets can have properties that affect how they are built.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
set_target_properties(target1 target2 ...
|
set_target_properties(target1 target2 ...
|
||||||
PROPERTIES prop1 value1
|
PROPERTIES prop1 value1
|
||||||
prop2 value2 ...)
|
prop2 value2 ...)
|
||||||
|
|
||||||
Set properties on targets. The syntax for the command is to list all
|
Sets properties on targets. The syntax for the command is to list all
|
||||||
the targets you want to change, and then provide the values you want to
|
the targets you want to change, and then provide the values you want to
|
||||||
set next. You can use any prop value pair you want and extract it
|
set next. You can use any prop value pair you want and extract it
|
||||||
later with the :command:`get_property` or :command:`get_target_property`
|
later with the :command:`get_property` or :command:`get_target_property`
|
||||||
|
@ -3,11 +3,11 @@ set_tests_properties
|
|||||||
|
|
||||||
Set a property of the tests.
|
Set a property of the tests.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
|
set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
|
||||||
|
|
||||||
Set a property for the tests. If the test is not found, CMake
|
Sets a property for the tests. If the test is not found, CMake
|
||||||
will report an error.
|
will report an error.
|
||||||
:manual:`Generator expressions <cmake-generator-expressions(7)>` will be
|
:manual:`Generator expressions <cmake-generator-expressions(7)>` will be
|
||||||
expanded the same as supported by the test's :command:`add_test` call. See
|
expanded the same as supported by the test's :command:`add_test` call. See
|
||||||
|
@ -4,7 +4,7 @@ source_group
|
|||||||
Define a grouping for source files in IDE project generation.
|
Define a grouping for source files in IDE project generation.
|
||||||
There are two different signatures to create source groups.
|
There are two different signatures to create source groups.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
source_group(<name> [FILES <src>...] [REGULAR_EXPRESSION <regex>])
|
source_group(<name> [FILES <src>...] [REGULAR_EXPRESSION <regex>])
|
||||||
source_group(TREE <root> [PREFIX <prefix>] [FILES <src>...])
|
source_group(TREE <root> [PREFIX <prefix>] [FILES <src>...])
|
||||||
|
@ -3,13 +3,13 @@ target_compile_definitions
|
|||||||
|
|
||||||
Add compile definitions to a target.
|
Add compile definitions to a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_compile_definitions(<target>
|
target_compile_definitions(<target>
|
||||||
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
||||||
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
||||||
|
|
||||||
Specify compile definitions to use when compiling a given ``<target>``. The
|
Specifies compile definitions to use when compiling a given ``<target>``. The
|
||||||
named ``<target>`` must have been created by a command such as
|
named ``<target>`` must have been created by a command such as
|
||||||
:command:`add_executable` or :command:`add_library` and must not be an
|
:command:`add_executable` or :command:`add_library` and must not be an
|
||||||
:ref:`ALIAS target <Alias Targets>`.
|
:ref:`ALIAS target <Alias Targets>`.
|
||||||
|
@ -3,11 +3,11 @@ target_compile_features
|
|||||||
|
|
||||||
Add expected compiler features to a target.
|
Add expected compiler features to a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_compile_features(<target> <PRIVATE|PUBLIC|INTERFACE> <feature> [...])
|
target_compile_features(<target> <PRIVATE|PUBLIC|INTERFACE> <feature> [...])
|
||||||
|
|
||||||
Specify compiler features required when compiling a given target. If the
|
Specifies compiler features required when compiling a given target. If the
|
||||||
feature is not listed in the :variable:`CMAKE_C_COMPILE_FEATURES` variable
|
feature is not listed in the :variable:`CMAKE_C_COMPILE_FEATURES` variable
|
||||||
or :variable:`CMAKE_CXX_COMPILE_FEATURES` variable,
|
or :variable:`CMAKE_CXX_COMPILE_FEATURES` variable,
|
||||||
then an error will be reported by CMake. If the use of the feature requires
|
then an error will be reported by CMake. If the use of the feature requires
|
||||||
|
@ -3,13 +3,13 @@ target_compile_options
|
|||||||
|
|
||||||
Add compile options to a target.
|
Add compile options to a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_compile_options(<target> [BEFORE]
|
target_compile_options(<target> [BEFORE]
|
||||||
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
||||||
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
||||||
|
|
||||||
Specify compile options to use when compiling a given target. The
|
Specifies compile options to use when compiling a given target. The
|
||||||
named ``<target>`` must have been created by a command such as
|
named ``<target>`` must have been created by a command such as
|
||||||
:command:`add_executable` or :command:`add_library` and must not be an
|
:command:`add_executable` or :command:`add_library` and must not be an
|
||||||
:ref:`ALIAS target <Alias Targets>`.
|
:ref:`ALIAS target <Alias Targets>`.
|
||||||
|
@ -3,13 +3,13 @@ target_include_directories
|
|||||||
|
|
||||||
Add include directories to a target.
|
Add include directories to a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_include_directories(<target> [SYSTEM] [BEFORE]
|
target_include_directories(<target> [SYSTEM] [BEFORE]
|
||||||
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
||||||
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
||||||
|
|
||||||
Specify include directories to use when compiling a given target.
|
Specifies include directories to use when compiling a given target.
|
||||||
The named ``<target>`` must have been created by a command such
|
The named ``<target>`` must have been created by a command such
|
||||||
as :command:`add_executable` or :command:`add_library` and must not be an
|
as :command:`add_executable` or :command:`add_library` and must not be an
|
||||||
:ref:`ALIAS target <Alias Targets>`.
|
:ref:`ALIAS target <Alias Targets>`.
|
||||||
|
@ -3,13 +3,13 @@ target_link_directories
|
|||||||
|
|
||||||
Add link directories to a target.
|
Add link directories to a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_link_directories(<target> [BEFORE]
|
target_link_directories(<target> [BEFORE]
|
||||||
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
||||||
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
||||||
|
|
||||||
Specify the paths in which the linker should search for libraries when
|
Specifies the paths in which the linker should search for libraries when
|
||||||
linking a given target. Each item can be an absolute or relative path,
|
linking a given target. Each item can be an absolute or relative path,
|
||||||
with the latter being interpreted as relative to the current source
|
with the latter being interpreted as relative to the current source
|
||||||
directory. These items will be added to the link command.
|
directory. These items will be added to the link command.
|
||||||
|
@ -14,7 +14,9 @@ Overview
|
|||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
This command has several signatures as detailed in subsections below.
|
This command has several signatures as detailed in subsections below.
|
||||||
All of them have the general form::
|
All of them have the general form
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_link_libraries(<target> ... <item>... ...)
|
target_link_libraries(<target> ... <item>... ...)
|
||||||
|
|
||||||
@ -128,7 +130,7 @@ buildsystem properties.
|
|||||||
Libraries for a Target and/or its Dependents
|
Libraries for a Target and/or its Dependents
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_link_libraries(<target>
|
target_link_libraries(<target>
|
||||||
<PRIVATE|PUBLIC|INTERFACE> <item>...
|
<PRIVATE|PUBLIC|INTERFACE> <item>...
|
||||||
@ -145,7 +147,7 @@ used for linking ``<target>``.
|
|||||||
Libraries for both a Target and its Dependents
|
Libraries for both a Target and its Dependents
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_link_libraries(<target> <item>...)
|
target_link_libraries(<target> <item>...)
|
||||||
|
|
||||||
@ -163,7 +165,7 @@ exclusively by this signature private.
|
|||||||
Libraries for a Target and/or its Dependents (Legacy)
|
Libraries for a Target and/or its Dependents (Legacy)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_link_libraries(<target>
|
target_link_libraries(<target>
|
||||||
<LINK_PRIVATE|LINK_PUBLIC> <lib>...
|
<LINK_PRIVATE|LINK_PUBLIC> <lib>...
|
||||||
@ -185,7 +187,7 @@ made part of the :prop_tgt:`INTERFACE_LINK_LIBRARIES`. If policy
|
|||||||
Libraries for Dependents Only (Legacy)
|
Libraries for Dependents Only (Legacy)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_link_libraries(<target> LINK_INTERFACE_LIBRARIES <item>...)
|
target_link_libraries(<target> LINK_INTERFACE_LIBRARIES <item>...)
|
||||||
|
|
||||||
|
@ -3,13 +3,13 @@ target_link_options
|
|||||||
|
|
||||||
Add link options to a target.
|
Add link options to a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_link_options(<target> [BEFORE]
|
target_link_options(<target> [BEFORE]
|
||||||
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
||||||
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
||||||
|
|
||||||
Specify link options to use when linking a given target. The
|
Specifies link options to use when linking a given target. The
|
||||||
named ``<target>`` must have been created by a command such as
|
named ``<target>`` must have been created by a command such as
|
||||||
:command:`add_executable` or :command:`add_library` and must not be an
|
:command:`add_executable` or :command:`add_library` and must not be an
|
||||||
:ref:`ALIAS target <Alias Targets>`.
|
:ref:`ALIAS target <Alias Targets>`.
|
||||||
|
@ -3,13 +3,13 @@ target_sources
|
|||||||
|
|
||||||
Add sources to a target.
|
Add sources to a target.
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_sources(<target>
|
target_sources(<target>
|
||||||
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
<INTERFACE|PUBLIC|PRIVATE> [items1...]
|
||||||
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
[<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])
|
||||||
|
|
||||||
Specify sources to use when compiling a given target. Relative
|
Specifies sources to use when compiling a given target. Relative
|
||||||
source file paths are interpreted as being relative to the current
|
source file paths are interpreted as being relative to the current
|
||||||
source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). The
|
source directory (i.e. :variable:`CMAKE_CURRENT_SOURCE_DIR`). The
|
||||||
named ``<target>`` must have been created by a command such as
|
named ``<target>`` must have been created by a command such as
|
||||||
|
@ -10,7 +10,7 @@ Try building some code.
|
|||||||
Try Compiling Whole Projects
|
Try Compiling Whole Projects
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
try_compile(RESULT_VAR <bindir> <srcdir>
|
try_compile(RESULT_VAR <bindir> <srcdir>
|
||||||
<projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
|
<projectName> [<targetName>] [CMAKE_FLAGS <flags>...]
|
||||||
@ -28,7 +28,7 @@ below for the meaning of other options.
|
|||||||
Try Compiling Source Files
|
Try Compiling Source Files
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>
|
try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>
|
||||||
[CMAKE_FLAGS <flags>...]
|
[CMAKE_FLAGS <flags>...]
|
||||||
@ -47,7 +47,9 @@ returned in ``RESULT_VAR``.
|
|||||||
|
|
||||||
In this form the user need only supply one or more source files that include a
|
In this form the user need only supply one or more source files that include a
|
||||||
definition for ``main``. CMake will create a ``CMakeLists.txt`` file to build
|
definition for ``main``. CMake will create a ``CMakeLists.txt`` file to build
|
||||||
the source(s) as an executable that looks something like this::
|
the source(s) as an executable that looks something like this:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_definitions(<expanded COMPILE_DEFINITIONS from caller>)
|
add_definitions(<expanded COMPILE_DEFINITIONS from caller>)
|
||||||
include_directories(${INCLUDE_DIRECTORIES})
|
include_directories(${INCLUDE_DIRECTORIES})
|
||||||
|
@ -10,7 +10,7 @@ Try compiling and then running some code.
|
|||||||
Try Compiling and Running Source Files
|
Try Compiling and Running Source Files
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
::
|
.. code-block:: cmake
|
||||||
|
|
||||||
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
||||||
bindir srcfile [CMAKE_FLAGS <flags>...]
|
bindir srcfile [CMAKE_FLAGS <flags>...]
|
||||||
|
Loading…
Reference in New Issue
Block a user