CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
This page documents variables that are provided by CMake or have mean-
ing to CMake when set by project code.
For general information on variables, see the Variables section in the
cmake-language manual.
NOTE:
CMake reserves identifiers that:
o begin with CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _CMAKE_ (upper-, lower-, or mixed-case), or
o begin with _ followed by the name of any CMake Command.
VARIABLES THAT PROVIDE INFORMATION
CMAKE_AR
Name of archiving tool for static libraries.
This specifies the name of the program that creates archive or static
libraries.
CMAKE_ARGC
Number of command line arguments passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the number of
command line arguments. See also CMAKE_ARGV0, 1, 2
CMAKE_ARGV0
Command line argument passed to CMake in script mode.
When run in -P script mode, CMake sets this variable to the first com-
mand line argument. It then also sets CMAKE_ARGV1, CMAKE_ARGV2, and
so on, up to the number of command line arguments given. See also
CMAKE_ARGC.
CMAKE_BINARY_DIR
The path to the top level of the build tree.
This is the full path to the top level of the current CMake build tree.
For an in-source build, this would be the same as CMAKE_SOURCE_DIR.
When run in -P script mode, CMake sets the variables CMAKE_BINARY_DIR,
CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
to the current working directory.
CMAKE_BUILD_TOOL
This variable exists only for backwards compatibility. It contains the
same value as CMAKE_MAKE_PROGRAM. Use that variable instead.
CMAKE_CACHEFILE_DIR
The directory with the CMakeCache.txt file.
This is the full path to the directory that has the CMakeCache.txt file
in it. This is the same as CMAKE_BINARY_DIR.
CMAKE_CACHE_MAJOR_VERSION
Major version of CMake used to create the CMakeCache.txt file
This stores the major version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_MINOR_VERSION
Minor version of CMake used to create the CMakeCache.txt file
This stores the minor version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CACHE_PATCH_VERSION
Patch version of CMake used to create the CMakeCache.txt file
This stores the patch version of CMake used to write a CMake cache
file. It is only different when a different version of CMake is run on
a previously created cache file.
CMAKE_CFG_INTDIR
Build-time reference to per-configuration output subdirectory.
For native build systems supporting multiple configurations in the
build tree (such as Visual Studio Generators and Xcode), the value is a
reference to a build-time variable specifying the name of the per-con-
figuration output subdirectory. On Makefile Generators this evaluates
to . because there is only one configuration in a build tree. Example
values:
$(ConfigurationName) = Visual Studio 9
$(Configuration) = Visual Studio 10
$(CONFIGURATION) = Xcode
. = Make-based tools
. = Ninja
${CONFIGURATION} = Ninja Multi-Config
Note that this variable only has limited support on Ninja Multi-Config.
It is recommended that you use the $<CONFIG> generator expression in-
stead.
Since these values are evaluated by the native build system, this vari-
able is suitable only for use in command lines that will be evaluated
at build time. Example of intended usage:
add_executable(mytool mytool.c)
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool
${CMAKE_CURRENT_SOURCE_DIR}/in.txt out.txt
DEPENDS mytool in.txt
)
add_custom_target(drive ALL DEPENDS out.txt)
Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND
option, so ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mytool can
be replaced by just mytool.
This variable is read-only. Setting it is undefined behavior. In
multi-configuration build systems the value of this variable is passed
as the value of preprocessor symbol CMAKE_INTDIR to the compilation of
all source files.
CMAKE_COMMAND
The full path to the cmake(1) executable.
This is the full path to the CMake executable cmake(1) which is useful
from custom commands that want to use the cmake -E option for portable
system commands. (e.g. /usr/local/bin/cmake)
CMAKE_CPACK_COMMAND
Full path to cpack(1) command installed with CMake.
This is the full path to the CPack executable cpack(1) which is useful
from custom commands that want to use the cmake(1) -E option for porta-
ble system commands.
CMAKE_CROSSCOMPILING
Intended to indicate whether CMake is cross compiling, but note limita-
tions discussed below.
This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME
variable has been set manually (i.e. in a toolchain file or as a cache
entry from the cmake command line). In most cases, manually setting
CMAKE_SYSTEM_NAME will only be done when cross compiling, since it will
otherwise be given the same value as CMAKE_HOST_SYSTEM_NAME if not man-
ually set, which is correct for the non-cross-compiling case. In the
event that CMAKE_SYSTEM_NAME is manually set to the same value as
CMAKE_HOST_SYSTEM_NAME, then CMAKE_CROSSCOMPILING will still be set to
true.
Another case to be aware of is that builds targeting Apple platforms
other than macOS are handled differently to other cross compiling sce-
narios. Rather than relying on CMAKE_SYSTEM_NAME to select the target
platform, Apple device builds use CMAKE_OSX_SYSROOT to select the ap-
propriate SDK, which indirectly determines the target platform. Fur-
thermore, when using the Xcode generator, developers can switch between
device and simulator builds at build time rather than having a single
choice at configure time, so the concept of whether the build is cross
compiling or not is more complex. Therefore, the use of CMAKE_CROSSCOM-
PILING is not recommended for projects targeting Apple devices.
CMAKE_CROSSCOMPILING_EMULATOR
This variable is only used when CMAKE_CROSSCOMPILING is on. It should
point to a command on the host system that can run executable built for
the target system.
If this variable contains a semicolon-separated list, then the first
value is the command and remaining values are its arguments.
The command will be used to run try_run()
CMAKE-VARIABLES(7) CMake CMAKE-VARIABLES(7)
NAME
cmake-variables - CMake Variables Reference
3.18.4 September 13, 2021 CMAKE-VARIABLES(7)
Czas wygenerowania: 0.00030 sek.
Created with the man page lookup class by Andrew Collington.
Based on a C man page viewer by Vadim Pavlov
Unicode soft-hyphen fix (as used by RedHat) by Dan Edwards
Some optimisations by Eli Argon
Caching idea and code contribution by James Richardson
Copyright © 2003-2025 Linux.pl
Hosted by Hosting Linux.pl