code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>find_path — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="find_program" href="find_program.html" />
    <link rel="prev" title="find_package" href="find_package.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

find_path

find_path¶

A short-hand signature is:

find_path (<VAR> name1 [path1 path2 ...])

The general signature is:

find_path (
          <VAR>
          name | NAMES name1 [name2 ...]
          [HINTS [path | ENV var]... ]
          [PATHS [path | ENV var]... ]
          [REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
          [PATH_SUFFIXES suffix1 [suffix2 ...]]
          [VALIDATOR function]
          [DOC "cache documentation string"]
          [NO_CACHE]
          [REQUIRED]
          [NO_DEFAULT_PATH]
          [NO_PACKAGE_ROOT_PATH]
          [NO_CMAKE_PATH]
          [NO_CMAKE_ENVIRONMENT_PATH]
          [NO_SYSTEM_ENVIRONMENT_PATH]
          [NO_CMAKE_SYSTEM_PATH]
          [NO_CMAKE_INSTALL_PREFIX]
          [CMAKE_FIND_ROOT_PATH_BOTH |
           ONLY_CMAKE_FIND_ROOT_PATH |
           NO_CMAKE_FIND_ROOT_PATH]
         )

This command is used to find a directory containing the named file.
A cache entry, or a normal variable if NO_CACHE is specified,
named by <VAR> is created to store the result of this command.
If the file in a directory is found the result is stored in the variable
and the search will not be repeated unless the variable is cleared.
If nothing is found, the result will be <VAR>-NOTFOUND.

Options include:

NAMES

Specify one or more possible names for the file in a directory.

When using this to specify names with and without a version
suffix, we recommend specifying the unversioned name first
so that locally-built packages can be found before those
provided by distributions.

HINTS, PATHS

Specify directories to search in addition to the default locations.
The ENV var sub-option reads paths from a system environment
variable.

Changed in version 3.24: On Windows platform, it is possible to include registry queries as part
of the directories, using a dedicated syntax.
Such specifications will be ignored on all other platforms.

REGISTRY_VIEW

New in version 3.24.

Specify which registry views must be queried. This option is only meaningful
on Windows platforms and will be ignored on other ones. When not
specified, the TARGET view is used when the
CMP0134 policy is NEW. Refer to CMP0134 for the
default view when the policy is OLD.

64

Query the 64-bit registry. On 32-bit Windows, it always returns the string
/REGISTRY-NOTFOUND.

32

Query the 32-bit registry.

64_32

Query both views (64 and 32) and generate a path for each.

32_64

Query both views (32 and 64) and generate a path for each.

HOST

Query the registry matching the architecture of the host: 64 on 64-bit
Windows and 32 on 32-bit Windows.

TARGET

Query the registry matching the architecture specified by the
CMAKE_SIZEOF_VOID_P variable. If not defined, fall back to
HOST view.

BOTH

Query both views (32 and 64). The order depends on the following
rules: If the CMAKE_SIZEOF_VOID_P variable is defined, use the
following view depending on the content of this variable:

8: 64_32

4: 32_64

If the CMAKE_SIZEOF_VOID_P variable is not defined, rely on the
architecture of the host:

64-bit: 64_32

32-bit: 32

PATH_SUFFIXES

Specify additional subdirectories to check below each directory
location otherwise considered.

VALIDATOR

New in version 3.25.

Specify a function() to be called for each candidate item found
(a macro() cannot be provided, that will result in an error).
Two arguments will be passed to the validator function: the name of a
result variable, and the absolute path to the candidate item.  The item
will be accepted and the search will end unless the function sets the
value in the result variable to false in the calling scope.  The result
variable will hold a true value when the validator function is entered.

function(my_check validator_result_var item)
  if(NOT item MATCHES ...)
    set(${validator_result_var} FALSE PARENT_SCOPE)
  endif()
endfunction()

find_path (result NAMES ... VALIDATOR my_check)

Note that if a cached result is used, the search is skipped and any
VALIDATOR is ignored.  The cached result is not required to pass the
validation function.

DOC

Specify the documentation string for the <VAR> cache entry.

NO_CACHE

New in version 3.21.

The result of the search will be stored in a normal variable rather than
a cache entry.

Note

If the variable is already set before the call (as a normal or cache
variable) then the search will not occur.

Warning

This option should be used with caution because it can greatly increase
the cost of repeated configure steps.

REQUIRED

New in version 3.18.

Stop processing with an error message if nothing is found, otherwise
the search will be attempted again the next time find_path is invoked
with the same variable.

If NO_DEFAULT_PATH is specified, then no additional paths are
added to the search.
If NO_DEFAULT_PATH is not specified, the search process is as follows:

If called from within a find module or any other script loaded by a call to
find_package(<PackageName>), search prefixes unique to the
current package being found.  See policy CMP0074.

New in version 3.12.

Specifically, search paths specified by the following variables, in order:

<PackageName>_ROOT CMake variable,
where <PackageName> is the case-preserved package name.

<PACKAGENAME>_ROOT CMake variable,
where <PACKAGENAME> is the upper-cased package name.
See policy CMP0144.

New in version 3.27.

<PackageName>_ROOT environment variable,
where <PackageName> is the case-preserved package name.

<PACKAGENAME>_ROOT environment variable,
where <PACKAGENAME> is the upper-cased package name.
See policy CMP0144.

New in version 3.27.

The package root variables are maintained as a stack, so if called from
nested find modules or config packages, root paths from the parent's find
module or config package will be searched after paths from the current
module or package.  In other words, the search order would be
<CurrentPackage>_ROOT, ENV{<CurrentPackage>_ROOT},
<ParentPackage>_ROOT, ENV{<ParentPackage>_ROOT}, etc.
This can be skipped if NO_PACKAGE_ROOT_PATH is passed or by setting
the CMAKE_FIND_USE_PACKAGE_ROOT_PATH to FALSE.

<prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE
is set, and <prefix>/include for each <prefix> in the
<PackageName>_ROOT CMake variable and the
<PackageName>_ROOT environment variable if
called from within a find module loaded by
find_package(<PackageName>)

Search paths specified in cmake-specific cache variables.
These are intended to be used on the command line with a -DVAR=value.
The values are interpreted as semicolon-separated lists.
This can be skipped if NO_CMAKE_PATH is passed or by setting the
CMAKE_FIND_USE_CMAKE_PATH to FALSE.

<prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE
is set, and <prefix>/include for each <prefix> in CMAKE_PREFIX_PATH

CMAKE_INCLUDE_PATH

CMAKE_FRAMEWORK_PATH

Search paths specified in cmake-specific environment variables.
These are intended to be set in the user's shell configuration,
and therefore use the host's native path separator
(; on Windows and : on UNIX).
This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed or
by setting the CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH to FALSE.

<prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set,
and <prefix>/include for each <prefix> in CMAKE_PREFIX_PATH

CMAKE_INCLUDE_PATH

CMAKE_FRAMEWORK_PATH

Search the paths specified by the HINTS option.
These should be paths computed by system introspection, such as a
hint provided by the location of another item already found.
Hard-coded guesses should be specified with the PATHS option.

Search the standard system environment variables.
This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is passed or by
setting the CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to FALSE.

The directories in INCLUDE
and PATH.

On Windows hosts, CMake 3.3 through 3.27 searched additional paths:
<prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE
is set, and <prefix>/include for each <prefix>/[s]bin in PATH, and
<entry>/include for other entries in PATH.
This behavior was removed by CMake 3.28.

Search cmake variables defined in the Platform files
for the current system.  The searching of CMAKE_INSTALL_PREFIX and
CMAKE_STAGING_PREFIX can be
skipped if NO_CMAKE_INSTALL_PREFIX is passed or by setting the
CMAKE_FIND_USE_INSTALL_PREFIX to FALSE. All these locations
can be skipped if NO_CMAKE_SYSTEM_PATH is passed or by setting the
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH to FALSE.

<prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE
is set, and <prefix>/include for each <prefix> in
CMAKE_SYSTEM_PREFIX_PATH

CMAKE_SYSTEM_INCLUDE_PATH

CMAKE_SYSTEM_FRAMEWORK_PATH

The platform paths that these variables contain are locations that
typically include installed software. An example being /usr/local for
UNIX based platforms.

Search the paths specified by the PATHS option
or in the short-hand version of the command.
These are typically hard-coded guesses.

The CMAKE_IGNORE_PATH, CMAKE_IGNORE_PREFIX_PATH,
CMAKE_SYSTEM_IGNORE_PATH and
CMAKE_SYSTEM_IGNORE_PREFIX_PATH variables can also cause some
of the above locations to be ignored.

New in version 3.16: Added CMAKE_FIND_USE_<CATEGORY>_PATH variables to globally disable
various search locations.

On macOS the CMAKE_FIND_FRAMEWORK and
CMAKE_FIND_APPBUNDLE variables determine the order of
preference between Apple-style and unix-style package components.

The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more
directories to be prepended to all other search directories.  This
effectively "re-roots" the entire search under given locations.
Paths which are descendants of the CMAKE_STAGING_PREFIX are excluded
from this re-rooting, because that variable is always a path on the host system.
By default the CMAKE_FIND_ROOT_PATH is empty.

The CMAKE_SYSROOT variable can also be used to specify exactly one
directory to use as a prefix.  Setting CMAKE_SYSROOT also has other
effects.  See the documentation for that variable for more.

These variables are especially useful when cross-compiling to
point to the root directory of the target environment and CMake will
search there too.  By default at first the directories listed in
CMAKE_FIND_ROOT_PATH are searched, then the CMAKE_SYSROOT
directory is searched, and then the non-rooted directories will be
searched.  The default behavior can be adjusted by setting
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE.  This behavior can be manually
overridden on a per-call basis using options:

CMAKE_FIND_ROOT_PATH_BOTH

Search in the order described above.

NO_CMAKE_FIND_ROOT_PATH

Do not use the CMAKE_FIND_ROOT_PATH variable.

ONLY_CMAKE_FIND_ROOT_PATH

Search only the re-rooted directories and directories below
CMAKE_STAGING_PREFIX.

The default search order is designed to be most-specific to
least-specific for common use cases.
Projects may override the order by simply calling the command
multiple times and using the NO_* options:

find_path (<VAR> NAMES name PATHS paths... NO_DEFAULT_PATH)
find_path (<VAR> NAMES name)

Once one of the calls succeeds the result variable will be set
and stored in the cache so that no call will search again.

When searching for frameworks, if the file is specified as A/b.h, then
the framework search will look for A.framework/Headers/b.h.  If that
is found the path will be set to the path to the framework.  CMake
will convert this to the correct -F option to include the file.

Previous topic

find_package

Next topic

find_program

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

find_path

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>find_program — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="foreach" href="foreach.html" />
    <link rel="prev" title="find_path" href="find_path.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

find_program

find_program¶

A short-hand signature is:

find_program (<VAR> name1 [path1 path2 ...])

The general signature is:

find_program (
          <VAR>
          name | NAMES name1 [name2 ...] [NAMES_PER_DIR]
          [HINTS [path | ENV var]... ]
          [PATHS [path | ENV var]... ]
          [REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
          [PATH_SUFFIXES suffix1 [suffix2 ...]]
          [VALIDATOR function]
          [DOC "cache documentation string"]
          [NO_CACHE]
          [REQUIRED]
          [NO_DEFAULT_PATH]
          [NO_PACKAGE_ROOT_PATH]
          [NO_CMAKE_PATH]
          [NO_CMAKE_ENVIRONMENT_PATH]
          [NO_SYSTEM_ENVIRONMENT_PATH]
          [NO_CMAKE_SYSTEM_PATH]
          [NO_CMAKE_INSTALL_PREFIX]
          [CMAKE_FIND_ROOT_PATH_BOTH |
           ONLY_CMAKE_FIND_ROOT_PATH |
           NO_CMAKE_FIND_ROOT_PATH]
         )

This command is used to find a program.
A cache entry, or a normal variable if NO_CACHE is specified,
named by <VAR> is created to store the result of this command.
If the program is found the result is stored in the variable
and the search will not be repeated unless the variable is cleared.
If nothing is found, the result will be <VAR>-NOTFOUND.

Options include:

NAMES

Specify one or more possible names for the program.

When using this to specify names with and without a version
suffix, we recommend specifying the unversioned name first
so that locally-built packages can be found before those
provided by distributions.

HINTS, PATHS

Specify directories to search in addition to the default locations.
The ENV var sub-option reads paths from a system environment
variable.

Changed in version 3.24: On Windows platform, it is possible to include registry queries as part
of the directories, using a dedicated syntax.
Such specifications will be ignored on all other platforms.

REGISTRY_VIEW

New in version 3.24.

Specify which registry views must be queried. This option is only meaningful
on Windows platforms and will be ignored on other ones. When not
specified, the BOTH view is used when the
CMP0134 policy is NEW. Refer to CMP0134 for the
default view when the policy is OLD.

64

Query the 64-bit registry. On 32-bit Windows, it always returns the string
/REGISTRY-NOTFOUND.

32

Query the 32-bit registry.

64_32

Query both views (64 and 32) and generate a path for each.

32_64

Query both views (32 and 64) and generate a path for each.

HOST

Query the registry matching the architecture of the host: 64 on 64-bit
Windows and 32 on 32-bit Windows.

TARGET

Query the registry matching the architecture specified by the
CMAKE_SIZEOF_VOID_P variable. If not defined, fall back to
HOST view.

BOTH

Query both views (32 and 64). The order depends on the following
rules: If the CMAKE_SIZEOF_VOID_P variable is defined, use the
following view depending on the content of this variable:

8: 64_32

4: 32_64

If the CMAKE_SIZEOF_VOID_P variable is not defined, rely on the
architecture of the host:

64-bit: 64_32

32-bit: 32

PATH_SUFFIXES

Specify additional subdirectories to check below each directory
location otherwise considered.

VALIDATOR

New in version 3.25.

Specify a function() to be called for each candidate item found
(a macro() cannot be provided, that will result in an error).
Two arguments will be passed to the validator function: the name of a
result variable, and the absolute path to the candidate item.  The item
will be accepted and the search will end unless the function sets the
value in the result variable to false in the calling scope.  The result
variable will hold a true value when the validator function is entered.

function(my_check validator_result_var item)
  if(NOT item MATCHES ...)
    set(${validator_result_var} FALSE PARENT_SCOPE)
  endif()
endfunction()

find_program (result NAMES ... VALIDATOR my_check)

Note that if a cached result is used, the search is skipped and any
VALIDATOR is ignored.  The cached result is not required to pass the
validation function.

DOC

Specify the documentation string for the <VAR> cache entry.

NO_CACHE

New in version 3.21.

The result of the search will be stored in a normal variable rather than
a cache entry.

Note

If the variable is already set before the call (as a normal or cache
variable) then the search will not occur.

Warning

This option should be used with caution because it can greatly increase
the cost of repeated configure steps.

REQUIRED

New in version 3.18.

Stop processing with an error message if nothing is found, otherwise
the search will be attempted again the next time find_program is invoked
with the same variable.

If NO_DEFAULT_PATH is specified, then no additional paths are
added to the search.
If NO_DEFAULT_PATH is not specified, the search process is as follows:

If called from within a find module or any other script loaded by a call to
find_package(<PackageName>), search prefixes unique to the
current package being found.  See policy CMP0074.

New in version 3.12.

Specifically, search paths specified by the following variables, in order:

<PackageName>_ROOT CMake variable,
where <PackageName> is the case-preserved package name.

<PACKAGENAME>_ROOT CMake variable,
where <PACKAGENAME> is the upper-cased package name.
See policy CMP0144.

New in version 3.27.

<PackageName>_ROOT environment variable,
where <PackageName> is the case-preserved package name.

<PACKAGENAME>_ROOT environment variable,
where <PACKAGENAME> is the upper-cased package name.
See policy CMP0144.

New in version 3.27.

The package root variables are maintained as a stack, so if called from
nested find modules or config packages, root paths from the parent's find
module or config package will be searched after paths from the current
module or package.  In other words, the search order would be
<CurrentPackage>_ROOT, ENV{<CurrentPackage>_ROOT},
<ParentPackage>_ROOT, ENV{<ParentPackage>_ROOT}, etc.
This can be skipped if NO_PACKAGE_ROOT_PATH is passed or by setting
the CMAKE_FIND_USE_PACKAGE_ROOT_PATH to FALSE.

<prefix>/[s]bin for each <prefix> in the
<PackageName>_ROOT CMake variable and the
<PackageName>_ROOT environment variable if
called from within a find module loaded by
find_package(<PackageName>)

Search paths specified in cmake-specific cache variables.
These are intended to be used on the command line with a -DVAR=value.
The values are interpreted as semicolon-separated lists.
This can be skipped if NO_CMAKE_PATH is passed or by setting the
CMAKE_FIND_USE_CMAKE_PATH to FALSE.

<prefix>/[s]bin for each <prefix> in CMAKE_PREFIX_PATH

CMAKE_PROGRAM_PATH

CMAKE_APPBUNDLE_PATH

Search paths specified in cmake-specific environment variables.
These are intended to be set in the user's shell configuration,
and therefore use the host's native path separator
(; on Windows and : on UNIX).
This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed or
by setting the CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH to FALSE.

<prefix>/[s]bin for each <prefix> in CMAKE_PREFIX_PATH

CMAKE_PROGRAM_PATH

CMAKE_APPBUNDLE_PATH

Search the paths specified by the HINTS option.
These should be paths computed by system introspection, such as a
hint provided by the location of another item already found.
Hard-coded guesses should be specified with the PATHS option.

Search the standard system environment variables.
This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is passed or by
setting the CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to FALSE.

The directories in PATH itself.

Search cmake variables defined in the Platform files
for the current system.  The searching of CMAKE_INSTALL_PREFIX and
CMAKE_STAGING_PREFIX can be
skipped if NO_CMAKE_INSTALL_PREFIX is passed or by setting the
CMAKE_FIND_USE_INSTALL_PREFIX to FALSE. All these locations
can be skipped if NO_CMAKE_SYSTEM_PATH is passed or by setting the
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH to FALSE.

<prefix>/[s]bin for each <prefix> in
CMAKE_SYSTEM_PREFIX_PATH

CMAKE_SYSTEM_PROGRAM_PATH

CMAKE_SYSTEM_APPBUNDLE_PATH

The platform paths that these variables contain are locations that
typically include installed software. An example being /usr/local for
UNIX based platforms.

Search the paths specified by the PATHS option
or in the short-hand version of the command.
These are typically hard-coded guesses.

The CMAKE_IGNORE_PATH, CMAKE_IGNORE_PREFIX_PATH,
CMAKE_SYSTEM_IGNORE_PATH and
CMAKE_SYSTEM_IGNORE_PREFIX_PATH variables can also cause some
of the above locations to be ignored.

New in version 3.16: Added CMAKE_FIND_USE_<CATEGORY>_PATH variables to globally disable
various search locations.

On macOS the CMAKE_FIND_FRAMEWORK and
CMAKE_FIND_APPBUNDLE variables determine the order of
preference between Apple-style and unix-style package components.

The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more
directories to be prepended to all other search directories.  This
effectively "re-roots" the entire search under given locations.
Paths which are descendants of the CMAKE_STAGING_PREFIX are excluded
from this re-rooting, because that variable is always a path on the host system.
By default the CMAKE_FIND_ROOT_PATH is empty.

The CMAKE_SYSROOT variable can also be used to specify exactly one
directory to use as a prefix.  Setting CMAKE_SYSROOT also has other
effects.  See the documentation for that variable for more.

These variables are especially useful when cross-compiling to
point to the root directory of the target environment and CMake will
search there too.  By default at first the directories listed in
CMAKE_FIND_ROOT_PATH are searched, then the CMAKE_SYSROOT
directory is searched, and then the non-rooted directories will be
searched.  The default behavior can be adjusted by setting
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM.  This behavior can be manually
overridden on a per-call basis using options:

CMAKE_FIND_ROOT_PATH_BOTH

Search in the order described above.

NO_CMAKE_FIND_ROOT_PATH

Do not use the CMAKE_FIND_ROOT_PATH variable.

ONLY_CMAKE_FIND_ROOT_PATH

Search only the re-rooted directories and directories below
CMAKE_STAGING_PREFIX.

The default search order is designed to be most-specific to
least-specific for common use cases.
Projects may override the order by simply calling the command
multiple times and using the NO_* options:

find_program (<VAR> NAMES name PATHS paths... NO_DEFAULT_PATH)
find_program (<VAR> NAMES name)

Once one of the calls succeeds the result variable will be set
and stored in the cache so that no call will search again.

When more than one value is given to the NAMES option this command by
default will consider one name at a time and search every directory
for it.  The NAMES_PER_DIR option tells this command to consider one
directory at a time and search for all names in it.

Previous topic

find_path

Next topic

foreach

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

find_program

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.

repo_name: lazytadpole/codenamesilverfish

license: mit


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>fltk_wrap_ui — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="get_source_file_property" href="get_source_file_property.html" />
    <link rel="prev" title="export" href="export.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

fltk_wrap_ui

fltk_wrap_ui¶

Create FLTK user interfaces Wrappers.

fltk_wrap_ui(resultingLibraryName source1
             source2 ... sourceN )

Produce .h and .cxx files for all the .fl and .fld files listed.  The
resulting .h and .cxx files will be added to a variable named
resultingLibraryName_FLTK_UI_SRCS which should be added to your
library.

Previous topic

export

Next topic

get_source_file_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

fltk_wrap_ui

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>foreach — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="function" href="function.html" />
    <link rel="prev" title="find_program" href="find_program.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

foreach

foreach¶

Evaluate a group of commands for each value in a list.

foreach(<loop_var> <items>)
  <commands>
endforeach()

where <items> is a list of items that are separated by
semicolon or whitespace.
All commands between foreach and the matching endforeach are recorded
without being invoked.  Once the endforeach is evaluated, the recorded
list of commands is invoked once for each item in <items>.
At the beginning of each iteration the variable <loop_var> will be set
to the value of the current item.

The scope of <loop_var> is restricted to the loop scope. See policy
CMP0124 for details.

The commands break() and continue() provide means to
escape from the normal control flow.

Per legacy, the endforeach() command admits
an optional <loop_var> argument.
If used, it must be a verbatim
repeat of the argument of the opening
foreach command.

foreach(<loop_var> RANGE <stop>)

In this variant, foreach iterates over the numbers
0, 1, ... up to (and including) the nonnegative integer <stop>.

foreach(<loop_var> RANGE <start> <stop> [<step>])

In this variant, foreach iterates over the numbers from
<start> up to at most <stop> in steps of <step>.
If <step> is not specified, then the step size is 1.
The three arguments <start> <stop> <step> must
all be nonnegative integers, and <stop> must not be
smaller than <start>; otherwise you enter the danger zone
of undocumented behavior that may change in future releases.

foreach(<loop_var> IN [LISTS [<lists>]] [ITEMS [<items>]])

In this variant, <lists> is a whitespace or semicolon
separated list of list-valued variables. The foreach
command iterates over each item in each given list.
The <items> following the ITEMS keyword are processed
as in the first variant of the foreach command.
The forms LISTS A and ITEMS ${A} are
equivalent.

The following example shows how the LISTS option is
processed:

set(A 0;1)
set(B 2 3)
set(C "4 5")
set(D 6;7 8)
set(E "")
foreach(X IN LISTS A B C D E)
    message(STATUS "X=${X}")
endforeach()

yields:

-- X=0
-- X=1
-- X=2
-- X=3
-- X=4 5
-- X=6
-- X=7
-- X=8

foreach(<loop_var>... IN ZIP_LISTS <lists>)

New in version 3.17.

In this variant, <lists> is a whitespace or semicolon
separated list of list-valued variables. The foreach
command iterates over each list simultaneously setting the
iteration variables as follows:

if the only loop_var given, then it sets a series of
loop_var_N variables to the current item from the
corresponding list;

if multiple variable names passed, their count should match
the lists variables count;

if any of the lists are shorter, the corresponding iteration
variable is not defined for the current iteration.

list(APPEND English one two three four)
list(APPEND Bahasa satu dua tiga)

foreach(num IN ZIP_LISTS English Bahasa)
    message(STATUS "num_0=${num_0}, num_1=${num_1}")
endforeach()

foreach(en ba IN ZIP_LISTS English Bahasa)
    message(STATUS "en=${en}, ba=${ba}")
endforeach()

yields:

-- num_0=one, num_1=satu
-- num_0=two, num_1=dua
-- num_0=three, num_1=tiga
-- num_0=four, num_1=
-- en=one, ba=satu
-- en=two, ba=dua
-- en=three, ba=tiga
-- en=four, ba=

See Also¶

break()

continue()

endforeach()

while()

Table of Contents

foreach

See Also

Previous topic

find_program

Next topic

function

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

foreach

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>function — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="get_cmake_property" href="get_cmake_property.html" />
    <link rel="prev" title="foreach" href="foreach.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

function

function¶

Start recording a function for later invocation as a command.

function(<name> [<arg1> ...])
  <commands>
endfunction()

Defines a function named <name> that takes arguments named
<arg1>, ...  The <commands> in the function definition
are recorded; they are not executed until the function is invoked.

Per legacy, the endfunction() command admits an optional
<name> argument. If used, it must be a verbatim repeat of the
argument of the opening function command.

A function opens a new scope: see set(var PARENT_SCOPE) for
details.

See the cmake_policy() command documentation for the behavior
of policies inside functions.

See the macro() command documentation for differences
between CMake functions and macros.

Invocation¶

The function invocation is case-insensitive. A function defined as

function(foo)
  <commands>
endfunction()

can be invoked through any of

foo()
Foo()
FOO()
cmake_language(CALL foo)

and so on. However, it is strongly recommended to stay with the
case chosen in the function definition. Typically functions use
all-lowercase names.

New in version 3.18: The cmake_language(CALL ...) command can also be used to
invoke the function.

Arguments¶

When the function is invoked, the recorded <commands> are first
modified by replacing formal parameters (${arg1}, ...) with the
arguments passed, and then invoked as normal commands.

In addition to referencing the formal parameters you can reference the
ARGC variable which will be set to the number of arguments passed
into the function as well as ARGV0, ARGV1, ARGV2, ...  which
will have the actual values of the arguments passed in.  This facilitates
creating functions with optional arguments.

Furthermore, ARGV holds the list of all arguments given to the
function and ARGN holds the list of arguments past the last expected
argument.  Referencing to ARGV# arguments beyond ARGC have
undefined behavior.  Checking that ARGC is greater than # is
the only way to ensure that ARGV# was passed to the function as an
extra argument.

See Also¶

cmake_parse_arguments()

endfunction()

return()

Table of Contents

function

Invocation

Arguments

See Also

Previous topic

foreach

Next topic

get_cmake_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

function

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>get_cmake_property — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="get_directory_property" href="get_directory_property.html" />
    <link rel="prev" title="function" href="function.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_cmake_property

get_cmake_property¶

Get a global property of the CMake instance.

get_cmake_property(<variable> <property>)

Gets a global property from the CMake instance.  The value of
the <property> is stored in the specified <variable>.
If the property is not found, <variable> will be set to NOTFOUND.
See the cmake-properties(7) manual for available properties.

In addition to global properties, this command (for historical reasons)
also supports the VARIABLES and MACROS directory
properties.  It also supports a special COMPONENTS global property that
lists the components given to the install() command.

See Also¶

the get_property() command GLOBAL option

Table of Contents

get_cmake_property

See Also

Previous topic

function

Next topic

get_directory_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_cmake_property

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>get_directory_property — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="get_filename_component" href="get_filename_component.html" />
    <link rel="prev" title="get_cmake_property" href="get_cmake_property.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_directory_property

get_directory_property¶

Get a property of DIRECTORY scope.

get_directory_property(<variable> [DIRECTORY <dir>] <prop-name>)

Stores a property of directory scope in the named <variable>.

The DIRECTORY argument specifies another directory from which
to retrieve the property value instead of the current directory.
Relative paths are treated as relative to the
current source directory.  CMake must already know about the directory,
either by having added it through a call to add_subdirectory()
or being the top level directory.

New in version 3.19: <dir> may reference a binary directory.

If the property is not defined for the nominated directory scope,
an empty string is returned.  In the case of INHERITED properties,
if the property is not found for the nominated directory scope,
the search will chain to a parent scope as described for the
define_property() command.

get_directory_property(<variable> [DIRECTORY <dir>]
                       DEFINITION <var-name>)

Get a variable definition from a directory.  This form is useful to
get a variable definition from another directory.

See Also¶

define_property()

the more general get_property() command

Table of Contents

get_directory_property

See Also

Previous topic

get_cmake_property

Next topic

get_filename_component

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_directory_property

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>get_filename_component — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="get_property" href="get_property.html" />
    <link rel="prev" title="get_directory_property" href="get_directory_property.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_filename_component

get_filename_component¶

Get a specific component of a full filename.

Changed in version 3.20: This command has been superseded by the cmake_path() command, except
for REALPATH, which is now offered by file(REAL_PATH), and
PROGRAM, now available in separate_arguments(PROGRAM).

Changed in version 3.24: The undocumented feature offering the capability to query the Windows
registry is superseded by
cmake_host_system_information(QUERY WINDOWS_REGISTRY)
command.

get_filename_component(<var> <FileName> <mode> [CACHE])

Sets <var> to a component of <FileName>, where <mode> is one of:

DIRECTORY = Directory without file name
NAME      = File name without directory
EXT       = File name longest extension (.b.c from d/a.b.c)
NAME_WE   = File name with neither the directory nor the longest extension
LAST_EXT  = File name last extension (.c from d/a.b.c)
NAME_WLE  = File name with neither the directory nor the last extension
PATH      = Legacy alias for DIRECTORY (use for CMake <= 2.8.11)

New in version 3.14: Added the LAST_EXT and NAME_WLE modes.

Paths are returned with forward slashes and have no trailing slashes.
If the optional CACHE argument is specified, the result variable is
added to the cache.

get_filename_component(<var> <FileName> <mode> [BASE_DIR <dir>] [CACHE])

New in version 3.4.

Sets <var> to the absolute path of <FileName>, where <mode> is one
of:

ABSOLUTE  = Full path to file
REALPATH  = Full path to existing file with symlinks resolved

If the provided <FileName> is a relative path, it is evaluated relative
to the given base directory <dir>.  If no base directory is
provided, the default base directory will be
CMAKE_CURRENT_SOURCE_DIR.

Paths are returned with forward slashes and have no trailing slashes.  If the
optional CACHE argument is specified, the result variable is added to the
cache.

get_filename_component(<var> <FileName> PROGRAM [PROGRAM_ARGS <arg_var>] [CACHE])

The program in <FileName> will be found in the system search path or
left as a full path.  If PROGRAM_ARGS is present with PROGRAM, then
any command-line arguments present in the <FileName> string are split
from the program name and stored in <arg_var>.  This is used to
separate a program name from its arguments in a command line string.

See Also¶

cmake_path()

Table of Contents

get_filename_component

See Also

Previous topic

get_directory_property

Next topic

get_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_filename_component

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>get_property — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="if" href="if.html" />
    <link rel="prev" title="get_filename_component" href="get_filename_component.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_property

get_property¶

Get a property.

get_property(<variable>
             <GLOBAL             |
              DIRECTORY [<dir>]  |
              TARGET    <target> |
              SOURCE    <source>
                        [DIRECTORY <dir> | TARGET_DIRECTORY <target>] |
              INSTALL   <file>   |
              TEST      <test>
                        [DIRECTORY <dir>] |
              CACHE     <entry>  |
              VARIABLE           >
             PROPERTY <name>
             [SET | DEFINED | BRIEF_DOCS | FULL_DOCS])

Gets one property from one object in a scope.

The first argument specifies the variable in which to store the result.
The second argument determines the scope from which to get the property.
It must be one of the following:

GLOBAL

Scope is unique and does not accept a name.

DIRECTORY

Scope defaults to the current directory but another
directory (already processed by CMake) may be named by the
full or relative path <dir>.
Relative paths are treated as relative to the current source directory.
See also the get_directory_property() command.

New in version 3.19: <dir> may reference a binary directory.

TARGET

Scope must name one existing target.
See also the get_target_property() command.

SOURCE

Scope must name one source file.  By default, the source file's property
will be read from the current source directory's scope.

New in version 3.18: Directory scope can be overridden with one of the following sub-options:

DIRECTORY <dir>

The source file property will be read from the <dir> directory's
scope.  CMake must already know about
the directory, either by having added it through a call
to add_subdirectory() or <dir> being the top level directory.
Relative paths are treated as relative to the current source directory.

New in version 3.19: <dir> may reference a binary directory.

TARGET_DIRECTORY <target>

The source file property will be read from the directory scope in which
<target> was created (<target> must therefore already exist).

See also the get_source_file_property() command.

INSTALL

New in version 3.1.

Scope must name one installed file path.

TEST

Scope must name one existing test.
See also the get_test_property() command.

New in version 3.28: Directory scope can be overridden with the following sub-option:

DIRECTORY <dir>

The test property will be read from the <dir> directory's
scope.  CMake must already know about the directory, either by having added
it through a call to add_subdirectory() or <dir> being the top
level directory. Relative paths are treated as relative to the current
source directory. <dir> may reference a binary directory.

CACHE

Scope must name one cache entry.

VARIABLE

Scope is unique and does not accept a name.

The required PROPERTY option is immediately followed by the name of
the property to get.  If the property is not set an empty value is
returned, although some properties support inheriting from a parent scope
if defined to behave that way (see define_property()).

If the SET option is given the variable is set to a boolean
value indicating whether the property has been set.  If the DEFINED
option is given the variable is set to a boolean value indicating
whether the property has been defined such as with the
define_property() command.

If BRIEF_DOCS or FULL_DOCS is given then the variable is set to a
string containing documentation for the requested property.  If
documentation is requested for a property that has not been defined
NOTFOUND is returned.

Note

The GENERATED source file property may be globally visible.
See its documentation for details.

See Also¶

define_property()

set_property()

Table of Contents

get_property

See Also

Previous topic

get_filename_component

Next topic

if

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_property

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>get_source_file_property — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="get_target_property" href="get_target_property.html" />
    <link rel="prev" title="fltk_wrap_ui" href="fltk_wrap_ui.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_source_file_property

get_source_file_property¶

Get a property for a source file.

get_source_file_property(<variable> <file>
                         [DIRECTORY <dir> | TARGET_DIRECTORY <target>]
                         <property>)

Gets a property from a source file.  The value of the property is stored in
the specified <variable>.  If the <file> is not a source file, or the
source property is not found, <variable> will be set to NOTFOUND.
If the source property was defined to be an INHERITED property (see
define_property()), the search will include the relevant parent
scopes, as described for the define_property() command.

By default, the source file's property will be read from the current source
directory's scope.

New in version 3.18: Directory scope can be overridden with one of the following sub-options:

DIRECTORY <dir>

The source file property will be read from the <dir> directory's
scope.  CMake must already know about that source directory, either by
having added it through a call to add_subdirectory() or <dir>
being the top level source directory.  Relative paths are treated as
relative to the current source directory.

TARGET_DIRECTORY <target>

The source file property will be read from the directory scope in which
<target> was created (<target> must therefore already exist).

Use set_source_files_properties() to set property values.  Source
file properties usually control how the file is built. One property that is
always there is LOCATION.

Note

The GENERATED source file property may be globally visible.
See its documentation for details.

See Also¶

define_property()

the more general get_property() command

set_source_files_properties()

Table of Contents

get_source_file_property

See Also

Previous topic

fltk_wrap_ui

Next topic

get_target_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_source_file_property

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>get_target_property — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="get_test_property" href="get_test_property.html" />
    <link rel="prev" title="get_source_file_property" href="get_source_file_property.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_target_property

get_target_property¶

Get a property from a target.

get_target_property(<variable> <target> <property>)

Get a property from a target.  The value of the property is stored in the
specified <variable>.  If the target property is not found, <variable>
will be set to <variable>-NOTFOUND.  If the target property was defined to
be an INHERITED property (see define_property()), the search will
include the relevant parent scopes, as described for the
define_property() command.

Use set_target_properties() to set target property values.
Properties are usually used to control how a target is built, but some
query the target instead.  This command can get properties for any
target so far created.  The targets do not need to be in the current
CMakeLists.txt file.

See Also¶

define_property()

the more general get_property() command

set_target_properties()

Properties on Targets for the list of properties known to CMake

Table of Contents

get_target_property

See Also

Previous topic

get_source_file_property

Next topic

get_test_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_target_property

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>get_test_property — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="include_directories" href="include_directories.html" />
    <link rel="prev" title="get_target_property" href="get_target_property.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_test_property

get_test_property¶

Get a property of the test.

get_test_property(<test> <property> [DIRECTORY <dir>] <variable>)

Get a property from the test.  The value of the property is stored in
the specified <variable>.  If the <test> is not defined, or the
test property is not found, <variable> will be set to NOTFOUND.
If the test property was defined to be an INHERITED property (see
define_property()), the search will include the relevant parent
scopes, as described for the define_property() command.

For a list of standard properties you can type
cmake --help-property-list.

New in version 3.28: Directory scope can be overridden with the following sub-option:

DIRECTORY <dir>

The test property will be read from the <dir> directory's
scope.  CMake must already know about that source directory, either by
having added it through a call to add_subdirectory() or <dir>
being the top level source directory.  Relative paths are treated as
relative to the current source directory. <dir> may reference a binary
directory.

See Also¶

define_property()

the more general get_property() command

Table of Contents

get_test_property

See Also

Previous topic

get_target_property

Next topic

include_directories

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

get_test_property

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>if — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="include" href="include.html" />
    <link rel="prev" title="get_property" href="get_property.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

if

if¶

Conditionally execute a group of commands.

Synopsis¶

if(<condition>)
  <commands>
elseif(<condition>) # optional block, can be repeated
  <commands>
else()              # optional block
  <commands>
endif()

Evaluates the condition argument of the if clause according to the
Condition syntax described below. If the result is true, then the
commands in the if block are executed.
Otherwise, optional elseif blocks are processed in the same way.
Finally, if no condition is true, commands in the optional else
block are executed.

Per legacy, the else() and endif() commands admit
an optional <condition> argument.
If used, it must be a verbatim
repeat of the argument of the opening
if command.

Condition Syntax¶

The following syntax applies to the condition argument of
the if, elseif and while() clauses.

Compound conditions are evaluated in the following order of precedence:

Parentheses.

Unary tests such as EXISTS, COMMAND, and DEFINED.

Binary tests such as EQUAL, LESS, LESS_EQUAL, GREATER,
GREATER_EQUAL, STREQUAL, STRLESS, STRLESS_EQUAL,
STRGREATER, STRGREATER_EQUAL, VERSION_EQUAL, VERSION_LESS,
VERSION_LESS_EQUAL, VERSION_GREATER, VERSION_GREATER_EQUAL,
PATH_EQUAL, and MATCHES.

Unary logical operator NOT.

Binary logical operators AND and OR, from left to right,
without any short-circuit.

Basic Expressions¶

if(<constant>)¶

True if the constant is 1, ON, YES, TRUE, Y,
or a non-zero number (including floating point numbers).
False if the constant is 0, OFF,
NO, FALSE, N, IGNORE, NOTFOUND, the empty string,
or ends in the suffix -NOTFOUND.  Named boolean constants are
case-insensitive.  If the argument is not one of these specific
constants, it is treated as a variable or string (see Variable Expansion
further below) and one of the following two forms applies.

if(<variable>)¶

True if given a variable that is defined to a value that is not a false
constant.  False otherwise, including if the variable is undefined.
Note that macro arguments are not variables.
Environment Variables also
cannot be tested this way, e.g. if(ENV{some_var}) will always evaluate
to false.

if(<string>)¶

A quoted string always evaluates to false unless:

The string's value is one of the true constants, or

Policy CMP0054 is not set to NEW and the string's value
happens to be a variable name that is affected by CMP0054's
behavior.

Logic Operators¶

if(NOT <condition>)¶

True if the condition is not true.

if(<cond1> AND <cond2>)¶

True if both conditions would be considered true individually.

if(<cond1> OR <cond2>)¶

True if either condition would be considered true individually.

if((condition) AND (condition OR (condition)))¶

The conditions inside the parenthesis are evaluated first and then
the remaining condition is evaluated as in the other examples.
Where there are nested parenthesis the innermost are evaluated as part
of evaluating the condition that contains them.

Existence Checks¶

if(COMMAND <command-name>)¶

True if the given name is a command, macro or function that can be
invoked.

if(POLICY <policy-id>)¶

True if the given name is an existing policy (of the form CMP<NNNN>).

if(TARGET <target-name>)¶

True if the given name is an existing logical target name created
by a call to the add_executable(), add_library(),
or add_custom_target() command that has already been invoked
(in any directory).

if(TEST <test-name>)¶

New in version 3.3.

True if the given name is an existing test name created by the
add_test() command.

if(DEFINED <name>|CACHE{<name>}|ENV{<name>})¶

True if a variable, cache variable or environment variable
with given <name> is defined. The value of the variable
does not matter. Note the following caveats:

Macro arguments are not variables.

It is not possible to test directly whether a <name> is a non-cache
variable.  The expression if(DEFINED someName) will evaluate to true
if either a cache or non-cache variable someName exists.  In
comparison, the expression if(DEFINED CACHE{someName}) will only
evaluate to true if a cache variable someName exists.  Both expressions
need to be tested if you need to know whether a non-cache variable exists:
if(DEFINED someName AND NOT DEFINED CACHE{someName}).

New in version 3.14: Added support for CACHE{<name>} variables.

if(<variable|string> IN_LIST <variable>)¶

New in version 3.3.

True if the given element is contained in the named list variable.

File Operations¶

if(EXISTS <path-to-file-or-directory>)¶

True if the named file or directory exists and is readable.  Behavior
is well-defined only for explicit full paths (a leading ~/ is not
expanded as a home directory and is considered a relative path).
Resolves symbolic links, i.e. if the named file or directory is a
symbolic link, returns true if the target of the symbolic link exists.

False if the given path is an empty string.

Note

Prefer if(IS_READABLE) to check file readability.  if(EXISTS)
may be changed in the future to to only check file existence.

if(IS_READABLE <path-to-file-or-directory>)¶

New in version 3.29.

True if the named file or directory is readable.  Behavior
is well-defined only for explicit full paths (a leading ~/ is not
expanded as a home directory and is considered a relative path).
Resolves symbolic links, i.e. if the named file or directory is a
symbolic link, returns true if the target of the symbolic link is readable.

False if the given path is an empty string.

if(IS_WRITABLE <path-to-file-or-directory>)¶

New in version 3.29.

True if the named file or directory is writable.  Behavior
is well-defined only for explicit full paths (a leading ~/ is not
expanded as a home directory and is considered a relative path).
Resolves symbolic links, i.e. if the named file or directory is a
symbolic link, returns true if the target of the symbolic link is writable.

False if the given path is an empty string.

if(IS_EXECUTABLE <path-to-file-or-directory>)¶

New in version 3.29.

True if the named file or directory is executable.  Behavior
is well-defined only for explicit full paths (a leading ~/ is not
expanded as a home directory and is considered a relative path).
Resolves symbolic links, i.e. if the named file or directory is a
symbolic link, returns true if the target of the symbolic link is executable.

False if the given path is an empty string.

if(<file1> IS_NEWER_THAN <file2>)¶

True if file1 is newer than file2 or if one of the two files doesn't
exist.  Behavior is well-defined only for full paths.  If the file
time stamps are exactly the same, an IS_NEWER_THAN comparison returns
true, so that any dependent build operations will occur in the event
of a tie.  This includes the case of passing the same file name for
both file1 and file2.

if(IS_DIRECTORY <path>)¶

True if path is a directory.  Behavior is well-defined only
for full paths.

False if the given path is an empty string.

if(IS_SYMLINK <path>)¶

True if the given path is a symbolic link.  Behavior is well-defined
only for full paths.

if(IS_ABSOLUTE <path>)¶

True if the given path is an absolute path.  Note the following special
cases:

An empty path evaluates to false.

On Windows hosts, any path that begins with a drive letter and colon
(e.g. C:), a forward slash or a backslash will evaluate to true.
This means a path like C:no\base\dir will evaluate to true, even
though the non-drive part of the path is relative.

On non-Windows hosts, any path that begins with a tilde (~)
evaluates to true.

Comparisons¶

if(<variable|string> MATCHES <regex>)¶

True if the given string or variable's value matches the given regular
expression.  See Regex Specification for regex format.

New in version 3.9: () groups are captured in CMAKE_MATCH_<n> variables.

if(<variable|string> LESS <variable|string>)¶

True if the given string or variable's value parses as a real number
(like a C double) and less than that on the right.

if(<variable|string> GREATER <variable|string>)¶

True if the given string or variable's value parses as a real number
(like a C double) and greater than that on the right.

if(<variable|string> EQUAL <variable|string>)¶

True if the given string or variable's value parses as a real number
(like a C double) and equal to that on the right.

if(<variable|string> LESS_EQUAL <variable|string>)¶

New in version 3.7.

True if the given string or variable's value parses as a real number
(like a C double) and less than or equal to that on the right.

if(<variable|string> GREATER_EQUAL <variable|string>)¶

New in version 3.7.

True if the given string or variable's value parses as a real number
(like a C double) and greater than or equal to that on the right.

if(<variable|string> STRLESS <variable|string>)¶

True if the given string or variable's value is lexicographically less
than the string or variable on the right.

if(<variable|string> STRGREATER <variable|string>)¶

True if the given string or variable's value is lexicographically greater
than the string or variable on the right.

if(<variable|string> STREQUAL <variable|string>)¶

True if the given string or variable's value is lexicographically equal
to the string or variable on the right.

if(<variable|string> STRLESS_EQUAL <variable|string>)¶

New in version 3.7.

True if the given string or variable's value is lexicographically less
than or equal to the string or variable on the right.

if(<variable|string> STRGREATER_EQUAL <variable|string>)¶

New in version 3.7.

True if the given string or variable's value is lexicographically greater
than or equal to the string or variable on the right.

Version Comparisons¶

if(<variable|string> VERSION_LESS <variable|string>)¶

Component-wise integer version number comparison (version format is
major[.minor[.patch[.tweak]]], omitted components are treated as zero).
Any non-integer version component or non-integer trailing part of a version
component effectively truncates the string at that point.

if(<variable|string> VERSION_GREATER <variable|string>)¶

Component-wise integer version number comparison (version format is
major[.minor[.patch[.tweak]]], omitted components are treated as zero).
Any non-integer version component or non-integer trailing part of a version
component effectively truncates the string at that point.

if(<variable|string> VERSION_EQUAL <variable|string>)¶

Component-wise integer version number comparison (version format is
major[.minor[.patch[.tweak]]], omitted components are treated as zero).
Any non-integer version component or non-integer trailing part of a version
component effectively truncates the string at that point.

if(<variable|string> VERSION_LESS_EQUAL <variable|string>)¶

New in version 3.7.

Component-wise integer version number comparison (version format is
major[.minor[.patch[.tweak]]], omitted components are treated as zero).
Any non-integer version component or non-integer trailing part of a version
component effectively truncates the string at that point.

if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)¶

New in version 3.7.

Component-wise integer version number comparison (version format is
major[.minor[.patch[.tweak]]], omitted components are treated as zero).
Any non-integer version component or non-integer trailing part of a version
component effectively truncates the string at that point.

Path Comparisons¶

if(<variable|string> PATH_EQUAL <variable|string>)¶

New in version 3.24.

Compares the two paths component-by-component.  Only if every component of
both paths match will the two paths compare equal.  Multiple path separators
are effectively collapsed into a single separator, but note that backslashes
are not converted to forward slashes.  No other
path normalization is performed.

Component-wise comparison is superior to string-based comparison due to the
handling of multiple path separators.  In the following example, the
expression evaluates to true using PATH_EQUAL, but false with
STREQUAL:

# comparison is TRUE
if ("/a//b/c" PATH_EQUAL "/a/b/c")
   ...
endif()

# comparison is FALSE
if ("/a//b/c" STREQUAL "/a/b/c")
   ...
endif()

See cmake_path(COMPARE) for more details.

Variable Expansion¶

The if command was written very early in CMake's history, predating
the ${} variable evaluation syntax, and for convenience evaluates
variables named by its arguments as shown in the above signatures.
Note that normal variable evaluation with ${} applies before the if
command even receives the arguments.  Therefore code like

set(var1 OFF)
set(var2 "var1")
if(${var2})

appears to the if command as

if(var1)

and is evaluated according to the if(<variable>) case documented
above.  The result is OFF which is false.  However, if we remove the
${} from the example then the command sees

if(var2)

which is true because var2 is defined to var1 which is not a false
constant.

Automatic evaluation applies in the other cases whenever the
above-documented condition syntax accepts <variable|string>:

The left hand argument to MATCHES is first checked to see if it is
a defined variable.  If so, the variable's value is used, otherwise the
original value is used.

If the left hand argument to MATCHES is missing it returns false
without error

Both left and right hand arguments to LESS, GREATER, EQUAL,
LESS_EQUAL, and GREATER_EQUAL, are independently tested to see if
they are defined variables.  If so, their defined values are used otherwise
the original value is used.

Both left and right hand arguments to STRLESS, STRGREATER,
STREQUAL, STRLESS_EQUAL, and STRGREATER_EQUAL are independently
tested to see if they are defined variables.  If so, their defined values are
used otherwise the original value is used.

Both left and right hand arguments to VERSION_LESS,
VERSION_GREATER, VERSION_EQUAL, VERSION_LESS_EQUAL, and
VERSION_GREATER_EQUAL are independently tested to see if they are defined
variables.  If so, their defined values are used otherwise the original value
is used.

The right hand argument to NOT is tested to see if it is a boolean
constant.  If so, the value is used, otherwise it is assumed to be a
variable and it is dereferenced.

The left and right hand arguments to AND and OR are independently
tested to see if they are boolean constants.  If so, they are used as
such, otherwise they are assumed to be variables and are dereferenced.

Changed in version 3.1: To prevent ambiguity, potential variable or keyword names can be
specified in a Quoted Argument or a Bracket Argument.
A quoted or bracketed variable or keyword will be interpreted as a
string and not dereferenced or interpreted.
See policy CMP0054.

There is no automatic evaluation for environment or cache
Variable References.  Their values must be referenced as
$ENV{<name>} or $CACHE{<name>} wherever the above-documented
condition syntax accepts <variable|string>.

See also¶

else()

elseif()

endif()

Table of Contents

if

Synopsis

Condition Syntax

Basic Expressions

Logic Operators

Existence Checks

File Operations

Comparisons

Version Comparisons

Path Comparisons

Variable Expansion

See also

Previous topic

get_property

Next topic

include

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

if

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>include — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="include_guard" href="include_guard.html" />
    <link rel="prev" title="if" href="if.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include

include¶

Load and run CMake code from a file or module.

include(<file|module> [OPTIONAL] [RESULT_VARIABLE <var>]
                      [NO_POLICY_SCOPE])

Loads and runs CMake code from the file given.  Variable reads and
writes access the scope of the caller (dynamic scoping).  If OPTIONAL
is present, then no error is raised if the file does not exist.  If
RESULT_VARIABLE is given the variable <var> will be set to the
full filename which has been included or NOTFOUND if it failed.

If a module is specified instead of a file, the file with name
<modulename>.cmake is searched first in CMAKE_MODULE_PATH,
then in the CMake module directory.  There is one exception to this: if
the file which calls include() is located itself in the CMake builtin
module directory, then first the CMake builtin module directory is searched and
CMAKE_MODULE_PATH afterwards.  See also policy CMP0017.

See the cmake_policy() command documentation for discussion of the
NO_POLICY_SCOPE option.

Previous topic

if

Next topic

include_guard

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>include_directories — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="include_external_msproject" href="include_external_msproject.html" />
    <link rel="prev" title="get_test_property" href="get_test_property.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_directories

include_directories¶

Add include directories to the build.

include_directories([AFTER|BEFORE] [SYSTEM] dir1 [dir2 ...])

Add the given directories to those the compiler uses to search for
include files.  Relative paths are interpreted as relative to the
current source directory.

The include directories are added to the INCLUDE_DIRECTORIES
directory property for the current CMakeLists file.  They are also
added to the INCLUDE_DIRECTORIES target property for each
target in the current CMakeLists file.  The target property values
are the ones used by the generators.

By default the directories specified are appended onto the current list of
directories.  This default behavior can be changed by setting
CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON.  By using
AFTER or BEFORE explicitly, you can select between appending and
prepending, independent of the default.

If the SYSTEM option is given, the compiler will be told the
directories are meant as system include directories on some platforms.
Signaling this setting might achieve effects such as the compiler
skipping warnings, or these fixed-install system files not being
considered in dependency calculations - see compiler docs.

Arguments to include_directories may use generator expressions
with the syntax $<...>. See the cmake-generator-expressions(7)
manual for available expressions.  See the cmake-buildsystem(7) manual
for more on defining buildsystem properties.

Note

Prefer the target_include_directories() command to add include
directories to individual targets and optionally propagate/export them
to dependents.

See Also¶

target_include_directories()

Table of Contents

include_directories

See Also

Previous topic

get_test_property

Next topic

include_external_msproject

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_directories

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>include_external_msproject — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="include_regular_expression" href="include_regular_expression.html" />
    <link rel="prev" title="include_directories" href="include_directories.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_external_msproject

include_external_msproject¶

Include an external Microsoft project file in a workspace.

include_external_msproject(projectname location
                           [TYPE projectTypeGUID]
                           [GUID projectGUID]
                           [PLATFORM platformName]
                           dep1 dep2 ...)

Includes an external Microsoft project in the generated workspace
file.  Currently does nothing on UNIX.  This will create a target
named [projectname].  This can be used in the add_dependencies()
command to make things depend on the external project.

TYPE, GUID and PLATFORM are optional parameters that allow one to
specify the type of project, id (GUID) of the project and the name of
the target platform.  This is useful for projects requiring values
other than the default (e.g.  WIX projects).

New in version 3.9: If the imported project has different configuration names than the
current project, set the MAP_IMPORTED_CONFIG_<CONFIG>
target property to specify the mapping.

Previous topic

include_directories

Next topic

include_regular_expression

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_external_msproject

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>include_guard — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="list" href="list.html" />
    <link rel="prev" title="include" href="include.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_guard

include_guard¶

New in version 3.10.

Provides an include guard for the file currently being processed by CMake.

include_guard([DIRECTORY|GLOBAL])

Sets up an include guard for the current CMake file (see the
CMAKE_CURRENT_LIST_FILE variable documentation).

CMake will end its processing of the current file at the location of the
include_guard command if the current file has already been
processed for the applicable scope (see below). This provides functionality
similar to the include guards commonly used in source headers or to the
#pragma once directive. If the current file has been processed previously
for the applicable scope, the effect is as though return() had been
called. Do not call this command from inside a function being defined within
the current file.

An optional argument specifying the scope of the guard may be provided.
Possible values for the option are:

DIRECTORY

The include guard applies within the current directory and below. The file
will only be included once within this directory scope, but may be included
again by other files outside of this directory (i.e. a parent directory or
another directory not pulled in by add_subdirectory() or
include() from the current file or its children).

GLOBAL

The include guard applies globally to the whole build. The current file
will only be included once regardless of the scope.

If no arguments given, include_guard has the same scope as a variable,
meaning that the include guard effect is isolated by the most recent
function scope or current directory if no inner function scopes exist.
In this case the command behavior is the same as:

if(__CURRENT_FILE_VAR__)
  return()
endif()
set(__CURRENT_FILE_VAR__ TRUE)

Previous topic

include

Next topic

list

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_guard

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.


code:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>include_regular_expression — CMake 3.29.0-rc3 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css" />

    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="install" href="install.html" />
    <link rel="prev" title="include_external_msproject" href="include_external_msproject.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_regular_expression

include_regular_expression¶

Set the regular expression used for dependency checking.

include_regular_expression(regex_match [regex_complain])

Sets the regular expressions used in dependency checking.  Only files
matching regex_match will be traced as dependencies.  Only files
matching regex_complain will generate warnings if they cannot be found
(standard header paths are not searched).  The defaults are:

regex_match    = "^.*$" (match everything)
regex_complain = "^$" (match empty string only)

Previous topic

include_external_msproject

Next topic

install

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.29.0-rc3 Documentation »

cmake-commands(7) »

include_regular_expression

        © Copyright 2000-2024 Kitware, Inc. and Contributors.
      Created using Sphinx 6.2.1.