mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
Merge pull request #19 from Sak32009/third-party/deps/linux
Fix #12 (third-party/deps/linux)
This commit is contained in:
commit
0f64de9125
98
7za/SOURCE.txt
Normal file
98
7za/SOURCE.txt
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#### INFO
|
||||||
|
|
||||||
|
https://sourceforge.net/projects/p7zip/
|
||||||
|
|
||||||
|
VERSION: https://sourceforge.net/projects/p7zip/files/p7zip/16.02/
|
||||||
|
|
||||||
|
#### LICENSE
|
||||||
|
|
||||||
|
7-Zip
|
||||||
|
~~~~~
|
||||||
|
License for use and distribution
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
7-Zip Copyright (C) 1999-2023 Igor Pavlov.
|
||||||
|
|
||||||
|
The licenses for files are:
|
||||||
|
|
||||||
|
1) 7z.dll:
|
||||||
|
- The "GNU LGPL" as main license for most of the code
|
||||||
|
- The "GNU LGPL" with "unRAR license restriction" for some code
|
||||||
|
- The "BSD 3-clause License" for some code
|
||||||
|
2) All other files: the "GNU LGPL".
|
||||||
|
|
||||||
|
Redistributions in binary form must reproduce related license information from this file.
|
||||||
|
|
||||||
|
Note:
|
||||||
|
You can use 7-Zip on any computer, including a computer in a commercial
|
||||||
|
organization. You don't need to register or pay for 7-Zip.
|
||||||
|
|
||||||
|
|
||||||
|
GNU LGPL information
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You can receive a copy of the GNU Lesser General Public License from
|
||||||
|
http://www.gnu.org/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BSD 3-clause License
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression.
|
||||||
|
That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
|
||||||
|
that also uses the "BSD 3-clause License":
|
||||||
|
|
||||||
|
----
|
||||||
|
Copyright (c) 2015-2016, Apple Inc. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
unRAR license restriction
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
The decompression engine for RAR archives was developed using source
|
||||||
|
code of unRAR program.
|
||||||
|
All copyrights to original unRAR code are owned by Alexander Roshal.
|
||||||
|
|
||||||
|
The license for original unRAR code has the following restriction:
|
||||||
|
|
||||||
|
The unRAR sources cannot be used to re-create the RAR compression algorithm,
|
||||||
|
which is proprietary. Distribution of modified unRAR sources in separate form
|
||||||
|
or as a part of other software is permitted, provided that it is clearly
|
||||||
|
stated in the documentation and source comments that the code may
|
||||||
|
not be used to develop a RAR (WinRAR) compatible archiver.
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
Igor Pavlov
|
173
cmake/SOURCE.txt
Normal file
173
cmake/SOURCE.txt
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
#### INFO
|
||||||
|
|
||||||
|
https://gitlab.kitware.com/cmake/cmake
|
||||||
|
|
||||||
|
VERSION: https://github.com/Kitware/CMake/releases/tag/v3.30.2
|
||||||
|
|
||||||
|
#### LICENSE
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
BIN
cmake/bin/cmake
BIN
cmake/bin/cmake
Binary file not shown.
@ -1,44 +1,44 @@
|
|||||||
dnl Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
dnl Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
dnl file Copyright.txt or https://cmake.org/licensing for details.
|
dnl file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
AC_DEFUN([CMAKE_FIND_BINARY],
|
AC_DEFUN([CMAKE_FIND_BINARY],
|
||||||
[AC_ARG_VAR([CMAKE_BINARY], [path to the cmake binary])dnl
|
[AC_ARG_VAR([CMAKE_BINARY], [path to the cmake binary])dnl
|
||||||
|
|
||||||
if test "x$ac_cv_env_CMAKE_BINARY_set" != "xset"; then
|
if test "x$ac_cv_env_CMAKE_BINARY_set" != "xset"; then
|
||||||
AC_PATH_TOOL([CMAKE_BINARY], [cmake])dnl
|
AC_PATH_TOOL([CMAKE_BINARY], [cmake])dnl
|
||||||
fi
|
fi
|
||||||
])dnl
|
])dnl
|
||||||
|
|
||||||
# $1: package name
|
# $1: package name
|
||||||
# $2: language (e.g. C/CXX/Fortran)
|
# $2: language (e.g. C/CXX/Fortran)
|
||||||
# $3: The compiler ID, defaults to GNU.
|
# $3: The compiler ID, defaults to GNU.
|
||||||
# Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
|
# Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
|
||||||
# PathScale, Cray, SCO, MSVC, LCC
|
# PathScale, Cray, SCO, MSVC, LCC
|
||||||
# $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
|
# $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
|
||||||
# $5: optional path to cmake binary
|
# $5: optional path to cmake binary
|
||||||
AC_DEFUN([CMAKE_FIND_PACKAGE], [
|
AC_DEFUN([CMAKE_FIND_PACKAGE], [
|
||||||
AC_REQUIRE([CMAKE_FIND_BINARY])dnl
|
AC_REQUIRE([CMAKE_FIND_BINARY])dnl
|
||||||
|
|
||||||
AC_ARG_VAR([$1][_][$2][FLAGS], [$2 compiler flags for $1. This overrides the cmake output])dnl
|
AC_ARG_VAR([$1][_][$2][FLAGS], [$2 compiler flags for $1. This overrides the cmake output])dnl
|
||||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1. This overrides the cmake output])dnl
|
AC_ARG_VAR([$1][_LIBS], [linker flags for $1. This overrides the cmake output])dnl
|
||||||
|
|
||||||
failed=false
|
failed=false
|
||||||
AC_MSG_CHECKING([for $1])
|
AC_MSG_CHECKING([for $1])
|
||||||
if test -z "${$1[]_$2[]FLAGS}"; then
|
if test -z "${$1[]_$2[]FLAGS}"; then
|
||||||
$1[]_$2[]FLAGS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=COMPILE $4` || failed=true
|
$1[]_$2[]FLAGS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=COMPILE $4` || failed=true
|
||||||
fi
|
fi
|
||||||
if test -z "${$1[]_LIBS}"; then
|
if test -z "${$1[]_LIBS}"; then
|
||||||
$1[]_LIBS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=LINK $4` || failed=true
|
$1[]_LIBS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=LINK $4` || failed=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $failed; then
|
if $failed; then
|
||||||
unset $1[]_$2[]FLAGS
|
unset $1[]_$2[]FLAGS
|
||||||
unset $1[]_LIBS
|
unset $1[]_LIBS
|
||||||
|
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
$6
|
$6
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
$5
|
$5
|
||||||
fi[]dnl
|
fi[]dnl
|
||||||
])
|
])
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Version=1.0
|
Version=1.0
|
||||||
Name=CMake
|
Name=CMake
|
||||||
Comment=Cross-platform buildsystem
|
Comment=Cross-platform buildsystem
|
||||||
Exec=cmake-gui %f
|
Exec=cmake-gui %f
|
||||||
Icon=CMakeSetup
|
Icon=CMakeSetup
|
||||||
Terminal=false
|
Terminal=false
|
||||||
X-MultipleArgs=false
|
X-MultipleArgs=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Development;Building;
|
Categories=Development;Building;
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
MimeType=application/x-cmakecache;
|
MimeType=application/x-cmakecache;
|
||||||
|
@ -1,202 +1,216 @@
|
|||||||
# bash completion for cmake(1) -*- shell-script -*-
|
# bash completion for cmake(1) -*- shell-script -*-
|
||||||
|
|
||||||
_cmake()
|
_cmake()
|
||||||
{
|
{
|
||||||
local cur prev words cword split=false
|
local is_old_completion=false
|
||||||
if type -t _init_completion >/dev/null; then
|
local is_init_completion=false
|
||||||
_init_completion -n = || return
|
|
||||||
else
|
local cur prev words cword split was_split
|
||||||
# manual initialization for older bash completion versions
|
if type -t _comp_initialize >/dev/null; then
|
||||||
COMPREPLY=()
|
_comp_initialize -s || return
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
elif type -t _init_completion >/dev/null; then
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
_init_completion -s || return
|
||||||
fi
|
is_init_completion=true
|
||||||
|
else
|
||||||
# Workaround for options like -DCMAKE_BUILD_TYPE=Release
|
# manual initialization for older bash completion versions
|
||||||
local prefix=
|
COMPREPLY=()
|
||||||
if [[ $cur == -D* ]]; then
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev=-D
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
prefix=-D
|
is_old_completion=true
|
||||||
cur="${cur#-D}"
|
split=false
|
||||||
elif [[ $cur == -U* ]]; then
|
fi
|
||||||
prev=-U
|
|
||||||
prefix=-U
|
# Workaround for options like -DCMAKE_BUILD_TYPE=Release
|
||||||
cur="${cur#-U}"
|
local prefix=
|
||||||
fi
|
if [[ $cur == -D* ]]; then
|
||||||
|
prev=-D
|
||||||
case "$prev" in
|
prefix=-D
|
||||||
-D)
|
cur="${cur#-D}"
|
||||||
if [[ $cur == *=* ]]; then
|
elif [[ $cur == -U* ]]; then
|
||||||
# complete values for variables
|
prev=-U
|
||||||
local var type value
|
prefix=-U
|
||||||
var="${cur%%[:=]*}"
|
cur="${cur#-U}"
|
||||||
value="${cur#*=}"
|
fi
|
||||||
|
|
||||||
if [[ $cur == CMAKE_BUILD_TYPE* ]]; then # most widely used case
|
case "$prev" in
|
||||||
COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
|
-D)
|
||||||
MinSizeRel' -- "$value" ) )
|
if [[ $cur == *=* ]]; then
|
||||||
return
|
# complete values for variables
|
||||||
fi
|
local var type value
|
||||||
|
var="${cur%%[:=]*}"
|
||||||
if [[ $cur == *:* ]]; then
|
value="${cur#*=}"
|
||||||
type="${cur#*:}"
|
|
||||||
type="${type%%=*}"
|
if [[ $cur == CMAKE_BUILD_TYPE* ]]; then # most widely used case
|
||||||
else # get type from cache if it's not set explicitly
|
COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
|
||||||
type=$( cmake -LA -N 2>/dev/null | grep "$var:" \
|
MinSizeRel' -- "$value" ) )
|
||||||
2>/dev/null )
|
return
|
||||||
type="${type#*:}"
|
fi
|
||||||
type="${type%%=*}"
|
|
||||||
fi
|
if [[ $cur == *:* ]]; then
|
||||||
case "$type" in
|
type="${cur#*:}"
|
||||||
FILEPATH)
|
type="${type%%=*}"
|
||||||
cur="$value"
|
else # get type from cache if it's not set explicitly
|
||||||
_filedir
|
type=$( cmake -LA -N 2>/dev/null | grep "$var:" \
|
||||||
return
|
2>/dev/null )
|
||||||
;;
|
type="${type#*:}"
|
||||||
PATH)
|
type="${type%%=*}"
|
||||||
cur="$value"
|
fi
|
||||||
_filedir -d
|
case "$type" in
|
||||||
return
|
FILEPATH)
|
||||||
;;
|
cur="$value"
|
||||||
BOOL)
|
_filedir
|
||||||
COMPREPLY=( $( compgen -W 'ON OFF TRUE FALSE' -- \
|
return
|
||||||
"$value" ) )
|
;;
|
||||||
return
|
PATH)
|
||||||
;;
|
cur="$value"
|
||||||
STRING|INTERNAL)
|
_filedir -d
|
||||||
# no completion available
|
return
|
||||||
return
|
;;
|
||||||
;;
|
BOOL)
|
||||||
esac
|
COMPREPLY=( $( compgen -W 'ON OFF TRUE FALSE' -- \
|
||||||
elif [[ $cur == *:* ]]; then
|
"$value" ) )
|
||||||
# complete types
|
return
|
||||||
local type="${cur#*:}"
|
;;
|
||||||
COMPREPLY=( $( compgen -W 'FILEPATH PATH STRING BOOL INTERNAL'\
|
STRING|INTERNAL)
|
||||||
-S = -- "$type" ) )
|
# no completion available
|
||||||
compopt -o nospace
|
return
|
||||||
else
|
;;
|
||||||
# complete variable names
|
esac
|
||||||
COMPREPLY=( $( compgen -W '$( cmake -LA -N 2>/dev/null |
|
elif [[ $cur == *:* ]]; then
|
||||||
tail -n +2 | cut -f1 -d: )' -P "$prefix" -- "$cur" ) )
|
# complete types
|
||||||
compopt -o nospace
|
local type="${cur#*:}"
|
||||||
fi
|
COMPREPLY=( $( compgen -W 'FILEPATH PATH STRING BOOL INTERNAL'\
|
||||||
return
|
-S = -- "$type" ) )
|
||||||
;;
|
compopt -o nospace
|
||||||
-U)
|
else
|
||||||
COMPREPLY=( $( compgen -W '$( cmake -LA -N | tail -n +2 |
|
# complete variable names
|
||||||
cut -f1 -d: )' -P "$prefix" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '$( cmake -LA -N 2>/dev/null |
|
||||||
return
|
tail -n +2 | cut -f1 -d: )' -P "$prefix" -- "$cur" ) )
|
||||||
;;
|
compopt -o nospace
|
||||||
esac
|
fi
|
||||||
|
return
|
||||||
_split_longopt && split=true
|
;;
|
||||||
|
-U)
|
||||||
case "$prev" in
|
COMPREPLY=( $( compgen -W '$( cmake -LA -N | tail -n +2 |
|
||||||
-C|-P|--graphviz|--system-information)
|
cut -f1 -d: )' -P "$prefix" -- "$cur" ) )
|
||||||
_filedir
|
return
|
||||||
return
|
;;
|
||||||
;;
|
esac
|
||||||
--build)
|
|
||||||
# Seed the reply with non-directory arguments that we know are
|
if $is_old_completion; then
|
||||||
# allowed to follow --build. _filedir will then prepend any valid
|
_split_longopt && split=true
|
||||||
# directory matches to these.
|
fi
|
||||||
COMPREPLY=( $( compgen -W "--preset --list-presets" -- "$cur" ) )
|
|
||||||
_filedir -d
|
case "$prev" in
|
||||||
return
|
-C|-P|--graphviz|--system-information)
|
||||||
;;
|
_filedir
|
||||||
--install|--open)
|
return
|
||||||
_filedir -d
|
;;
|
||||||
return
|
--build)
|
||||||
;;
|
# Seed the reply with non-directory arguments that we know are
|
||||||
-E)
|
# allowed to follow --build. _filedir will then prepend any valid
|
||||||
COMPREPLY=( $( compgen -W "$( cmake -E help |& sed -n \
|
# directory matches to these.
|
||||||
'/^ [^ ]/{s|^ \([^ ]\{1,\}\) .*$|\1|;p}' 2>/dev/null )" \
|
COMPREPLY=( $( compgen -W "--preset --list-presets" -- "$cur" ) )
|
||||||
-- "$cur" ) )
|
_filedir -d
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
-G)
|
--install|--open)
|
||||||
local IFS=$'\n'
|
_filedir -d
|
||||||
local quoted
|
return
|
||||||
printf -v quoted %q "$cur"
|
;;
|
||||||
COMPREPLY=( $( compgen -W '$( cmake --help 2>/dev/null | sed -n \
|
-E)
|
||||||
-e "1,/^Generators/d" \
|
COMPREPLY=( $( compgen -W "$( cmake -E help |& sed -n \
|
||||||
-e "/^ *[^ =]/{s|^ *\([^=]*[^ =]\).*$|\1|;s| |\\\\ |g;p}" \
|
'/^ [^ ]/{s|^ \([^ ]\{1,\}\) .*$|\1|;p}' 2>/dev/null )" \
|
||||||
2>/dev/null )' -- "$quoted" ) )
|
-- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--loglevel)
|
-G)
|
||||||
COMPREPLY=( $(compgen -W 'error warning notice status verbose debug trace' -- $cur ) )
|
local IFS=$'\n'
|
||||||
;;
|
local quoted
|
||||||
--help-command)
|
printf -v quoted %q "$cur"
|
||||||
COMPREPLY=( $( compgen -W '$( cmake --help-command-list 2>/dev/null|
|
COMPREPLY=( $( compgen -W '$( cmake --help 2>/dev/null | sed -n \
|
||||||
grep -v "^cmake version " )' -- "$cur" ) )
|
-e "1,/^Generators/d" \
|
||||||
return
|
-e "/^ *[^ =]/{s|^ *\([^=]*[^ =]\).*$|\1|;s| |\\\\ |g;p}" \
|
||||||
;;
|
2>/dev/null )' -- "$quoted" ) )
|
||||||
--help-manual)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( cmake --help-manual-list 2>/dev/null|
|
;;
|
||||||
grep -v "^cmake version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
|
--loglevel)
|
||||||
return
|
COMPREPLY=( $(compgen -W 'error warning notice status verbose debug trace' -- $cur ) )
|
||||||
;;
|
;;
|
||||||
--help-module)
|
--help-command)
|
||||||
COMPREPLY=( $( compgen -W '$( cmake --help-module-list 2>/dev/null|
|
COMPREPLY=( $( compgen -W '$( cmake --help-command-list 2>/dev/null|
|
||||||
grep -v "^cmake version " )' -- "$cur" ) )
|
grep -v "^cmake version " )' -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--help-policy)
|
--help-manual)
|
||||||
COMPREPLY=( $( compgen -W '$( cmake --help-policy-list 2>/dev/null |
|
COMPREPLY=( $( compgen -W '$( cmake --help-manual-list 2>/dev/null|
|
||||||
grep -v "^cmake version " )' -- "$cur" ) )
|
grep -v "^cmake version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--help-property)
|
--help-module)
|
||||||
COMPREPLY=( $( compgen -W '$( cmake --help-property-list \
|
COMPREPLY=( $( compgen -W '$( cmake --help-module-list 2>/dev/null|
|
||||||
2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) )
|
grep -v "^cmake version " )' -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--help-variable)
|
--help-policy)
|
||||||
COMPREPLY=( $( compgen -W '$( cmake --help-variable-list \
|
COMPREPLY=( $( compgen -W '$( cmake --help-policy-list 2>/dev/null |
|
||||||
2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) )
|
grep -v "^cmake version " )' -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--list-presets)
|
--help-property)
|
||||||
local IFS=$'\n'
|
COMPREPLY=( $( compgen -W '$( cmake --help-property-list \
|
||||||
local quoted
|
2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) )
|
||||||
printf -v quoted %q "$cur"
|
return
|
||||||
|
;;
|
||||||
if [[ ! "${IFS}${COMP_WORDS[*]}${IFS}" =~ "${IFS}--build${IFS}" ]]; then
|
--help-variable)
|
||||||
COMPREPLY=( $( compgen -W "configure${IFS}build${IFS}test${IFS}all" -- "$quoted" ) )
|
COMPREPLY=( $( compgen -W '$( cmake --help-variable-list \
|
||||||
fi
|
2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--preset)
|
--list-presets)
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local quoted
|
local quoted
|
||||||
printf -v quoted %q "$cur"
|
printf -v quoted %q "$cur"
|
||||||
|
|
||||||
local build_or_configure="configure"
|
if [[ ! "${IFS}${COMP_WORDS[*]}${IFS}" =~ "${IFS}--build${IFS}" ]]; then
|
||||||
if [[ "${IFS}${COMP_WORDS[*]}${IFS}" =~ "${IFS}--build${IFS}" ]]; then
|
COMPREPLY=( $( compgen -W "configure${IFS}build${IFS}test${IFS}all" -- "$quoted" ) )
|
||||||
build_or_configure="build"
|
fi
|
||||||
fi
|
return
|
||||||
|
;;
|
||||||
local presets=$( cmake --list-presets="$build_or_configure" 2>/dev/null |
|
--preset)
|
||||||
grep -o "^ \".*\"" | sed \
|
local IFS=$'\n'
|
||||||
-e "s/^ //g" \
|
local quoted
|
||||||
-e "s/\"//g" \
|
printf -v quoted %q "$cur"
|
||||||
-e 's/ /\\\\ /g' )
|
|
||||||
COMPREPLY=( $( compgen -W "$presets" -- "$quoted" ) )
|
local build_or_configure="configure"
|
||||||
return
|
if [[ "${IFS}${COMP_WORDS[*]}${IFS}" =~ "${IFS}--build${IFS}" ]]; then
|
||||||
;;
|
build_or_configure="build"
|
||||||
esac
|
fi
|
||||||
|
|
||||||
$split && return
|
local presets=$( cmake --list-presets="$build_or_configure" 2>/dev/null |
|
||||||
|
grep -o "^ \".*\"" | sed \
|
||||||
if [[ "$cur" == -* ]]; then
|
-e "s/^ //g" \
|
||||||
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
-e "s/\"//g" \
|
||||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
-e 's/ /\\\\ /g' )
|
||||||
[[ $COMPREPLY ]] && return
|
COMPREPLY=( $( compgen -W "$presets" -- "$quoted" ) )
|
||||||
fi
|
return
|
||||||
|
;;
|
||||||
_filedir
|
esac
|
||||||
} &&
|
|
||||||
complete -F _cmake cmake
|
if ($is_old_completion || $is_init_completion); then
|
||||||
|
$split && return
|
||||||
# ex: ts=4 sw=4 et filetype=sh
|
else
|
||||||
|
[[ $was_split ]] && return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
||||||
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||||
|
[[ $COMPREPLY ]] && return
|
||||||
|
fi
|
||||||
|
|
||||||
|
_filedir
|
||||||
|
} &&
|
||||||
|
complete -F _cmake cmake
|
||||||
|
|
||||||
|
# ex: ts=4 sw=4 et filetype=sh
|
||||||
|
@ -1,88 +1,90 @@
|
|||||||
# bash completion for cpack(1) -*- shell-script -*-
|
# bash completion for cpack(1) -*- shell-script -*-
|
||||||
|
|
||||||
_cpack()
|
_cpack()
|
||||||
{
|
{
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
if type -t _init_completion >/dev/null; then
|
if type -t _comp_initialize >/dev/null; then
|
||||||
_init_completion -n = || return
|
_comp_initialize -n = || return
|
||||||
else
|
elif type -t _init_completion >/dev/null; then
|
||||||
# manual initialization for older bash completion versions
|
_init_completion -n = || return
|
||||||
COMPREPLY=()
|
else
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
# manual initialization for older bash completion versions
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
COMPREPLY=()
|
||||||
fi
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
case "$prev" in
|
fi
|
||||||
-G)
|
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null |
|
case "$prev" in
|
||||||
sed -e "1,/^Generators/d" -e "s|^ *\([^ ]*\) .*$|\1|" \
|
-G)
|
||||||
2>/dev/null )' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null |
|
||||||
return
|
sed -e "1,/^Generators/d" -e "s|^ *\([^ ]*\) .*$|\1|" \
|
||||||
;;
|
2>/dev/null )' -- "$cur" ) )
|
||||||
-C)
|
return
|
||||||
COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
|
;;
|
||||||
MinSizeRel' -- "$cur" ) )
|
-C)
|
||||||
return
|
COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
|
||||||
;;
|
MinSizeRel' -- "$cur" ) )
|
||||||
-D)
|
return
|
||||||
[[ $cur == *=* ]] && return # no completion for values
|
;;
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
|
-D)
|
||||||
2>/dev/null | grep -v "^cpack version " )' -S = -- "$cur" ) )
|
[[ $cur == *=* ]] && return # no completion for values
|
||||||
compopt -o nospace
|
COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
|
||||||
return
|
2>/dev/null | grep -v "^cpack version " )' -S = -- "$cur" ) )
|
||||||
;;
|
compopt -o nospace
|
||||||
-P|-R|--vendor)
|
return
|
||||||
# argument required but no completions available
|
;;
|
||||||
return
|
-P|-R|--vendor)
|
||||||
;;
|
# argument required but no completions available
|
||||||
-B)
|
return
|
||||||
_filedir -d
|
;;
|
||||||
return
|
-B)
|
||||||
;;
|
_filedir -d
|
||||||
--config)
|
return
|
||||||
_filedir
|
;;
|
||||||
return
|
--config)
|
||||||
;;
|
_filedir
|
||||||
--help-command)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help-command-list 2>/dev/null|
|
;;
|
||||||
grep -v "^cpack version " )' -- "$cur" ) )
|
--help-command)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( cpack --help-command-list 2>/dev/null|
|
||||||
;;
|
grep -v "^cpack version " )' -- "$cur" ) )
|
||||||
--help-manual)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help-manual-list 2>/dev/null|
|
;;
|
||||||
grep -v "^cpack version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
|
--help-manual)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( cpack --help-manual-list 2>/dev/null|
|
||||||
;;
|
grep -v "^cpack version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
|
||||||
--help-module)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help-module-list 2>/dev/null|
|
;;
|
||||||
grep -v "^cpack version " )' -- "$cur" ) )
|
--help-module)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( cpack --help-module-list 2>/dev/null|
|
||||||
;;
|
grep -v "^cpack version " )' -- "$cur" ) )
|
||||||
--help-policy)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help-policy-list 2>/dev/null |
|
;;
|
||||||
grep -v "^cpack version " )' -- "$cur" ) )
|
--help-policy)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( cpack --help-policy-list 2>/dev/null |
|
||||||
;;
|
grep -v "^cpack version " )' -- "$cur" ) )
|
||||||
--help-property)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help-property-list \
|
;;
|
||||||
2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
|
--help-property)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( cpack --help-property-list \
|
||||||
;;
|
2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
|
||||||
--help-variable)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
|
;;
|
||||||
2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
|
--help-variable)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
|
||||||
;;
|
2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
|
||||||
esac
|
return
|
||||||
|
;;
|
||||||
if [[ "$cur" == -* ]]; then
|
esac
|
||||||
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
|
||||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
if [[ "$cur" == -* ]]; then
|
||||||
[[ $COMPREPLY ]] && return
|
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
||||||
fi
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||||
|
[[ $COMPREPLY ]] && return
|
||||||
_filedir
|
fi
|
||||||
} &&
|
|
||||||
complete -F _cpack cpack
|
_filedir
|
||||||
|
} &&
|
||||||
# ex: ts=4 sw=4 et filetype=sh
|
complete -F _cpack cpack
|
||||||
|
|
||||||
|
# ex: ts=4 sw=4 et filetype=sh
|
||||||
|
@ -1,129 +1,131 @@
|
|||||||
# bash completion for ctest(1) -*- shell-script -*-
|
# bash completion for ctest(1) -*- shell-script -*-
|
||||||
|
|
||||||
_ctest()
|
_ctest()
|
||||||
{
|
{
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
if type -t _init_completion >/dev/null; then
|
if type -t _comp_initialize >/dev/null; then
|
||||||
_init_completion -n = || return
|
_comp_initialize -n = || return
|
||||||
else
|
elif type -t _init_completion >/dev/null; then
|
||||||
# manual initialization for older bash completion versions
|
_init_completion -n = || return
|
||||||
COMPREPLY=()
|
else
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
# manual initialization for older bash completion versions
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
COMPREPLY=()
|
||||||
fi
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
case "$prev" in
|
fi
|
||||||
-C|--build-config)
|
|
||||||
COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
|
case "$prev" in
|
||||||
MinSizeRel' -- "$cur" ) )
|
-C|--build-config)
|
||||||
return
|
COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
|
||||||
;;
|
MinSizeRel' -- "$cur" ) )
|
||||||
-j|--parallel)
|
return
|
||||||
COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) )
|
;;
|
||||||
return
|
-j|--parallel)
|
||||||
;;
|
COMPREPLY=( $( compgen -W "{1..$(( $(_ncpus)*2 ))}" -- "$cur" ) )
|
||||||
-O|--output-log|-A|--add-notes|--extra-submit)
|
return
|
||||||
_filedir
|
;;
|
||||||
return
|
-O|--output-log|-A|--add-notes|--extra-submit)
|
||||||
;;
|
_filedir
|
||||||
-L|--label-regex|-LE|--label-exclude)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --print-labels 2>/dev/null |
|
;;
|
||||||
grep "^ " 2>/dev/null | cut -d" " -f 3 )' -- "$cur" ) )
|
-L|--label-regex|-LE|--label-exclude)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest --print-labels 2>/dev/null |
|
||||||
;;
|
grep "^ " 2>/dev/null | cut -d" " -f 3 )' -- "$cur" ) )
|
||||||
--track|-I|--tests-information|--max-width|--timeout|--stop-time)
|
return
|
||||||
# argument required but no completions available
|
;;
|
||||||
return
|
--track|-I|--tests-information|--max-width|--timeout|--stop-time)
|
||||||
;;
|
# argument required but no completions available
|
||||||
-R|--tests-regex|-E|--exclude-regex)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( ctest -N 2>/dev/null |
|
;;
|
||||||
grep "^ Test" 2>/dev/null | cut -d: -f 2 )' -- "$cur" ) )
|
-R|--tests-regex|-E|--exclude-regex)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest -N 2>/dev/null |
|
||||||
;;
|
grep "^ Test" 2>/dev/null | cut -d: -f 2 )' -- "$cur" ) )
|
||||||
-D|--dashboard)
|
return
|
||||||
if [[ $cur == @(Experimental|Nightly|Continuous)* ]]; then
|
;;
|
||||||
local model action
|
-D|--dashboard)
|
||||||
action=${cur#@(Experimental|Nightly|Continuous)}
|
if [[ $cur == @(Experimental|Nightly|Continuous)* ]]; then
|
||||||
model=${cur%"$action"}
|
local model action
|
||||||
COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
|
action=${cur#@(Experimental|Nightly|Continuous)}
|
||||||
Coverage Submit MemCheck' -P "$model" -- "$action" ) )
|
model=${cur%"$action"}
|
||||||
else
|
COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
|
||||||
COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' \
|
Coverage Submit MemCheck' -P "$model" -- "$action" ) )
|
||||||
-- "$cur" ) )
|
else
|
||||||
compopt -o nospace
|
COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' \
|
||||||
fi
|
-- "$cur" ) )
|
||||||
return
|
compopt -o nospace
|
||||||
;;
|
fi
|
||||||
-M|--test-model)
|
return
|
||||||
COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' -- \
|
;;
|
||||||
"$cur" ) )
|
-M|--test-model)
|
||||||
return
|
COMPREPLY=( $( compgen -W 'Experimental Nightly Continuous' -- \
|
||||||
;;
|
"$cur" ) )
|
||||||
-T|--test-action)
|
return
|
||||||
COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
|
;;
|
||||||
Coverage Submit MemCheck' -- "$cur" ) )
|
-T|--test-action)
|
||||||
return
|
COMPREPLY=( $( compgen -W 'Start Update Configure Build Test
|
||||||
;;
|
Coverage Submit MemCheck' -- "$cur" ) )
|
||||||
-S|--script|-SP|--script-new-process)
|
return
|
||||||
_filedir '@(cmake|ctest)'
|
;;
|
||||||
return
|
-S|--script|-SP|--script-new-process)
|
||||||
;;
|
_filedir '@(cmake|ctest)'
|
||||||
--interactive-debug-mode)
|
return
|
||||||
COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
|
;;
|
||||||
return
|
--interactive-debug-mode)
|
||||||
;;
|
COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
|
||||||
|
return
|
||||||
--help-command)
|
;;
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null|
|
|
||||||
grep -v "^ctest version " )' -- "$cur" ) )
|
--help-command)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null|
|
||||||
;;
|
grep -v "^ctest version " )' -- "$cur" ) )
|
||||||
--help-manual)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --help-manual-list 2>/dev/null|
|
;;
|
||||||
grep -v "^ctest version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
|
--help-manual)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest --help-manual-list 2>/dev/null|
|
||||||
;;
|
grep -v "^ctest version " | sed -e "s/([0-9])$//" )' -- "$cur" ) )
|
||||||
--help-module)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --help-module-list 2>/dev/null|
|
;;
|
||||||
grep -v "^ctest version " )' -- "$cur" ) )
|
--help-module)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest --help-module-list 2>/dev/null|
|
||||||
;;
|
grep -v "^ctest version " )' -- "$cur" ) )
|
||||||
--help-policy)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --help-policy-list 2>/dev/null |
|
;;
|
||||||
grep -v "^ctest version " )' -- "$cur" ) )
|
--help-policy)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest --help-policy-list 2>/dev/null |
|
||||||
;;
|
grep -v "^ctest version " )' -- "$cur" ) )
|
||||||
--help-property)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --help-property-list \
|
;;
|
||||||
2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
|
--help-property)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest --help-property-list \
|
||||||
;;
|
2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
|
||||||
--help-variable)
|
return
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --help-variable-list \
|
;;
|
||||||
2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
|
--help-variable)
|
||||||
return
|
COMPREPLY=( $( compgen -W '$( ctest --help-variable-list \
|
||||||
;;
|
2>/dev/null | grep -v "^ctest version " )' -- "$cur" ) )
|
||||||
--preset)
|
return
|
||||||
local IFS=$'\n'
|
;;
|
||||||
local quoted
|
--preset)
|
||||||
printf -v quoted %q "$cur"
|
local IFS=$'\n'
|
||||||
COMPREPLY=( $( compgen -W '$( ctest --list-presets 2>/dev/null |
|
local quoted
|
||||||
grep -o "^ \".*\"" | sed \
|
printf -v quoted %q "$cur"
|
||||||
-e "s/^ //g" \
|
COMPREPLY=( $( compgen -W '$( ctest --list-presets 2>/dev/null |
|
||||||
-e "s/\"//g" \
|
grep -o "^ \".*\"" | sed \
|
||||||
-e "s/ /\\\\ /g" )' -- "$quoted" ) )
|
-e "s/^ //g" \
|
||||||
return
|
-e "s/\"//g" \
|
||||||
;;
|
-e "s/ /\\\\ /g" )' -- "$quoted" ) )
|
||||||
esac
|
return
|
||||||
|
;;
|
||||||
if [[ "$cur" == -* ]]; then
|
esac
|
||||||
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
|
||||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
if [[ "$cur" == -* ]]; then
|
||||||
[[ $COMPREPLY ]] && return
|
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
||||||
fi
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||||
|
[[ $COMPREPLY ]] && return
|
||||||
_filedir
|
fi
|
||||||
} &&
|
|
||||||
complete -F _ctest ctest
|
_filedir
|
||||||
|
} &&
|
||||||
# ex: ts=4 sw=4 et filetype=sh
|
complete -F _ctest ctest
|
||||||
|
|
||||||
|
# ex: ts=4 sw=4 et filetype=sh
|
||||||
|
@ -1,268 +0,0 @@
|
|||||||
add_library
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. only:: html
|
|
||||||
|
|
||||||
.. contents::
|
|
||||||
|
|
||||||
Add a library to the project using the specified source files.
|
|
||||||
|
|
||||||
Normal Libraries
|
|
||||||
^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
add_library(<name> [STATIC | SHARED | MODULE]
|
|
||||||
[EXCLUDE_FROM_ALL]
|
|
||||||
[<source>...])
|
|
||||||
|
|
||||||
Adds a library target called ``<name>`` to be built from the source files
|
|
||||||
listed in the command invocation. The ``<name>``
|
|
||||||
corresponds to the logical target name and must be globally unique within
|
|
||||||
a project. The actual file name of the library built is constructed based
|
|
||||||
on conventions of the native platform (such as ``lib<name>.a`` or
|
|
||||||
``<name>.lib``).
|
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
|
||||||
Source arguments to ``add_library`` may use "generator expressions" with
|
|
||||||
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
|
||||||
manual for available expressions.
|
|
||||||
|
|
||||||
.. versionadded:: 3.11
|
|
||||||
The source files can be omitted if they are added later using
|
|
||||||
:command:`target_sources`.
|
|
||||||
|
|
||||||
``STATIC``, ``SHARED``, or ``MODULE`` may be given to specify the type of
|
|
||||||
library to be created. ``STATIC`` libraries are archives of object files
|
|
||||||
for use when linking other targets. ``SHARED`` libraries are linked
|
|
||||||
dynamically and loaded at runtime. ``MODULE`` libraries are plugins that
|
|
||||||
are not linked into other targets but may be loaded dynamically at runtime
|
|
||||||
using dlopen-like functionality. If no type is given explicitly the
|
|
||||||
type is ``STATIC`` or ``SHARED`` based on whether the current value of the
|
|
||||||
variable :variable:`BUILD_SHARED_LIBS` is ``ON``. For ``SHARED`` and
|
|
||||||
``MODULE`` libraries the :prop_tgt:`POSITION_INDEPENDENT_CODE` target
|
|
||||||
property is set to ``ON`` automatically.
|
|
||||||
A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK`
|
|
||||||
target property to create an macOS Framework.
|
|
||||||
|
|
||||||
.. versionadded:: 3.8
|
|
||||||
A ``STATIC`` library may be marked with the :prop_tgt:`FRAMEWORK`
|
|
||||||
target property to create a static Framework.
|
|
||||||
|
|
||||||
If a library does not export any symbols, it must not be declared as a
|
|
||||||
``SHARED`` library. For example, a Windows resource DLL or a managed C++/CLI
|
|
||||||
DLL that exports no unmanaged symbols would need to be a ``MODULE`` library.
|
|
||||||
This is because CMake expects a ``SHARED`` library to always have an
|
|
||||||
associated import library on Windows.
|
|
||||||
|
|
||||||
By default the library file will be created in the build tree directory
|
|
||||||
corresponding to the source tree directory in which the command was
|
|
||||||
invoked. See documentation of the :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`,
|
|
||||||
:prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`, and
|
|
||||||
:prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target properties to change this
|
|
||||||
location. See documentation of the :prop_tgt:`OUTPUT_NAME` target
|
|
||||||
property to change the ``<name>`` part of the final file name.
|
|
||||||
|
|
||||||
If ``EXCLUDE_FROM_ALL`` is given the corresponding property will be set on
|
|
||||||
the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL`
|
|
||||||
target property for details.
|
|
||||||
|
|
||||||
See the :manual:`cmake-buildsystem(7)` manual for more on defining
|
|
||||||
buildsystem properties.
|
|
||||||
|
|
||||||
See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
|
|
||||||
pre-processed, and you want to have the original sources reachable from
|
|
||||||
within IDE.
|
|
||||||
|
|
||||||
Object Libraries
|
|
||||||
^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
add_library(<name> OBJECT [<source>...])
|
|
||||||
|
|
||||||
Creates an :ref:`Object Library <Object Libraries>`. An object library
|
|
||||||
compiles source files but does not archive or link their object files into a
|
|
||||||
library. Instead other targets created by ``add_library`` or
|
|
||||||
:command:`add_executable` may reference the objects using an expression of the
|
|
||||||
form :genex:`$\<TARGET_OBJECTS:objlib\> <TARGET_OBJECTS>` as a source, where
|
|
||||||
``objlib`` is the object library name. For example:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
add_library(... $<TARGET_OBJECTS:objlib> ...)
|
|
||||||
add_executable(... $<TARGET_OBJECTS:objlib> ...)
|
|
||||||
|
|
||||||
will include objlib's object files in a library and an executable
|
|
||||||
along with those compiled from their own sources. Object libraries
|
|
||||||
may contain only sources that compile, header files, and other files
|
|
||||||
that would not affect linking of a normal library (e.g. ``.txt``).
|
|
||||||
They may contain custom commands generating such sources, but not
|
|
||||||
``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Some native build
|
|
||||||
systems (such as Xcode) may not like targets that have only object files, so
|
|
||||||
consider adding at least one real source file to any target that references
|
|
||||||
:genex:`$\<TARGET_OBJECTS:objlib\> <TARGET_OBJECTS>`.
|
|
||||||
|
|
||||||
.. versionadded:: 3.12
|
|
||||||
Object libraries can be linked to with :command:`target_link_libraries`.
|
|
||||||
|
|
||||||
Interface Libraries
|
|
||||||
^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
add_library(<name> INTERFACE)
|
|
||||||
|
|
||||||
Creates an :ref:`Interface Library <Interface Libraries>`.
|
|
||||||
An ``INTERFACE`` library target does not compile sources and does
|
|
||||||
not produce a library artifact on disk. However, it may have
|
|
||||||
properties set on it and it may be installed and exported.
|
|
||||||
Typically, ``INTERFACE_*`` properties are populated on an interface
|
|
||||||
target using the commands:
|
|
||||||
|
|
||||||
* :command:`set_property`,
|
|
||||||
* :command:`target_link_libraries(INTERFACE)`,
|
|
||||||
* :command:`target_link_options(INTERFACE)`,
|
|
||||||
* :command:`target_include_directories(INTERFACE)`,
|
|
||||||
* :command:`target_compile_options(INTERFACE)`,
|
|
||||||
* :command:`target_compile_definitions(INTERFACE)`, and
|
|
||||||
* :command:`target_sources(INTERFACE)`,
|
|
||||||
|
|
||||||
and then it is used as an argument to :command:`target_link_libraries`
|
|
||||||
like any other target.
|
|
||||||
|
|
||||||
An interface library created with the above signature has no source files
|
|
||||||
itself and is not included as a target in the generated buildsystem.
|
|
||||||
|
|
||||||
.. versionadded:: 3.15
|
|
||||||
An interface library can have :prop_tgt:`PUBLIC_HEADER` and
|
|
||||||
:prop_tgt:`PRIVATE_HEADER` properties. The headers specified by those
|
|
||||||
properties can be installed using the :command:`install(TARGETS)` command.
|
|
||||||
|
|
||||||
.. versionadded:: 3.19
|
|
||||||
An interface library target may be created with source files:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
add_library(<name> INTERFACE [<source>...] [EXCLUDE_FROM_ALL])
|
|
||||||
|
|
||||||
Source files may be listed directly in the ``add_library`` call or added
|
|
||||||
later by calls to :command:`target_sources` with the ``PRIVATE`` or
|
|
||||||
``PUBLIC`` keywords.
|
|
||||||
|
|
||||||
If an interface library has source files (i.e. the :prop_tgt:`SOURCES`
|
|
||||||
target property is set), or header sets (i.e. the :prop_tgt:`HEADER_SETS`
|
|
||||||
target property is set), it will appear in the generated buildsystem
|
|
||||||
as a build target much like a target defined by the
|
|
||||||
:command:`add_custom_target` command. It does not compile any sources,
|
|
||||||
but does contain build rules for custom commands created by the
|
|
||||||
:command:`add_custom_command` command.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
In most command signatures where the ``INTERFACE`` keyword appears,
|
|
||||||
the items listed after it only become part of that target's usage
|
|
||||||
requirements and are not part of the target's own settings. However,
|
|
||||||
in this signature of ``add_library``, the ``INTERFACE`` keyword refers
|
|
||||||
to the library type only. Sources listed after it in the ``add_library``
|
|
||||||
call are ``PRIVATE`` to the interface library and do not appear in its
|
|
||||||
:prop_tgt:`INTERFACE_SOURCES` target property.
|
|
||||||
|
|
||||||
.. _`add_library imported libraries`:
|
|
||||||
|
|
||||||
Imported Libraries
|
|
||||||
^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
add_library(<name> <type> IMPORTED [GLOBAL])
|
|
||||||
|
|
||||||
Creates an :ref:`IMPORTED library target <Imported Targets>` called ``<name>``.
|
|
||||||
No rules are generated to build it, and the :prop_tgt:`IMPORTED` target
|
|
||||||
property is ``True``. The target name has scope in the directory in which
|
|
||||||
it is created and below, but the ``GLOBAL`` option extends visibility.
|
|
||||||
It may be referenced like any target built within the project.
|
|
||||||
``IMPORTED`` libraries are useful for convenient reference from commands
|
|
||||||
like :command:`target_link_libraries`. Details about the imported library
|
|
||||||
are specified by setting properties whose names begin in ``IMPORTED_`` and
|
|
||||||
``INTERFACE_``.
|
|
||||||
|
|
||||||
The ``<type>`` must be one of:
|
|
||||||
|
|
||||||
``STATIC``, ``SHARED``, ``MODULE``, ``UNKNOWN``
|
|
||||||
References a library file located outside the project. The
|
|
||||||
:prop_tgt:`IMPORTED_LOCATION` target property (or its per-configuration
|
|
||||||
variant :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) specifies the
|
|
||||||
location of the main library file on disk:
|
|
||||||
|
|
||||||
* For a ``SHARED`` library on most non-Windows platforms, the main library
|
|
||||||
file is the ``.so`` or ``.dylib`` file used by both linkers and dynamic
|
|
||||||
loaders. If the referenced library file has a ``SONAME`` (or on macOS,
|
|
||||||
has a ``LC_ID_DYLIB`` starting in ``@rpath/``), the value of that field
|
|
||||||
should be set in the :prop_tgt:`IMPORTED_SONAME` target property.
|
|
||||||
If the referenced library file does not have a ``SONAME``, but the
|
|
||||||
platform supports it, then the :prop_tgt:`IMPORTED_NO_SONAME` target
|
|
||||||
property should be set.
|
|
||||||
|
|
||||||
* For a ``SHARED`` library on Windows, the :prop_tgt:`IMPORTED_IMPLIB`
|
|
||||||
target property (or its per-configuration variant
|
|
||||||
:prop_tgt:`IMPORTED_IMPLIB_<CONFIG>`) specifies the location of the
|
|
||||||
DLL import library file (``.lib`` or ``.dll.a``) on disk, and the
|
|
||||||
``IMPORTED_LOCATION`` is the location of the ``.dll`` runtime
|
|
||||||
library (and is optional, but needed by the :genex:`TARGET_RUNTIME_DLLS`
|
|
||||||
generator expression).
|
|
||||||
|
|
||||||
Additional usage requirements may be specified in ``INTERFACE_*`` properties.
|
|
||||||
|
|
||||||
An ``UNKNOWN`` library type is typically only used in the implementation of
|
|
||||||
:ref:`Find Modules`. It allows the path to an imported library (often found
|
|
||||||
using the :command:`find_library` command) to be used without having to know
|
|
||||||
what type of library it is. This is especially useful on Windows where a
|
|
||||||
static library and a DLL's import library both have the same file extension.
|
|
||||||
|
|
||||||
``OBJECT``
|
|
||||||
References a set of object files located outside the project.
|
|
||||||
The :prop_tgt:`IMPORTED_OBJECTS` target property (or its per-configuration
|
|
||||||
variant :prop_tgt:`IMPORTED_OBJECTS_<CONFIG>`) specifies the locations of
|
|
||||||
object files on disk.
|
|
||||||
Additional usage requirements may be specified in ``INTERFACE_*`` properties.
|
|
||||||
|
|
||||||
``INTERFACE``
|
|
||||||
Does not reference any library or object files on disk, but may
|
|
||||||
specify usage requirements in ``INTERFACE_*`` properties.
|
|
||||||
|
|
||||||
See documentation of the ``IMPORTED_*`` and ``INTERFACE_*`` properties
|
|
||||||
for more information.
|
|
||||||
|
|
||||||
Alias Libraries
|
|
||||||
^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
add_library(<name> ALIAS <target>)
|
|
||||||
|
|
||||||
Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can be
|
|
||||||
used to refer to ``<target>`` in subsequent commands. The ``<name>`` does
|
|
||||||
not appear in the generated buildsystem as a make target. The ``<target>``
|
|
||||||
may not be an ``ALIAS``.
|
|
||||||
|
|
||||||
.. versionadded:: 3.11
|
|
||||||
An ``ALIAS`` can target a ``GLOBAL`` :ref:`Imported Target <Imported Targets>`
|
|
||||||
|
|
||||||
.. versionadded:: 3.18
|
|
||||||
An ``ALIAS`` can target a non-``GLOBAL`` Imported Target. Such alias is
|
|
||||||
scoped to the directory in which it is created and below.
|
|
||||||
The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the
|
|
||||||
alias is global or not.
|
|
||||||
|
|
||||||
``ALIAS`` targets can be used as linkable targets and as targets to
|
|
||||||
read properties from. They can also be tested for existence with the
|
|
||||||
regular :command:`if(TARGET)` subcommand. The ``<name>`` may not be used
|
|
||||||
to modify properties of ``<target>``, that is, it may not be used as the
|
|
||||||
operand of :command:`set_property`, :command:`set_target_properties`,
|
|
||||||
:command:`target_link_libraries` etc. An ``ALIAS`` target may not be
|
|
||||||
installed or exported.
|
|
||||||
|
|
||||||
See Also
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
* :command:`add_executable`
|
|
@ -1,30 +0,0 @@
|
|||||||
create_test_sourcelist
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Create a test driver and source list for building test programs.
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
create_test_sourcelist(sourceListName driverName
|
|
||||||
test1 test2 test3
|
|
||||||
EXTRA_INCLUDE include.h
|
|
||||||
FUNCTION function)
|
|
||||||
|
|
||||||
A test driver is a program that links together many small tests into a
|
|
||||||
single executable. This is useful when building static executables
|
|
||||||
with large libraries to shrink the total required size. The list of
|
|
||||||
source files needed to build the test driver will be in
|
|
||||||
``sourceListName``. ``driverName`` is the name of the test driver program.
|
|
||||||
The rest of the arguments consist of a list of test source files, can
|
|
||||||
be semicolon separated. Each test source file should have a function
|
|
||||||
in it that is the same name as the file with no extension (foo.cxx
|
|
||||||
should have int foo(int, char*[]);) ``driverName`` will be able to call
|
|
||||||
each of the tests by name on the command line. If ``EXTRA_INCLUDE`` is
|
|
||||||
specified, then the next argument is included into the generated file.
|
|
||||||
If ``FUNCTION`` is specified, then the next argument is taken as a
|
|
||||||
function name that is passed a pointer to ac and av. This can be used
|
|
||||||
to add extra command line processing to each test. The
|
|
||||||
``CMAKE_TESTDRIVER_BEFORE_TESTMAIN`` cmake variable can be set to
|
|
||||||
have code that will be placed directly before calling the test main function.
|
|
||||||
``CMAKE_TESTDRIVER_AFTER_TESTMAIN`` can be set to have code that
|
|
||||||
will be placed directly after the call to the test main function.
|
|
@ -1,24 +0,0 @@
|
|||||||
enable_language
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Enable languages (CXX/C/OBJC/OBJCXX/Fortran/etc)
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
enable_language(<lang>... [OPTIONAL])
|
|
||||||
|
|
||||||
Enables support for the named languages in CMake. This is the same as
|
|
||||||
the :command:`project` command but does not create any of the extra
|
|
||||||
variables that are created by the project command.
|
|
||||||
|
|
||||||
.. include:: SUPPORTED_LANGUAGES.txt
|
|
||||||
|
|
||||||
This command must be called in file scope, not in a function call.
|
|
||||||
Furthermore, it must be called in the highest directory common to all
|
|
||||||
targets using the named language directly for compiling sources or
|
|
||||||
indirectly through link dependencies. It is simplest to enable all
|
|
||||||
needed languages in the top-level directory of a project.
|
|
||||||
|
|
||||||
The ``OPTIONAL`` keyword is a placeholder for future implementation and
|
|
||||||
does not currently work. Instead you can use the :module:`CheckLanguage`
|
|
||||||
module to verify support before enabling.
|
|
@ -1,26 +0,0 @@
|
|||||||
get_test_property
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Get a property of the test.
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
get_test_property(test property VAR)
|
|
||||||
|
|
||||||
Get a property from the test. The value of the property is stored in
|
|
||||||
the variable ``VAR``. If the test property is not found, the behavior
|
|
||||||
depends on whether it has been defined to be an ``INHERITED`` property
|
|
||||||
or not (see :command:`define_property`). Non-inherited properties will
|
|
||||||
set ``VAR`` to "NOTFOUND", whereas inherited properties will search the
|
|
||||||
relevant parent scope as described for the :command:`define_property`
|
|
||||||
command and if still unable to find the property, ``VAR`` will be set to
|
|
||||||
an empty string.
|
|
||||||
|
|
||||||
For a list of standard properties you can type
|
|
||||||
:option:`cmake --help-property-list`.
|
|
||||||
|
|
||||||
See Also
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
* :command:`define_property`
|
|
||||||
* the more general :command:`get_property` command
|
|
File diff suppressed because it is too large
Load Diff
@ -1,23 +0,0 @@
|
|||||||
set_tests_properties
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
Set a property of the tests.
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
|
|
||||||
|
|
||||||
Sets a property for the tests. If the test is not found, CMake
|
|
||||||
will report an error.
|
|
||||||
|
|
||||||
Test property values may be specified using
|
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`
|
|
||||||
for tests created by the :command:`add_test(NAME)` signature.
|
|
||||||
|
|
||||||
See Also
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
* :command:`add_test`
|
|
||||||
* :command:`define_property`
|
|
||||||
* the more general :command:`set_property` command
|
|
||||||
* :ref:`Target Properties` for the list of properties known to CMake
|
|
@ -1,7 +0,0 @@
|
|||||||
CTEST_PARALLEL_LEVEL
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
.. include:: ENV_VAR.txt
|
|
||||||
|
|
||||||
Specify the number of tests for CTest to run in parallel. See :manual:`ctest(1)`
|
|
||||||
for more information on parallel test execution.
|
|
@ -1,57 +0,0 @@
|
|||||||
Visual Studio 11 2012
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
Deprecated. Generates Visual Studio 11 (VS 2012) project files.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
This generator is deprecated and will be removed in a future version
|
|
||||||
of CMake. It will still be possible to build with VS 11 2012 tools
|
|
||||||
using the :generator:`Visual Studio 12 2013` (or above) generator
|
|
||||||
with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v110``, or by
|
|
||||||
using the :generator:`NMake Makefiles` generator.
|
|
||||||
|
|
||||||
For compatibility with CMake versions prior to 3.0, one may specify this
|
|
||||||
generator using the name "Visual Studio 11" without the year component.
|
|
||||||
|
|
||||||
Project Types
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Only Visual C++ and C# projects may be generated (and Fortran with
|
|
||||||
Intel compiler integration). Other types of projects (JavaScript,
|
|
||||||
Database, Website, etc.) are not supported.
|
|
||||||
|
|
||||||
Platform Selection
|
|
||||||
^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The default target platform name (architecture) is ``Win32``.
|
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
|
||||||
The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps
|
|
||||||
via the :option:`cmake -A` option, to specify a target platform
|
|
||||||
name (architecture). For example:
|
|
||||||
|
|
||||||
* ``cmake -G "Visual Studio 11 2012" -A Win32``
|
|
||||||
* ``cmake -G "Visual Studio 11 2012" -A x64``
|
|
||||||
* ``cmake -G "Visual Studio 11 2012" -A ARM``
|
|
||||||
* ``cmake -G "Visual Studio 11 2012" -A <WinCE-SDK>``
|
|
||||||
(Specify a target platform matching a Windows CE SDK name.)
|
|
||||||
|
|
||||||
For compatibility with CMake versions prior to 3.1, one may specify
|
|
||||||
a target platform name optionally at the end of the generator name.
|
|
||||||
This is supported only for:
|
|
||||||
|
|
||||||
``Visual Studio 11 2012 Win64``
|
|
||||||
Specify target platform ``x64``.
|
|
||||||
|
|
||||||
``Visual Studio 11 2012 ARM``
|
|
||||||
Specify target platform ``ARM``.
|
|
||||||
|
|
||||||
``Visual Studio 11 2012 <WinCE-SDK>``
|
|
||||||
Specify target platform matching a Windows CE SDK name.
|
|
||||||
|
|
||||||
Toolset Selection
|
|
||||||
^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The ``v110`` toolset that comes with Visual Studio 11 2012 is selected by
|
|
||||||
default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps
|
|
||||||
via the :option:`cmake -T` option, to specify another toolset.
|
|
@ -1,41 +0,0 @@
|
|||||||
Visual Studio 9 2008
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
Deprecated. Generates Visual Studio 9 2008 project files.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
This generator is deprecated and will be removed in a future version
|
|
||||||
of CMake. It will still be possible to build with VS 9 2008 tools
|
|
||||||
using the :generator:`Visual Studio 12 2013` generator (or above,
|
|
||||||
and with VS 10 2010 also installed) with
|
|
||||||
:variable:`CMAKE_GENERATOR_TOOLSET` set to ``v90``,
|
|
||||||
or by using the :generator:`NMake Makefiles` generator.
|
|
||||||
|
|
||||||
Platform Selection
|
|
||||||
^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The default target platform name (architecture) is ``Win32``.
|
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
|
||||||
The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps
|
|
||||||
via the :option:`cmake -A` option, to specify a target platform
|
|
||||||
name (architecture). For example:
|
|
||||||
|
|
||||||
* ``cmake -G "Visual Studio 9 2008" -A Win32``
|
|
||||||
* ``cmake -G "Visual Studio 9 2008" -A x64``
|
|
||||||
* ``cmake -G "Visual Studio 9 2008" -A Itanium``
|
|
||||||
* ``cmake -G "Visual Studio 9 2008" -A <WinCE-SDK>``
|
|
||||||
(Specify a target platform matching a Windows CE SDK name.)
|
|
||||||
|
|
||||||
For compatibility with CMake versions prior to 3.1, one may specify
|
|
||||||
a target platform name optionally at the end of the generator name.
|
|
||||||
This is supported only for:
|
|
||||||
|
|
||||||
``Visual Studio 9 2008 Win64``
|
|
||||||
Specify target platform ``x64``.
|
|
||||||
|
|
||||||
``Visual Studio 9 2008 IA64``
|
|
||||||
Specify target platform ``Itanium``.
|
|
||||||
|
|
||||||
``Visual Studio 9 2008 <WinCE-SDK>``
|
|
||||||
Specify target platform matching a Windows CE SDK name.
|
|
@ -1,26 +0,0 @@
|
|||||||
CMP0099
|
|
||||||
-------
|
|
||||||
|
|
||||||
.. versionadded:: 3.17
|
|
||||||
|
|
||||||
Target link properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
|
|
||||||
:prop_tgt:`INTERFACE_LINK_DIRECTORIES` and :prop_tgt:`INTERFACE_LINK_DEPENDS`
|
|
||||||
are now transitive over private dependencies of static libraries.
|
|
||||||
|
|
||||||
In CMake 3.16 and below the interface link properties attached to libraries
|
|
||||||
are not propagated for private dependencies of static libraries.
|
|
||||||
Only the libraries themselves are propagated to link the dependent binary.
|
|
||||||
CMake 3.17 and later prefer to propagate all interface link properties.
|
|
||||||
This policy provides compatibility for projects that have not been updated
|
|
||||||
to expect the new behavior.
|
|
||||||
|
|
||||||
The ``OLD`` behavior for this policy is to not propagate interface link
|
|
||||||
properties. The ``NEW`` behavior of this policy is to propagate interface link
|
|
||||||
properties.
|
|
||||||
|
|
||||||
This policy was introduced in CMake version 3.17. Use the
|
|
||||||
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
|
|
||||||
Unlike many policies, CMake version |release| does *not* warn
|
|
||||||
when this policy is not set and simply uses ``OLD`` behavior.
|
|
||||||
|
|
||||||
.. include:: DEPRECATED.txt
|
|
@ -1,25 +0,0 @@
|
|||||||
CMP0118
|
|
||||||
-------
|
|
||||||
|
|
||||||
.. versionadded:: 3.20
|
|
||||||
|
|
||||||
The :prop_sf:`GENERATED` source file property is now visible in all directories.
|
|
||||||
|
|
||||||
Whether or not a source file is generated is an all-or-nothing global
|
|
||||||
property of the source. Consequently, the associated ``GENERATED``
|
|
||||||
property is now visible from any directory scope, not only from the scope
|
|
||||||
for which it was set.
|
|
||||||
|
|
||||||
Additionally, the ``GENERATED`` property may now be set only to boolean
|
|
||||||
values, and may not be turned off once turned on.
|
|
||||||
|
|
||||||
The ``OLD`` behavior of this policy is to only allow ``GENERATED`` to be
|
|
||||||
visible from the directory scope for which it was set. The ``NEW``
|
|
||||||
behavior on the other hand allows it to be visible from any scope.
|
|
||||||
|
|
||||||
This policy was introduced in CMake version 3.20. Use the
|
|
||||||
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
|
|
||||||
Unlike many policies, CMake version |release| does *not* warn
|
|
||||||
when this policy is not set and simply uses ``OLD`` behavior with regard
|
|
||||||
to visibility of the ``GENERATED`` property. However, CMake does warn
|
|
||||||
about setting the ``GENERATED`` property to a non-boolean value.
|
|
@ -1,29 +0,0 @@
|
|||||||
CMP0135
|
|
||||||
-------
|
|
||||||
|
|
||||||
.. versionadded:: 3.24
|
|
||||||
|
|
||||||
When using the ``URL`` download method with the :command:`ExternalProject_Add`
|
|
||||||
command, CMake 3.23 and below sets the timestamps of the extracted contents
|
|
||||||
to the same as the timestamps in the archive. When the ``URL`` changes, the
|
|
||||||
new archive is downloaded and extracted, but the timestamps of the extracted
|
|
||||||
contents might not be newer than the previous contents. Anything that depends
|
|
||||||
on the extracted contents might not be rebuilt, even though the contents may
|
|
||||||
change.
|
|
||||||
|
|
||||||
CMake 3.24 and above prefers to set the timestamps of all extracted contents
|
|
||||||
to the time of the extraction. This ensures that anything that depends on the
|
|
||||||
extracted contents will be rebuilt whenever the ``URL`` changes.
|
|
||||||
|
|
||||||
The ``DOWNLOAD_EXTRACT_TIMESTAMP`` option to the
|
|
||||||
:command:`ExternalProject_Add` command can be used to explicitly specify how
|
|
||||||
timestamps should be handled. When ``DOWNLOAD_EXTRACT_TIMESTAMP`` is not
|
|
||||||
given, this policy controls the default behavior. The ``OLD`` behavior for
|
|
||||||
this policy is to restore the timestamps from the archive. The ``NEW``
|
|
||||||
behavior sets the timestamps of extracted contents to the time of extraction.
|
|
||||||
|
|
||||||
This policy was introduced in CMake version 3.24. CMake version |release|
|
|
||||||
warns when the policy is not set and uses ``OLD`` behavior. Use the
|
|
||||||
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
|
|
||||||
|
|
||||||
.. include:: DEPRECATED.txt
|
|
@ -1,9 +0,0 @@
|
|||||||
CMake >= |disallowed_version| prefer that this command never be called.
|
|
||||||
The ``OLD`` behavior for this policy is to allow the command to be called.
|
|
||||||
The ``NEW`` behavior for this policy is to issue a ``FATAL_ERROR`` when the
|
|
||||||
command is called.
|
|
||||||
|
|
||||||
This policy was introduced in CMake version |disallowed_version|.
|
|
||||||
CMake version |release| warns when the policy is not set and uses
|
|
||||||
``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD`` or
|
|
||||||
``NEW`` explicitly.
|
|
@ -1,13 +0,0 @@
|
|||||||
EXCLUDE_FROM_ALL
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Set this directory property to a true value on a subdirectory to exclude
|
|
||||||
its targets from the "all" target of its ancestors. If excluded, running
|
|
||||||
e.g. ``make`` in the parent directory will not build targets the
|
|
||||||
subdirectory by default. This does not affect the "all" target of the
|
|
||||||
subdirectory itself. Running e.g. ``make`` inside the subdirectory will
|
|
||||||
still build its targets.
|
|
||||||
|
|
||||||
If the :prop_tgt:`EXCLUDE_FROM_ALL` target property is set on a target
|
|
||||||
then its value determines whether the target is included in the "all"
|
|
||||||
target of this directory and its ancestors.
|
|
@ -1,19 +0,0 @@
|
|||||||
FAIL_REGULAR_EXPRESSION
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
If the output matches this regular expression the test will fail,
|
|
||||||
regardless of the process exit code.
|
|
||||||
|
|
||||||
If set, if the output matches one of specified regular expressions,
|
|
||||||
the test will fail. Example:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
set_tests_properties(mytest PROPERTIES
|
|
||||||
FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
|
|
||||||
)
|
|
||||||
|
|
||||||
``FAIL_REGULAR_EXPRESSION`` expects a list of regular expressions.
|
|
||||||
|
|
||||||
See also the :prop_test:`PASS_REGULAR_EXPRESSION` and
|
|
||||||
:prop_test:`SKIP_REGULAR_EXPRESSION` test properties.
|
|
@ -1,20 +0,0 @@
|
|||||||
PASS_REGULAR_EXPRESSION
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
The output must match this regular expression for the test to pass.
|
|
||||||
The process exit code is ignored.
|
|
||||||
|
|
||||||
If set, the test output will be checked against the specified regular
|
|
||||||
expressions and at least one of the regular expressions has to match,
|
|
||||||
otherwise the test will fail. Example:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
set_tests_properties(mytest PROPERTIES
|
|
||||||
PASS_REGULAR_EXPRESSION "TestPassed;All ok"
|
|
||||||
)
|
|
||||||
|
|
||||||
``PASS_REGULAR_EXPRESSION`` expects a list of regular expressions.
|
|
||||||
|
|
||||||
See also the :prop_test:`FAIL_REGULAR_EXPRESSION` and
|
|
||||||
:prop_test:`SKIP_REGULAR_EXPRESSION` test properties.
|
|
@ -1,21 +0,0 @@
|
|||||||
SKIP_REGULAR_EXPRESSION
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.16
|
|
||||||
|
|
||||||
If the output matches this regular expression the test will be marked as skipped.
|
|
||||||
|
|
||||||
If set, if the output matches one of specified regular expressions,
|
|
||||||
the test will be marked as skipped. Example:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
set_property(TEST mytest PROPERTY
|
|
||||||
SKIP_REGULAR_EXPRESSION "[^a-z]Skip" "SKIP" "Skipped"
|
|
||||||
)
|
|
||||||
|
|
||||||
``SKIP_REGULAR_EXPRESSION`` expects a list of regular expressions.
|
|
||||||
|
|
||||||
See also the :prop_test:`SKIP_RETURN_CODE`,
|
|
||||||
:prop_test:`PASS_REGULAR_EXPRESSION`, and :prop_test:`FAIL_REGULAR_EXPRESSION`
|
|
||||||
test properties.
|
|
@ -1,12 +0,0 @@
|
|||||||
SKIP_RETURN_CODE
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Return code to mark a test as skipped.
|
|
||||||
|
|
||||||
Sometimes only a test itself can determine if all requirements for the
|
|
||||||
test are met. If such a situation should not be considered a hard failure
|
|
||||||
a return code of the process can be specified that will mark the test as
|
|
||||||
``Not Run`` if it is encountered. Valid values are in the range of
|
|
||||||
0 to 255, inclusive.
|
|
||||||
|
|
||||||
See also the :prop_test:`SKIP_REGULAR_EXPRESSION` property.
|
|
@ -1,8 +0,0 @@
|
|||||||
WILL_FAIL
|
|
||||||
---------
|
|
||||||
|
|
||||||
If set to true, this will invert the pass/fail flag of the test.
|
|
||||||
|
|
||||||
This property can be used for tests that are expected to fail and return a
|
|
||||||
non-zero return code. Note that system-level test failures such as segmentation
|
|
||||||
faults or heap errors will still fail the test even if ``WILL_FALL`` is true.
|
|
@ -1,40 +0,0 @@
|
|||||||
AUTOGEN_ORIGIN_DEPENDS
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.14
|
|
||||||
|
|
||||||
Switch for forwarding origin target dependencies to the corresponding
|
|
||||||
``_autogen`` target.
|
|
||||||
|
|
||||||
Targets which have their :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` property
|
|
||||||
``ON`` have a corresponding ``_autogen`` target which generates
|
|
||||||
``moc`` and ``uic`` files. As this ``_autogen`` target is created at
|
|
||||||
generate-time, it is not possible to define dependencies of it using
|
|
||||||
e.g. :command:`add_dependencies`. Instead the
|
|
||||||
``AUTOGEN_ORIGIN_DEPENDS`` target property decides whether the origin
|
|
||||||
target dependencies should be forwarded to the ``_autogen`` target or not.
|
|
||||||
|
|
||||||
By default ``AUTOGEN_ORIGIN_DEPENDS`` is initialized from
|
|
||||||
:variable:`CMAKE_AUTOGEN_ORIGIN_DEPENDS` which is ``ON`` by default.
|
|
||||||
|
|
||||||
In total the dependencies of the ``_autogen`` target are composed from
|
|
||||||
|
|
||||||
- forwarded origin target dependencies
|
|
||||||
(enabled by default via ``AUTOGEN_ORIGIN_DEPENDS``)
|
|
||||||
- additional user defined dependencies from :prop_tgt:`AUTOGEN_TARGET_DEPENDS`
|
|
||||||
|
|
||||||
See the :manual:`cmake-qt(7)` manual for more information on using CMake
|
|
||||||
with Qt.
|
|
||||||
|
|
||||||
Note
|
|
||||||
^^^^
|
|
||||||
|
|
||||||
Disabling ``AUTOGEN_ORIGIN_DEPENDS`` is useful to avoid building of
|
|
||||||
origin target dependencies when building the ``_autogen`` target only.
|
|
||||||
This is especially interesting when a
|
|
||||||
:variable:`global autogen target <CMAKE_GLOBAL_AUTOGEN_TARGET>` is enabled.
|
|
||||||
|
|
||||||
When the ``_autogen`` target doesn't require all the origin target's
|
|
||||||
dependencies, and ``AUTOGEN_ORIGIN_DEPENDS`` is disabled, it might be
|
|
||||||
necessary to extend :prop_tgt:`AUTOGEN_TARGET_DEPENDS` to add missing
|
|
||||||
dependencies.
|
|
@ -1,36 +0,0 @@
|
|||||||
AUTOGEN_TARGET_DEPENDS
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Additional target dependencies of the corresponding ``_autogen`` target.
|
|
||||||
|
|
||||||
Targets which have their :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` property
|
|
||||||
``ON`` have a corresponding ``_autogen`` target which generates
|
|
||||||
``moc`` and ``uic`` files. As this ``_autogen`` target is created at
|
|
||||||
generate-time, it is not possible to define dependencies of it using
|
|
||||||
e.g. :command:`add_dependencies`. Instead the
|
|
||||||
``AUTOGEN_TARGET_DEPENDS`` target property can be set to a
|
|
||||||
:ref:`;-list <CMake Language Lists>` of additional dependencies for the
|
|
||||||
``_autogen`` target. Dependencies can be target names or file names.
|
|
||||||
|
|
||||||
In total the dependencies of the ``_autogen`` target are composed from
|
|
||||||
|
|
||||||
- forwarded origin target dependencies
|
|
||||||
(enabled by default via :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS`)
|
|
||||||
- additional user defined dependencies from ``AUTOGEN_TARGET_DEPENDS``
|
|
||||||
|
|
||||||
See the :manual:`cmake-qt(7)` manual for more information on using CMake
|
|
||||||
with Qt.
|
|
||||||
|
|
||||||
Use cases
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
If :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` depends on a file that is either
|
|
||||||
|
|
||||||
- a :prop_sf:`GENERATED` non C++ file (e.g. a :prop_sf:`GENERATED` ``.json``
|
|
||||||
or ``.ui`` file) or
|
|
||||||
- a :prop_sf:`GENERATED` C++ file that isn't recognized by :prop_tgt:`AUTOMOC`
|
|
||||||
and :prop_tgt:`AUTOUIC` because it's skipped by :prop_sf:`SKIP_AUTOMOC`,
|
|
||||||
:prop_sf:`SKIP_AUTOUIC`, :prop_sf:`SKIP_AUTOGEN` or :policy:`CMP0071` or
|
|
||||||
- a file that isn't in the origin target's sources
|
|
||||||
|
|
||||||
it must be added to ``AUTOGEN_TARGET_DEPENDS``.
|
|
@ -1,24 +0,0 @@
|
|||||||
IMPORTED_IMPLIB
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Full path to the import library for an ``IMPORTED`` target.
|
|
||||||
|
|
||||||
This property may be set:
|
|
||||||
|
|
||||||
* On DLL platforms, to the location of the ``.lib`` part of the DLL.
|
|
||||||
* On AIX, to an import file (e.g. ``.imp``) created for executables that export
|
|
||||||
symbols (see the :prop_tgt:`ENABLE_EXPORTS` target property).
|
|
||||||
* On macOS, to an import file (e.g. ``.tbd``) created for shared libraries (see
|
|
||||||
the :prop_tgt:`ENABLE_EXPORTS` target property). For frameworks this is the
|
|
||||||
location of the ``.tbd`` file symlink just inside the framework folder.
|
|
||||||
|
|
||||||
The ``IMPORTED_IMPLIB`` target property may be overridden for a
|
|
||||||
given configuration ``<CONFIG>`` by the configuration-specific
|
|
||||||
:prop_tgt:`IMPORTED_IMPLIB_<CONFIG>` target property. Furthermore,
|
|
||||||
the :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property may be
|
|
||||||
used to map between a project's configurations and those of an imported
|
|
||||||
target. If none of these is set then the name of any other configuration
|
|
||||||
listed in the :prop_tgt:`IMPORTED_CONFIGURATIONS` target property may be
|
|
||||||
selected and its :prop_tgt:`IMPORTED_IMPLIB_<CONFIG>` value used.
|
|
||||||
|
|
||||||
This property is ignored for non-imported targets.
|
|
@ -1,19 +0,0 @@
|
|||||||
IOS_INSTALL_COMBINED
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.5
|
|
||||||
|
|
||||||
Build a combined (device and simulator) target when installing.
|
|
||||||
|
|
||||||
When this property is set to set to false (which is the default) then it will
|
|
||||||
either be built with the device SDK or the simulator SDK depending on the SDK
|
|
||||||
set. But if this property is set to true then the target will at install time
|
|
||||||
also be built for the corresponding SDK and combined into one library.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
If a selected architecture is available for both: device SDK and simulator
|
|
||||||
SDK it will be built for the SDK selected by :variable:`CMAKE_OSX_SYSROOT`
|
|
||||||
and removed from the corresponding SDK.
|
|
||||||
|
|
||||||
This feature requires at least Xcode version 6.
|
|
@ -1,8 +0,0 @@
|
|||||||
Swift_LANGUAGE_VERSION
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.16
|
|
||||||
|
|
||||||
This property sets the language version for the Swift sources in the target. If
|
|
||||||
one is not specified, it will default to ``<CMAKE_Swift_LANGUAGE_VERSION>`` if
|
|
||||||
specified, otherwise it is the latest version supported by the compiler.
|
|
@ -1,10 +0,0 @@
|
|||||||
VS_KEYWORD
|
|
||||||
----------
|
|
||||||
|
|
||||||
Visual Studio project keyword for VS 9 (2008) and older.
|
|
||||||
|
|
||||||
Can be set to change the visual studio keyword, for example Qt
|
|
||||||
integration works better if this is set to Qt4VSv1.0.
|
|
||||||
|
|
||||||
Use the :prop_tgt:`VS_GLOBAL_KEYWORD` target property to set the
|
|
||||||
keyword for Visual Studio 11 (2012) and newer.
|
|
@ -1,10 +0,0 @@
|
|||||||
BUILD_SHARED_LIBS
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Global flag to cause :command:`add_library` to create shared libraries if on.
|
|
||||||
|
|
||||||
If present and true, this will cause all libraries to be built shared
|
|
||||||
unless the library was explicitly added as a static library. This
|
|
||||||
variable is often added to projects as an :command:`option` so that each user
|
|
||||||
of a project can decide if they want to build the project using shared or
|
|
||||||
static libraries.
|
|
@ -1,29 +0,0 @@
|
|||||||
CMAKE_CUDA_HOST_COMPILER
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.10
|
|
||||||
|
|
||||||
When :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is
|
|
||||||
``NVIDIA``, ``CMAKE_CUDA_HOST_COMPILER`` selects the compiler executable to use
|
|
||||||
when compiling host code for ``CUDA`` language files.
|
|
||||||
This maps to the ``nvcc -ccbin`` option.
|
|
||||||
|
|
||||||
The ``CMAKE_CUDA_HOST_COMPILER`` variable may be set explicitly before CUDA is
|
|
||||||
first enabled by a :command:`project` or :command:`enable_language` command.
|
|
||||||
This can be done via ``-DCMAKE_CUDA_HOST_COMPILER=...`` on the command line
|
|
||||||
or in a :ref:`toolchain file <Cross Compiling Toolchain>`. Or, one may set
|
|
||||||
the :envvar:`CUDAHOSTCXX` environment variable to provide a default value.
|
|
||||||
|
|
||||||
Once the CUDA language is enabled, the ``CMAKE_CUDA_HOST_COMPILER`` variable
|
|
||||||
is read-only and changes to it are undefined behavior.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Since ``CMAKE_CUDA_HOST_COMPILER`` is meaningful only when the
|
|
||||||
:variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is ``NVIDIA``,
|
|
||||||
it does not make sense to set ``CMAKE_CUDA_HOST_COMPILER`` without also
|
|
||||||
setting ``CMAKE_CUDA_COMPILER`` to NVCC.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Ignored when using :ref:`Visual Studio Generators`.
|
|
@ -1,12 +0,0 @@
|
|||||||
CMAKE_FIND_LIBRARY_SUFFIXES
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
Suffixes to append when looking for libraries.
|
|
||||||
|
|
||||||
This specifies what suffixes to add to library names when the
|
|
||||||
:command:`find_library` command looks for libraries. On Windows systems this
|
|
||||||
is typically ``.lib`` and, depending on the compiler, ``.dll.a``, ``.a``
|
|
||||||
(e.g. GCC and Clang), so when it tries to find the ``foo`` library, it will
|
|
||||||
look for ``[<prefix>]foo.lib`` and/or ``[<prefix>]foo[.dll].a``, depending on
|
|
||||||
the compiler used and the ``<prefix>`` specified in the
|
|
||||||
:variable:`CMAKE_FIND_LIBRARY_PREFIXES`.
|
|
@ -1,12 +0,0 @@
|
|||||||
CMAKE_HIP_ARCHITECTURES
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.21
|
|
||||||
|
|
||||||
Default value for :prop_tgt:`HIP_ARCHITECTURES` property of targets.
|
|
||||||
|
|
||||||
This is initialized to the architectures reported by ``rocm_agent_enumerator``,
|
|
||||||
if available, and otherwise to the default chosen by the compiler.
|
|
||||||
|
|
||||||
This variable is used to initialize the :prop_tgt:`HIP_ARCHITECTURES` property
|
|
||||||
on all targets. See the target property for additional information.
|
|
@ -1,16 +0,0 @@
|
|||||||
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.7.1
|
|
||||||
|
|
||||||
CMake sets this variable to a ``TRUE`` value when the
|
|
||||||
:variable:`CMAKE_INSTALL_PREFIX` has just been initialized to
|
|
||||||
its default value, typically on the first run of CMake within
|
|
||||||
a new build tree. This can be used by project code to change
|
|
||||||
the default without overriding a user-provided value:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
||||||
set(CMAKE_INSTALL_PREFIX "/my/default" CACHE PATH "..." FORCE)
|
|
||||||
endif()
|
|
@ -1,8 +0,0 @@
|
|||||||
CMAKE_MODULE_PATH
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
:ref:`Semicolon-separated list <CMake Language Lists>` of directories,
|
|
||||||
represented using forward slashes, specifying a search path for CMake modules
|
|
||||||
to be loaded by the :command:`include` or :command:`find_package` commands
|
|
||||||
before checking the default modules that come with CMake. By default it is
|
|
||||||
empty. It is intended to be set by the project.
|
|
@ -1,14 +0,0 @@
|
|||||||
CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>
|
|
||||||
----------------------------------------
|
|
||||||
|
|
||||||
.. versionadded:: 3.22
|
|
||||||
|
|
||||||
Variable for making :command:`find_package` call ``REQUIRED``.
|
|
||||||
|
|
||||||
Every non-``REQUIRED`` :command:`find_package` call in a project can be
|
|
||||||
turned into ``REQUIRED`` by setting the variable
|
|
||||||
``CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>`` to ``TRUE``.
|
|
||||||
This can be used to assert assumptions about build environment and to
|
|
||||||
ensure the build will fail early if they do not hold.
|
|
||||||
|
|
||||||
See also the :variable:`CMAKE_DISABLE_FIND_PACKAGE_<PackageName>` variable.
|
|
@ -1,23 +0,0 @@
|
|||||||
CMAKE_SYSTEM_NAME
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
The name of the operating system for which CMake is to build.
|
|
||||||
See the :variable:`CMAKE_SYSTEM_VERSION` variable for the OS version.
|
|
||||||
|
|
||||||
Note that ``CMAKE_SYSTEM_NAME`` is not set to anything by default when running
|
|
||||||
in script mode, since it's not building anything.
|
|
||||||
|
|
||||||
System Name for Host Builds
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
``CMAKE_SYSTEM_NAME`` is by default set to the same value as the
|
|
||||||
:variable:`CMAKE_HOST_SYSTEM_NAME` variable so that the build
|
|
||||||
targets the host system.
|
|
||||||
|
|
||||||
System Name for Cross Compiling
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
``CMAKE_SYSTEM_NAME`` may be set explicitly when first configuring a new build
|
|
||||||
tree in order to enable :ref:`cross compiling <Cross Compiling Toolchain>`.
|
|
||||||
In this case the :variable:`CMAKE_SYSTEM_VERSION` variable must also be
|
|
||||||
set explicitly.
|
|
@ -1,47 +0,0 @@
|
|||||||
#ifndef __CUDACC__
|
|
||||||
# error "A C or C++ compiler has been selected for CUDA"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#include <cuda_runtime.h>
|
|
||||||
|
|
||||||
#include "CMakeCompilerABI.h"
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
int require = 0;
|
|
||||||
require += info_sizeof_dptr[argc];
|
|
||||||
require += info_byte_order_big_endian[argc];
|
|
||||||
require += info_byte_order_little_endian[argc];
|
|
||||||
#if defined(ABI_ID)
|
|
||||||
require += info_abi[argc];
|
|
||||||
#endif
|
|
||||||
static_cast<void>(argv);
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
if (cudaGetDeviceCount(&count) != cudaSuccess || count == 0) {
|
|
||||||
std::fprintf(stderr, "No CUDA devices found.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int found = 0;
|
|
||||||
const char* sep = "";
|
|
||||||
for (int device = 0; device < count; ++device) {
|
|
||||||
cudaDeviceProp prop;
|
|
||||||
if (cudaGetDeviceProperties(&prop, device) == cudaSuccess) {
|
|
||||||
std::printf("%s%d%d", sep, prop.major, prop.minor);
|
|
||||||
sep = ";";
|
|
||||||
found = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
std::fprintf(stderr, "No CUDA architecture detected from any devices.\n");
|
|
||||||
// Convince the compiler that the non-zero return value depends
|
|
||||||
// on the info strings so they are not optimized out.
|
|
||||||
return require ? -1 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
||||||
|
|
||||||
|
|
||||||
# this file has flags that are shared across languages and sets
|
|
||||||
# cache values that can be initialized in the platform-compiler.cmake file
|
|
||||||
# it may be included by more than one language.
|
|
||||||
|
|
||||||
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
|
|
||||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
|
|
||||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
|
|
||||||
|
|
||||||
cmake_initialize_per_config_variable(CMAKE_EXE_LINKER_FLAGS "Flags used by the linker")
|
|
||||||
cmake_initialize_per_config_variable(CMAKE_SHARED_LINKER_FLAGS "Flags used by the linker during the creation of shared libraries")
|
|
||||||
cmake_initialize_per_config_variable(CMAKE_MODULE_LINKER_FLAGS "Flags used by the linker during the creation of modules")
|
|
||||||
cmake_initialize_per_config_variable(CMAKE_STATIC_LINKER_FLAGS "Flags used by the linker during the creation of static libraries")
|
|
||||||
|
|
||||||
# Alias the build tool variable for backward compatibility.
|
|
||||||
set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM})
|
|
||||||
|
|
||||||
mark_as_advanced(
|
|
||||||
CMAKE_VERBOSE_MAKEFILE
|
|
||||||
)
|
|
@ -1,624 +0,0 @@
|
|||||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
||||||
|
|
||||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
|
||||||
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
|
|
||||||
|
|
||||||
if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
|
|
||||||
("${CMAKE_GENERATOR}" MATCHES "Ninja") OR
|
|
||||||
("${CMAKE_GENERATOR}" MATCHES "Visual Studio (1|[9][0-9])") ) )
|
|
||||||
message(FATAL_ERROR "CUDA language not currently supported by \"${CMAKE_GENERATOR}\" generator")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
|
||||||
if(DEFINED ENV{CUDAHOSTCXX} OR DEFINED CMAKE_CUDA_HOST_COMPILER)
|
|
||||||
message(WARNING "Visual Studio does not support specifying CUDAHOSTCXX or CMAKE_CUDA_HOST_COMPILER. Using the C++ compiler provided by Visual Studio.")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(NOT CMAKE_CUDA_COMPILER)
|
|
||||||
set(CMAKE_CUDA_COMPILER_INIT NOTFOUND)
|
|
||||||
|
|
||||||
# prefer the environment variable CUDACXX
|
|
||||||
if(NOT $ENV{CUDACXX} STREQUAL "")
|
|
||||||
get_filename_component(CMAKE_CUDA_COMPILER_INIT $ENV{CUDACXX} PROGRAM PROGRAM_ARGS CMAKE_CUDA_FLAGS_ENV_INIT)
|
|
||||||
if(CMAKE_CUDA_FLAGS_ENV_INIT)
|
|
||||||
set(CMAKE_CUDA_COMPILER_ARG1 "${CMAKE_CUDA_FLAGS_ENV_INIT}" CACHE STRING "Arguments to CUDA compiler")
|
|
||||||
endif()
|
|
||||||
if(NOT EXISTS ${CMAKE_CUDA_COMPILER_INIT})
|
|
||||||
message(FATAL_ERROR "Could not find compiler set in environment variable CUDACXX:\n$ENV{CUDACXX}.\n${CMAKE_CUDA_COMPILER_INIT}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# finally list compilers to try
|
|
||||||
if(NOT CMAKE_CUDA_COMPILER_INIT)
|
|
||||||
set(CMAKE_CUDA_COMPILER_LIST nvcc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(_CMAKE_CUDA_COMPILER_PATHS "$ENV{CUDA_PATH}/bin")
|
|
||||||
_cmake_find_compiler(CUDA)
|
|
||||||
unset(_CMAKE_CUDA_COMPILER_PATHS)
|
|
||||||
else()
|
|
||||||
_cmake_find_compiler_path(CUDA)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(CMAKE_CUDA_COMPILER)
|
|
||||||
|
|
||||||
#Allow the user to specify a host compiler except for Visual Studio
|
|
||||||
if(NOT $ENV{CUDAHOSTCXX} STREQUAL "")
|
|
||||||
get_filename_component(CMAKE_CUDA_HOST_COMPILER $ENV{CUDAHOSTCXX} PROGRAM)
|
|
||||||
if(NOT EXISTS ${CMAKE_CUDA_HOST_COMPILER})
|
|
||||||
message(FATAL_ERROR "Could not find compiler set in environment variable CUDAHOSTCXX:\n$ENV{CUDAHOSTCXX}.\n${CMAKE_CUDA_HOST_COMPILER}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "$ENV{CUDAARCHS}" STREQUAL "")
|
|
||||||
set(CMAKE_CUDA_ARCHITECTURES "$ENV{CUDAARCHS}" CACHE STRING "CUDA architectures")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Build a small source file to identify the compiler.
|
|
||||||
if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
|
|
||||||
set(CMAKE_CUDA_COMPILER_ID_RUN 1)
|
|
||||||
|
|
||||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
|
||||||
|
|
||||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
|
||||||
# We will not know CMAKE_CUDA_COMPILER until the main compiler id step
|
|
||||||
# below extracts it, but we do know that the compiler id will be NVIDIA.
|
|
||||||
set(CMAKE_CUDA_COMPILER_ID "NVIDIA")
|
|
||||||
else()
|
|
||||||
# We determine the vendor to help with find the toolkit and use the right flags for detection right away.
|
|
||||||
# The main compiler identification is still needed below to extract other information.
|
|
||||||
list(APPEND CMAKE_CUDA_COMPILER_ID_VENDORS NVIDIA Clang)
|
|
||||||
set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_NVIDIA "nvcc: NVIDIA \\(R\\) Cuda compiler driver")
|
|
||||||
set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)")
|
|
||||||
CMAKE_DETERMINE_COMPILER_ID_VENDOR(CUDA "--version")
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" AND WIN32)
|
|
||||||
message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Find the CUDA toolkit. We store the CMAKE_CUDA_COMPILER_TOOLKIT_ROOT, CMAKE_CUDA_COMPILER_TOOLKIT_VERSION and
|
|
||||||
# CMAKE_CUDA_COMPILER_LIBRARY_ROOT in CMakeCUDACompiler.cmake so FindCUDAToolkit can avoid searching on future
|
|
||||||
# runs and the toolkit is the same.
|
|
||||||
# This is very similar to FindCUDAToolkit, but somewhat simplified since we can issue fatal errors
|
|
||||||
# if we fail and we don't need to account for searching the libraries.
|
|
||||||
|
|
||||||
# For NVCC we can easily deduce the SDK binary directory from the compiler path.
|
|
||||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
|
||||||
set(_CUDA_NVCC_EXECUTABLE "${CMAKE_CUDA_COMPILER}")
|
|
||||||
else()
|
|
||||||
# Search using CUDAToolkit_ROOT and then CUDA_PATH for equivalence with FindCUDAToolkit.
|
|
||||||
# In FindCUDAToolkit CUDAToolkit_ROOT is searched automatically due to being in a find_package().
|
|
||||||
# First we search candidate non-default paths to give them priority.
|
|
||||||
find_program(_CUDA_NVCC_EXECUTABLE
|
|
||||||
NAMES nvcc nvcc.exe
|
|
||||||
PATHS ${CUDAToolkit_ROOT}
|
|
||||||
ENV CUDAToolkit_ROOT
|
|
||||||
ENV CUDA_PATH
|
|
||||||
PATH_SUFFIXES bin
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
|
||||||
|
|
||||||
# If we didn't find NVCC, then try the default paths.
|
|
||||||
find_program(_CUDA_NVCC_EXECUTABLE
|
|
||||||
NAMES nvcc nvcc.exe
|
|
||||||
PATH_SUFFIXES bin
|
|
||||||
)
|
|
||||||
|
|
||||||
# If the user specified CUDAToolkit_ROOT but nvcc could not be found, this is an error.
|
|
||||||
if(NOT _CUDA_NVCC_EXECUTABLE AND (DEFINED CUDAToolkit_ROOT OR DEFINED ENV{CUDAToolkit_ROOT}))
|
|
||||||
set(fail_base "Could not find nvcc executable in path specified by")
|
|
||||||
|
|
||||||
if(DEFINED CUDAToolkit_ROOT)
|
|
||||||
message(FATAL_ERROR "${fail_base} CUDAToolkit_ROOT=${CUDAToolkit_ROOT}")
|
|
||||||
elseif(DEFINED ENV{CUDAToolkit_ROOT})
|
|
||||||
message(FATAL_ERROR "${fail_base} environment variable CUDAToolkit_ROOT=$ENV{CUDAToolkit_ROOT}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# CUDAToolkit_ROOT cmake/env variable not specified, try platform defaults.
|
|
||||||
#
|
|
||||||
# - Linux: /usr/local/cuda-X.Y
|
|
||||||
# - macOS: /Developer/NVIDIA/CUDA-X.Y
|
|
||||||
# - Windows: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y
|
|
||||||
#
|
|
||||||
# We will also search the default symlink location /usr/local/cuda first since
|
|
||||||
# if CUDAToolkit_ROOT is not specified, it is assumed that the symlinked
|
|
||||||
# directory is the desired location.
|
|
||||||
if(NOT _CUDA_NVCC_EXECUTABLE)
|
|
||||||
if(UNIX)
|
|
||||||
if(NOT APPLE)
|
|
||||||
set(platform_base "/usr/local/cuda-")
|
|
||||||
else()
|
|
||||||
set(platform_base "/Developer/NVIDIA/CUDA-")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(platform_base "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Build out a descending list of possible cuda installations, e.g.
|
|
||||||
file(GLOB possible_paths "${platform_base}*")
|
|
||||||
# Iterate the glob results and create a descending list.
|
|
||||||
set(versions)
|
|
||||||
foreach(p ${possible_paths})
|
|
||||||
# Extract version number from end of string
|
|
||||||
string(REGEX MATCH "[0-9][0-9]?\\.[0-9]$" p_version ${p})
|
|
||||||
if(IS_DIRECTORY ${p} AND p_version)
|
|
||||||
list(APPEND versions ${p_version})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Sort numerically in descending order, so we try the newest versions first.
|
|
||||||
list(SORT versions COMPARE NATURAL ORDER DESCENDING)
|
|
||||||
|
|
||||||
# With a descending list of versions, populate possible paths to search.
|
|
||||||
set(search_paths)
|
|
||||||
foreach(v ${versions})
|
|
||||||
list(APPEND search_paths "${platform_base}${v}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Force the global default /usr/local/cuda to the front on Unix.
|
|
||||||
if(UNIX)
|
|
||||||
list(INSERT search_paths 0 "/usr/local/cuda")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Now search for nvcc again using the platform default search paths.
|
|
||||||
find_program(_CUDA_NVCC_EXECUTABLE
|
|
||||||
NAMES nvcc nvcc.exe
|
|
||||||
PATHS ${search_paths}
|
|
||||||
PATH_SUFFIXES bin
|
|
||||||
)
|
|
||||||
|
|
||||||
# We are done with these variables now, cleanup.
|
|
||||||
unset(platform_base)
|
|
||||||
unset(possible_paths)
|
|
||||||
unset(versions)
|
|
||||||
unset(search_paths)
|
|
||||||
|
|
||||||
if(NOT _CUDA_NVCC_EXECUTABLE)
|
|
||||||
message(FATAL_ERROR "Failed to find nvcc.\nCompiler ${CMAKE_CUDA_COMPILER_ID} requires the CUDA toolkit. Please set the CUDAToolkit_ROOT variable.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Given that NVCC can be provided by multiple different sources (NVIDIA HPC SDK, CUDA Toolkit, distro)
|
|
||||||
# each of which has a different layout, we need to extract the CUDA toolkit root from the compiler
|
|
||||||
# itself, allowing us to support numerous different scattered toolkit layouts
|
|
||||||
execute_process(COMMAND ${_CUDA_NVCC_EXECUTABLE} "-v" "__cmake_determine_cuda"
|
|
||||||
OUTPUT_VARIABLE _CUDA_NVCC_OUT ERROR_VARIABLE _CUDA_NVCC_OUT)
|
|
||||||
if(_CUDA_NVCC_OUT MATCHES "\\#\\$ TOP=([^\r\n]*)")
|
|
||||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_MATCH_1}" ABSOLUTE)
|
|
||||||
else()
|
|
||||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY)
|
|
||||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(_CUDA_NVCC_OUT MATCHES "\\#\\$ NVVMIR_LIBRARY_DIR=([^\r\n]*)")
|
|
||||||
get_filename_component(_CUDA_NVVMIR_LIBRARY_DIR "${CMAKE_MATCH_1}" ABSOLUTE)
|
|
||||||
|
|
||||||
#We require the path to end in `/nvvm/libdevice'
|
|
||||||
if(_CUDA_NVVMIR_LIBRARY_DIR MATCHES "nvvm/libdevice$")
|
|
||||||
get_filename_component(_CUDA_NVVMIR_LIBRARY_DIR "${_CUDA_NVVMIR_LIBRARY_DIR}/../.." ABSOLUTE)
|
|
||||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR "${_CUDA_NVVMIR_LIBRARY_DIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
unset(_CUDA_NVVMIR_LIBRARY_DIR)
|
|
||||||
unset(_cuda_nvvmir_dir_name)
|
|
||||||
endif()
|
|
||||||
unset(_CUDA_NVCC_OUT)
|
|
||||||
|
|
||||||
set(CMAKE_CUDA_DEVICE_LINKER "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/nvlink${CMAKE_EXECUTABLE_SUFFIX}")
|
|
||||||
set(CMAKE_CUDA_FATBINARY "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/bin/fatbinary${CMAKE_EXECUTABLE_SUFFIX}")
|
|
||||||
|
|
||||||
# In a non-scattered installation the following are equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT.
|
|
||||||
# We first check for a non-scattered installation to prefer it over a scattered installation.
|
|
||||||
|
|
||||||
# CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library.
|
|
||||||
if(DEFINED CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR)
|
|
||||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR}")
|
|
||||||
elseif(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/nvvm/libdevice")
|
|
||||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
|
|
||||||
elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/nvvm/libdevice")
|
|
||||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda")
|
|
||||||
elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/nvvm/libdevice")
|
|
||||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Couldn't find CUDA library root.")
|
|
||||||
endif()
|
|
||||||
unset(CMAKE_CUDA_COMPILER_LIBRARY_ROOT_FROM_NVVMIR_LIBRARY_DIR)
|
|
||||||
|
|
||||||
# CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT contains the linking stubs necessary for device linking and other low-level library files.
|
|
||||||
if(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/nvidia-cuda-toolkit/bin/crt/link.stub")
|
|
||||||
set(CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/nvidia-cuda-toolkit")
|
|
||||||
elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/nvidia-cuda-toolkit/bin/crt/link.stub")
|
|
||||||
set(CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/nvidia-cuda-toolkit")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# For regular nvcc we the toolkit version is the same as the compiler version and we can parse it from the vendor test output.
|
|
||||||
# For Clang we need to invoke nvcc to get version output.
|
|
||||||
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
||||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
|
||||||
execute_process(COMMAND ${_CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE CMAKE_CUDA_COMPILER_ID_OUTPUT)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_ID_OUTPUT MATCHES [=[V([0-9]+\.[0-9]+\.[0-9]+)]=])
|
|
||||||
set(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION "${CMAKE_MATCH_1}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-v")
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
|
||||||
set(nvcc_test_flags "--keep --keep-dir tmp")
|
|
||||||
if(CMAKE_CUDA_HOST_COMPILER)
|
|
||||||
string(APPEND nvcc_test_flags " -ccbin=\"${CMAKE_CUDA_HOST_COMPILER}\"")
|
|
||||||
endif()
|
|
||||||
# If we have extracted the vendor as NVIDIA we should require detection to
|
|
||||||
# work. If we don't, users will get confusing errors later about failure
|
|
||||||
# to detect a default value for CMAKE_CUDA_ARCHITECTURES
|
|
||||||
set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
|
|
||||||
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
|
||||||
set(clang_test_flags "--cuda-path=\"${CMAKE_CUDA_COMPILER_LIBRARY_ROOT}\"")
|
|
||||||
if(CMAKE_CROSSCOMPILING)
|
|
||||||
# Need to pass the host target and include directories if we're crosscompiling.
|
|
||||||
string(APPEND clang_test_flags " --sysroot=\"${CMAKE_SYSROOT}\" --target=${CMAKE_CUDA_COMPILER_TARGET}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Rest of the code treats an empty value as equivalent to "use the defaults".
|
|
||||||
# Error out early to prevent confusing errors as a result of this.
|
|
||||||
# Note that this also catches invalid non-numerical values such as "a".
|
|
||||||
if(DEFINED CMAKE_CUDA_ARCHITECTURES)
|
|
||||||
if(CMAKE_CUDA_ARCHITECTURES STREQUAL "")
|
|
||||||
message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES must be non-empty if set.")
|
|
||||||
elseif(CMAKE_CUDA_ARCHITECTURES AND NOT CMAKE_CUDA_ARCHITECTURES MATCHES "^([0-9]+a?(-real|-virtual)?(;[0-9]+a?(-real|-virtual)?|;)*|all|all-major|native)$")
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"CMAKE_CUDA_ARCHITECTURES:\n"
|
|
||||||
" ${CMAKE_CUDA_ARCHITECTURES}\n"
|
|
||||||
"is not one of the following:\n"
|
|
||||||
" * a semicolon-separated list of integers, each optionally\n"
|
|
||||||
" followed by '-real' or '-virtual'\n"
|
|
||||||
" * a special value: all, all-major, native\n"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
|
||||||
# Clang doesn't automatically select an architecture supported by the SDK.
|
|
||||||
# Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups).
|
|
||||||
foreach(arch "52" "30" "20")
|
|
||||||
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}")
|
|
||||||
endforeach()
|
|
||||||
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
|
||||||
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${nvcc_test_flags}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# We perform compiler identification for a second time to extract implicit linking info and host compiler for NVCC.
|
|
||||||
# We need to unset the compiler ID otherwise CMAKE_DETERMINE_COMPILER_ID() doesn't work.
|
|
||||||
set(CMAKE_CUDA_COMPILER_ID)
|
|
||||||
set(CMAKE_CUDA_PLATFORM_ID)
|
|
||||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
|
||||||
CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT)
|
|
||||||
|
|
||||||
CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
|
|
||||||
|
|
||||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
|
||||||
# Now that we have the path to nvcc, we can compute the toolkit root.
|
|
||||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER}" DIRECTORY)
|
|
||||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
|
|
||||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
|
|
||||||
|
|
||||||
# The compiler comes with the toolkit, so the versions are the same.
|
|
||||||
set(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION ${CMAKE_CUDA_COMPILER_VERSION})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(${CMAKE_ROOT}/Modules/CUDA/architectures.cmake)
|
|
||||||
|
|
||||||
_cmake_find_compiler_sysroot(CUDA)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(_CMAKE_PROCESSING_LANGUAGE "CUDA")
|
|
||||||
include(CMakeFindBinUtils)
|
|
||||||
include(Compiler/${CMAKE_CUDA_COMPILER_ID}-FindBinUtils OPTIONAL)
|
|
||||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
|
||||||
|
|
||||||
if(MSVC_CUDA_ARCHITECTURE_ID)
|
|
||||||
set(SET_MSVC_CUDA_ARCHITECTURE_ID
|
|
||||||
"set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
|
||||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_LINKER}")
|
|
||||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
|
|
||||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "")
|
|
||||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
|
||||||
|
|
||||||
# We do not currently detect CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES but we
|
|
||||||
# do need to detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by
|
|
||||||
# looking at which cudart library exists in the implicit link libraries passed
|
|
||||||
# to the host linker.
|
|
||||||
if(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart_static\\.lib")
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
|
|
||||||
elseif(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart\\.lib")
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE")
|
|
||||||
endif()
|
|
||||||
set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
|
|
||||||
"set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
|
|
||||||
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
|
||||||
string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
|
||||||
|
|
||||||
foreach(cpu ${target_cpus})
|
|
||||||
string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${cpu}")
|
|
||||||
list(APPEND architectures_detected "${CMAKE_MATCH_1}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Find target directory when crosscompiling.
|
|
||||||
if(CMAKE_CROSSCOMPILING)
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
|
|
||||||
# Support for NVPACK
|
|
||||||
set(_CUDA_TARGET_NAME "armv7-linux-androideabi")
|
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
|
|
||||||
set(_CUDA_TARGET_NAME "armv7-linux-gnueabihf")
|
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
|
|
||||||
if(ANDROID_ARCH_NAME STREQUAL "arm64")
|
|
||||||
set(_CUDA_TARGET_NAME "aarch64-linux-androideabi")
|
|
||||||
else()
|
|
||||||
set(_CUDA_TARGET_NAME "aarch64-linux")
|
|
||||||
endif()
|
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
|
||||||
set(_CUDA_TARGET_NAME "x86_64-linux")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/targets/${_CUDA_TARGET_NAME}")
|
|
||||||
set(_CUDA_TARGET_DIR "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/targets/${_CUDA_TARGET_NAME}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If not already set we can simply use the toolkit root or it's a scattered installation.
|
|
||||||
if(NOT _CUDA_TARGET_DIR)
|
|
||||||
set(_CUDA_TARGET_DIR "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# We can't use find_library() yet at this point, so try a few guesses.
|
|
||||||
if(EXISTS "${_CUDA_TARGET_DIR}/lib64")
|
|
||||||
set(_CUDA_LIBRARY_DIR "${_CUDA_TARGET_DIR}/lib64")
|
|
||||||
elseif(EXISTS "${_CUDA_TARGET_DIR}/lib/x64")
|
|
||||||
set(_CUDA_LIBRARY_DIR "${_CUDA_TARGET_DIR}/lib/x64")
|
|
||||||
elseif(EXISTS "${_CUDA_TARGET_DIR}/lib")
|
|
||||||
set(_CUDA_LIBRARY_DIR "${_CUDA_TARGET_DIR}/lib")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unable to find _CUDA_LIBRARY_DIR based on _CUDA_TARGET_DIR=${_CUDA_TARGET_DIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# _CUDA_TARGET_DIR always points to the directory containing the include directory.
|
|
||||||
# On a scattered installation /usr, on a non-scattered something like /usr/local/cuda or /usr/local/cuda-10.2/targets/aarch64-linux.
|
|
||||||
if(EXISTS "${_CUDA_TARGET_DIR}/include/cuda_runtime.h")
|
|
||||||
set(_CUDA_INCLUDE_DIR "${_CUDA_TARGET_DIR}/include")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unable to find cuda_runtime.h in \"${_CUDA_TARGET_DIR}/include\" for _CUDA_INCLUDE_DIR.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Clang does not add any CUDA SDK libraries or directories when invoking the host linker.
|
|
||||||
# Add the CUDA toolkit library directory ourselves so that linking works.
|
|
||||||
# The CUDA runtime libraries are handled elsewhere by CMAKE_CUDA_RUNTIME_LIBRARY.
|
|
||||||
set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${_CUDA_INCLUDE_DIR}")
|
|
||||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "${_CUDA_LIBRARY_DIR}")
|
|
||||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
|
|
||||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
|
||||||
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
|
||||||
set(_nvcc_log "")
|
|
||||||
string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
|
||||||
if(_nvcc_output_orig MATCHES "#\\\$ +PATH= *([^\n]*)\n")
|
|
||||||
set(_nvcc_path "${CMAKE_MATCH_1}")
|
|
||||||
string(APPEND _nvcc_log " found 'PATH=' string: [${_nvcc_path}]\n")
|
|
||||||
string(REPLACE ":" ";" _nvcc_path "${_nvcc_path}")
|
|
||||||
else()
|
|
||||||
set(_nvcc_path "")
|
|
||||||
string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
|
|
||||||
string(APPEND _nvcc_log " no 'PATH=' string found in nvcc output:${_nvcc_output_log}\n")
|
|
||||||
endif()
|
|
||||||
if(_nvcc_output_orig MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
|
|
||||||
set(_nvcc_libraries "${CMAKE_MATCH_1}")
|
|
||||||
string(APPEND _nvcc_log " found 'LIBRARIES=' string: [${_nvcc_libraries}]\n")
|
|
||||||
else()
|
|
||||||
set(_nvcc_libraries "")
|
|
||||||
string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
|
|
||||||
string(APPEND _nvcc_log " no 'LIBRARIES=' string found in nvcc output:${_nvcc_output_log}\n")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(_nvcc_link_line "")
|
|
||||||
if(_nvcc_libraries)
|
|
||||||
# Remove variable assignments.
|
|
||||||
string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output_orig}")
|
|
||||||
# Encode [] characters that break list expansion.
|
|
||||||
string(REPLACE "[" "{==={" _nvcc_output "${_nvcc_output}")
|
|
||||||
string(REPLACE "]" "}===}" _nvcc_output "${_nvcc_output}")
|
|
||||||
# Split lines.
|
|
||||||
string(REGEX REPLACE "\n+(#\\\$ )?" ";" _nvcc_output "${_nvcc_output}")
|
|
||||||
foreach(line IN LISTS _nvcc_output)
|
|
||||||
set(_nvcc_output_line "${line}")
|
|
||||||
string(REPLACE "{==={" "[" _nvcc_output_line "${_nvcc_output_line}")
|
|
||||||
string(REPLACE "}===}" "]" _nvcc_output_line "${_nvcc_output_line}")
|
|
||||||
string(APPEND _nvcc_log " considering line: [${_nvcc_output_line}]\n")
|
|
||||||
if("${_nvcc_output_line}" MATCHES "^ *nvlink")
|
|
||||||
string(APPEND _nvcc_log " ignoring nvlink line\n")
|
|
||||||
elseif(_nvcc_libraries)
|
|
||||||
if("${_nvcc_output_line}" MATCHES "(@\"?((tmp/)?a\\.exe\\.res)\"?)")
|
|
||||||
set(_nvcc_link_res_arg "${CMAKE_MATCH_1}")
|
|
||||||
set(_nvcc_link_res_file "${CMAKE_MATCH_2}")
|
|
||||||
set(_nvcc_link_res "${CMAKE_PLATFORM_INFO_DIR}/CompilerIdCUDA/${_nvcc_link_res_file}")
|
|
||||||
if(EXISTS "${_nvcc_link_res}")
|
|
||||||
file(READ "${_nvcc_link_res}" _nvcc_link_res_content)
|
|
||||||
string(REPLACE "${_nvcc_link_res_arg}" "${_nvcc_link_res_content}" _nvcc_output_line "${_nvcc_output_line}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
string(FIND "${_nvcc_output_line}" "${_nvcc_libraries}" _nvcc_libraries_pos)
|
|
||||||
if(NOT _nvcc_libraries_pos EQUAL -1)
|
|
||||||
set(_nvcc_link_line "${_nvcc_output_line}")
|
|
||||||
string(APPEND _nvcc_log " extracted link line: [${_nvcc_link_line}]\n")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(_nvcc_link_line)
|
|
||||||
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
|
|
||||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_LINKER}")
|
|
||||||
else()
|
|
||||||
#extract the compiler that is being used for linking
|
|
||||||
separate_arguments(_nvcc_link_line_args UNIX_COMMAND "${_nvcc_link_line}")
|
|
||||||
list(GET _nvcc_link_line_args 0 _nvcc_host_link_launcher)
|
|
||||||
if(IS_ABSOLUTE "${_nvcc_host_link_launcher}")
|
|
||||||
string(APPEND _nvcc_log " extracted link launcher absolute path: [${_nvcc_host_link_launcher}]\n")
|
|
||||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}")
|
|
||||||
else()
|
|
||||||
string(APPEND _nvcc_log " extracted link launcher name: [${_nvcc_host_link_launcher}]\n")
|
|
||||||
find_program(_nvcc_find_host_link_launcher
|
|
||||||
NAMES ${_nvcc_host_link_launcher}
|
|
||||||
PATHS ${_nvcc_path} NO_DEFAULT_PATH)
|
|
||||||
find_program(_nvcc_find_host_link_launcher
|
|
||||||
NAMES ${_nvcc_host_link_launcher})
|
|
||||||
if(_nvcc_find_host_link_launcher)
|
|
||||||
string(APPEND _nvcc_log " found link launcher absolute path: [${_nvcc_find_host_link_launcher}]\n")
|
|
||||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_find_host_link_launcher}")
|
|
||||||
else()
|
|
||||||
string(APPEND _nvcc_log " could not find link launcher absolute path\n")
|
|
||||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}")
|
|
||||||
endif()
|
|
||||||
unset(_nvcc_find_host_link_launcher CACHE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#prefix the line with cuda-fake-ld so that implicit link info believes it is
|
|
||||||
#a link line
|
|
||||||
set(_nvcc_link_line "cuda-fake-ld ${_nvcc_link_line}")
|
|
||||||
CMAKE_PARSE_IMPLICIT_LINK_INFO("${_nvcc_link_line}"
|
|
||||||
CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES
|
|
||||||
CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES
|
|
||||||
CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
|
|
||||||
log
|
|
||||||
"${CMAKE_CUDA_IMPLICIT_OBJECT_REGEX}"
|
|
||||||
LANGUAGE CUDA)
|
|
||||||
|
|
||||||
# Detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by looking at which
|
|
||||||
# cudart library exists in the implicit link libraries passed to the host linker.
|
|
||||||
# This is required when a project sets the cuda runtime library as part of the
|
|
||||||
# initial flags.
|
|
||||||
if(";${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES};" MATCHES [[;cudart_static(\.lib)?;]])
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
|
|
||||||
elseif(";${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES};" MATCHES [[;cudart(\.lib)?;]])
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE")
|
|
||||||
endif()
|
|
||||||
set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
|
|
||||||
"set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
|
|
||||||
|
|
||||||
message(CONFIGURE_LOG
|
|
||||||
"Parsed CUDA nvcc implicit link information:\n${_nvcc_log}\n${log}\n\n")
|
|
||||||
else()
|
|
||||||
message(CONFIGURE_LOG
|
|
||||||
"Failed to parse CUDA nvcc implicit link information:\n${_nvcc_log}\n\n")
|
|
||||||
message(FATAL_ERROR "Failed to extract nvcc implicit link line.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES is detected above as the list of
|
|
||||||
# libraries that the CUDA compiler implicitly passes to the host linker.
|
|
||||||
# CMake invokes the host linker directly and so needs to pass these libraries.
|
|
||||||
# We filter out those that should not be passed unconditionally both here
|
|
||||||
# and from CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES in CMakeTestCUDACompiler.
|
|
||||||
set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE
|
|
||||||
# The CUDA runtime libraries are controlled by CMAKE_CUDA_RUNTIME_LIBRARY.
|
|
||||||
cudart cudart.lib
|
|
||||||
cudart_static cudart_static.lib
|
|
||||||
cudadevrt cudadevrt.lib
|
|
||||||
|
|
||||||
# Dependencies of the CUDA static runtime library on Linux hosts.
|
|
||||||
rt
|
|
||||||
pthread
|
|
||||||
dl
|
|
||||||
)
|
|
||||||
list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE})
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_SYSROOT)
|
|
||||||
string(CONCAT _SET_CMAKE_CUDA_COMPILER_SYSROOT
|
|
||||||
"set(CMAKE_CUDA_COMPILER_SYSROOT \"${CMAKE_CUDA_COMPILER_SYSROOT}\")\n"
|
|
||||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_CUDA_COMPILER_SYSROOT}\")")
|
|
||||||
else()
|
|
||||||
set(_SET_CMAKE_CUDA_COMPILER_SYSROOT "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Determine CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
|
|
||||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
|
||||||
set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
|
|
||||||
string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
|
||||||
if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
|
|
||||||
set(_nvcc_includes "${CMAKE_MATCH_1}")
|
|
||||||
string(APPEND _nvcc_log " found 'INCLUDES=' string: [${_nvcc_includes}]\n")
|
|
||||||
else()
|
|
||||||
set(_nvcc_includes "")
|
|
||||||
string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
|
|
||||||
string(APPEND _nvcc_log " no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
|
|
||||||
endif()
|
|
||||||
if(_nvcc_includes)
|
|
||||||
# across all operating system each include directory is prefixed with -I
|
|
||||||
separate_arguments(_nvcc_output NATIVE_COMMAND "${_nvcc_includes}")
|
|
||||||
foreach(line IN LISTS _nvcc_output)
|
|
||||||
string(REGEX REPLACE "^-I" "" line "${line}")
|
|
||||||
get_filename_component(line "${line}" ABSOLUTE)
|
|
||||||
list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
message(CONFIGURE_LOG
|
|
||||||
"Parsed CUDA nvcc include information:\n${_nvcc_log}\n${log}\n\n")
|
|
||||||
else()
|
|
||||||
message(CONFIGURE_LOG
|
|
||||||
"Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(REGEX MATCHALL "-arch compute_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
|
||||||
|
|
||||||
foreach(cpu ${target_cpus})
|
|
||||||
string(REGEX MATCH "-arch compute_([0-9]+)" dont_care "${cpu}")
|
|
||||||
list(APPEND architectures_detected "${CMAKE_MATCH_1}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If the user didn't set the architectures, then set them to a default.
|
|
||||||
# If the user did, then make sure those architectures worked.
|
|
||||||
if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
|
|
||||||
cmake_policy(GET CMP0104 _CUDA_CMP0104)
|
|
||||||
|
|
||||||
if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" OR _CUDA_CMP0104 STREQUAL "NEW")
|
|
||||||
set(CMAKE_CUDA_ARCHITECTURES "${architectures_detected}" CACHE STRING "CUDA architectures")
|
|
||||||
|
|
||||||
if(NOT CMAKE_CUDA_ARCHITECTURES)
|
|
||||||
message(FATAL_ERROR "Failed to detect a default CUDA architecture.\n\nCompiler output:\n${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# configure all variables set in this file
|
|
||||||
configure_file(${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in
|
|
||||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake
|
|
||||||
@ONLY
|
|
||||||
)
|
|
||||||
|
|
||||||
# Don't leak variables unnecessarily to user code.
|
|
||||||
unset(_CUDA_INCLUDE_DIR CACHE)
|
|
||||||
unset(_CUDA_NVCC_EXECUTABLE CACHE)
|
|
||||||
unset(_CUDA_LIBRARY_DIR)
|
|
||||||
unset(_CUDA_TARGET_DIR)
|
|
||||||
unset(_CUDA_TARGET_NAME)
|
|
||||||
|
|
||||||
unset(architectures_detected)
|
|
||||||
|
|
||||||
set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
|
|
||||||
set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
|
|
@ -1,234 +0,0 @@
|
|||||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
||||||
|
|
||||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
|
||||||
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
|
|
||||||
include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake)
|
|
||||||
|
|
||||||
if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
|
|
||||||
("${CMAKE_GENERATOR}" MATCHES "Ninja") ) )
|
|
||||||
message(FATAL_ERROR "HIP language not currently supported by \"${CMAKE_GENERATOR}\" generator")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(NOT CMAKE_HIP_COMPILER)
|
|
||||||
set(CMAKE_HIP_COMPILER_INIT NOTFOUND)
|
|
||||||
|
|
||||||
# prefer the environment variable HIPCXX
|
|
||||||
if(NOT $ENV{HIPCXX} STREQUAL "")
|
|
||||||
if("$ENV{HIPCXX}" MATCHES "hipcc")
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"The HIPCXX environment variable is set to the hipcc wrapper:\n"
|
|
||||||
" $ENV{HIPCXX}\n"
|
|
||||||
"This is not supported. Use Clang directly, or let CMake pick a default."
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
get_filename_component(CMAKE_HIP_COMPILER_INIT $ENV{HIPCXX} PROGRAM PROGRAM_ARGS CMAKE_HIP_FLAGS_ENV_INIT)
|
|
||||||
if(CMAKE_HIP_FLAGS_ENV_INIT)
|
|
||||||
set(CMAKE_HIP_COMPILER_ARG1 "${CMAKE_HIP_FLAGS_ENV_INIT}" CACHE STRING "Arguments to CXX compiler")
|
|
||||||
endif()
|
|
||||||
if(NOT EXISTS ${CMAKE_HIP_COMPILER_INIT})
|
|
||||||
message(FATAL_ERROR "Could not find compiler set in environment variable HIPCXX:\n$ENV{HIPCXX}.\n${CMAKE_HIP_COMPILER_INIT}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# finally list compilers to try
|
|
||||||
if(NOT CMAKE_HIP_COMPILER_INIT)
|
|
||||||
set(CMAKE_HIP_COMPILER_LIST clang++)
|
|
||||||
|
|
||||||
# Look for the Clang coming with ROCm to support HIP.
|
|
||||||
execute_process(COMMAND hipconfig --hipclangpath
|
|
||||||
OUTPUT_VARIABLE _CMAKE_HIPCONFIG_CLANGPATH
|
|
||||||
RESULT_VARIABLE _CMAKE_HIPCONFIG_RESULT
|
|
||||||
)
|
|
||||||
if(_CMAKE_HIPCONFIG_RESULT EQUAL 0 AND EXISTS "${_CMAKE_HIPCONFIG_CLANGPATH}")
|
|
||||||
set(CMAKE_HIP_COMPILER_HINTS "${_CMAKE_HIPCONFIG_CLANGPATH}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
_cmake_find_compiler(HIP)
|
|
||||||
elseif(CMAKE_HIP_COMPILER MATCHES "hipcc")
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"CMAKE_HIP_COMPILER is set to the hipcc wrapper:\n"
|
|
||||||
" ${CMAKE_HIP_COMPILER}\n"
|
|
||||||
"This is not supported. Use Clang directly, or let CMake pick a default."
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
_cmake_find_compiler_path(HIP)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(CMAKE_HIP_COMPILER)
|
|
||||||
|
|
||||||
# Build a small source file to identify the compiler.
|
|
||||||
if(NOT CMAKE_HIP_COMPILER_ID_RUN)
|
|
||||||
set(CMAKE_HIP_COMPILER_ID_RUN 1)
|
|
||||||
|
|
||||||
# Try to identify the compiler.
|
|
||||||
set(CMAKE_HIP_COMPILER_ID)
|
|
||||||
set(CMAKE_HIP_PLATFORM_ID)
|
|
||||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
|
||||||
CMAKE_HIP_COMPILER_ID_PLATFORM_CONTENT)
|
|
||||||
|
|
||||||
list(APPEND CMAKE_HIP_COMPILER_ID_TEST_FLAGS_FIRST "-v")
|
|
||||||
|
|
||||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
|
||||||
CMAKE_DETERMINE_COMPILER_ID(HIP HIPFLAGS CMakeHIPCompilerId.hip)
|
|
||||||
|
|
||||||
_cmake_find_compiler_sysroot(HIP)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT AND CMAKE_HIP_COMPILER_ID STREQUAL "Clang")
|
|
||||||
execute_process(COMMAND "${CMAKE_HIP_COMPILER}" -v -print-targets
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
RESULT_VARIABLE _CMAKE_HIP_COMPILER_RESULT
|
|
||||||
OUTPUT_VARIABLE _CMAKE_HIP_COMPILER_STDOUT
|
|
||||||
ERROR_VARIABLE _CMAKE_HIP_COMPILER_STDERR
|
|
||||||
)
|
|
||||||
|
|
||||||
if(_CMAKE_HIP_COMPILER_RESULT EQUAL 0 AND _CMAKE_HIP_COMPILER_STDERR MATCHES "Found HIP installation: *([^,]*)[,\n]")
|
|
||||||
set(CMAKE_HIP_COMPILER_ROCM_ROOT "${CMAKE_MATCH_1}")
|
|
||||||
file(TO_CMAKE_PATH "${CMAKE_HIP_COMPILER_ROCM_ROOT}" CMAKE_HIP_COMPILER_ROCM_ROOT)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT)
|
|
||||||
execute_process(
|
|
||||||
COMMAND hipconfig --rocmpath
|
|
||||||
OUTPUT_VARIABLE _CMAKE_HIPCONFIG_ROCMPATH
|
|
||||||
RESULT_VARIABLE _CMAKE_HIPCONFIG_RESULT
|
|
||||||
)
|
|
||||||
if(_CMAKE_HIPCONFIG_RESULT EQUAL 0 AND EXISTS "${_CMAKE_HIPCONFIG_ROCMPATH}")
|
|
||||||
set(CMAKE_HIP_COMPILER_ROCM_ROOT "${_CMAKE_HIPCONFIG_ROCMPATH}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT)
|
|
||||||
message(FATAL_ERROR "Failed to find ROCm root directory.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Normally implicit link information is not detected until
|
|
||||||
cmake_parse_implicit_link_info("${CMAKE_HIP_COMPILER_PRODUCED_OUTPUT}"
|
|
||||||
_CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS
|
|
||||||
_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS
|
|
||||||
_CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS
|
|
||||||
_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG
|
|
||||||
"" LANGUAGE HIP)
|
|
||||||
message(CONFIGURE_LOG
|
|
||||||
"Parsed HIP implicit link information from compiler id output:\n${_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG}\n\n")
|
|
||||||
cmake_parse_library_architecture(HIP "${_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS}" "" CMAKE_HIP_LIBRARY_ARCHITECTURE)
|
|
||||||
if(CMAKE_HIP_LIBRARY_ARCHITECTURE)
|
|
||||||
message(CONFIGURE_LOG
|
|
||||||
"Parsed HIP library architecture from compiler id output: ${CMAKE_HIP_LIBRARY_ARCHITECTURE}\n")
|
|
||||||
endif()
|
|
||||||
unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS)
|
|
||||||
unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS)
|
|
||||||
unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS)
|
|
||||||
unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG)
|
|
||||||
|
|
||||||
if(NOT CMAKE_HIP_COMPILER_ROCM_LIB)
|
|
||||||
set(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS
|
|
||||||
"${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib"
|
|
||||||
"${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib64"
|
|
||||||
)
|
|
||||||
if(CMAKE_HIP_LIBRARY_ARCHITECTURE)
|
|
||||||
list(APPEND _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/${CMAKE_HIP_LIBRARY_ARCHITECTURE}")
|
|
||||||
endif()
|
|
||||||
foreach(dir IN LISTS _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS)
|
|
||||||
if(EXISTS "${dir}/cmake/hip-lang/hip-lang-config.cmake")
|
|
||||||
set(CMAKE_HIP_COMPILER_ROCM_LIB "${dir}")
|
|
||||||
break()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(NOT CMAKE_HIP_COMPILER_ROCM_LIB)
|
|
||||||
list(TRANSFORM _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS APPEND "/cmake/hip-lang/hip-lang-config.cmake")
|
|
||||||
string(REPLACE ";" "\n " _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}")
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"The ROCm root directory:\n"
|
|
||||||
" ${CMAKE_HIP_COMPILER_ROCM_ROOT}\n"
|
|
||||||
"does not contain the HIP runtime CMake package, expected at one of:\n"
|
|
||||||
" ${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}\n"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
unset(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS)
|
|
||||||
endif()
|
|
||||||
if(CMAKE_HIP_COMPILER_ROCM_LIB MATCHES "/lib64$" AND NOT DEFINED CMAKE_SIZEOF_VOID_P)
|
|
||||||
# We have not yet determined the target ABI but we need 'find_package' to
|
|
||||||
# search lib64 directories to find hip-lang CMake package dependencies.
|
|
||||||
# This will be replaced by ABI detection later.
|
|
||||||
set(CMAKE_HIP_SIZEOF_DATA_PTR 8)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
|
||||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_HIP_COMPILER}" PATH)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(_CMAKE_PROCESSING_LANGUAGE "HIP")
|
|
||||||
include(CMakeFindBinUtils)
|
|
||||||
include(Compiler/${CMAKE_HIP_COMPILER_ID}-FindBinUtils OPTIONAL)
|
|
||||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
|
||||||
|
|
||||||
if(CMAKE_HIP_COMPILER_SYSROOT)
|
|
||||||
string(CONCAT _SET_CMAKE_HIP_COMPILER_SYSROOT
|
|
||||||
"set(CMAKE_HIP_COMPILER_SYSROOT \"${CMAKE_HIP_COMPILER_SYSROOT}\")\n"
|
|
||||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_HIP_COMPILER_SYSROOT}\")")
|
|
||||||
else()
|
|
||||||
set(_SET_CMAKE_HIP_COMPILER_SYSROOT "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_HIP_COMPILER_ARCHITECTURE_ID)
|
|
||||||
set(_SET_CMAKE_HIP_COMPILER_ARCHITECTURE_ID
|
|
||||||
"set(CMAKE_HIP_COMPILER_ARCHITECTURE_ID ${CMAKE_HIP_COMPILER_ARCHITECTURE_ID})")
|
|
||||||
else()
|
|
||||||
set(_SET_CMAKE_HIP_COMPILER_ARCHITECTURE_ID "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC_HIP_ARCHITECTURE_ID)
|
|
||||||
set(SET_MSVC_HIP_ARCHITECTURE_ID
|
|
||||||
"set(MSVC_HIP_ARCHITECTURE_ID ${MSVC_HIP_ARCHITECTURE_ID})")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED CMAKE_HIP_ARCHITECTURES)
|
|
||||||
# Use 'rocm_agent_enumerator' to get the current GPU architecture.
|
|
||||||
set(_CMAKE_HIP_ARCHITECTURES)
|
|
||||||
find_program(_CMAKE_HIP_ROCM_AGENT_ENUMERATOR
|
|
||||||
NAMES rocm_agent_enumerator
|
|
||||||
HINTS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/bin"
|
|
||||||
NO_CACHE)
|
|
||||||
if(_CMAKE_HIP_ROCM_AGENT_ENUMERATOR)
|
|
||||||
execute_process(COMMAND "${_CMAKE_HIP_ROCM_AGENT_ENUMERATOR}" -t GPU
|
|
||||||
RESULT_VARIABLE _CMAKE_ROCM_AGENT_ENUMERATOR_RESULT
|
|
||||||
OUTPUT_VARIABLE _CMAKE_ROCM_AGENT_ENUMERATOR_STDOUT
|
|
||||||
ERROR_VARIABLE _CMAKE_ROCM_AGENT_ENUMERATOR_STDERR
|
|
||||||
)
|
|
||||||
if(_CMAKE_ROCM_AGENT_ENUMERATOR_RESULT EQUAL 0)
|
|
||||||
separate_arguments(_hip_archs NATIVE_COMMAND "${_CMAKE_ROCM_AGENT_ENUMERATOR_STDOUT}")
|
|
||||||
foreach(_hip_arch ${_hip_archs})
|
|
||||||
if(_hip_arch STREQUAL "gfx000")
|
|
||||||
continue()
|
|
||||||
endif()
|
|
||||||
string(FIND ${_hip_arch} ":" pos)
|
|
||||||
if(NOT pos STREQUAL "-1")
|
|
||||||
string(SUBSTRING ${_hip_arch} 0 ${pos} _hip_arch)
|
|
||||||
endif()
|
|
||||||
list(APPEND _CMAKE_HIP_ARCHITECTURES "${_hip_arch}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
unset(_CMAKE_ROCM_AGENT_ENUMERATOR_RESULT)
|
|
||||||
unset(_CMAKE_ROCM_AGENT_ENUMERATOR_STDOUT)
|
|
||||||
unset(_CMAKE_ROCM_AGENT_ENUMERATOR_STDERR)
|
|
||||||
endif()
|
|
||||||
unset(_CMAKE_HIP_ROCM_AGENT_ENUMERATOR)
|
|
||||||
if(_CMAKE_HIP_ARCHITECTURES)
|
|
||||||
set(CMAKE_HIP_ARCHITECTURES "${_CMAKE_HIP_ARCHITECTURES}" CACHE STRING "HIP architectures")
|
|
||||||
elseif(CMAKE_HIP_COMPILER_PRODUCED_OUTPUT MATCHES " -target-cpu ([a-z0-9]+) ")
|
|
||||||
set(CMAKE_HIP_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "HIP architectures")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Failed to find a default HIP architecture.")
|
|
||||||
endif()
|
|
||||||
unset(_CMAKE_HIP_ARCHITECTURES)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# configure variables set in this file for fast reload later on
|
|
||||||
configure_file(${CMAKE_ROOT}/Modules/CMakeHIPCompiler.cmake.in
|
|
||||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeHIPCompiler.cmake
|
|
||||||
@ONLY
|
|
||||||
)
|
|
||||||
set(CMAKE_HIP_COMPILER_ENV_VAR "HIPCXX")
|
|
@ -1,16 +0,0 @@
|
|||||||
#ifndef __HIP__
|
|
||||||
# error "A C or C++ compiler has been selected for HIP"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "CMakeCompilerABI.h"
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
int require = 0;
|
|
||||||
require += info_sizeof_dptr[argc];
|
|
||||||
#if defined(ABI_ID)
|
|
||||||
require += info_abi[argc];
|
|
||||||
#endif
|
|
||||||
(void)argv;
|
|
||||||
return require;
|
|
||||||
}
|
|
@ -1,346 +0,0 @@
|
|||||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
||||||
|
|
||||||
#[=======================================================================[.rst:
|
|
||||||
CMakePackageConfigHelpers
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
Helpers functions for creating config files that can be included by other
|
|
||||||
projects to find and use a package.
|
|
||||||
|
|
||||||
Adds the :command:`configure_package_config_file()` and
|
|
||||||
:command:`write_basic_package_version_file()` commands.
|
|
||||||
|
|
||||||
Generating a Package Configuration File
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. command:: configure_package_config_file
|
|
||||||
|
|
||||||
Create a config file for a project::
|
|
||||||
|
|
||||||
configure_package_config_file(<input> <output>
|
|
||||||
INSTALL_DESTINATION <path>
|
|
||||||
[PATH_VARS <var1> <var2> ... <varN>]
|
|
||||||
[NO_SET_AND_CHECK_MACRO]
|
|
||||||
[NO_CHECK_REQUIRED_COMPONENTS_MACRO]
|
|
||||||
[INSTALL_PREFIX <path>]
|
|
||||||
)
|
|
||||||
|
|
||||||
``configure_package_config_file()`` should be used instead of the plain
|
|
||||||
:command:`configure_file()` command when creating the ``<PackageName>Config.cmake``
|
|
||||||
or ``<PackageName>-config.cmake`` file for installing a project or library.
|
|
||||||
It helps making the resulting package relocatable by avoiding hardcoded paths
|
|
||||||
in the installed ``Config.cmake`` file.
|
|
||||||
|
|
||||||
In a ``FooConfig.cmake`` file there may be code like this to make the install
|
|
||||||
destinations know to the using project:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
|
|
||||||
set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
|
|
||||||
set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" )
|
|
||||||
#...logic to determine installedPrefix from the own location...
|
|
||||||
set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
|
|
||||||
|
|
||||||
All 4 options shown above are not sufficient, since the first 3 hardcode the
|
|
||||||
absolute directory locations, and the 4th case works only if the logic to
|
|
||||||
determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR``
|
|
||||||
contains a relative path, which in general cannot be guaranteed. This has the
|
|
||||||
effect that the resulting ``FooConfig.cmake`` file would work poorly under
|
|
||||||
Windows and OSX, where users are used to choose the install location of a
|
|
||||||
binary package at install time, independent from how
|
|
||||||
:variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time.
|
|
||||||
|
|
||||||
Using ``configure_package_config_file`` helps. If used correctly, it makes
|
|
||||||
the resulting ``FooConfig.cmake`` file relocatable. Usage:
|
|
||||||
|
|
||||||
1. write a ``FooConfig.cmake.in`` file as you are used to
|
|
||||||
2. insert a line containing only the string ``@PACKAGE_INIT@``
|
|
||||||
3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use
|
|
||||||
``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the
|
|
||||||
``@PACKAGE_INIT@`` line)
|
|
||||||
4. instead of using the normal :command:`configure_file()`, use
|
|
||||||
``configure_package_config_file()``
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The ``<input>`` and ``<output>`` arguments are the input and output file, the
|
|
||||||
same way as in :command:`configure_file()`.
|
|
||||||
|
|
||||||
The ``<path>`` given to ``INSTALL_DESTINATION`` must be the destination where
|
|
||||||
the ``FooConfig.cmake`` file will be installed to. This path can either be
|
|
||||||
absolute, or relative to the ``INSTALL_PREFIX`` path.
|
|
||||||
|
|
||||||
The variables ``<var1>`` to ``<varN>`` given as ``PATH_VARS`` are the
|
|
||||||
variables which contain install destinations. For each of them the macro will
|
|
||||||
create a helper variable ``PACKAGE_<var...>``. These helper variables must be
|
|
||||||
used in the ``FooConfig.cmake.in`` file for setting the installed location.
|
|
||||||
They are calculated by ``configure_package_config_file`` so that they are
|
|
||||||
always relative to the installed location of the package. This works both for
|
|
||||||
relative and also for absolute locations. For absolute locations it works
|
|
||||||
only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
|
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
|
||||||
If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
|
|
||||||
calculate all the relative paths. The ``<path>`` argument must be an absolute
|
|
||||||
path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
|
|
||||||
variable will be used instead. The default value is good when generating a
|
|
||||||
FooConfig.cmake file to use your package from the install tree. When
|
|
||||||
generating a FooConfig.cmake file to use your package from the build tree this
|
|
||||||
option should be used.
|
|
||||||
|
|
||||||
By default ``configure_package_config_file`` also generates two helper macros,
|
|
||||||
``set_and_check()`` and ``check_required_components()`` into the
|
|
||||||
``FooConfig.cmake`` file.
|
|
||||||
|
|
||||||
``set_and_check()`` should be used instead of the normal ``set()`` command for
|
|
||||||
setting directories and file locations. Additionally to setting the variable
|
|
||||||
it also checks that the referenced file or directory actually exists and fails
|
|
||||||
with a ``FATAL_ERROR`` otherwise. This makes sure that the created
|
|
||||||
``FooConfig.cmake`` file does not contain wrong references.
|
|
||||||
When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated
|
|
||||||
into the ``FooConfig.cmake`` file.
|
|
||||||
|
|
||||||
``check_required_components(<PackageName>)`` should be called at the end of
|
|
||||||
the ``FooConfig.cmake`` file. This macro checks whether all requested,
|
|
||||||
non-optional components have been found, and if this is not the case, sets
|
|
||||||
the ``Foo_FOUND`` variable to ``FALSE``, so that the package is considered to
|
|
||||||
be not found. It does that by testing the ``Foo_<Component>_FOUND``
|
|
||||||
variables for all requested required components. This macro should be
|
|
||||||
called even if the package doesn't provide any components to make sure
|
|
||||||
users are not specifying components erroneously. When using the
|
|
||||||
``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is not generated
|
|
||||||
into the ``FooConfig.cmake`` file.
|
|
||||||
|
|
||||||
For an example see below the documentation for
|
|
||||||
:command:`write_basic_package_version_file()`.
|
|
||||||
|
|
||||||
Generating a Package Version File
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. command:: write_basic_package_version_file
|
|
||||||
|
|
||||||
Create a version file for a project::
|
|
||||||
|
|
||||||
write_basic_package_version_file(<filename>
|
|
||||||
[VERSION <major.minor.patch>]
|
|
||||||
COMPATIBILITY <AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion>
|
|
||||||
[ARCH_INDEPENDENT] )
|
|
||||||
|
|
||||||
|
|
||||||
Writes a file for use as ``<PackageName>ConfigVersion.cmake`` file to
|
|
||||||
``<filename>``. See the documentation of :command:`find_package()` for
|
|
||||||
details on this.
|
|
||||||
|
|
||||||
``<filename>`` is the output filename, it should be in the build tree.
|
|
||||||
``<major.minor.patch>`` is the version number of the project to be installed.
|
|
||||||
|
|
||||||
If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used.
|
|
||||||
If this hasn't been set, it errors out.
|
|
||||||
|
|
||||||
The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed
|
|
||||||
package version will be considered compatible if it is newer or exactly the
|
|
||||||
same as the requested version. This mode should be used for packages which
|
|
||||||
are fully backward compatible, also across major versions.
|
|
||||||
If ``SameMajorVersion`` is used instead, then the behavior differs from
|
|
||||||
``AnyNewerVersion`` in that the major version number must be the same as
|
|
||||||
requested, e.g. version 2.0 will not be considered compatible if 1.0 is
|
|
||||||
requested. This mode should be used for packages which guarantee backward
|
|
||||||
compatibility within the same major version.
|
|
||||||
If ``SameMinorVersion`` is used, the behavior is the same as
|
|
||||||
``SameMajorVersion``, but both major and minor version must be the same as
|
|
||||||
requested, e.g version 0.2 will not be compatible if 0.1 is requested.
|
|
||||||
If ``ExactVersion`` is used, then the package is only considered compatible if
|
|
||||||
the requested version matches exactly its own version number (not considering
|
|
||||||
the tweak version). For example, version 1.2.3 of a package is only
|
|
||||||
considered compatible to requested version 1.2.3. This mode is for packages
|
|
||||||
without compatibility guarantees.
|
|
||||||
If your project has more elaborated version matching rules, you will need to
|
|
||||||
write your own custom ``ConfigVersion.cmake`` file instead of using this
|
|
||||||
macro.
|
|
||||||
|
|
||||||
.. versionadded:: 3.11
|
|
||||||
The ``SameMinorVersion`` compatibility mode.
|
|
||||||
|
|
||||||
.. versionadded:: 3.14
|
|
||||||
If ``ARCH_INDEPENDENT`` is given, the installed package version will be
|
|
||||||
considered compatible even if it was built for a different architecture than
|
|
||||||
the requested architecture. Otherwise, an architecture check will be performed,
|
|
||||||
and the package will be considered compatible only if the architecture matches
|
|
||||||
exactly. For example, if the package is built for a 32-bit architecture, the
|
|
||||||
package is only considered compatible if it is used on a 32-bit architecture,
|
|
||||||
unless ``ARCH_INDEPENDENT`` is given, in which case the package is considered
|
|
||||||
compatible on any architecture.
|
|
||||||
|
|
||||||
.. note:: ``ARCH_INDEPENDENT`` is intended for header-only libraries or similar
|
|
||||||
packages with no binaries.
|
|
||||||
|
|
||||||
.. versionadded:: 3.19
|
|
||||||
The version file generated by ``AnyNewerVersion``, ``SameMajorVersion`` and
|
|
||||||
``SameMinorVersion`` arguments of ``COMPATIBILITY`` handle the version range
|
|
||||||
if any is specified (see :command:`find_package` command for the details).
|
|
||||||
``ExactVersion`` mode is incompatible with version ranges and will display an
|
|
||||||
author warning if one is specified.
|
|
||||||
|
|
||||||
Internally, this macro executes :command:`configure_file()` to create the
|
|
||||||
resulting version file. Depending on the ``COMPATIBILITY``, the corresponding
|
|
||||||
``BasicConfigVersion-<COMPATIBILITY>.cmake.in`` file is used.
|
|
||||||
Please note that these files are internal to CMake and you should not call
|
|
||||||
:command:`configure_file()` on them yourself, but they can be used as starting
|
|
||||||
point to create more sophisticated custom ``ConfigVersion.cmake`` files.
|
|
||||||
|
|
||||||
Example Generating Package Files
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Example using both :command:`configure_package_config_file` and
|
|
||||||
``write_basic_package_version_file()``:
|
|
||||||
|
|
||||||
``CMakeLists.txt``:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/Foo
|
|
||||||
CACHE PATH "Location of header files" )
|
|
||||||
set(SYSCONFIG_INSTALL_DIR ${CMAKE_INSTALL_SYSCONFDIR}/foo
|
|
||||||
CACHE PATH "Location of configuration files" )
|
|
||||||
#...
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
configure_package_config_file(FooConfig.cmake.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
|
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Foo
|
|
||||||
PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
|
|
||||||
write_basic_package_version_file(
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
|
|
||||||
VERSION 1.2.3
|
|
||||||
COMPATIBILITY SameMajorVersion )
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Foo )
|
|
||||||
|
|
||||||
``FooConfig.cmake.in``:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
set(FOO_VERSION x.y.z)
|
|
||||||
...
|
|
||||||
@PACKAGE_INIT@
|
|
||||||
...
|
|
||||||
set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
|
||||||
set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
|
|
||||||
|
|
||||||
check_required_components(Foo)
|
|
||||||
#]=======================================================================]
|
|
||||||
|
|
||||||
include(WriteBasicConfigVersionFile)
|
|
||||||
|
|
||||||
macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
|
|
||||||
write_basic_config_version_file(${ARGN})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
|
|
||||||
set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
|
||||||
set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX)
|
|
||||||
set(multiValueArgs PATH_VARS )
|
|
||||||
|
|
||||||
cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
||||||
|
|
||||||
if(CCF_UNPARSED_ARGUMENTS)
|
|
||||||
message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CCF_INSTALL_DESTINATION)
|
|
||||||
message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DEFINED CCF_INSTALL_PREFIX)
|
|
||||||
if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}")
|
|
||||||
set(installPrefix "${CCF_INSTALL_PREFIX}")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path")
|
|
||||||
endif()
|
|
||||||
elseif(IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
|
|
||||||
set(installPrefix "${CMAKE_INSTALL_PREFIX}")
|
|
||||||
else()
|
|
||||||
get_filename_component(installPrefix "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
|
|
||||||
set(absInstallDir "${CCF_INSTALL_DESTINATION}")
|
|
||||||
else()
|
|
||||||
set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" )
|
|
||||||
|
|
||||||
foreach(var ${CCF_PATH_VARS})
|
|
||||||
if(NOT DEFINED ${var})
|
|
||||||
message(FATAL_ERROR "Variable ${var} does not exist")
|
|
||||||
else()
|
|
||||||
if(IS_ABSOLUTE "${${var}}")
|
|
||||||
string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}"
|
|
||||||
PACKAGE_${var} "${${var}}")
|
|
||||||
else()
|
|
||||||
set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
get_filename_component(inputFileName "${_inputFile}" NAME)
|
|
||||||
|
|
||||||
set(PACKAGE_INIT "
|
|
||||||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
|
||||||
####### Any changes to this file will be overwritten by the next CMake run ####
|
|
||||||
####### The input file was ${inputFileName} ########
|
|
||||||
|
|
||||||
get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
|
|
||||||
")
|
|
||||||
|
|
||||||
if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+")
|
|
||||||
# Handle "/usr move" symlinks created by some Linux distros.
|
|
||||||
string(APPEND PACKAGE_INIT "
|
|
||||||
# Use original install prefix when loaded through a \"/usr move\"
|
|
||||||
# cross-prefix symbolic link such as /lib -> /usr/lib.
|
|
||||||
get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH)
|
|
||||||
get_filename_component(_realOrig \"${absInstallDir}\" REALPATH)
|
|
||||||
if(_realCurr STREQUAL _realOrig)
|
|
||||||
set(PACKAGE_PREFIX_DIR \"${installPrefix}\")
|
|
||||||
endif()
|
|
||||||
unset(_realOrig)
|
|
||||||
unset(_realCurr)
|
|
||||||
")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CCF_NO_SET_AND_CHECK_MACRO)
|
|
||||||
string(APPEND PACKAGE_INIT "
|
|
||||||
macro(set_and_check _var _file)
|
|
||||||
set(\${_var} \"\${_file}\")
|
|
||||||
if(NOT EXISTS \"\${_file}\")
|
|
||||||
message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
|
||||||
string(APPEND PACKAGE_INIT "
|
|
||||||
macro(check_required_components _NAME)
|
|
||||||
foreach(comp \${\${_NAME}_FIND_COMPONENTS})
|
|
||||||
if(NOT \${_NAME}_\${comp}_FOUND)
|
|
||||||
if(\${_NAME}_FIND_REQUIRED_\${comp})
|
|
||||||
set(\${_NAME}_FOUND FALSE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(APPEND PACKAGE_INIT "
|
|
||||||
####################################################################################")
|
|
||||||
|
|
||||||
configure_file("${_inputFile}" "${_outputFile}" @ONLY)
|
|
||||||
|
|
||||||
endfunction()
|
|
@ -1,137 +0,0 @@
|
|||||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
set(CMAKE_Swift_OUTPUT_EXTENSION .o)
|
|
||||||
else()
|
|
||||||
set(CMAKE_Swift_OUTPUT_EXTENSION .obj)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Load compiler-specific information.
|
|
||||||
if(CMAKE_Swift_COMPILER_ID)
|
|
||||||
include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
|
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR)
|
|
||||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
|
||||||
endif()
|
|
||||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_FLAG_Swift "-I ")
|
|
||||||
|
|
||||||
# FIXME: Move compiler- and platform-specific flags to the above-included modules.
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS"
|
|
||||||
OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
|
|
||||||
set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -install_name -Xlinker ")
|
|
||||||
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ")
|
|
||||||
endif()
|
|
||||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
|
|
||||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS"
|
|
||||||
OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
|
|
||||||
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP "")
|
|
||||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP "")
|
|
||||||
else()
|
|
||||||
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP ":")
|
|
||||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP ":")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ")
|
|
||||||
set(CMAKE_Swift_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "-tools-directory ")
|
|
||||||
# NOTE(compnerd) the `-sdk` support is not yet ready in the compiler; when that
|
|
||||||
# is fully working, we should be able to enable this.
|
|
||||||
# set(CMAKE_Swift_COMPILE_OPTIONS_SYSROOT "-sdk ")
|
|
||||||
# NOTE(compnerd) do not setup `-frontend` as we use the compiler as the driver
|
|
||||||
# during the link phase and use that to drive the compilation
|
|
||||||
set(CMAKE_Swift_COMPILER_ARG1 "")
|
|
||||||
set(CMAKE_Swift_DEFINE_FLAG -D)
|
|
||||||
set(CMAKE_Swift_FRAMEWORK_SEARCH_FLAG "-F ")
|
|
||||||
set(CMAKE_Swift_LIBRARY_PATH_FLAG "-L ")
|
|
||||||
set(CMAKE_Swift_LIBRARY_PATH_TERMINATOR "")
|
|
||||||
set(CMAKE_Swift_LINK_LIBRARY_FLAG "-l")
|
|
||||||
set(CMAKE_Swift_LINKER_WRAPPER_FLAG "-Xlinker" " ")
|
|
||||||
set(CMAKE_Swift_RESPONSE_FILE_LINK_FLAG @)
|
|
||||||
|
|
||||||
set(CMAKE_Swift_LINKER_PREFERENCE 50)
|
|
||||||
set(CMAKE_Swift_LINKER_PREFERENCE_PROPAGATES 1)
|
|
||||||
|
|
||||||
# NOTE(compnerd) use the short form for convenience and ease of search. They
|
|
||||||
# are treated equivalent to their long form names as well as custom Swift
|
|
||||||
# specific names.
|
|
||||||
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -libc MT)
|
|
||||||
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -libc MD)
|
|
||||||
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -libc MTd)
|
|
||||||
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -libc MDd)
|
|
||||||
|
|
||||||
if(CMAKE_GENERATOR STREQUAL "Xcode")
|
|
||||||
# Xcode has a separate Xcode project option (SWIFT_COMPILATION_MODE) used to set
|
|
||||||
# whether compiling with whole-module optimizations or incrementally. Setting
|
|
||||||
# these options here will have no effect when compiling with the built-in driver,
|
|
||||||
# and will explode violently, leaving build products in the source directory, when
|
|
||||||
# using the old swift driver.
|
|
||||||
set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g ${CMAKE_Swift_FLAGS_DEBUG_LINKER_FLAGS}")
|
|
||||||
set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
|
|
||||||
set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g ${CMAKE_Swift_FLAGS_RELWITHDEBINFO_LINKER_FLAGS}")
|
|
||||||
set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
|
|
||||||
else()
|
|
||||||
set(CMAKE_Swift_FLAGS_DEBUG_INIT "-Onone -g -incremental")
|
|
||||||
set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
|
|
||||||
set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")
|
|
||||||
set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
|
|
||||||
|
|
||||||
# Enable Whole Module Optimization by default unless the old
|
|
||||||
# C++ driver is being used, which behaves differently under WMO.
|
|
||||||
if(NOT CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
|
|
||||||
string(APPEND CMAKE_Swift_FLAGS_RELEASE_INIT " -wmo")
|
|
||||||
string(APPEND CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT " -wmo")
|
|
||||||
string(APPEND CMAKE_Swift_FLAGS_MINSIZEREL_INIT " -wmo")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
|
|
||||||
if(NOT DEFINED CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG)
|
|
||||||
set(CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG "LINKER:--no-as-needed")
|
|
||||||
endif()
|
|
||||||
if(NOT DEFINED CMAKE_LINK_WHAT_YOU_USE_CHECK)
|
|
||||||
set(CMAKE_LINK_WHAT_YOU_USE_CHECK ldd -u -r)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
cmake_initialize_per_config_variable(CMAKE_Swift_FLAGS "Swift Compiler Flags")
|
|
||||||
|
|
||||||
# NOTE(compnerd) we do not have an object compile rule since we build the objects as part of the link step
|
|
||||||
if(NOT CMAKE_Swift_COMPILE_OBJECT)
|
|
||||||
set(CMAKE_Swift_COMPILE_OBJECT ":")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_Swift_NUM_THREADS MATCHES "^[0-9]+$")
|
|
||||||
cmake_host_system_information(RESULT CMAKE_Swift_NUM_THREADS QUERY NUMBER_OF_LOGICAL_CORES)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
|
|
||||||
set(CMAKE_Swift_CREATE_SHARED_LIBRARY "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS} <LINK_LIBRARIES>")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
|
|
||||||
set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_Swift_LINK_EXECUTABLE)
|
|
||||||
set(CMAKE_Swift_LINK_EXECUTABLE "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS)
|
|
||||||
set(CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS "${CMAKE_Swift_LINK_EXECUTABLE} -emit-module -emit-module-path <SWIFT_MODULE> ${CMAKE_Swift_IMPLIB_LINKER_FLAGS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY)
|
|
||||||
set(CMAKE_Swift_CREATE_STATIC_LIBRARY "<CMAKE_Swift_COMPILER> -j ${CMAKE_Swift_NUM_THREADS} -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
|
|
||||||
|
|
||||||
set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>")
|
|
||||||
set(CMAKE_Swift_ARCHIVE_FINISH "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_Swift_INFORMATION_LOADED 1)
|
|
@ -1,69 +0,0 @@
|
|||||||
# See supported GPUs on Wikipedia
|
|
||||||
# https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
|
||||||
|
|
||||||
# Initial set based on CUDA 7.0.
|
|
||||||
set(CMAKE_CUDA_ARCHITECTURES_ALL 20 21 30 35 37 50 52 53)
|
|
||||||
set(CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 20 30 35 50)
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 8.0)
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 60 61 62)
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 60)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 9.0)
|
|
||||||
if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 70 72)
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 70)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 20 21)
|
|
||||||
list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 20)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 10.0
|
|
||||||
AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0))
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 75)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.0)
|
|
||||||
if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 80)
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 80)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 30)
|
|
||||||
list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 30)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.1
|
|
||||||
AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang" OR CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0))
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 86)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.4
|
|
||||||
AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 87)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.8
|
|
||||||
AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL 89 90)
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 90)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 12.0
|
|
||||||
AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"))
|
|
||||||
list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 35 37)
|
|
||||||
list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 35)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# only generate jit code for the newest arch for all/all-major
|
|
||||||
list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL _latest_arch)
|
|
||||||
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL APPEND "-real")
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL ${_latest_arch})
|
|
||||||
|
|
||||||
list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR _latest_arch)
|
|
||||||
list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR APPEND "-real")
|
|
||||||
list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR ${_latest_arch})
|
|
||||||
|
|
||||||
unset(_latest_arch)
|
|
@ -1,6 +0,0 @@
|
|||||||
int foo();
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return foo();
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
PROJECT(CHECK_LIBRARY_EXISTS)
|
|
||||||
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DCHECK_FUNCTION_EXISTS=${CHECK_LIBRARY_EXISTS_FUNCTION})
|
|
||||||
LINK_DIRECTORIES(${CHECK_LIBRARY_EXISTS_LOCATION})
|
|
||||||
ADD_EXECUTABLE(CheckLibraryExists ${CHECK_LIBRARY_EXISTS_SOURCE})
|
|
||||||
TARGET_LINK_LIBRARIES(CheckLibraryExists ${CHECK_LIBRARY_EXISTS_LIBRARY})
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
set(_compiler_id_pp_test "defined(__COMO__)")
|
|
||||||
|
|
||||||
set(_compiler_id_version_compute "
|
|
||||||
/* __COMO_VERSION__ = VRR */
|
|
||||||
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100)
|
|
||||||
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)")
|
|
@ -1,49 +0,0 @@
|
|||||||
include(Compiler/GNU)
|
|
||||||
__compiler_gnu(C)
|
|
||||||
|
|
||||||
|
|
||||||
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
|
|
||||||
AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
|
|
||||||
AND CMAKE_DEPFILE_FLAGS_C)
|
|
||||||
# dependencies are computed by the compiler itself
|
|
||||||
set(CMAKE_C_DEPFILE_FORMAT gcc)
|
|
||||||
set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
|
|
||||||
|
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
|
|
||||||
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
|
|
||||||
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
|
|
||||||
elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
|
|
||||||
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
|
|
||||||
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
|
|
||||||
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
|
|
||||||
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
|
|
||||||
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
|
|
||||||
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
|
|
||||||
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
|
|
||||||
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
|
|
||||||
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
|
|
||||||
elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
|
|
||||||
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
|
|
||||||
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
|
|
||||||
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
|
|
||||||
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1)
|
|
||||||
set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
|
|
||||||
set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
__compiler_check_default_language_standard(C 3.4 90 5.0 11 8.1 17)
|
|
@ -1,74 +0,0 @@
|
|||||||
include(Compiler/GNU)
|
|
||||||
__compiler_gnu(CXX)
|
|
||||||
|
|
||||||
|
|
||||||
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
|
|
||||||
AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
|
|
||||||
AND CMAKE_DEPFILE_FLAGS_CXX)
|
|
||||||
# dependencies are computed by the compiler itself
|
|
||||||
set(CMAKE_CXX_DEPFILE_FORMAT gcc)
|
|
||||||
set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
|
|
||||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fno-keep-inline-dllexport")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
|
|
||||||
set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
|
|
||||||
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
|
|
||||||
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
|
|
||||||
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
|
|
||||||
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
|
|
||||||
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
|
|
||||||
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
|
||||||
# 4.3 supports 0x variants
|
|
||||||
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
|
|
||||||
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.1)
|
|
||||||
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
|
||||||
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
|
|
||||||
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
|
|
||||||
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
|
||||||
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
|
|
||||||
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
|
||||||
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
|
||||||
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
|
|
||||||
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
|
|
||||||
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
|
|
||||||
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
|
|
||||||
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.1)
|
|
||||||
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
|
|
||||||
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
|
|
||||||
set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++23")
|
|
||||||
set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
|
|
||||||
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
|
||||||
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
|
|
||||||
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
__compiler_check_default_language_standard(CXX 3.4 98 6.0 14 11.1 17)
|
|
@ -1,175 +0,0 @@
|
|||||||
include(Compiler/CMakeCommonCompilerMacros)
|
|
||||||
|
|
||||||
set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE True)
|
|
||||||
set(CMAKE_CUDA_VERBOSE_FLAG "-v")
|
|
||||||
set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
|
|
||||||
|
|
||||||
set(_CMAKE_COMPILE_AS_CUDA_FLAG "-x cu")
|
|
||||||
set(_CMAKE_CUDA_WHOLE_FLAG "-c")
|
|
||||||
set(_CMAKE_CUDA_RDC_FLAG "-rdc=true")
|
|
||||||
set(_CMAKE_CUDA_PTX_FLAG "-ptx")
|
|
||||||
set(_CMAKE_CUDA_CUBIN_FLAG "-cubin")
|
|
||||||
set(_CMAKE_CUDA_FATBIN_FLAG "-fatbin")
|
|
||||||
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.7.0")
|
|
||||||
set(_CMAKE_CUDA_OPTIX_FLAG "-optix-ir")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
|
|
||||||
# The -forward-unknown-to-host-compiler flag was only
|
|
||||||
# added to nvcc in 10.2 so before that we had no good
|
|
||||||
# way to invoke the CUDA compiler and propagate unknown
|
|
||||||
# flags such as -pthread to the host compiler
|
|
||||||
set(_CMAKE_CUDA_EXTRA_FLAGS "-forward-unknown-to-host-compiler")
|
|
||||||
else()
|
|
||||||
set(_CMAKE_CUDA_EXTRA_FLAGS "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0")
|
|
||||||
set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "-Wno-deprecated-gpu-targets")
|
|
||||||
else()
|
|
||||||
set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_HOST_COMPILER AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
||||||
string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
|
|
||||||
# Starting in 10.2, nvcc supported treating all warnings as errors
|
|
||||||
set(CMAKE_CUDA_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror" "all-warnings")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
|
|
||||||
# The -MD flag was only added to nvcc in 10.2 so
|
|
||||||
# before that we had to invoke the compiler twice
|
|
||||||
# to get header dependency information
|
|
||||||
set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>")
|
|
||||||
endif()
|
|
||||||
set(CMAKE_CUDA_DEPFILE_FORMAT gcc)
|
|
||||||
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
|
|
||||||
AND CMAKE_GENERATOR MATCHES "Makefiles|WMake")
|
|
||||||
set(CMAKE_CUDA_DEPENDS_USE_COMPILER TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.2)
|
|
||||||
set(_CMAKE_CUDA_IPO_SUPPORTED_BY_CMAKE YES)
|
|
||||||
set(_CMAKE_CUDA_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
|
|
||||||
|
|
||||||
set(CMAKE_CUDA_DEVICE_LINK_OPTIONS_IPO " -dlto")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
|
|
||||||
set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
|
|
||||||
set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
|
|
||||||
set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
|
|
||||||
# CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we
|
|
||||||
# don't need to forward it through nvcc.
|
|
||||||
set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
|
|
||||||
string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
|
|
||||||
string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
|
|
||||||
string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
|
|
||||||
string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
|
|
||||||
string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
|
|
||||||
set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA "-isystem ")
|
|
||||||
|
|
||||||
if (CMAKE_CUDA_SIMULATE_ID STREQUAL "GNU")
|
|
||||||
set(CMAKE_CUDA_LINKER_WRAPPER_FLAG "-Wl,")
|
|
||||||
set(CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP ",")
|
|
||||||
elseif(CMAKE_CUDA_SIMULATE_ID STREQUAL "Clang")
|
|
||||||
set(CMAKE_CUDA_LINKER_WRAPPER_FLAG "-Xlinker" " ")
|
|
||||||
set(CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CUDA_DEVICE_COMPILER_WRAPPER_FLAG "-Xcompiler=")
|
|
||||||
set(CMAKE_CUDA_DEVICE_COMPILER_WRAPPER_FLAG_SEP ",")
|
|
||||||
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG "-Xlinker=")
|
|
||||||
set(CMAKE_CUDA_DEVICE_LINKER_WRAPPER_FLAG_SEP ",")
|
|
||||||
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static")
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart")
|
|
||||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "")
|
|
||||||
|
|
||||||
if(UNIX AND NOT (CMAKE_SYSTEM_NAME STREQUAL "QNX"))
|
|
||||||
list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
|
|
||||||
# MSVC requires c++14 as the minimum level
|
|
||||||
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "")
|
|
||||||
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "")
|
|
||||||
|
|
||||||
# MSVC requires c++14 as the minimum level
|
|
||||||
set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "")
|
|
||||||
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "")
|
|
||||||
|
|
||||||
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
|
|
||||||
if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
|
|
||||||
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
|
|
||||||
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
|
|
||||||
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0)
|
|
||||||
if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.11.25505)
|
|
||||||
set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "-std=c++17")
|
|
||||||
set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "-std=c++17")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 12.0)
|
|
||||||
if(CMAKE_CUDA_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.11.25505)
|
|
||||||
set(CMAKE_CUDA20_STANDARD_COMPILE_OPTION "-std=c++20")
|
|
||||||
set(CMAKE_CUDA20_EXTENSION_COMPILE_OPTION "-std=c++20")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
else()
|
|
||||||
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "")
|
|
||||||
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "")
|
|
||||||
|
|
||||||
set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
|
|
||||||
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
|
|
||||||
|
|
||||||
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
|
|
||||||
set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03")
|
|
||||||
set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "-std=c++03")
|
|
||||||
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
|
|
||||||
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0)
|
|
||||||
set(CMAKE_CUDA17_STANDARD_COMPILE_OPTION "-std=c++17")
|
|
||||||
set(CMAKE_CUDA17_EXTENSION_COMPILE_OPTION "-std=c++17")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 12.0)
|
|
||||||
set(CMAKE_CUDA20_STANDARD_COMPILE_OPTION "-std=c++20")
|
|
||||||
set(CMAKE_CUDA20_EXTENSION_COMPILE_OPTION "-std=c++20")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0")
|
|
||||||
set(CMAKE_CUDA_RESPONSE_FILE_DEVICE_LINK_FLAG "--options-file ")
|
|
||||||
set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0")
|
|
||||||
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 1)
|
|
||||||
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
|
|
||||||
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
|
||||||
else()
|
|
||||||
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0)
|
|
||||||
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
|
|
||||||
set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
__compiler_check_default_language_standard(CUDA 6.0 03)
|
|
File diff suppressed because it is too large
Load Diff
@ -1,182 +0,0 @@
|
|||||||
cmake_policy(VERSION 3.25)
|
|
||||||
|
|
||||||
# Determine the remote URL of the project containing the working_directory.
|
|
||||||
# This will leave output_variable unset if the URL can't be determined.
|
|
||||||
function(_ep_get_git_remote_url output_variable working_directory)
|
|
||||||
set("${output_variable}" "" PARENT_SCOPE)
|
|
||||||
|
|
||||||
find_package(Git QUIET REQUIRED)
|
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${GIT_EXECUTABLE} symbolic-ref --short HEAD
|
|
||||||
WORKING_DIRECTORY "${working_directory}"
|
|
||||||
OUTPUT_VARIABLE git_symbolic_ref
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
ERROR_QUIET
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT git_symbolic_ref STREQUAL "")
|
|
||||||
# We are potentially on a branch. See if that branch is associated with
|
|
||||||
# an upstream remote (might be just a local one or not a branch at all).
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${GIT_EXECUTABLE} config branch.${git_symbolic_ref}.remote
|
|
||||||
WORKING_DIRECTORY "${working_directory}"
|
|
||||||
OUTPUT_VARIABLE git_remote_name
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
ERROR_QUIET
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT git_remote_name)
|
|
||||||
# Can't select a remote based on a branch. If there's only one remote,
|
|
||||||
# or we have multiple remotes but one is called "origin", choose that.
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${GIT_EXECUTABLE} remote
|
|
||||||
WORKING_DIRECTORY "${working_directory}"
|
|
||||||
OUTPUT_VARIABLE git_remote_list
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
ERROR_QUIET
|
|
||||||
)
|
|
||||||
string(REPLACE "\n" ";" git_remote_list "${git_remote_list}")
|
|
||||||
list(LENGTH git_remote_list git_remote_list_length)
|
|
||||||
|
|
||||||
if(git_remote_list_length EQUAL 0)
|
|
||||||
message(FATAL_ERROR "Git remote not found in parent project.")
|
|
||||||
elseif(git_remote_list_length EQUAL 1)
|
|
||||||
list(GET git_remote_list 0 git_remote_name)
|
|
||||||
else()
|
|
||||||
set(base_warning_msg "Multiple git remotes found for parent project")
|
|
||||||
if("origin" IN_LIST git_remote_list)
|
|
||||||
message(WARNING "${base_warning_msg}, defaulting to origin.")
|
|
||||||
set(git_remote_name "origin")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "${base_warning_msg}, none of which are origin.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(GIT_VERSION VERSION_LESS 1.7.5)
|
|
||||||
set(_git_remote_url_cmd_args config remote.${git_remote_name}.url)
|
|
||||||
elseif(GIT_VERSION VERSION_LESS 2.7)
|
|
||||||
set(_git_remote_url_cmd_args ls-remote --get-url ${git_remote_name})
|
|
||||||
else()
|
|
||||||
set(_git_remote_url_cmd_args remote get-url ${git_remote_name})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${GIT_EXECUTABLE} ${_git_remote_url_cmd_args}
|
|
||||||
WORKING_DIRECTORY "${working_directory}"
|
|
||||||
OUTPUT_VARIABLE git_remote_url
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
COMMAND_ERROR_IS_FATAL LAST
|
|
||||||
ENCODING UTF-8 # Needed to handle non-ascii characters in local paths
|
|
||||||
)
|
|
||||||
|
|
||||||
set("${output_variable}" "${git_remote_url}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(_ep_is_relative_git_remote output_variable remote_url)
|
|
||||||
if(remote_url MATCHES "^\\.\\./")
|
|
||||||
set("${output_variable}" TRUE PARENT_SCOPE)
|
|
||||||
else()
|
|
||||||
set("${output_variable}" FALSE PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# Return an absolute remote URL given an existing remote URL and relative path.
|
|
||||||
# The output_variable will be set to an empty string if an absolute URL
|
|
||||||
# could not be computed (no error message is output).
|
|
||||||
function(_ep_resolve_relative_git_remote
|
|
||||||
output_variable
|
|
||||||
parent_remote_url
|
|
||||||
relative_remote_url
|
|
||||||
)
|
|
||||||
set("${output_variable}" "" PARENT_SCOPE)
|
|
||||||
|
|
||||||
if(parent_remote_url STREQUAL "")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(REGEX MATCH
|
|
||||||
"^(([A-Za-z0-9][A-Za-z0-9+.-]*)://)?(([^/@]+)@)?(\\[[A-Za-z0-9:]+\\]|[^/:]+)?([/:]/?)(.+(\\.git)?/?)$"
|
|
||||||
git_remote_url_components
|
|
||||||
"${parent_remote_url}"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(protocol "${CMAKE_MATCH_1}")
|
|
||||||
set(auth "${CMAKE_MATCH_3}")
|
|
||||||
set(host "${CMAKE_MATCH_5}")
|
|
||||||
set(separator "${CMAKE_MATCH_6}")
|
|
||||||
set(path "${CMAKE_MATCH_7}")
|
|
||||||
|
|
||||||
string(REPLACE "/" ";" remote_path_components "${path}")
|
|
||||||
string(REPLACE "/" ";" relative_path_components "${relative_remote_url}")
|
|
||||||
|
|
||||||
foreach(relative_path_component IN LISTS relative_path_components)
|
|
||||||
if(NOT relative_path_component STREQUAL "..")
|
|
||||||
break()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(LENGTH remote_path_components remote_path_component_count)
|
|
||||||
|
|
||||||
if(remote_path_component_count LESS 1)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(POP_BACK remote_path_components)
|
|
||||||
list(POP_FRONT relative_path_components)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
list(APPEND final_path_components ${remote_path_components} ${relative_path_components})
|
|
||||||
list(JOIN final_path_components "/" path)
|
|
||||||
|
|
||||||
set("${output_variable}" "${protocol}${auth}${host}${separator}${path}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# The output_variable will be set to the original git_repository if it
|
|
||||||
# could not be resolved (no error message is output). The original value is
|
|
||||||
# also returned if it doesn't need to be resolved.
|
|
||||||
function(_ep_resolve_git_remote
|
|
||||||
output_variable
|
|
||||||
git_repository
|
|
||||||
cmp0150
|
|
||||||
cmp0150_old_base_dir
|
|
||||||
)
|
|
||||||
if(git_repository STREQUAL "")
|
|
||||||
set("${output_variable}" "" PARENT_SCOPE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
_ep_is_relative_git_remote(_git_repository_is_relative "${git_repository}")
|
|
||||||
|
|
||||||
if(NOT _git_repository_is_relative)
|
|
||||||
set("${output_variable}" "${git_repository}" PARENT_SCOPE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(cmp0150 STREQUAL "NEW")
|
|
||||||
_ep_get_git_remote_url(_parent_git_remote_url "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
||||||
_ep_resolve_relative_git_remote(_resolved_git_remote_url "${_parent_git_remote_url}" "${git_repository}")
|
|
||||||
|
|
||||||
if(_resolved_git_remote_url STREQUAL "")
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"Failed to resolve relative git remote URL:\n"
|
|
||||||
" Relative URL: ${git_repository}\n"
|
|
||||||
" Parent URL: ${_parent_git_remote_url}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
set("${output_variable}" "${_resolved_git_remote_url}" PARENT_SCOPE)
|
|
||||||
return()
|
|
||||||
elseif(cmp0150 STREQUAL "")
|
|
||||||
cmake_policy(GET_WARNING CMP0150 _cmp0150_warning)
|
|
||||||
message(AUTHOR_WARNING
|
|
||||||
"${_cmp0150_warning}\n"
|
|
||||||
"A relative GIT_REPOSITORY path was detected. "
|
|
||||||
"This will be interpreted as a local path to where the project is being cloned. "
|
|
||||||
"Set GIT_REPOSITORY to an absolute path or set policy CMP0150 to NEW to avoid "
|
|
||||||
"this warning."
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set("${output_variable}" "${cmp0150_old_base_dir}/${git_repository}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
@ -1,20 +0,0 @@
|
|||||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
||||||
|
|
||||||
if(NOT CPACK_WIX_ROOT)
|
|
||||||
string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
|
|
||||||
PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
|
|
||||||
|
|
||||||
if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
|
|
||||||
message(FATAL_ERROR "Could not find the WiX candle executable.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(CPACK_WIX_LIGHT_EXECUTABLE light
|
|
||||||
PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
|
|
||||||
|
|
||||||
if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
|
|
||||||
message(FATAL_ERROR "Could not find the WiX light executable.")
|
|
||||||
endif()
|
|
@ -1 +0,0 @@
|
|||||||
set(CMAKE_Swift_SYSROOT_FLAG "-sdk")
|
|
@ -1,3 +0,0 @@
|
|||||||
include(Platform/Windows-GNU)
|
|
||||||
__windows_compiler_gnu(Fortran)
|
|
||||||
# TODO: MSVC ABI Support
|
|
@ -1,15 +1,15 @@
|
|||||||
.. versionchanged:: 3.27
|
.. versionchanged:: 3.27
|
||||||
|
|
||||||
Compatibility with versions of CMake older than 3.5 is deprecated.
|
Compatibility with versions of CMake older than 3.5 is deprecated.
|
||||||
Calls to :command:`cmake_minimum_required(VERSION)` or
|
Calls to :command:`cmake_minimum_required(VERSION)` or
|
||||||
:command:`cmake_policy(VERSION)` that do not specify at least
|
:command:`cmake_policy(VERSION)` that do not specify at least
|
||||||
3.5 as their policy version (optionally via ``...<max>``)
|
3.5 as their policy version (optionally via ``...<max>``)
|
||||||
will produce a deprecation warning in CMake 3.27 and above.
|
will produce a deprecation warning in CMake 3.27 and above.
|
||||||
|
|
||||||
.. versionchanged:: 3.19
|
.. versionchanged:: 3.19
|
||||||
|
|
||||||
Compatibility with versions of CMake older than 2.8.12 is deprecated.
|
Compatibility with versions of CMake older than 2.8.12 is deprecated.
|
||||||
Calls to :command:`cmake_minimum_required(VERSION)` or
|
Calls to :command:`cmake_minimum_required(VERSION)` or
|
||||||
:command:`cmake_policy(VERSION)` that do not specify at least
|
:command:`cmake_policy(VERSION)` that do not specify at least
|
||||||
2.8.12 as their policy version (optionally via ``...<max>``)
|
2.8.12 as their policy version (optionally via ``...<max>``)
|
||||||
will produce a deprecation warning in CMake 3.19 and above.
|
will produce a deprecation warning in CMake 3.19 and above.
|
@ -1,12 +1,12 @@
|
|||||||
Host And Device Specific Link Options
|
Host And Device Specific Link Options
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. versionadded:: 3.18
|
.. versionadded:: 3.18
|
||||||
When a device link step is involved, which is controlled by
|
When a device link step is involved, which is controlled by
|
||||||
:prop_tgt:`CUDA_SEPARABLE_COMPILATION` and
|
:prop_tgt:`CUDA_SEPARABLE_COMPILATION` and
|
||||||
:prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and policy :policy:`CMP0105`,
|
:prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and policy :policy:`CMP0105`,
|
||||||
the raw options will be delivered to the host and device link steps (wrapped in
|
the raw options will be delivered to the host and device link steps (wrapped in
|
||||||
``-Xcompiler`` or equivalent for device link). Options wrapped with
|
``-Xcompiler`` or equivalent for device link). Options wrapped with
|
||||||
:genex:`$<DEVICE_LINK:...>` generator expression will be used
|
:genex:`$<DEVICE_LINK:...>` generator expression will be used
|
||||||
only for the device link step. Options wrapped with :genex:`$<HOST_LINK:...>`
|
only for the device link step. Options wrapped with :genex:`$<HOST_LINK:...>`
|
||||||
generator expression will be used only for the host link step.
|
generator expression will be used only for the host link step.
|
@ -1,252 +1,253 @@
|
|||||||
A short-hand signature is:
|
A short-hand signature is:
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
|FIND_XXX| (<VAR> name1 [path1 path2 ...])
|
|FIND_XXX| (<VAR> name1 [path1 path2 ...])
|
||||||
|
|
||||||
The general signature is:
|
The general signature is:
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
|FIND_XXX| (
|
|FIND_XXX| (
|
||||||
<VAR>
|
<VAR>
|
||||||
name | |NAMES|
|
name | |NAMES|
|
||||||
[HINTS [path | ENV var]... ]
|
[HINTS [path | ENV var]... ]
|
||||||
[PATHS [path | ENV var]... ]
|
[PATHS [path | ENV var]... ]
|
||||||
[REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
|
[REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
|
||||||
[PATH_SUFFIXES suffix1 [suffix2 ...]]
|
[PATH_SUFFIXES suffix1 [suffix2 ...]]
|
||||||
[VALIDATOR function]
|
[VALIDATOR function]
|
||||||
[DOC "cache documentation string"]
|
[DOC "cache documentation string"]
|
||||||
[NO_CACHE]
|
[NO_CACHE]
|
||||||
[REQUIRED]
|
[REQUIRED]
|
||||||
[NO_DEFAULT_PATH]
|
[NO_DEFAULT_PATH]
|
||||||
[NO_PACKAGE_ROOT_PATH]
|
[NO_PACKAGE_ROOT_PATH]
|
||||||
[NO_CMAKE_PATH]
|
[NO_CMAKE_PATH]
|
||||||
[NO_CMAKE_ENVIRONMENT_PATH]
|
[NO_CMAKE_ENVIRONMENT_PATH]
|
||||||
[NO_SYSTEM_ENVIRONMENT_PATH]
|
[NO_SYSTEM_ENVIRONMENT_PATH]
|
||||||
[NO_CMAKE_SYSTEM_PATH]
|
[NO_CMAKE_SYSTEM_PATH]
|
||||||
[NO_CMAKE_INSTALL_PREFIX]
|
[NO_CMAKE_INSTALL_PREFIX]
|
||||||
[CMAKE_FIND_ROOT_PATH_BOTH |
|
[CMAKE_FIND_ROOT_PATH_BOTH |
|
||||||
ONLY_CMAKE_FIND_ROOT_PATH |
|
ONLY_CMAKE_FIND_ROOT_PATH |
|
||||||
NO_CMAKE_FIND_ROOT_PATH]
|
NO_CMAKE_FIND_ROOT_PATH]
|
||||||
)
|
)
|
||||||
|
|
||||||
This command is used to find a |SEARCH_XXX_DESC|.
|
This command is used to find a |SEARCH_XXX_DESC|.
|
||||||
A cache entry, or a normal variable if ``NO_CACHE`` is specified,
|
A cache entry, or a normal variable if ``NO_CACHE`` is specified,
|
||||||
named by ``<VAR>`` is created to store the result of this command.
|
named by ``<VAR>`` is created to store the result of this command.
|
||||||
If the |SEARCH_XXX| is found the result is stored in the variable
|
If the |SEARCH_XXX| is found the result is stored in the variable
|
||||||
and the search will not be repeated unless the variable is cleared.
|
and the search will not be repeated unless the variable is cleared.
|
||||||
If nothing is found, the result will be ``<VAR>-NOTFOUND``.
|
If nothing is found, the result will be ``<VAR>-NOTFOUND``.
|
||||||
|
|
||||||
Options include:
|
Options include:
|
||||||
|
|
||||||
``NAMES``
|
``NAMES``
|
||||||
Specify one or more possible names for the |SEARCH_XXX|.
|
Specify one or more possible names for the |SEARCH_XXX|.
|
||||||
|
|
||||||
When using this to specify names with and without a version
|
When using this to specify names with and without a version
|
||||||
suffix, we recommend specifying the unversioned name first
|
suffix, we recommend specifying the unversioned name first
|
||||||
so that locally-built packages can be found before those
|
so that locally-built packages can be found before those
|
||||||
provided by distributions.
|
provided by distributions.
|
||||||
|
|
||||||
``HINTS``, ``PATHS``
|
``HINTS``, ``PATHS``
|
||||||
Specify directories to search in addition to the default locations.
|
Specify directories to search in addition to the default locations.
|
||||||
The ``ENV var`` sub-option reads paths from a system environment
|
The ``ENV var`` sub-option reads paths from a system environment
|
||||||
variable.
|
variable.
|
||||||
|
|
||||||
.. versionchanged:: 3.24
|
.. versionchanged:: 3.24
|
||||||
On ``Windows`` platform, it is possible to include registry queries as part
|
On ``Windows`` platform, it is possible to include registry queries as part
|
||||||
of the directories, using a :ref:`dedicated syntax <Find Using Windows Registry>`.
|
of the directories, using a :ref:`dedicated syntax <Find Using Windows Registry>`.
|
||||||
Such specifications will be ignored on all other platforms.
|
Such specifications will be ignored on all other platforms.
|
||||||
|
|
||||||
``REGISTRY_VIEW``
|
``REGISTRY_VIEW``
|
||||||
.. versionadded:: 3.24
|
.. versionadded:: 3.24
|
||||||
|
|
||||||
.. include:: FIND_XXX_REGISTRY_VIEW.txt
|
.. include:: FIND_XXX_REGISTRY_VIEW.txt
|
||||||
|
|
||||||
``PATH_SUFFIXES``
|
``PATH_SUFFIXES``
|
||||||
Specify additional subdirectories to check below each directory
|
Specify additional subdirectories to check below each directory
|
||||||
location otherwise considered.
|
location otherwise considered.
|
||||||
|
|
||||||
``VALIDATOR``
|
``VALIDATOR``
|
||||||
.. versionadded:: 3.25
|
.. versionadded:: 3.25
|
||||||
|
|
||||||
Specify a :command:`function` to be called for each candidate item found
|
Specify a :command:`function` to be called for each candidate item found
|
||||||
(a :command:`macro` cannot be provided, that will result in an error).
|
(a :command:`macro` cannot be provided, that will result in an error).
|
||||||
Two arguments will be passed to the validator function: the name of a
|
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
|
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
|
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
|
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.
|
variable will hold a true value when the validator function is entered.
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
function(my_check validator_result_var item)
|
function(my_check validator_result_var item)
|
||||||
if(NOT item MATCHES ...)
|
if(NOT item MATCHES ...)
|
||||||
set(${validator_result_var} FALSE PARENT_SCOPE)
|
set(${validator_result_var} FALSE PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|FIND_XXX| (result NAMES ... VALIDATOR my_check)
|
|FIND_XXX| (result NAMES ... VALIDATOR my_check)
|
||||||
|
|
||||||
Note that if a cached result is used, the search is skipped and any
|
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
|
``VALIDATOR`` is ignored. The cached result is not required to pass the
|
||||||
validation function.
|
validation function.
|
||||||
|
|
||||||
``DOC``
|
``DOC``
|
||||||
Specify the documentation string for the ``<VAR>`` cache entry.
|
Specify the documentation string for the ``<VAR>`` cache entry.
|
||||||
|
|
||||||
``NO_CACHE``
|
``NO_CACHE``
|
||||||
.. versionadded:: 3.21
|
.. versionadded:: 3.21
|
||||||
|
|
||||||
The result of the search will be stored in a normal variable rather than
|
The result of the search will be stored in a normal variable rather than
|
||||||
a cache entry.
|
a cache entry.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If the variable is already set before the call (as a normal or cache
|
If the variable is already set before the call (as a normal or cache
|
||||||
variable) then the search will not occur.
|
variable) then the search will not occur.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
This option should be used with caution because it can greatly increase
|
This option should be used with caution because it can greatly increase
|
||||||
the cost of repeated configure steps.
|
the cost of repeated configure steps.
|
||||||
|
|
||||||
``REQUIRED``
|
``REQUIRED``
|
||||||
.. versionadded:: 3.18
|
.. versionadded:: 3.18
|
||||||
|
|
||||||
Stop processing with an error message if nothing is found, otherwise
|
Stop processing with an error message if nothing is found, otherwise
|
||||||
the search will be attempted again the next time |FIND_XXX| is invoked
|
the search will be attempted again the next time |FIND_XXX| is invoked
|
||||||
with the same variable.
|
with the same variable.
|
||||||
|
|
||||||
If ``NO_DEFAULT_PATH`` is specified, then no additional paths are
|
If ``NO_DEFAULT_PATH`` is specified, then no additional paths are
|
||||||
added to the search.
|
added to the search.
|
||||||
If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
|
If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
|
||||||
|
|
||||||
.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| replace::
|
.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| replace::
|
||||||
|prefix_XXX_SUBDIR| for each ``<prefix>`` in the
|
|prefix_XXX_SUBDIR| for each ``<prefix>`` in the
|
||||||
:variable:`<PackageName>_ROOT` CMake variable and the
|
:variable:`<PackageName>_ROOT` CMake variable and the
|
||||||
:envvar:`<PackageName>_ROOT` environment variable if
|
:envvar:`<PackageName>_ROOT` environment variable if
|
||||||
called from within a find module loaded by
|
called from within a find module loaded by
|
||||||
:command:`find_package(<PackageName>)`
|
:command:`find_package(<PackageName>)`
|
||||||
|
|
||||||
.. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace::
|
.. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace::
|
||||||
|prefix_XXX_SUBDIR| for each ``<prefix>`` in :variable:`CMAKE_PREFIX_PATH`
|
|prefix_XXX_SUBDIR| for each ``<prefix>`` in :variable:`CMAKE_PREFIX_PATH`
|
||||||
|
|
||||||
.. |ENV_CMAKE_PREFIX_PATH_XXX_SUBDIR| replace::
|
.. |ENV_CMAKE_PREFIX_PATH_XXX_SUBDIR| replace::
|
||||||
|prefix_XXX_SUBDIR| for each ``<prefix>`` in :envvar:`CMAKE_PREFIX_PATH`
|
|prefix_XXX_SUBDIR| for each ``<prefix>`` in :envvar:`CMAKE_PREFIX_PATH`
|
||||||
|
|
||||||
.. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace::
|
.. |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR| replace::
|
||||||
|prefix_XXX_SUBDIR| for each ``<prefix>/[s]bin`` in ``PATH``, and
|
|prefix_XXX_SUBDIR| for each ``<prefix>/[s]bin`` in ``PATH``, and
|
||||||
|entry_XXX_SUBDIR| for other entries in ``PATH``
|
|entry_XXX_SUBDIR| for other entries in ``PATH``
|
||||||
|
|
||||||
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace::
|
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| replace::
|
||||||
|prefix_XXX_SUBDIR| for each ``<prefix>`` in
|
|prefix_XXX_SUBDIR| for each ``<prefix>`` in
|
||||||
:variable:`CMAKE_SYSTEM_PREFIX_PATH`
|
:variable:`CMAKE_SYSTEM_PREFIX_PATH`
|
||||||
|
|
||||||
1. If called from within a find module or any other script loaded by a call to
|
1. If called from within a find module or any other script loaded by a call to
|
||||||
:command:`find_package(<PackageName>)`, search prefixes unique to the
|
:command:`find_package(<PackageName>)`, search prefixes unique to the
|
||||||
current package being found. See policy :policy:`CMP0074`.
|
current package being found. See policy :policy:`CMP0074`.
|
||||||
|
|
||||||
.. versionadded:: 3.12
|
.. versionadded:: 3.12
|
||||||
|
|
||||||
Specifically, search paths specified by the following variables, in order:
|
Specifically, search paths specified by the following variables, in order:
|
||||||
|
|
||||||
a. :variable:`<PackageName>_ROOT` CMake variable,
|
a. :variable:`<PackageName>_ROOT` CMake variable,
|
||||||
where ``<PackageName>`` is the case-preserved package name.
|
where ``<PackageName>`` is the case-preserved package name.
|
||||||
|
|
||||||
b. :variable:`<PACKAGENAME>_ROOT` CMake variable,
|
b. :variable:`<PACKAGENAME>_ROOT` CMake variable,
|
||||||
where ``<PACKAGENAME>`` is the upper-cased package name.
|
where ``<PACKAGENAME>`` is the upper-cased package name.
|
||||||
See policy :policy:`CMP0144`.
|
See policy :policy:`CMP0144`.
|
||||||
|
|
||||||
.. versionadded:: 3.27
|
.. versionadded:: 3.27
|
||||||
|
|
||||||
c. :envvar:`<PackageName>_ROOT` environment variable,
|
c. :envvar:`<PackageName>_ROOT` environment variable,
|
||||||
where ``<PackageName>`` is the case-preserved package name.
|
where ``<PackageName>`` is the case-preserved package name.
|
||||||
|
|
||||||
d. :envvar:`<PACKAGENAME>_ROOT` environment variable,
|
d. :envvar:`<PACKAGENAME>_ROOT` environment variable,
|
||||||
where ``<PACKAGENAME>`` is the upper-cased package name.
|
where ``<PACKAGENAME>`` is the upper-cased package name.
|
||||||
See policy :policy:`CMP0144`.
|
See policy :policy:`CMP0144`.
|
||||||
|
|
||||||
.. versionadded:: 3.27
|
.. versionadded:: 3.27
|
||||||
|
|
||||||
The package root variables are maintained as a stack, so if called from
|
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
|
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 config package will be searched after paths from the current
|
||||||
module or package. In other words, the search order would be
|
module or package. In other words, the search order would be
|
||||||
``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
|
``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
|
||||||
``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc.
|
``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc.
|
||||||
This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
|
This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
|
||||||
the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
|
the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
|
||||||
|
|
||||||
* |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX|
|
* |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX|
|
||||||
|
|
||||||
2. Search paths specified in cmake-specific cache variables.
|
2. Search paths specified in cmake-specific cache variables.
|
||||||
These are intended to be used on the command line with a ``-DVAR=value``.
|
These are intended to be used on the command line with a ``-DVAR=value``.
|
||||||
The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
|
The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
|
||||||
This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
|
This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
|
||||||
:variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``.
|
:variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``.
|
||||||
|
|
||||||
* |CMAKE_PREFIX_PATH_XXX|
|
* |CMAKE_PREFIX_PATH_XXX|
|
||||||
* |CMAKE_XXX_PATH|
|
* |CMAKE_XXX_PATH|
|
||||||
* |CMAKE_XXX_MAC_PATH|
|
* |CMAKE_XXX_MAC_PATH|
|
||||||
|
|
||||||
3. Search paths specified in cmake-specific environment variables.
|
3. Search paths specified in cmake-specific environment variables.
|
||||||
These are intended to be set in the user's shell configuration,
|
These are intended to be set in the user's shell configuration,
|
||||||
and therefore use the host's native path separator
|
and therefore use the host's native path separator
|
||||||
(``;`` on Windows and ``:`` on UNIX).
|
(``;`` on Windows and ``:`` on UNIX).
|
||||||
This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or
|
This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or
|
||||||
by setting the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``.
|
by setting the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``.
|
||||||
|
|
||||||
* |ENV_CMAKE_PREFIX_PATH_XXX|
|
* |ENV_CMAKE_PREFIX_PATH_XXX|
|
||||||
* |ENV_CMAKE_XXX_PATH|
|
* |ENV_CMAKE_XXX_PATH|
|
||||||
* |ENV_CMAKE_XXX_MAC_PATH|
|
* |ENV_CMAKE_XXX_MAC_PATH|
|
||||||
|
|
||||||
4. Search the paths specified by the ``HINTS`` option.
|
4. Search the paths specified by the ``HINTS`` option.
|
||||||
These should be paths computed by system introspection, such as a
|
These should be paths computed by system introspection, such as a
|
||||||
hint provided by the location of another item already found.
|
hint provided by the location of another item already found.
|
||||||
Hard-coded guesses should be specified with the ``PATHS`` option.
|
Hard-coded guesses should be specified with the ``PATHS`` option.
|
||||||
|
|
||||||
5. Search the standard system environment variables.
|
5. Search the standard system environment variables.
|
||||||
This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by
|
This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by
|
||||||
setting the :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``.
|
setting the :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``.
|
||||||
|
|
||||||
* |SYSTEM_ENVIRONMENT_PATH_XXX|
|
* |SYSTEM_ENVIRONMENT_PATH_XXX|
|
||||||
* |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX|
|
|
||||||
|
|SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX|
|
||||||
6. Search cmake variables defined in the Platform files
|
|
||||||
for the current system. The searching of ``CMAKE_INSTALL_PREFIX`` and
|
6. Search cmake variables defined in the Platform files
|
||||||
``CMAKE_STAGING_PREFIX`` can be
|
for the current system. The searching of ``CMAKE_INSTALL_PREFIX`` and
|
||||||
skipped if ``NO_CMAKE_INSTALL_PREFIX`` is passed or by setting the
|
``CMAKE_STAGING_PREFIX`` can be
|
||||||
:variable:`CMAKE_FIND_USE_INSTALL_PREFIX` to ``FALSE``. All these locations
|
skipped if ``NO_CMAKE_INSTALL_PREFIX`` is passed or by setting the
|
||||||
can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed or by setting the
|
:variable:`CMAKE_FIND_USE_INSTALL_PREFIX` to ``FALSE``. All these locations
|
||||||
:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH` to ``FALSE``.
|
can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed or by setting the
|
||||||
|
:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH` to ``FALSE``.
|
||||||
* |CMAKE_SYSTEM_PREFIX_PATH_XXX|
|
|
||||||
* |CMAKE_SYSTEM_XXX_PATH|
|
* |CMAKE_SYSTEM_PREFIX_PATH_XXX|
|
||||||
* |CMAKE_SYSTEM_XXX_MAC_PATH|
|
* |CMAKE_SYSTEM_XXX_PATH|
|
||||||
|
* |CMAKE_SYSTEM_XXX_MAC_PATH|
|
||||||
The platform paths that these variables contain are locations that
|
|
||||||
typically include installed software. An example being ``/usr/local`` for
|
The platform paths that these variables contain are locations that
|
||||||
UNIX based platforms.
|
typically include installed software. An example being ``/usr/local`` for
|
||||||
|
UNIX based platforms.
|
||||||
7. Search the paths specified by the PATHS option
|
|
||||||
or in the short-hand version of the command.
|
7. Search the paths specified by the PATHS option
|
||||||
These are typically hard-coded guesses.
|
or in the short-hand version of the command.
|
||||||
|
These are typically hard-coded guesses.
|
||||||
The :variable:`CMAKE_IGNORE_PATH`, :variable:`CMAKE_IGNORE_PREFIX_PATH`,
|
|
||||||
:variable:`CMAKE_SYSTEM_IGNORE_PATH` and
|
The :variable:`CMAKE_IGNORE_PATH`, :variable:`CMAKE_IGNORE_PREFIX_PATH`,
|
||||||
:variable:`CMAKE_SYSTEM_IGNORE_PREFIX_PATH` variables can also cause some
|
:variable:`CMAKE_SYSTEM_IGNORE_PATH` and
|
||||||
of the above locations to be ignored.
|
:variable:`CMAKE_SYSTEM_IGNORE_PREFIX_PATH` variables can also cause some
|
||||||
|
of the above locations to be ignored.
|
||||||
.. versionadded:: 3.16
|
|
||||||
Added ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable
|
.. versionadded:: 3.16
|
||||||
various search locations.
|
Added ``CMAKE_FIND_USE_<CATEGORY>_PATH`` variables to globally disable
|
||||||
|
various search locations.
|
||||||
.. |FIND_ARGS_XXX| replace:: <VAR> NAMES name
|
|
||||||
|
.. |FIND_ARGS_XXX| replace:: <VAR> NAMES name
|
||||||
On macOS the :variable:`CMAKE_FIND_FRAMEWORK` and
|
|
||||||
:variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of
|
On macOS the :variable:`CMAKE_FIND_FRAMEWORK` and
|
||||||
preference between Apple-style and unix-style package components.
|
:variable:`CMAKE_FIND_APPBUNDLE` variables determine the order of
|
||||||
|
preference between Apple-style and unix-style package components.
|
||||||
.. include:: FIND_XXX_ROOT.txt
|
|
||||||
.. include:: FIND_XXX_ORDER.txt
|
.. include:: FIND_XXX_ROOT.txt
|
||||||
|
.. include:: FIND_XXX_ORDER.txt
|
@ -1,12 +1,12 @@
|
|||||||
The default search order is designed to be most-specific to
|
The default search order is designed to be most-specific to
|
||||||
least-specific for common use cases.
|
least-specific for common use cases.
|
||||||
Projects may override the order by simply calling the command
|
Projects may override the order by simply calling the command
|
||||||
multiple times and using the ``NO_*`` options:
|
multiple times and using the ``NO_*`` options:
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
|FIND_XXX| (|FIND_ARGS_XXX| PATHS paths... NO_DEFAULT_PATH)
|
|FIND_XXX| (|FIND_ARGS_XXX| PATHS paths... NO_DEFAULT_PATH)
|
||||||
|FIND_XXX| (|FIND_ARGS_XXX|)
|
|FIND_XXX| (|FIND_ARGS_XXX|)
|
||||||
|
|
||||||
Once one of the calls succeeds the result variable will be set
|
Once one of the calls succeeds the result variable will be set
|
||||||
and stored in the cache so that no call will search again.
|
and stored in the cache so that no call will search again.
|
@ -1,41 +1,41 @@
|
|||||||
Specify which registry views must be queried. This option is only meaningful
|
Specify which registry views must be queried. This option is only meaningful
|
||||||
on ``Windows`` platforms and will be ignored on other ones. When not
|
on ``Windows`` platforms and will be ignored on other ones. When not
|
||||||
specified, the |FIND_XXX_REGISTRY_VIEW_DEFAULT| view is used when the
|
specified, the |FIND_XXX_REGISTRY_VIEW_DEFAULT| view is used when the
|
||||||
:policy:`CMP0134` policy is ``NEW``. Refer to :policy:`CMP0134` for the
|
:policy:`CMP0134` policy is ``NEW``. Refer to :policy:`CMP0134` for the
|
||||||
default view when the policy is ``OLD``.
|
default view when the policy is ``OLD``.
|
||||||
|
|
||||||
``64``
|
``64``
|
||||||
Query the 64-bit registry. On 32-bit Windows, it always returns the string
|
Query the 64-bit registry. On 32-bit Windows, it always returns the string
|
||||||
``/REGISTRY-NOTFOUND``.
|
``/REGISTRY-NOTFOUND``.
|
||||||
|
|
||||||
``32``
|
``32``
|
||||||
Query the 32-bit registry.
|
Query the 32-bit registry.
|
||||||
|
|
||||||
``64_32``
|
``64_32``
|
||||||
Query both views (``64`` and ``32``) and generate a path for each.
|
Query both views (``64`` and ``32``) and generate a path for each.
|
||||||
|
|
||||||
``32_64``
|
``32_64``
|
||||||
Query both views (``32`` and ``64``) and generate a path for each.
|
Query both views (``32`` and ``64``) and generate a path for each.
|
||||||
|
|
||||||
``HOST``
|
``HOST``
|
||||||
Query the registry matching the architecture of the host: ``64`` on 64-bit
|
Query the registry matching the architecture of the host: ``64`` on 64-bit
|
||||||
Windows and ``32`` on 32-bit Windows.
|
Windows and ``32`` on 32-bit Windows.
|
||||||
|
|
||||||
``TARGET``
|
``TARGET``
|
||||||
Query the registry matching the architecture specified by the
|
Query the registry matching the architecture specified by the
|
||||||
:variable:`CMAKE_SIZEOF_VOID_P` variable. If not defined, fall back to
|
:variable:`CMAKE_SIZEOF_VOID_P` variable. If not defined, fall back to
|
||||||
``HOST`` view.
|
``HOST`` view.
|
||||||
|
|
||||||
``BOTH``
|
``BOTH``
|
||||||
Query both views (``32`` and ``64``). The order depends on the following
|
Query both views (``32`` and ``64``). The order depends on the following
|
||||||
rules: If the :variable:`CMAKE_SIZEOF_VOID_P` variable is defined, use the
|
rules: If the :variable:`CMAKE_SIZEOF_VOID_P` variable is defined, use the
|
||||||
following view depending on the content of this variable:
|
following view depending on the content of this variable:
|
||||||
|
|
||||||
* ``8``: ``64_32``
|
* ``8``: ``64_32``
|
||||||
* ``4``: ``32_64``
|
* ``4``: ``32_64``
|
||||||
|
|
||||||
If the :variable:`CMAKE_SIZEOF_VOID_P` variable is not defined, rely on the
|
If the :variable:`CMAKE_SIZEOF_VOID_P` variable is not defined, rely on the
|
||||||
architecture of the host:
|
architecture of the host:
|
||||||
|
|
||||||
* 64-bit: ``64_32``
|
* 64-bit: ``64_32``
|
||||||
* 32-bit: ``32``
|
* 32-bit: ``32``
|
@ -1,29 +1,29 @@
|
|||||||
The CMake variable :variable:`CMAKE_FIND_ROOT_PATH` specifies one or more
|
The CMake variable :variable:`CMAKE_FIND_ROOT_PATH` specifies one or more
|
||||||
directories to be prepended to all other search directories. This
|
directories to be prepended to all other search directories. This
|
||||||
effectively "re-roots" the entire search under given locations.
|
effectively "re-roots" the entire search under given locations.
|
||||||
Paths which are descendants of the :variable:`CMAKE_STAGING_PREFIX` are excluded
|
Paths which are descendants of the :variable:`CMAKE_STAGING_PREFIX` are excluded
|
||||||
from this re-rooting, because that variable is always a path on the host system.
|
from this re-rooting, because that variable is always a path on the host system.
|
||||||
By default the :variable:`CMAKE_FIND_ROOT_PATH` is empty.
|
By default the :variable:`CMAKE_FIND_ROOT_PATH` is empty.
|
||||||
|
|
||||||
The :variable:`CMAKE_SYSROOT` variable can also be used to specify exactly one
|
The :variable:`CMAKE_SYSROOT` variable can also be used to specify exactly one
|
||||||
directory to use as a prefix. Setting :variable:`CMAKE_SYSROOT` also has other
|
directory to use as a prefix. Setting :variable:`CMAKE_SYSROOT` also has other
|
||||||
effects. See the documentation for that variable for more.
|
effects. See the documentation for that variable for more.
|
||||||
|
|
||||||
These variables are especially useful when cross-compiling to
|
These variables are especially useful when cross-compiling to
|
||||||
point to the root directory of the target environment and CMake will
|
point to the root directory of the target environment and CMake will
|
||||||
search there too. By default at first the directories listed in
|
search there too. By default at first the directories listed in
|
||||||
:variable:`CMAKE_FIND_ROOT_PATH` are searched, then the :variable:`CMAKE_SYSROOT`
|
:variable:`CMAKE_FIND_ROOT_PATH` are searched, then the :variable:`CMAKE_SYSROOT`
|
||||||
directory is searched, and then the non-rooted directories will be
|
directory is searched, and then the non-rooted directories will be
|
||||||
searched. The default behavior can be adjusted by setting
|
searched. The default behavior can be adjusted by setting
|
||||||
|CMAKE_FIND_ROOT_PATH_MODE_XXX|. This behavior can be manually
|
|CMAKE_FIND_ROOT_PATH_MODE_XXX|. This behavior can be manually
|
||||||
overridden on a per-call basis using options:
|
overridden on a per-call basis using options:
|
||||||
|
|
||||||
``CMAKE_FIND_ROOT_PATH_BOTH``
|
``CMAKE_FIND_ROOT_PATH_BOTH``
|
||||||
Search in the order described above.
|
Search in the order described above.
|
||||||
|
|
||||||
``NO_CMAKE_FIND_ROOT_PATH``
|
``NO_CMAKE_FIND_ROOT_PATH``
|
||||||
Do not use the :variable:`CMAKE_FIND_ROOT_PATH` variable.
|
Do not use the :variable:`CMAKE_FIND_ROOT_PATH` variable.
|
||||||
|
|
||||||
``ONLY_CMAKE_FIND_ROOT_PATH``
|
``ONLY_CMAKE_FIND_ROOT_PATH``
|
||||||
Search only the re-rooted directories and directories below
|
Search only the re-rooted directories and directories below
|
||||||
:variable:`CMAKE_STAGING_PREFIX`.
|
:variable:`CMAKE_STAGING_PREFIX`.
|
@ -1,6 +1,6 @@
|
|||||||
.. |more_see_also| replace:: See the :manual:`cmake-buildsystem(7)` manual
|
.. |more_see_also| replace:: See the :manual:`cmake-buildsystem(7)` manual
|
||||||
for more on defining buildsystem properties.
|
for more on defining buildsystem properties.
|
||||||
|
|
||||||
Arguments to |command_name| may use generator expressions
|
Arguments to |command_name| may use generator expressions
|
||||||
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
||||||
manual for available expressions. |more_see_also|
|
manual for available expressions. |more_see_also|
|
@ -1,25 +1,25 @@
|
|||||||
Handling Compiler Driver Differences
|
Handling Compiler Driver Differences
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
To pass options to the linker tool, each compiler driver has its own syntax.
|
To pass options to the linker tool, each compiler driver has its own syntax.
|
||||||
The ``LINKER:`` prefix and ``,`` separator can be used to specify, in a portable
|
The ``LINKER:`` prefix and ``,`` separator can be used to specify, in a portable
|
||||||
way, options to pass to the linker tool. ``LINKER:`` is replaced by the
|
way, options to pass to the linker tool. ``LINKER:`` is replaced by the
|
||||||
appropriate driver option and ``,`` by the appropriate driver separator.
|
appropriate driver option and ``,`` by the appropriate driver separator.
|
||||||
The driver prefix and driver separator are given by the values of the
|
The driver prefix and driver separator are given by the values of the
|
||||||
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
|
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
|
||||||
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.
|
:variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.
|
||||||
|
|
||||||
For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for
|
For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for
|
||||||
``Clang`` and ``-Wl,-z,defs`` for ``GNU GCC``.
|
``Clang`` and ``-Wl,-z,defs`` for ``GNU GCC``.
|
||||||
|
|
||||||
The ``LINKER:`` prefix can be specified as part of a ``SHELL:`` prefix
|
The ``LINKER:`` prefix can be specified as part of a ``SHELL:`` prefix
|
||||||
expression.
|
expression.
|
||||||
|
|
||||||
The ``LINKER:`` prefix supports, as an alternative syntax, specification of
|
The ``LINKER:`` prefix supports, as an alternative syntax, specification of
|
||||||
arguments using the ``SHELL:`` prefix and space as separator. The previous
|
arguments using the ``SHELL:`` prefix and space as separator. The previous
|
||||||
example then becomes ``"LINKER:SHELL:-z defs"``.
|
example then becomes ``"LINKER:SHELL:-z defs"``.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
|
Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
|
||||||
``LINKER:`` prefix is not supported.
|
``LINKER:`` prefix is not supported.
|
@ -1,15 +1,15 @@
|
|||||||
Option De-duplication
|
Option De-duplication
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The final set of options used for a target is constructed by
|
The final set of options used for a target is constructed by
|
||||||
accumulating options from the current target and the usage requirements of
|
accumulating options from the current target and the usage requirements of
|
||||||
its dependencies. The set of options is de-duplicated to avoid repetition.
|
its dependencies. The set of options is de-duplicated to avoid repetition.
|
||||||
|
|
||||||
.. versionadded:: 3.12
|
.. versionadded:: 3.12
|
||||||
While beneficial for individual options, the de-duplication step can break
|
While beneficial for individual options, the de-duplication step can break
|
||||||
up option groups. For example, ``-option A -option B`` becomes
|
up option groups. For example, ``-option A -option B`` becomes
|
||||||
``-option A B``. One may specify a group of options using shell-like
|
``-option A B``. One may specify a group of options using shell-like
|
||||||
quoting along with a ``SHELL:`` prefix. The ``SHELL:`` prefix is dropped,
|
quoting along with a ``SHELL:`` prefix. The ``SHELL:`` prefix is dropped,
|
||||||
and the rest of the option string is parsed using the
|
and the rest of the option string is parsed using the
|
||||||
:command:`separate_arguments` ``UNIX_COMMAND`` mode. For example,
|
:command:`separate_arguments` ``UNIX_COMMAND`` mode. For example,
|
||||||
``"SHELL:-option A" "SHELL:-option B"`` becomes ``-option A -option B``.
|
``"SHELL:-option A" "SHELL:-option B"`` becomes ``-option A -option B``.
|
@ -1,25 +1,25 @@
|
|||||||
|
|
||||||
Supported languages are ``C``, ``CXX`` (i.e. C++), ``CSharp`` (i.e. C#), ``CUDA``,
|
Supported languages are ``C``, ``CXX`` (i.e. C++), ``CSharp`` (i.e. C#), ``CUDA``,
|
||||||
``OBJC`` (i.e. Objective-C), ``OBJCXX`` (i.e. Objective-C++), ``Fortran``, ``HIP``,
|
``OBJC`` (i.e. Objective-C), ``OBJCXX`` (i.e. Objective-C++), ``Fortran``, ``HIP``,
|
||||||
``ISPC``, ``Swift``, ``ASM``, ``ASM_NASM``, ``ASM_MARMASM``, ``ASM_MASM``, and ``ASM-ATT``.
|
``ISPC``, ``Swift``, ``ASM``, ``ASM_NASM``, ``ASM_MARMASM``, ``ASM_MASM``, and ``ASM-ATT``.
|
||||||
|
|
||||||
.. versionadded:: 3.8
|
.. versionadded:: 3.8
|
||||||
Added ``CSharp`` and ``CUDA`` support.
|
Added ``CSharp`` and ``CUDA`` support.
|
||||||
|
|
||||||
.. versionadded:: 3.15
|
.. versionadded:: 3.15
|
||||||
Added ``Swift`` support.
|
Added ``Swift`` support.
|
||||||
|
|
||||||
.. versionadded:: 3.16
|
.. versionadded:: 3.16
|
||||||
Added ``OBJC`` and ``OBJCXX`` support.
|
Added ``OBJC`` and ``OBJCXX`` support.
|
||||||
|
|
||||||
.. versionadded:: 3.18
|
.. versionadded:: 3.18
|
||||||
Added ``ISPC`` support.
|
Added ``ISPC`` support.
|
||||||
|
|
||||||
.. versionadded:: 3.21
|
.. versionadded:: 3.21
|
||||||
Added ``HIP`` support.
|
Added ``HIP`` support.
|
||||||
|
|
||||||
.. versionadded:: 3.26
|
.. versionadded:: 3.26
|
||||||
Added ``ASM_MARMASM`` support.
|
Added ``ASM_MARMASM`` support.
|
||||||
|
|
||||||
If enabling ``ASM``, list it last so that CMake can check whether
|
If enabling ``ASM``, list it last so that CMake can check whether
|
||||||
compilers for other languages like ``C`` work for assembly too.
|
compilers for other languages like ``C`` work for assembly too.
|
@ -1,9 +1,9 @@
|
|||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
When evaluating :ref:`Variable References` of the form ``${VAR}``, CMake
|
When evaluating :ref:`Variable References` of the form ``${VAR}``, CMake
|
||||||
first searches for a normal variable with that name. If no such normal
|
first searches for a normal variable with that name. If no such normal
|
||||||
variable exists, CMake will then search for a cache entry with that name.
|
variable exists, CMake will then search for a cache entry with that name.
|
||||||
Because of this, **unsetting a normal variable can expose a cache variable
|
Because of this, **unsetting a normal variable can expose a cache variable
|
||||||
that was previously hidden**. To force a variable reference of the form
|
that was previously hidden**. To force a variable reference of the form
|
||||||
``${VAR}`` to return an empty string, use ``set(<variable> "")``, which
|
``${VAR}`` to return an empty string, use ``set(<variable> "")``, which
|
||||||
clears the normal variable but leaves it defined.
|
clears the normal variable but leaves it defined.
|
@ -1,33 +1,33 @@
|
|||||||
add_compile_definitions
|
add_compile_definitions
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
.. versionadded:: 3.12
|
.. versionadded:: 3.12
|
||||||
|
|
||||||
Add preprocessor definitions to the compilation of source files.
|
Add preprocessor definitions to the compilation of source files.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_compile_definitions(<definition> ...)
|
add_compile_definitions(<definition> ...)
|
||||||
|
|
||||||
Adds preprocessor definitions to the compiler command line.
|
Adds preprocessor definitions to the compiler command line.
|
||||||
|
|
||||||
The preprocessor definitions are added to the :prop_dir:`COMPILE_DEFINITIONS`
|
The preprocessor definitions are added to the :prop_dir:`COMPILE_DEFINITIONS`
|
||||||
directory property for the current ``CMakeLists`` file. They are also added to
|
directory property for the current ``CMakeLists`` file. They are also added to
|
||||||
the :prop_tgt:`COMPILE_DEFINITIONS` target property for each target in the
|
the :prop_tgt:`COMPILE_DEFINITIONS` target property for each target in the
|
||||||
current ``CMakeLists`` file.
|
current ``CMakeLists`` file.
|
||||||
|
|
||||||
Definitions are specified using the syntax ``VAR`` or ``VAR=value``.
|
Definitions are specified using the syntax ``VAR`` or ``VAR=value``.
|
||||||
Function-style definitions are not supported. CMake will automatically
|
Function-style definitions are not supported. CMake will automatically
|
||||||
escape the value correctly for the native build system (note that CMake
|
escape the value correctly for the native build system (note that CMake
|
||||||
language syntax may require escapes to specify some values).
|
language syntax may require escapes to specify some values).
|
||||||
|
|
||||||
.. versionadded:: 3.26
|
.. versionadded:: 3.26
|
||||||
Any leading ``-D`` on an item will be removed.
|
Any leading ``-D`` on an item will be removed.
|
||||||
|
|
||||||
.. |command_name| replace:: ``add_compile_definitions``
|
.. |command_name| replace:: ``add_compile_definitions``
|
||||||
.. include:: GENEX_NOTE.txt
|
.. include:: GENEX_NOTE.txt
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* The command :command:`target_compile_definitions` adds target-specific definitions.
|
* The command :command:`target_compile_definitions` adds target-specific definitions.
|
@ -1,67 +1,67 @@
|
|||||||
add_compile_options
|
add_compile_options
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Add options to the compilation of source files.
|
Add options to the compilation of source files.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_compile_options(<option> ...)
|
add_compile_options(<option> ...)
|
||||||
|
|
||||||
Adds options to the :prop_dir:`COMPILE_OPTIONS` directory property.
|
Adds options to the :prop_dir:`COMPILE_OPTIONS` directory property.
|
||||||
These options are used when compiling targets from the current
|
These options are used when compiling targets from the current
|
||||||
directory and below.
|
directory and below.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
These options are not used when linking.
|
These options are not used when linking.
|
||||||
See the :command:`add_link_options` command for that.
|
See the :command:`add_link_options` command for that.
|
||||||
|
|
||||||
Arguments
|
Arguments
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
|
|
||||||
.. |command_name| replace:: ``add_compile_options``
|
.. |command_name| replace:: ``add_compile_options``
|
||||||
.. include:: GENEX_NOTE.txt
|
.. include:: GENEX_NOTE.txt
|
||||||
|
|
||||||
.. include:: OPTIONS_SHELL.txt
|
.. include:: OPTIONS_SHELL.txt
|
||||||
|
|
||||||
Example
|
Example
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
|
|
||||||
Since different compilers support different options, a typical use of
|
Since different compilers support different options, a typical use of
|
||||||
this command is in a compiler-specific conditional clause:
|
this command is in a compiler-specific conditional clause:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# warning level 4
|
# warning level 4
|
||||||
add_compile_options(/W4)
|
add_compile_options(/W4)
|
||||||
else()
|
else()
|
||||||
# additional warnings
|
# additional warnings
|
||||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
To set per-language options, use the :genex:`$<COMPILE_LANGUAGE>`
|
To set per-language options, use the :genex:`$<COMPILE_LANGUAGE>`
|
||||||
or :genex:`$<COMPILE_LANGUAGE:languages>` generator expressions.
|
or :genex:`$<COMPILE_LANGUAGE:languages>` generator expressions.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* This command can be used to add any options. However, for
|
* This command can be used to add any options. However, for
|
||||||
adding preprocessor definitions and include directories it is recommended
|
adding preprocessor definitions and include directories it is recommended
|
||||||
to use the more specific commands :command:`add_compile_definitions`
|
to use the more specific commands :command:`add_compile_definitions`
|
||||||
and :command:`include_directories`.
|
and :command:`include_directories`.
|
||||||
|
|
||||||
* The command :command:`target_compile_options` adds target-specific options.
|
* The command :command:`target_compile_options` adds target-specific options.
|
||||||
|
|
||||||
* This command adds compile options for all languages.
|
* This command adds compile options for all languages.
|
||||||
Use the :genex:`COMPILE_LANGUAGE` generator expression to specify
|
Use the :genex:`COMPILE_LANGUAGE` generator expression to specify
|
||||||
per-language compile options.
|
per-language compile options.
|
||||||
|
|
||||||
* The source file property :prop_sf:`COMPILE_OPTIONS` adds options to one
|
* The source file property :prop_sf:`COMPILE_OPTIONS` adds options to one
|
||||||
source file.
|
source file.
|
||||||
|
|
||||||
* :command:`add_link_options` adds options for linking.
|
* :command:`add_link_options` adds options for linking.
|
||||||
|
|
||||||
* :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
|
* :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
|
||||||
add language-wide flags passed to all invocations of the compiler.
|
add language-wide flags passed to all invocations of the compiler.
|
||||||
This includes invocations that drive compiling and those that drive linking.
|
This includes invocations that drive compiling and those that drive linking.
|
File diff suppressed because it is too large
Load Diff
@ -1,192 +1,211 @@
|
|||||||
add_custom_target
|
add_custom_target
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Add a target with no output so it will always be built.
|
Add a target with no output so it will always be built.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_custom_target(Name [ALL] [command1 [args1...]]
|
add_custom_target(Name [ALL] [command1 [args1...]]
|
||||||
[COMMAND command2 [args2...] ...]
|
[COMMAND command2 [args2...] ...]
|
||||||
[DEPENDS depend depend depend ... ]
|
[DEPENDS depend depend depend ... ]
|
||||||
[BYPRODUCTS [files...]]
|
[BYPRODUCTS [files...]]
|
||||||
[WORKING_DIRECTORY dir]
|
[WORKING_DIRECTORY dir]
|
||||||
[COMMENT comment]
|
[COMMENT comment]
|
||||||
[JOB_POOL job_pool]
|
[JOB_POOL job_pool]
|
||||||
[VERBATIM] [USES_TERMINAL]
|
[JOB_SERVER_AWARE <bool>]
|
||||||
[COMMAND_EXPAND_LISTS]
|
[VERBATIM] [USES_TERMINAL]
|
||||||
[SOURCES src1 [src2...]])
|
[COMMAND_EXPAND_LISTS]
|
||||||
|
[SOURCES src1 [src2...]])
|
||||||
Adds a target with the given name that executes the given commands.
|
|
||||||
The target has no output file and is *always considered out of date*
|
Adds a target with the given name that executes the given commands.
|
||||||
even if the commands try to create a file with the name of the target.
|
The target has no output file and is *always considered out of date*
|
||||||
Use the :command:`add_custom_command` command to generate a file with
|
even if the commands try to create a file with the name of the target.
|
||||||
dependencies. By default nothing depends on the custom target. Use
|
Use the :command:`add_custom_command` command to generate a file with
|
||||||
the :command:`add_dependencies` command to add dependencies to or
|
dependencies. By default nothing depends on the custom target. Use
|
||||||
from other targets.
|
the :command:`add_dependencies` command to add dependencies to or
|
||||||
|
from other targets.
|
||||||
The options are:
|
|
||||||
|
The options are:
|
||||||
``ALL``
|
|
||||||
Indicate that this target should be added to the default build
|
``ALL``
|
||||||
target so that it will be run every time (the command cannot be
|
Indicate that this target should be added to the default build
|
||||||
called ``ALL``).
|
target so that it will be run every time (the command cannot be
|
||||||
|
called ``ALL``).
|
||||||
``BYPRODUCTS``
|
|
||||||
.. versionadded:: 3.2
|
``BYPRODUCTS``
|
||||||
|
.. versionadded:: 3.2
|
||||||
Specify the files the command is expected to produce but whose
|
|
||||||
modification time may or may not be updated on subsequent builds.
|
Specify the files the command is expected to produce but whose
|
||||||
If a byproduct name is a relative path it will be interpreted
|
modification time may or may not be updated on subsequent builds.
|
||||||
relative to the build tree directory corresponding to the
|
If a byproduct name is a relative path it will be interpreted
|
||||||
current source directory.
|
relative to the build tree directory corresponding to the
|
||||||
Each byproduct file will be marked with the :prop_sf:`GENERATED`
|
current source directory.
|
||||||
source file property automatically.
|
Each byproduct file will be marked with the :prop_sf:`GENERATED`
|
||||||
|
source file property automatically.
|
||||||
*See policy* :policy:`CMP0058` *for the motivation behind this feature.*
|
|
||||||
|
*See policy* :policy:`CMP0058` *for the motivation behind this feature.*
|
||||||
Explicit specification of byproducts is supported by the
|
|
||||||
:generator:`Ninja` generator to tell the ``ninja`` build tool
|
Explicit specification of byproducts is supported by the
|
||||||
how to regenerate byproducts when they are missing. It is
|
:generator:`Ninja` generator to tell the ``ninja`` build tool
|
||||||
also useful when other build rules (e.g. custom commands)
|
how to regenerate byproducts when they are missing. It is
|
||||||
depend on the byproducts. Ninja requires a build rule for any
|
also useful when other build rules (e.g. custom commands)
|
||||||
generated file on which another rule depends even if there are
|
depend on the byproducts. Ninja requires a build rule for any
|
||||||
order-only dependencies to ensure the byproducts will be
|
generated file on which another rule depends even if there are
|
||||||
available before their dependents build.
|
order-only dependencies to ensure the byproducts will be
|
||||||
|
available before their dependents build.
|
||||||
The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
|
|
||||||
:prop_sf:`GENERATED` files during ``make clean``.
|
The :ref:`Makefile Generators` will remove ``BYPRODUCTS`` and other
|
||||||
|
:prop_sf:`GENERATED` files during ``make clean``.
|
||||||
.. versionadded:: 3.20
|
|
||||||
Arguments to ``BYPRODUCTS`` may use a restricted set of
|
.. versionadded:: 3.20
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
Arguments to ``BYPRODUCTS`` may use a restricted set of
|
||||||
:ref:`Target-dependent expressions <Target-Dependent Queries>` are not
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
permitted.
|
:ref:`Target-dependent expressions <Target-Dependent Expressions>`
|
||||||
|
are not permitted.
|
||||||
``COMMAND``
|
|
||||||
Specify the command-line(s) to execute at build time.
|
.. versionchanged:: 3.28
|
||||||
If more than one ``COMMAND`` is specified they will be executed in order,
|
In custom targets using :ref:`file sets`, byproducts are now
|
||||||
but *not* necessarily composed into a stateful shell or batch script.
|
considered private unless they are listed in a non-private file set.
|
||||||
(To run a full script, use the :command:`configure_file` command or the
|
See policy :policy:`CMP0154`.
|
||||||
:command:`file(GENERATE)` command to create it, and then specify
|
|
||||||
a ``COMMAND`` to launch it.)
|
``COMMAND``
|
||||||
|
Specify the command-line(s) to execute at build time.
|
||||||
If ``COMMAND`` specifies an executable target name (created by the
|
If more than one ``COMMAND`` is specified they will be executed in order,
|
||||||
:command:`add_executable` command), it will automatically be replaced
|
but *not* necessarily composed into a stateful shell or batch script.
|
||||||
by the location of the executable created at build time if either of
|
(To run a full script, use the :command:`configure_file` command or the
|
||||||
the following is true:
|
:command:`file(GENERATE)` command to create it, and then specify
|
||||||
|
a ``COMMAND`` to launch it.)
|
||||||
* The target is not being cross-compiled (i.e. the
|
|
||||||
:variable:`CMAKE_CROSSCOMPILING` variable is not set to true).
|
If ``COMMAND`` specifies an executable target name (created by the
|
||||||
* .. versionadded:: 3.6
|
:command:`add_executable` command), it will automatically be replaced
|
||||||
The target is being cross-compiled and an emulator is provided (i.e.
|
by the location of the executable created at build time if either of
|
||||||
its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set).
|
the following is true:
|
||||||
In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be
|
|
||||||
prepended to the command before the location of the target executable.
|
* The target is not being cross-compiled (i.e. the
|
||||||
|
:variable:`CMAKE_CROSSCOMPILING` variable is not set to true).
|
||||||
If neither of the above conditions are met, it is assumed that the
|
* .. versionadded:: 3.6
|
||||||
command name is a program to be found on the ``PATH`` at build time.
|
The target is being cross-compiled and an emulator is provided (i.e.
|
||||||
|
its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set).
|
||||||
Arguments to ``COMMAND`` may use
|
In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
prepended to the command before the location of the target executable.
|
||||||
Use the :genex:`TARGET_FILE` generator expression to refer to the location
|
|
||||||
of a target later in the command line (i.e. as a command argument rather
|
If neither of the above conditions are met, it is assumed that the
|
||||||
than as the command to execute).
|
command name is a program to be found on the ``PATH`` at build time.
|
||||||
|
|
||||||
Whenever one of the following target based generator expressions are used as
|
Arguments to ``COMMAND`` may use
|
||||||
a command to execute or is mentioned in a command argument, a target-level
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
dependency will be added automatically so that the mentioned target will be
|
Use the :genex:`TARGET_FILE` generator expression to refer to the location
|
||||||
built before this custom target (see policy :policy:`CMP0112`).
|
of a target later in the command line (i.e. as a command argument rather
|
||||||
|
than as the command to execute).
|
||||||
* ``TARGET_FILE``
|
|
||||||
* ``TARGET_LINKER_FILE``
|
Whenever one of the following target based generator expressions are used as
|
||||||
* ``TARGET_SONAME_FILE``
|
a command to execute or is mentioned in a command argument, a target-level
|
||||||
* ``TARGET_PDB_FILE``
|
dependency will be added automatically so that the mentioned target will be
|
||||||
|
built before this custom target (see policy :policy:`CMP0112`).
|
||||||
The command and arguments are optional and if not specified an empty
|
|
||||||
target will be created.
|
* ``TARGET_FILE``
|
||||||
|
* ``TARGET_LINKER_FILE``
|
||||||
``COMMENT``
|
* ``TARGET_SONAME_FILE``
|
||||||
Display the given message before the commands are executed at
|
* ``TARGET_PDB_FILE``
|
||||||
build time.
|
|
||||||
|
The command and arguments are optional and if not specified an empty
|
||||||
.. versionadded:: 3.26
|
target will be created.
|
||||||
Arguments to ``COMMENT`` may use
|
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
``COMMENT``
|
||||||
|
Display the given message before the commands are executed at
|
||||||
``DEPENDS``
|
build time.
|
||||||
Reference files and outputs of custom commands created with
|
|
||||||
:command:`add_custom_command` command calls in the same directory
|
.. versionadded:: 3.26
|
||||||
(``CMakeLists.txt`` file). They will be brought up to date when
|
Arguments to ``COMMENT`` may use
|
||||||
the target is built.
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
|
|
||||||
.. versionchanged:: 3.16
|
``DEPENDS``
|
||||||
A target-level dependency is added if any dependency is a byproduct
|
Reference files and outputs of custom commands created with
|
||||||
of a target or any of its build events in the same directory to ensure
|
:command:`add_custom_command` command calls in the same directory
|
||||||
the byproducts will be available before this target is built.
|
(``CMakeLists.txt`` file). They will be brought up to date when
|
||||||
|
the target is built.
|
||||||
Use the :command:`add_dependencies` command to add dependencies
|
|
||||||
on other targets.
|
.. versionchanged:: 3.16
|
||||||
|
A target-level dependency is added if any dependency is a byproduct
|
||||||
``COMMAND_EXPAND_LISTS``
|
of a target or any of its build events in the same directory to ensure
|
||||||
.. versionadded:: 3.8
|
the byproducts will be available before this target is built.
|
||||||
|
|
||||||
Lists in ``COMMAND`` arguments will be expanded, including those
|
Use the :command:`add_dependencies` command to add dependencies
|
||||||
created with
|
on other targets.
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`,
|
|
||||||
allowing ``COMMAND`` arguments such as
|
``COMMAND_EXPAND_LISTS``
|
||||||
``${CC} "-I$<JOIN:$<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>,;-I>" foo.cc``
|
.. versionadded:: 3.8
|
||||||
to be properly expanded.
|
|
||||||
|
Lists in ``COMMAND`` arguments will be expanded, including those
|
||||||
``JOB_POOL``
|
created with
|
||||||
.. versionadded:: 3.15
|
:manual:`generator expressions <cmake-generator-expressions(7)>`,
|
||||||
|
allowing ``COMMAND`` arguments such as
|
||||||
Specify a :prop_gbl:`pool <JOB_POOLS>` for the :generator:`Ninja`
|
``${CC} "-I$<JOIN:$<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>,;-I>" foo.cc``
|
||||||
generator. Incompatible with ``USES_TERMINAL``, which implies
|
to be properly expanded.
|
||||||
the ``console`` pool.
|
|
||||||
Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes
|
``JOB_POOL``
|
||||||
an error by ninja at build time.
|
.. versionadded:: 3.15
|
||||||
|
|
||||||
``SOURCES``
|
Specify a :prop_gbl:`pool <JOB_POOLS>` for the :generator:`Ninja`
|
||||||
Specify additional source files to be included in the custom target.
|
generator. Incompatible with ``USES_TERMINAL``, which implies
|
||||||
Specified source files will be added to IDE project files for
|
the ``console`` pool.
|
||||||
convenience in editing even if they have no build rules.
|
Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes
|
||||||
|
an error by ninja at build time.
|
||||||
``VERBATIM``
|
|
||||||
All arguments to the commands will be escaped properly for the
|
``JOB_SERVER_AWARE``
|
||||||
build tool so that the invoked command receives each argument
|
.. versionadded:: 3.28
|
||||||
unchanged. Note that one level of escapes is still used by the
|
|
||||||
CMake language processor before ``add_custom_target`` even sees
|
Specify that the command is GNU Make job server aware.
|
||||||
the arguments. Use of ``VERBATIM`` is recommended as it enables
|
|
||||||
correct behavior. When ``VERBATIM`` is not given the behavior
|
For the :generator:`Unix Makefiles`, :generator:`MSYS Makefiles`, and
|
||||||
is platform specific because there is no protection of
|
:generator:`MinGW Makefiles` generators this will add the ``+`` prefix to the
|
||||||
tool-specific special characters.
|
recipe line. See the `GNU Make Documentation`_ for more information.
|
||||||
|
|
||||||
``USES_TERMINAL``
|
This option is silently ignored by other generators.
|
||||||
.. versionadded:: 3.2
|
|
||||||
|
.. _`GNU Make Documentation`: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html
|
||||||
The command will be given direct access to the terminal if possible.
|
|
||||||
With the :generator:`Ninja` generator, this places the command in
|
``SOURCES``
|
||||||
the ``console`` :prop_gbl:`pool <JOB_POOLS>`.
|
Specify additional source files to be included in the custom target.
|
||||||
|
Specified source files will be added to IDE project files for
|
||||||
``WORKING_DIRECTORY``
|
convenience in editing even if they have no build rules.
|
||||||
Execute the command with the given current working directory.
|
|
||||||
If it is a relative path it will be interpreted relative to the
|
``VERBATIM``
|
||||||
build tree directory corresponding to the current source directory.
|
All arguments to the commands will be escaped properly for the
|
||||||
|
build tool so that the invoked command receives each argument
|
||||||
.. versionadded:: 3.13
|
unchanged. Note that one level of escapes is still used by the
|
||||||
Arguments to ``WORKING_DIRECTORY`` may use
|
CMake language processor before ``add_custom_target`` even sees
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
the arguments. Use of ``VERBATIM`` is recommended as it enables
|
||||||
|
correct behavior. When ``VERBATIM`` is not given the behavior
|
||||||
Ninja Multi-Config
|
is platform specific because there is no protection of
|
||||||
^^^^^^^^^^^^^^^^^^
|
tool-specific special characters.
|
||||||
|
|
||||||
.. versionadded:: 3.20
|
``USES_TERMINAL``
|
||||||
|
.. versionadded:: 3.2
|
||||||
``add_custom_target`` supports the :generator:`Ninja Multi-Config`
|
|
||||||
generator's cross-config capabilities. See the generator documentation
|
The command will be given direct access to the terminal if possible.
|
||||||
for more information.
|
With the :generator:`Ninja` generator, this places the command in
|
||||||
|
the ``console`` :prop_gbl:`pool <JOB_POOLS>`.
|
||||||
See Also
|
|
||||||
^^^^^^^^
|
``WORKING_DIRECTORY``
|
||||||
|
Execute the command with the given current working directory.
|
||||||
* :command:`add_custom_command`
|
If it is a relative path it will be interpreted relative to the
|
||||||
|
build tree directory corresponding to the current source directory.
|
||||||
|
|
||||||
|
.. versionadded:: 3.13
|
||||||
|
Arguments to ``WORKING_DIRECTORY`` may use
|
||||||
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
|
|
||||||
|
Ninja Multi-Config
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. versionadded:: 3.20
|
||||||
|
|
||||||
|
``add_custom_target`` supports the :generator:`Ninja Multi-Config`
|
||||||
|
generator's cross-config capabilities. See the generator documentation
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
* :command:`add_custom_command`
|
@ -1,38 +1,38 @@
|
|||||||
add_definitions
|
add_definitions
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Add ``-D`` define flags to the compilation of source files.
|
Add ``-D`` define flags to the compilation of source files.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_definitions(-DFOO -DBAR ...)
|
add_definitions(-DFOO -DBAR ...)
|
||||||
|
|
||||||
Adds definitions to the compiler command line for targets in the current
|
Adds definitions to the compiler command line for targets in the current
|
||||||
directory, whether added before or after this command is invoked, and for
|
directory, whether added before or after this command is invoked, and for
|
||||||
the ones in sub-directories added after. This command can be used to add any
|
the ones in sub-directories added after. This command can be used to add any
|
||||||
flags, but it is intended to add preprocessor definitions.
|
flags, but it is intended to add preprocessor definitions.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This command has been superseded by alternatives:
|
This command has been superseded by alternatives:
|
||||||
|
|
||||||
* Use :command:`add_compile_definitions` to add preprocessor definitions.
|
* Use :command:`add_compile_definitions` to add preprocessor definitions.
|
||||||
* Use :command:`include_directories` to add include directories.
|
* Use :command:`include_directories` to add include directories.
|
||||||
* Use :command:`add_compile_options` to add other options.
|
* Use :command:`add_compile_options` to add other options.
|
||||||
|
|
||||||
Flags beginning in ``-D`` or ``/D`` that look like preprocessor definitions are
|
Flags beginning in ``-D`` or ``/D`` that look like preprocessor definitions are
|
||||||
automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory
|
automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory
|
||||||
property for the current directory. Definitions with non-trivial values
|
property for the current directory. Definitions with non-trivial values
|
||||||
may be left in the set of flags instead of being converted for reasons of
|
may be left in the set of flags instead of being converted for reasons of
|
||||||
backwards compatibility. See documentation of the
|
backwards compatibility. See documentation of the
|
||||||
:prop_dir:`directory <COMPILE_DEFINITIONS>`,
|
:prop_dir:`directory <COMPILE_DEFINITIONS>`,
|
||||||
:prop_tgt:`target <COMPILE_DEFINITIONS>`,
|
:prop_tgt:`target <COMPILE_DEFINITIONS>`,
|
||||||
:prop_sf:`source file <COMPILE_DEFINITIONS>` ``COMPILE_DEFINITIONS``
|
:prop_sf:`source file <COMPILE_DEFINITIONS>` ``COMPILE_DEFINITIONS``
|
||||||
properties for details on adding preprocessor definitions to specific
|
properties for details on adding preprocessor definitions to specific
|
||||||
scopes and configurations.
|
scopes and configurations.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* The :manual:`cmake-buildsystem(7)` manual for more on defining
|
* The :manual:`cmake-buildsystem(7)` manual for more on defining
|
||||||
buildsystem properties.
|
buildsystem properties.
|
@ -1,31 +1,42 @@
|
|||||||
add_dependencies
|
add_dependencies
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Add a dependency between top-level targets.
|
Add a dependency between top-level targets.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_dependencies(<target> [<target-dependency>]...)
|
add_dependencies(<target> [<target-dependency>]...)
|
||||||
|
|
||||||
Makes a top-level ``<target>`` depend on other top-level targets to
|
Makes a top-level ``<target>`` depend on other top-level targets to
|
||||||
ensure that they build before ``<target>`` does. A top-level target
|
ensure that they build before ``<target>`` does. A top-level target
|
||||||
is one created by one of the :command:`add_executable`,
|
is one created by one of the :command:`add_executable`,
|
||||||
:command:`add_library`, or :command:`add_custom_target` commands
|
:command:`add_library`, or :command:`add_custom_target` commands
|
||||||
(but not targets generated by CMake like ``install``).
|
(but not targets generated by CMake like ``install``).
|
||||||
|
|
||||||
Dependencies added to an :ref:`imported target <Imported Targets>`
|
Dependencies added to an :ref:`imported target <Imported Targets>`
|
||||||
or an :ref:`interface library <Interface Libraries>` are followed
|
or an :ref:`interface library <Interface Libraries>` are followed
|
||||||
transitively in its place since the target itself does not build.
|
transitively in its place since the target itself does not build.
|
||||||
|
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
Allow adding dependencies to interface libraries.
|
Allow adding dependencies to interface libraries.
|
||||||
|
|
||||||
See Also
|
.. versionadded:: 3.8
|
||||||
^^^^^^^^
|
Dependencies will populate the :prop_tgt:`MANUALLY_ADDED_DEPENDENCIES`
|
||||||
|
property of ``<target>``.
|
||||||
* The ``DEPENDS`` option of :command:`add_custom_target` and
|
|
||||||
:command:`add_custom_command` commands for adding file-level
|
.. versionchanged:: 3.9
|
||||||
dependencies in custom rules.
|
The :ref:`Ninja Generators` use weaker ordering than
|
||||||
|
other generators in order to improve available concurrency.
|
||||||
* The :prop_sf:`OBJECT_DEPENDS` source file property to add
|
They only guarantee that the dependencies' custom commands are
|
||||||
file-level dependencies to object files.
|
finished before sources in ``<target>`` start compiling; this
|
||||||
|
ensures generated sources are available.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
* The ``DEPENDS`` option of :command:`add_custom_target` and
|
||||||
|
:command:`add_custom_command` commands for adding file-level
|
||||||
|
dependencies in custom rules.
|
||||||
|
|
||||||
|
* The :prop_sf:`OBJECT_DEPENDS` source file property to add
|
||||||
|
file-level dependencies to object files.
|
@ -1,114 +1,123 @@
|
|||||||
add_executable
|
add_executable
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
.. only:: html
|
.. only:: html
|
||||||
|
|
||||||
.. contents::
|
.. contents::
|
||||||
|
|
||||||
Add an executable to the project using the specified source files.
|
Add an executable to the project using the specified source files.
|
||||||
|
|
||||||
Normal Executables
|
Normal Executables
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. signature::
|
||||||
|
add_executable(<name> <options>... <sources>...)
|
||||||
add_executable(<name> [WIN32] [MACOSX_BUNDLE]
|
:target: normal
|
||||||
[EXCLUDE_FROM_ALL]
|
|
||||||
[source1] [source2 ...])
|
Add an executable target called ``<name>`` to be built from the source
|
||||||
|
files listed in the command invocation.
|
||||||
Adds an executable target called ``<name>`` to be built from the source
|
|
||||||
files listed in the command invocation. The
|
The options are:
|
||||||
``<name>`` corresponds to the logical target name and must be globally
|
|
||||||
unique within a project. The actual file name of the executable built is
|
``WIN32``
|
||||||
constructed based on conventions of the native platform (such as
|
Set the :prop_tgt:`WIN32_EXECUTABLE` target property automatically.
|
||||||
``<name>.exe`` or just ``<name>``).
|
See documentation of that target property for details.
|
||||||
|
|
||||||
.. versionadded:: 3.1
|
``MACOSX_BUNDLE``
|
||||||
Source arguments to ``add_executable`` may use "generator expressions" with
|
Set the :prop_tgt:`MACOSX_BUNDLE` target property automatically.
|
||||||
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
See documentation of that target property for details.
|
||||||
manual for available expressions.
|
|
||||||
|
``EXCLUDE_FROM_ALL``
|
||||||
.. versionadded:: 3.11
|
Set the :prop_tgt:`EXCLUDE_FROM_ALL` target property automatically.
|
||||||
The source files can be omitted if they are added later using
|
See documentation of that target property for details.
|
||||||
:command:`target_sources`.
|
|
||||||
|
The ``<name>`` corresponds to the logical target name and must be globally
|
||||||
By default the executable file will be created in the build tree
|
unique within a project. The actual file name of the executable built is
|
||||||
directory corresponding to the source tree directory in which the
|
constructed based on conventions of the native platform (such as
|
||||||
command was invoked. See documentation of the
|
``<name>.exe`` or just ``<name>``).
|
||||||
:prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target property to change this
|
|
||||||
location. See documentation of the :prop_tgt:`OUTPUT_NAME` target property
|
.. versionadded:: 3.1
|
||||||
to change the ``<name>`` part of the final file name.
|
Source arguments to ``add_executable`` may use "generator expressions" with
|
||||||
|
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
||||||
If ``WIN32`` is given the property :prop_tgt:`WIN32_EXECUTABLE` will be
|
manual for available expressions.
|
||||||
set on the target created. See documentation of that target property for
|
|
||||||
details.
|
.. versionadded:: 3.11
|
||||||
|
The source files can be omitted if they are added later using
|
||||||
If ``MACOSX_BUNDLE`` is given the corresponding property will be set on
|
:command:`target_sources`.
|
||||||
the created target. See documentation of the :prop_tgt:`MACOSX_BUNDLE`
|
|
||||||
target property for details.
|
By default the executable file will be created in the build tree
|
||||||
|
directory corresponding to the source tree directory in which the
|
||||||
If ``EXCLUDE_FROM_ALL`` is given the corresponding property will be set on
|
command was invoked. See documentation of the
|
||||||
the created target. See documentation of the :prop_tgt:`EXCLUDE_FROM_ALL`
|
:prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target property to change this
|
||||||
target property for details.
|
location. See documentation of the :prop_tgt:`OUTPUT_NAME` target property
|
||||||
|
to change the ``<name>`` part of the final file name.
|
||||||
See the :manual:`cmake-buildsystem(7)` manual for more on defining
|
|
||||||
buildsystem properties.
|
See the :manual:`cmake-buildsystem(7)` manual for more on defining
|
||||||
|
buildsystem properties.
|
||||||
See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
|
|
||||||
pre-processed, and you want to have the original sources reachable from
|
See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
|
||||||
within IDE.
|
pre-processed, and you want to have the original sources reachable from
|
||||||
|
within IDE.
|
||||||
Imported Executables
|
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
Imported Executables
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
.. code-block:: cmake
|
|
||||||
|
.. signature::
|
||||||
add_executable(<name> IMPORTED [GLOBAL])
|
add_executable(<name> IMPORTED [GLOBAL])
|
||||||
|
:target: IMPORTED
|
||||||
An :ref:`IMPORTED executable target <Imported Targets>` references an
|
|
||||||
executable file located outside the project. No rules are generated to
|
Add an :ref:`IMPORTED executable target <Imported Targets>` to reference
|
||||||
build it, and the :prop_tgt:`IMPORTED` target property is ``True``. The
|
an executable file located outside the project. The target name may be
|
||||||
target name has scope in the directory in which it is created and below, but
|
referenced like any target built within the project, except that by
|
||||||
the ``GLOBAL`` option extends visibility. It may be referenced like any
|
default it is visible only in the directory in which it is created,
|
||||||
target built within the project. ``IMPORTED`` executables are useful
|
and below.
|
||||||
for convenient reference from commands like :command:`add_custom_command`.
|
|
||||||
Details about the imported executable are specified by setting properties
|
The options are:
|
||||||
whose names begin in ``IMPORTED_``. The most important such property is
|
|
||||||
:prop_tgt:`IMPORTED_LOCATION` (and its per-configuration version
|
``GLOBAL``
|
||||||
:prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) which specifies the location of
|
Make the target name globally visible.
|
||||||
the main executable file on disk. See documentation of the ``IMPORTED_*``
|
|
||||||
properties for more information.
|
No rules are generated to build imported targets, and the :prop_tgt:`IMPORTED`
|
||||||
|
target property is ``True``. Imported executables are useful for convenient
|
||||||
Alias Executables
|
reference from commands like :command:`add_custom_command`.
|
||||||
^^^^^^^^^^^^^^^^^
|
|
||||||
|
Details about the imported executable are specified by setting properties
|
||||||
.. code-block:: cmake
|
whose names begin in ``IMPORTED_``. The most important such property is
|
||||||
|
:prop_tgt:`IMPORTED_LOCATION` (and its per-configuration version
|
||||||
add_executable(<name> ALIAS <target>)
|
:prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) which specifies the location of
|
||||||
|
the main executable file on disk. See documentation of the ``IMPORTED_*``
|
||||||
Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can
|
properties for more information.
|
||||||
be used to refer to ``<target>`` in subsequent commands. The ``<name>``
|
|
||||||
does not appear in the generated buildsystem as a make target. The
|
Alias Executables
|
||||||
``<target>`` may not be an ``ALIAS``.
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. versionadded:: 3.11
|
.. signature::
|
||||||
An ``ALIAS`` can target a ``GLOBAL`` :ref:`Imported Target <Imported Targets>`
|
add_executable(<name> ALIAS <target>)
|
||||||
|
:target: ALIAS
|
||||||
.. versionadded:: 3.18
|
|
||||||
An ``ALIAS`` can target a non-``GLOBAL`` Imported Target. Such alias is
|
Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can
|
||||||
scoped to the directory in which it is created and subdirectories.
|
be used to refer to ``<target>`` in subsequent commands. The ``<name>``
|
||||||
The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the
|
does not appear in the generated buildsystem as a make target. The
|
||||||
alias is global or not.
|
``<target>`` may not be an ``ALIAS``.
|
||||||
|
|
||||||
``ALIAS`` targets can be used as targets to read properties
|
.. versionadded:: 3.11
|
||||||
from, executables for custom commands and custom targets. They can also be
|
An ``ALIAS`` can target a ``GLOBAL`` :ref:`Imported Target <Imported Targets>`
|
||||||
tested for existence with the regular :command:`if(TARGET)` subcommand.
|
|
||||||
The ``<name>`` may not be used to modify properties of ``<target>``, that
|
.. versionadded:: 3.18
|
||||||
is, it may not be used as the operand of :command:`set_property`,
|
An ``ALIAS`` can target a non-``GLOBAL`` Imported Target. Such alias is
|
||||||
:command:`set_target_properties`, :command:`target_link_libraries` etc.
|
scoped to the directory in which it is created and subdirectories.
|
||||||
An ``ALIAS`` target may not be installed or exported.
|
The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the
|
||||||
|
alias is global or not.
|
||||||
See Also
|
|
||||||
^^^^^^^^
|
``ALIAS`` targets can be used as targets to read properties
|
||||||
|
from, executables for custom commands and custom targets. They can also be
|
||||||
* :command:`add_library`
|
tested for existence with the regular :command:`if(TARGET)` subcommand.
|
||||||
|
The ``<name>`` may not be used to modify properties of ``<target>``, that
|
||||||
|
is, it may not be used as the operand of :command:`set_property`,
|
||||||
|
:command:`set_target_properties`, :command:`target_link_libraries` etc.
|
||||||
|
An ``ALIAS`` target may not be installed or exported.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
* :command:`add_library`
|
302
cmake/share/cmake-3.30/Help/command/add_library.rst
Normal file
302
cmake/share/cmake-3.30/Help/command/add_library.rst
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
add_library
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. only:: html
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
|
||||||
|
Add a library to the project using the specified source files.
|
||||||
|
|
||||||
|
Normal Libraries
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. signature::
|
||||||
|
add_library(<name> [<type>] [EXCLUDE_FROM_ALL] <sources>...)
|
||||||
|
:target: normal
|
||||||
|
|
||||||
|
Add a library target called ``<name>`` to be built from the source files
|
||||||
|
listed in the command invocation.
|
||||||
|
|
||||||
|
The optional ``<type>`` specifies the type of library to be created:
|
||||||
|
|
||||||
|
``STATIC``
|
||||||
|
An archive of object files for use when linking other targets.
|
||||||
|
|
||||||
|
``SHARED``
|
||||||
|
A dynamic library that may be linked by other targets and loaded
|
||||||
|
at runtime.
|
||||||
|
|
||||||
|
``MODULE``
|
||||||
|
A plugin that may not be linked by other targets, but may be
|
||||||
|
dynamically loaded at runtime using dlopen-like functionality.
|
||||||
|
|
||||||
|
If no ``<type>`` is given the default is ``STATIC`` or ``SHARED``
|
||||||
|
based on the value of the :variable:`BUILD_SHARED_LIBS` variable.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``EXCLUDE_FROM_ALL``
|
||||||
|
Set the :prop_tgt:`EXCLUDE_FROM_ALL` target property automatically.
|
||||||
|
See documentation of that target property for details.
|
||||||
|
|
||||||
|
The ``<name>`` corresponds to the logical target name and must be globally
|
||||||
|
unique within a project. The actual file name of the library built is
|
||||||
|
constructed based on conventions of the native platform (such as
|
||||||
|
``lib<name>.a`` or ``<name>.lib``).
|
||||||
|
|
||||||
|
.. versionadded:: 3.1
|
||||||
|
Source arguments to ``add_library`` may use "generator expressions" with
|
||||||
|
the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
||||||
|
manual for available expressions.
|
||||||
|
|
||||||
|
.. versionadded:: 3.11
|
||||||
|
The source files can be omitted if they are added later using
|
||||||
|
:command:`target_sources`.
|
||||||
|
|
||||||
|
For ``SHARED`` and ``MODULE`` libraries the
|
||||||
|
:prop_tgt:`POSITION_INDEPENDENT_CODE` target
|
||||||
|
property is set to ``ON`` automatically.
|
||||||
|
A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK`
|
||||||
|
target property to create an macOS Framework.
|
||||||
|
|
||||||
|
.. versionadded:: 3.8
|
||||||
|
A ``STATIC`` library may be marked with the :prop_tgt:`FRAMEWORK`
|
||||||
|
target property to create a static Framework.
|
||||||
|
|
||||||
|
If a library does not export any symbols, it must not be declared as a
|
||||||
|
``SHARED`` library. For example, a Windows resource DLL or a managed C++/CLI
|
||||||
|
DLL that exports no unmanaged symbols would need to be a ``MODULE`` library.
|
||||||
|
This is because CMake expects a ``SHARED`` library to always have an
|
||||||
|
associated import library on Windows.
|
||||||
|
|
||||||
|
By default the library file will be created in the build tree directory
|
||||||
|
corresponding to the source tree directory in which the command was
|
||||||
|
invoked. See documentation of the :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`,
|
||||||
|
:prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`, and
|
||||||
|
:prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target properties to change this
|
||||||
|
location. See documentation of the :prop_tgt:`OUTPUT_NAME` target
|
||||||
|
property to change the ``<name>`` part of the final file name.
|
||||||
|
|
||||||
|
See the :manual:`cmake-buildsystem(7)` manual for more on defining
|
||||||
|
buildsystem properties.
|
||||||
|
|
||||||
|
See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
|
||||||
|
pre-processed, and you want to have the original sources reachable from
|
||||||
|
within IDE.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.30
|
||||||
|
|
||||||
|
On platforms that do not support shared libraries, ``add_library``
|
||||||
|
now fails on calls creating ``SHARED`` libraries instead of
|
||||||
|
automatically converting them to ``STATIC`` libraries as before.
|
||||||
|
See policy :policy:`CMP0164`.
|
||||||
|
|
||||||
|
Object Libraries
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. signature::
|
||||||
|
add_library(<name> OBJECT <sources>...)
|
||||||
|
:target: OBJECT
|
||||||
|
|
||||||
|
Add an :ref:`Object Library <Object Libraries>` to compile source files
|
||||||
|
without archiving or linking their object files into a library.
|
||||||
|
|
||||||
|
Other targets created by ``add_library`` or :command:`add_executable`
|
||||||
|
may reference the objects using an expression of the
|
||||||
|
form :genex:`$\<TARGET_OBJECTS:objlib\> <TARGET_OBJECTS>` as a source, where
|
||||||
|
``objlib`` is the object library name. For example:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
add_library(... $<TARGET_OBJECTS:objlib> ...)
|
||||||
|
add_executable(... $<TARGET_OBJECTS:objlib> ...)
|
||||||
|
|
||||||
|
will include objlib's object files in a library and an executable
|
||||||
|
along with those compiled from their own sources. Object libraries
|
||||||
|
may contain only sources that compile, header files, and other files
|
||||||
|
that would not affect linking of a normal library (e.g. ``.txt``).
|
||||||
|
They may contain custom commands generating such sources, but not
|
||||||
|
``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Some native build
|
||||||
|
systems (such as Xcode) may not like targets that have only object files, so
|
||||||
|
consider adding at least one real source file to any target that references
|
||||||
|
:genex:`$\<TARGET_OBJECTS:objlib\> <TARGET_OBJECTS>`.
|
||||||
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
|
Object libraries can be linked to with :command:`target_link_libraries`.
|
||||||
|
|
||||||
|
Interface Libraries
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. signature::
|
||||||
|
add_library(<name> INTERFACE)
|
||||||
|
:target: INTERFACE
|
||||||
|
|
||||||
|
Add an :ref:`Interface Library <Interface Libraries>` target that may
|
||||||
|
specify usage requirements for dependents but does not compile sources
|
||||||
|
and does not produce a library artifact on disk.
|
||||||
|
|
||||||
|
An interface library with no source files is not included as a target
|
||||||
|
in the generated buildsystem. However, it may have
|
||||||
|
properties set on it and it may be installed and exported.
|
||||||
|
Typically, ``INTERFACE_*`` properties are populated on an interface
|
||||||
|
target using the commands:
|
||||||
|
|
||||||
|
* :command:`set_property`,
|
||||||
|
* :command:`target_link_libraries(INTERFACE)`,
|
||||||
|
* :command:`target_link_options(INTERFACE)`,
|
||||||
|
* :command:`target_include_directories(INTERFACE)`,
|
||||||
|
* :command:`target_compile_options(INTERFACE)`,
|
||||||
|
* :command:`target_compile_definitions(INTERFACE)`, and
|
||||||
|
* :command:`target_sources(INTERFACE)`,
|
||||||
|
|
||||||
|
and then it is used as an argument to :command:`target_link_libraries`
|
||||||
|
like any other target.
|
||||||
|
|
||||||
|
.. versionadded:: 3.15
|
||||||
|
An interface library can have :prop_tgt:`PUBLIC_HEADER` and
|
||||||
|
:prop_tgt:`PRIVATE_HEADER` properties. The headers specified by those
|
||||||
|
properties can be installed using the :command:`install(TARGETS)` command.
|
||||||
|
|
||||||
|
.. signature::
|
||||||
|
add_library(<name> INTERFACE [EXCLUDE_FROM_ALL] <sources>...)
|
||||||
|
:target: INTERFACE-with-sources
|
||||||
|
|
||||||
|
.. versionadded:: 3.19
|
||||||
|
|
||||||
|
Add an :ref:`Interface Library <Interface Libraries>` target with
|
||||||
|
source files (in addition to usage requirements and properties as
|
||||||
|
documented by the :command:`above signature <add_library(INTERFACE)>`).
|
||||||
|
Source files may be listed directly in the ``add_library`` call
|
||||||
|
or added later by calls to :command:`target_sources` with the
|
||||||
|
``PRIVATE`` or ``PUBLIC`` keywords.
|
||||||
|
|
||||||
|
If an interface library has source files (i.e. the :prop_tgt:`SOURCES`
|
||||||
|
target property is set), or header sets (i.e. the :prop_tgt:`HEADER_SETS`
|
||||||
|
target property is set), it will appear in the generated buildsystem
|
||||||
|
as a build target much like a target defined by the
|
||||||
|
:command:`add_custom_target` command. It does not compile any sources,
|
||||||
|
but does contain build rules for custom commands created by the
|
||||||
|
:command:`add_custom_command` command.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``EXCLUDE_FROM_ALL``
|
||||||
|
Set the :prop_tgt:`EXCLUDE_FROM_ALL` target property automatically.
|
||||||
|
See documentation of that target property for details.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
In most command signatures where the ``INTERFACE`` keyword appears,
|
||||||
|
the items listed after it only become part of that target's usage
|
||||||
|
requirements and are not part of the target's own settings. However,
|
||||||
|
in this signature of ``add_library``, the ``INTERFACE`` keyword refers
|
||||||
|
to the library type only. Sources listed after it in the ``add_library``
|
||||||
|
call are ``PRIVATE`` to the interface library and do not appear in its
|
||||||
|
:prop_tgt:`INTERFACE_SOURCES` target property.
|
||||||
|
|
||||||
|
.. _`add_library imported libraries`:
|
||||||
|
|
||||||
|
Imported Libraries
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. signature::
|
||||||
|
add_library(<name> <type> IMPORTED [GLOBAL])
|
||||||
|
:target: IMPORTED
|
||||||
|
|
||||||
|
Add an :ref:`IMPORTED library target <Imported Targets>` called ``<name>``.
|
||||||
|
The target name may be referenced like any target built within the project,
|
||||||
|
except that by default it is visible only in the directory in which it is
|
||||||
|
created, and below.
|
||||||
|
|
||||||
|
The ``<type>`` must be one of:
|
||||||
|
|
||||||
|
``STATIC``, ``SHARED``, ``MODULE``, ``UNKNOWN``
|
||||||
|
References a library file located outside the project. The
|
||||||
|
:prop_tgt:`IMPORTED_LOCATION` target property (or its per-configuration
|
||||||
|
variant :prop_tgt:`IMPORTED_LOCATION_<CONFIG>`) specifies the
|
||||||
|
location of the main library file on disk:
|
||||||
|
|
||||||
|
* For a ``SHARED`` library on most non-Windows platforms, the main library
|
||||||
|
file is the ``.so`` or ``.dylib`` file used by both linkers and dynamic
|
||||||
|
loaders. If the referenced library file has a ``SONAME`` (or on macOS,
|
||||||
|
has a ``LC_ID_DYLIB`` starting in ``@rpath/``), the value of that field
|
||||||
|
should be set in the :prop_tgt:`IMPORTED_SONAME` target property.
|
||||||
|
If the referenced library file does not have a ``SONAME``, but the
|
||||||
|
platform supports it, then the :prop_tgt:`IMPORTED_NO_SONAME` target
|
||||||
|
property should be set.
|
||||||
|
|
||||||
|
* For a ``SHARED`` library on Windows, the :prop_tgt:`IMPORTED_IMPLIB`
|
||||||
|
target property (or its per-configuration variant
|
||||||
|
:prop_tgt:`IMPORTED_IMPLIB_<CONFIG>`) specifies the location of the
|
||||||
|
DLL import library file (``.lib`` or ``.dll.a``) on disk, and the
|
||||||
|
``IMPORTED_LOCATION`` is the location of the ``.dll`` runtime
|
||||||
|
library (and is optional, but needed by the :genex:`TARGET_RUNTIME_DLLS`
|
||||||
|
generator expression).
|
||||||
|
|
||||||
|
Additional usage requirements may be specified in ``INTERFACE_*``
|
||||||
|
properties.
|
||||||
|
|
||||||
|
An ``UNKNOWN`` library type is typically only used in the implementation
|
||||||
|
of :ref:`Find Modules`. It allows the path to an imported library
|
||||||
|
(often found using the :command:`find_library` command) to be used
|
||||||
|
without having to know what type of library it is. This is especially
|
||||||
|
useful on Windows where a static library and a DLL's import library
|
||||||
|
both have the same file extension.
|
||||||
|
|
||||||
|
``OBJECT``
|
||||||
|
References a set of object files located outside the project.
|
||||||
|
The :prop_tgt:`IMPORTED_OBJECTS` target property (or its per-configuration
|
||||||
|
variant :prop_tgt:`IMPORTED_OBJECTS_<CONFIG>`) specifies the locations of
|
||||||
|
object files on disk.
|
||||||
|
Additional usage requirements may be specified in ``INTERFACE_*``
|
||||||
|
properties.
|
||||||
|
|
||||||
|
``INTERFACE``
|
||||||
|
Does not reference any library or object files on disk, but may
|
||||||
|
specify usage requirements in ``INTERFACE_*`` properties.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``GLOBAL``
|
||||||
|
Make the target name globally visible.
|
||||||
|
|
||||||
|
No rules are generated to build imported targets, and the :prop_tgt:`IMPORTED`
|
||||||
|
target property is ``True``. Imported libraries are useful for convenient
|
||||||
|
reference from commands like :command:`target_link_libraries`.
|
||||||
|
|
||||||
|
Details about the imported library are specified by setting properties whose
|
||||||
|
names begin in ``IMPORTED_`` and ``INTERFACE_``. See documentation of
|
||||||
|
such properties for more information.
|
||||||
|
|
||||||
|
Alias Libraries
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. signature::
|
||||||
|
add_library(<name> ALIAS <target>)
|
||||||
|
:target: ALIAS
|
||||||
|
|
||||||
|
Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can be
|
||||||
|
used to refer to ``<target>`` in subsequent commands. The ``<name>`` does
|
||||||
|
not appear in the generated buildsystem as a make target. The ``<target>``
|
||||||
|
may not be an ``ALIAS``.
|
||||||
|
|
||||||
|
.. versionadded:: 3.11
|
||||||
|
An ``ALIAS`` can target a ``GLOBAL`` :ref:`Imported Target <Imported Targets>`
|
||||||
|
|
||||||
|
.. versionadded:: 3.18
|
||||||
|
An ``ALIAS`` can target a non-``GLOBAL`` Imported Target. Such alias is
|
||||||
|
scoped to the directory in which it is created and below.
|
||||||
|
The :prop_tgt:`ALIAS_GLOBAL` target property can be used to check if the
|
||||||
|
alias is global or not.
|
||||||
|
|
||||||
|
``ALIAS`` targets can be used as linkable targets and as targets to
|
||||||
|
read properties from. They can also be tested for existence with the
|
||||||
|
regular :command:`if(TARGET)` subcommand. The ``<name>`` may not be used
|
||||||
|
to modify properties of ``<target>``, that is, it may not be used as the
|
||||||
|
operand of :command:`set_property`, :command:`set_target_properties`,
|
||||||
|
:command:`target_link_libraries` etc. An ``ALIAS`` target may not be
|
||||||
|
installed or exported.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
* :command:`add_executable`
|
@ -1,44 +1,44 @@
|
|||||||
add_link_options
|
add_link_options
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
.. versionadded:: 3.13
|
.. versionadded:: 3.13
|
||||||
|
|
||||||
Add options to the link step for executable, shared library or module
|
Add options to the link step for executable, shared library or module
|
||||||
library targets in the current directory and below that are added after
|
library targets in the current directory and below that are added after
|
||||||
this command is invoked.
|
this command is invoked.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_link_options(<option> ...)
|
add_link_options(<option> ...)
|
||||||
|
|
||||||
This command can be used to add any link options, but alternative commands
|
This command can be used to add any link options, but alternative commands
|
||||||
exist to add libraries (:command:`target_link_libraries` or
|
exist to add libraries (:command:`target_link_libraries` or
|
||||||
:command:`link_libraries`). See documentation of the
|
:command:`link_libraries`). See documentation of the
|
||||||
:prop_dir:`directory <LINK_OPTIONS>` and
|
:prop_dir:`directory <LINK_OPTIONS>` and
|
||||||
:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
|
:prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This command cannot be used to add options for static library targets,
|
This command cannot be used to add options for static library targets,
|
||||||
since they do not use a linker. To add archiver or MSVC librarian flags,
|
since they do not use a linker. To add archiver or MSVC librarian flags,
|
||||||
see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
|
see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
|
||||||
|
|
||||||
.. |command_name| replace:: ``add_link_options``
|
.. |command_name| replace:: ``add_link_options``
|
||||||
.. include:: GENEX_NOTE.txt
|
.. include:: GENEX_NOTE.txt
|
||||||
|
|
||||||
.. include:: DEVICE_LINK_OPTIONS.txt
|
.. include:: DEVICE_LINK_OPTIONS.txt
|
||||||
|
|
||||||
.. include:: OPTIONS_SHELL.txt
|
.. include:: OPTIONS_SHELL.txt
|
||||||
|
|
||||||
.. include:: LINK_OPTIONS_LINKER.txt
|
.. include:: LINK_OPTIONS_LINKER.txt
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* :command:`link_libraries`
|
* :command:`link_libraries`
|
||||||
* :command:`target_link_libraries`
|
* :command:`target_link_libraries`
|
||||||
* :command:`target_link_options`
|
* :command:`target_link_options`
|
||||||
|
|
||||||
* :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
|
* :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
|
||||||
add language-wide flags passed to all invocations of the compiler.
|
add language-wide flags passed to all invocations of the compiler.
|
||||||
This includes invocations that drive compiling and those that drive linking.
|
This includes invocations that drive compiling and those that drive linking.
|
@ -1,41 +1,32 @@
|
|||||||
add_subdirectory
|
add_subdirectory
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Add a subdirectory to the build.
|
Add a subdirectory to the build.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL] [SYSTEM])
|
add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL] [SYSTEM])
|
||||||
|
|
||||||
Adds a subdirectory to the build. The ``source_dir`` specifies the
|
Adds a subdirectory to the build. The ``source_dir`` specifies the
|
||||||
directory in which the source ``CMakeLists.txt`` and code files are
|
directory in which the source ``CMakeLists.txt`` and code files are
|
||||||
located. If it is a relative path, it will be evaluated with respect
|
located. If it is a relative path, it will be evaluated with respect
|
||||||
to the current directory (the typical usage), but it may also be an
|
to the current directory (the typical usage), but it may also be an
|
||||||
absolute path. The ``binary_dir`` specifies the directory in which to
|
absolute path. The ``binary_dir`` specifies the directory in which to
|
||||||
place the output files. If it is a relative path, it will be evaluated
|
place the output files. If it is a relative path, it will be evaluated
|
||||||
with respect to the current output directory, but it may also be an
|
with respect to the current output directory, but it may also be an
|
||||||
absolute path. If ``binary_dir`` is not specified, the value of
|
absolute path. If ``binary_dir`` is not specified, the value of
|
||||||
``source_dir``, before expanding any relative path, will be used (the
|
``source_dir``, before expanding any relative path, will be used (the
|
||||||
typical usage). The ``CMakeLists.txt`` file in the specified source
|
typical usage). The ``CMakeLists.txt`` file in the specified source
|
||||||
directory will be processed immediately by CMake before processing in
|
directory will be processed immediately by CMake before processing in
|
||||||
the current input file continues beyond this command.
|
the current input file continues beyond this command.
|
||||||
|
|
||||||
If the ``EXCLUDE_FROM_ALL`` argument is provided then targets in the
|
If the ``EXCLUDE_FROM_ALL`` argument is provided then the
|
||||||
subdirectory will not be included in the ``ALL`` target of the parent
|
:prop_dir:`EXCLUDE_FROM_ALL` property will be set on the added directory.
|
||||||
directory by default, and will be excluded from IDE project files.
|
This will exclude the directory from a default build. See the directory
|
||||||
Users must explicitly build targets in the subdirectory. This is
|
property :prop_dir:`EXCLUDE_FROM_ALL` for full details.
|
||||||
meant for use when the subdirectory contains a separate part of the
|
|
||||||
project that is useful but not necessary, such as a set of examples.
|
.. versionadded:: 3.25
|
||||||
Typically the subdirectory should contain its own :command:`project`
|
If the ``SYSTEM`` argument is provided, the :prop_dir:`SYSTEM` directory
|
||||||
command invocation so that a full build system will be generated in the
|
property of the subdirectory will be set to true. This property is
|
||||||
subdirectory (such as a Visual Studio IDE solution file). Note that
|
used to initialize the :prop_tgt:`SYSTEM` property of each non-imported
|
||||||
inter-target dependencies supersede this exclusion. If a target built by
|
target created in that subdirectory.
|
||||||
the parent project depends on a target in the subdirectory, the dependee
|
|
||||||
target will be included in the parent project build system to satisfy
|
|
||||||
the dependency.
|
|
||||||
|
|
||||||
.. versionadded:: 3.25
|
|
||||||
If the ``SYSTEM`` argument is provided, the :prop_dir:`SYSTEM` directory
|
|
||||||
property of the subdirectory will be set to true. This property is
|
|
||||||
used to initialize the :prop_tgt:`SYSTEM` property of each non-imported
|
|
||||||
target created in that subdirectory.
|
|
@ -1,89 +1,117 @@
|
|||||||
add_test
|
add_test
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Add a test to the project to be run by :manual:`ctest(1)`.
|
Add a test to the project to be run by :manual:`ctest(1)`.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
add_test(NAME <name> COMMAND <command> [<arg>...]
|
add_test(NAME <name> COMMAND <command> [<arg>...]
|
||||||
[CONFIGURATIONS <config>...]
|
[CONFIGURATIONS <config>...]
|
||||||
[WORKING_DIRECTORY <dir>]
|
[WORKING_DIRECTORY <dir>]
|
||||||
[COMMAND_EXPAND_LISTS])
|
[COMMAND_EXPAND_LISTS])
|
||||||
|
|
||||||
Adds a test called ``<name>``. The test name may contain arbitrary
|
Adds a test called ``<name>``. The test name may contain arbitrary
|
||||||
characters, expressed as a :ref:`Quoted Argument` or :ref:`Bracket Argument`
|
characters, expressed as a :ref:`Quoted Argument` or :ref:`Bracket Argument`
|
||||||
if necessary. See policy :policy:`CMP0110`.
|
if necessary. See policy :policy:`CMP0110`.
|
||||||
|
|
||||||
CMake only generates tests if the :command:`enable_testing` command has been
|
CMake only generates tests if the :command:`enable_testing` command has been
|
||||||
invoked. The :module:`CTest` module invokes ``enable_testing`` automatically
|
invoked. The :module:`CTest` module invokes ``enable_testing`` automatically
|
||||||
unless ``BUILD_TESTING`` is set to ``OFF``.
|
unless ``BUILD_TESTING`` is set to ``OFF``.
|
||||||
|
|
||||||
Tests added with the ``add_test(NAME)`` signature support using
|
Tests added with the ``add_test(NAME)`` signature support using
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`
|
:manual:`generator expressions <cmake-generator-expressions(7)>`
|
||||||
in test properties set by :command:`set_property(TEST)` or
|
in test properties set by :command:`set_property(TEST)` or
|
||||||
:command:`set_tests_properties`. Test properties may only be set in the
|
:command:`set_tests_properties`. Test properties may only be set in the
|
||||||
directory the test is created in.
|
directory the test is created in.
|
||||||
|
|
||||||
``add_test`` options are:
|
``add_test`` options are:
|
||||||
|
|
||||||
``COMMAND``
|
``COMMAND``
|
||||||
Specify the test command-line. If ``<command>`` specifies an executable
|
Specify the test command-line.
|
||||||
target created by :command:`add_executable`, it will automatically be
|
|
||||||
replaced by the location of the executable created at build time.
|
If ``<command>`` specifies an executable target created by
|
||||||
|
:command:`add_executable`:
|
||||||
The command may be specified using
|
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
* It will automatically be replaced by the location of the executable
|
||||||
|
created at build time.
|
||||||
``CONFIGURATIONS``
|
|
||||||
Restrict execution of the test only to the named configurations.
|
* .. versionadded:: 3.3
|
||||||
|
|
||||||
``WORKING_DIRECTORY``
|
The target's :prop_tgt:`CROSSCOMPILING_EMULATOR`, if set, will be
|
||||||
Set the test property :prop_test:`WORKING_DIRECTORY` in which to execute the
|
used to run the command on the host::
|
||||||
test. If not specified, the test will be run in
|
|
||||||
:variable:`CMAKE_CURRENT_BINARY_DIR`. The working directory may be specified
|
<emulator> <command>
|
||||||
using :manual:`generator expressions <cmake-generator-expressions(7)>`.
|
|
||||||
|
.. versionchanged:: 3.29
|
||||||
``COMMAND_EXPAND_LISTS``
|
|
||||||
.. versionadded:: 3.16
|
The emulator is used only when
|
||||||
|
:variable:`cross-compiling <CMAKE_CROSSCOMPILING>`.
|
||||||
Lists in ``COMMAND`` arguments will be expanded, including those created with
|
See policy :policy:`CMP0158`.
|
||||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
|
||||||
|
* .. versionadded:: 3.29
|
||||||
If the test command exits with code ``0`` the test passes. Non-zero exit code
|
|
||||||
is a "failed" test. The test property :prop_test:`WILL_FAIL` inverts this
|
The target's :prop_tgt:`TEST_LAUNCHER`, if set, will be
|
||||||
logic. Note that system-level test failures such as segmentation faults or
|
used to launch the command::
|
||||||
heap errors will still fail the test even if ``WILL_FALL`` is true. Output
|
|
||||||
written to stdout or stderr is captured by :manual:`ctest(1)` and only
|
<launcher> <command>
|
||||||
affects the pass/fail status via the :prop_test:`PASS_REGULAR_EXPRESSION`,
|
|
||||||
:prop_test:`FAIL_REGULAR_EXPRESSION`, or :prop_test:`SKIP_REGULAR_EXPRESSION`
|
If the :prop_tgt:`CROSSCOMPILING_EMULATOR` is also set, both are used::
|
||||||
test properties.
|
|
||||||
|
<launcher> <emulator> <command>
|
||||||
.. versionadded:: 3.16
|
|
||||||
Added :prop_test:`SKIP_REGULAR_EXPRESSION` property.
|
The command may be specified using
|
||||||
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
Example usage:
|
|
||||||
|
``CONFIGURATIONS``
|
||||||
.. code-block:: cmake
|
Restrict execution of the test only to the named configurations.
|
||||||
|
|
||||||
add_test(NAME mytest
|
``WORKING_DIRECTORY``
|
||||||
COMMAND testDriver --config $<CONFIG>
|
Set the test property :prop_test:`WORKING_DIRECTORY` in which to execute the
|
||||||
--exe $<TARGET_FILE:myexe>)
|
test. If not specified, the test will be run in
|
||||||
|
:variable:`CMAKE_CURRENT_BINARY_DIR`. The working directory may be specified
|
||||||
This creates a test ``mytest`` whose command runs a ``testDriver`` tool
|
using :manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
passing the configuration name and the full path to the executable
|
|
||||||
file produced by target ``myexe``.
|
``COMMAND_EXPAND_LISTS``
|
||||||
|
.. versionadded:: 3.16
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
Lists in ``COMMAND`` arguments will be expanded, including those created with
|
||||||
The command syntax above is recommended over the older, less flexible form:
|
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||||
|
|
||||||
.. code-block:: cmake
|
If the test command exits with code ``0`` the test passes. Non-zero exit code
|
||||||
|
is a "failed" test. The test property :prop_test:`WILL_FAIL` inverts this
|
||||||
add_test(<name> <command> [<arg>...])
|
logic. Note that system-level test failures such as segmentation faults or
|
||||||
|
heap errors will still fail the test even if ``WILL_FAIL`` is true. Output
|
||||||
Add a test called ``<name>`` with the given command-line.
|
written to stdout or stderr is captured by :manual:`ctest(1)` and only
|
||||||
|
affects the pass/fail status via the :prop_test:`PASS_REGULAR_EXPRESSION`,
|
||||||
Unlike the above ``NAME`` signature, target names are not supported
|
:prop_test:`FAIL_REGULAR_EXPRESSION`, or :prop_test:`SKIP_REGULAR_EXPRESSION`
|
||||||
in the command-line. Furthermore, tests added with this signature do not
|
test properties.
|
||||||
support :manual:`generator expressions <cmake-generator-expressions(7)>`
|
|
||||||
in the command-line or test properties.
|
.. versionadded:: 3.16
|
||||||
|
Added :prop_test:`SKIP_REGULAR_EXPRESSION` property.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
add_test(NAME mytest
|
||||||
|
COMMAND testDriver --config $<CONFIG>
|
||||||
|
--exe $<TARGET_FILE:myexe>)
|
||||||
|
|
||||||
|
This creates a test ``mytest`` whose command runs a ``testDriver`` tool
|
||||||
|
passing the configuration name and the full path to the executable
|
||||||
|
file produced by target ``myexe``.
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
The command syntax above is recommended over the older, less flexible form:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
add_test(<name> <command> [<arg>...])
|
||||||
|
|
||||||
|
Add a test called ``<name>`` with the given command-line.
|
||||||
|
|
||||||
|
Unlike the above ``NAME`` signature, target names are not supported
|
||||||
|
in the command-line. Furthermore, tests added with this signature do not
|
||||||
|
support :manual:`generator expressions <cmake-generator-expressions(7)>`
|
||||||
|
in the command-line or test properties.
|
@ -1,24 +1,24 @@
|
|||||||
aux_source_directory
|
aux_source_directory
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
Find all source files in a directory.
|
Find all source files in a directory.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
aux_source_directory(<dir> <variable>)
|
aux_source_directory(<dir> <variable>)
|
||||||
|
|
||||||
Collects the names of all the source files in the specified directory
|
Collects the names of all the source files in the specified directory
|
||||||
and stores the list in the ``<variable>`` provided. This command is
|
and stores the list in the ``<variable>`` provided. This command is
|
||||||
intended to be used by projects that use explicit template
|
intended to be used by projects that use explicit template
|
||||||
instantiation. Template instantiation files can be stored in a
|
instantiation. Template instantiation files can be stored in a
|
||||||
``Templates`` subdirectory and collected automatically using this
|
``Templates`` subdirectory and collected automatically using this
|
||||||
command to avoid manually listing all instantiations.
|
command to avoid manually listing all instantiations.
|
||||||
|
|
||||||
It is tempting to use this command to avoid writing the list of source
|
It is tempting to use this command to avoid writing the list of source
|
||||||
files for a library or executable target. While this seems to work,
|
files for a library or executable target. While this seems to work,
|
||||||
there is no way for CMake to generate a build system that knows when a
|
there is no way for CMake to generate a build system that knows when a
|
||||||
new source file has been added. Normally the generated build system
|
new source file has been added. Normally the generated build system
|
||||||
knows when it needs to rerun CMake because the ``CMakeLists.txt`` file is
|
knows when it needs to rerun CMake because the ``CMakeLists.txt`` file is
|
||||||
modified to add a new source. When the source is just added to the
|
modified to add a new source. When the source is just added to the
|
||||||
directory without modifying this file, one would have to manually
|
directory without modifying this file, one would have to manually
|
||||||
rerun CMake to generate a build system incorporating the new file.
|
rerun CMake to generate a build system incorporating the new file.
|
@ -1,76 +1,77 @@
|
|||||||
block
|
block
|
||||||
-----
|
-----
|
||||||
|
|
||||||
.. versionadded:: 3.25
|
.. versionadded:: 3.25
|
||||||
|
|
||||||
Evaluate a group of commands with a dedicated variable and/or policy scope.
|
Evaluate a group of commands with a dedicated variable and/or policy scope.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
block([SCOPE_FOR [POLICIES] [VARIABLES] ] [PROPAGATE <var-name>...])
|
block([SCOPE_FOR [POLICIES] [VARIABLES] ] [PROPAGATE <var-name>...])
|
||||||
<commands>
|
<commands>
|
||||||
endblock()
|
endblock()
|
||||||
|
|
||||||
All commands between ``block()`` and the matching :command:`endblock` are
|
All commands between ``block()`` and the matching :command:`endblock` are
|
||||||
recorded without being invoked. Once the :command:`endblock` is evaluated, the
|
recorded without being invoked. Once the :command:`endblock` is evaluated, the
|
||||||
recorded list of commands is invoked inside the requested scopes, then the
|
recorded list of commands is invoked inside the requested scopes, then the
|
||||||
scopes created by the ``block()`` command are removed.
|
scopes created by the ``block()`` command are removed.
|
||||||
|
|
||||||
``SCOPE_FOR``
|
``SCOPE_FOR``
|
||||||
Specify which scopes must be created.
|
Specify which scopes must be created.
|
||||||
|
|
||||||
``POLICIES``
|
``POLICIES``
|
||||||
Create a new policy scope. This is equivalent to
|
Create a new policy scope. This is equivalent to
|
||||||
:command:`cmake_policy(PUSH)`.
|
:command:`cmake_policy(PUSH)` with an automatic
|
||||||
|
:command:`cmake_policy(POP)` when leaving the block scope.
|
||||||
``VARIABLES``
|
|
||||||
Create a new variable scope.
|
``VARIABLES``
|
||||||
|
Create a new variable scope.
|
||||||
If ``SCOPE_FOR`` is not specified, this is equivalent to:
|
|
||||||
|
If ``SCOPE_FOR`` is not specified, this is equivalent to:
|
||||||
.. code-block:: cmake
|
|
||||||
|
.. code-block:: cmake
|
||||||
block(SCOPE_FOR VARIABLES POLICIES)
|
|
||||||
|
block(SCOPE_FOR VARIABLES POLICIES)
|
||||||
``PROPAGATE``
|
|
||||||
When a variable scope is created by the :command:`block` command, this
|
``PROPAGATE``
|
||||||
option sets or unsets the specified variables in the parent scope. This is
|
When a variable scope is created by the :command:`block` command, this
|
||||||
equivalent to :command:`set(PARENT_SCOPE)` or :command:`unset(PARENT_SCOPE)`
|
option sets or unsets the specified variables in the parent scope. This is
|
||||||
commands.
|
equivalent to :command:`set(PARENT_SCOPE)` or :command:`unset(PARENT_SCOPE)`
|
||||||
|
commands.
|
||||||
.. code-block:: cmake
|
|
||||||
|
.. code-block:: cmake
|
||||||
set(var1 "INIT1")
|
|
||||||
set(var2 "INIT2")
|
set(var1 "INIT1")
|
||||||
|
set(var2 "INIT2")
|
||||||
block(PROPAGATE var1 var2)
|
|
||||||
set(var1 "VALUE1")
|
block(PROPAGATE var1 var2)
|
||||||
unset(var2)
|
set(var1 "VALUE1")
|
||||||
endblock()
|
unset(var2)
|
||||||
|
endblock()
|
||||||
# Now var1 holds VALUE1, and var2 is unset
|
|
||||||
|
# Now var1 holds VALUE1, and var2 is unset
|
||||||
This option is only allowed when a variable scope is created. An error will
|
|
||||||
be raised in the other cases.
|
This option is only allowed when a variable scope is created. An error will
|
||||||
|
be raised in the other cases.
|
||||||
When the ``block()`` is inside a :command:`foreach` or :command:`while`
|
|
||||||
command, the :command:`break` and :command:`continue` commands can be used
|
When the ``block()`` is inside a :command:`foreach` or :command:`while`
|
||||||
inside the block.
|
command, the :command:`break` and :command:`continue` commands can be used
|
||||||
|
inside the block.
|
||||||
.. code-block:: cmake
|
|
||||||
|
.. code-block:: cmake
|
||||||
while(TRUE)
|
|
||||||
block()
|
while(TRUE)
|
||||||
...
|
block()
|
||||||
# the break() command will terminate the while() command
|
...
|
||||||
break()
|
# the break() command will terminate the while() command
|
||||||
endblock()
|
break()
|
||||||
endwhile()
|
endblock()
|
||||||
|
endwhile()
|
||||||
|
|
||||||
See Also
|
|
||||||
^^^^^^^^
|
See Also
|
||||||
|
^^^^^^^^
|
||||||
* :command:`endblock`
|
|
||||||
* :command:`return`
|
* :command:`endblock`
|
||||||
* :command:`cmake_policy`
|
* :command:`return`
|
||||||
|
* :command:`cmake_policy`
|
@ -1,12 +1,12 @@
|
|||||||
break
|
break
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Break from an enclosing foreach or while loop.
|
Break from an enclosing foreach or while loop.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
break()
|
break()
|
||||||
|
|
||||||
Breaks from an enclosing :command:`foreach` or :command:`while` loop.
|
Breaks from an enclosing :command:`foreach` or :command:`while` loop.
|
||||||
|
|
||||||
See also the :command:`continue` command.
|
See also the :command:`continue` command.
|
@ -1,51 +1,51 @@
|
|||||||
build_command
|
build_command
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Get a command line to build the current project.
|
Get a command line to build the current project.
|
||||||
This is mainly intended for internal use by the :module:`CTest` module.
|
This is mainly intended for internal use by the :module:`CTest` module.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
build_command(<variable>
|
build_command(<variable>
|
||||||
[CONFIGURATION <config>]
|
[CONFIGURATION <config>]
|
||||||
[PARALLEL_LEVEL <parallel>]
|
[PARALLEL_LEVEL <parallel>]
|
||||||
[TARGET <target>]
|
[TARGET <target>]
|
||||||
[PROJECT_NAME <projname>] # legacy, causes warning
|
[PROJECT_NAME <projname>] # legacy, causes warning
|
||||||
)
|
)
|
||||||
|
|
||||||
Sets the given ``<variable>`` to a command-line string of the form::
|
Sets the given ``<variable>`` to a command-line string of the form::
|
||||||
|
|
||||||
<cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...] [-- -i]
|
<cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...] [-- -i]
|
||||||
|
|
||||||
where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
|
where ``<cmake>`` is the location of the :manual:`cmake(1)` command-line
|
||||||
tool, and ``<config>``, ``<parallel>`` and ``<target>`` are the values
|
tool, and ``<config>``, ``<parallel>`` and ``<target>`` are the values
|
||||||
provided to the ``CONFIGURATION``, ``PARALLEL_LEVEL`` and ``TARGET``
|
provided to the ``CONFIGURATION``, ``PARALLEL_LEVEL`` and ``TARGET``
|
||||||
options, if any. The trailing ``-- -i`` option is added for
|
options, if any. The trailing ``-- -i`` option is added for
|
||||||
:ref:`Makefile Generators` if policy :policy:`CMP0061` is not set to
|
:ref:`Makefile Generators` if policy :policy:`CMP0061` is not set to
|
||||||
``NEW``.
|
``NEW``.
|
||||||
|
|
||||||
When invoked, this :option:`cmake --build` command line will launch the
|
When invoked, this :option:`cmake --build` command line will launch the
|
||||||
underlying build system tool.
|
underlying build system tool.
|
||||||
|
|
||||||
.. versionadded:: 3.21
|
.. versionadded:: 3.21
|
||||||
The ``PARALLEL_LEVEL`` argument can be used to set the
|
The ``PARALLEL_LEVEL`` argument can be used to set the
|
||||||
:option:`--parallel <cmake--build --parallel>` flag.
|
:option:`--parallel <cmake--build --parallel>` flag.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
build_command(<cachevariable> <makecommand>)
|
build_command(<cachevariable> <makecommand>)
|
||||||
|
|
||||||
This second signature is deprecated, but still available for backwards
|
This second signature is deprecated, but still available for backwards
|
||||||
compatibility. Use the first signature instead.
|
compatibility. Use the first signature instead.
|
||||||
|
|
||||||
It sets the given ``<cachevariable>`` to a command-line string as
|
It sets the given ``<cachevariable>`` to a command-line string as
|
||||||
above but without the :option:`--target <cmake--build --target>` option.
|
above but without the :option:`--target <cmake--build --target>` option.
|
||||||
The ``<makecommand>`` is ignored but should be the full path to
|
The ``<makecommand>`` is ignored but should be the full path to
|
||||||
devenv, nmake, make or one of the end user build tools
|
devenv, nmake, make or one of the end user build tools
|
||||||
for legacy invocations.
|
for legacy invocations.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
In CMake versions prior to 3.0 this command returned a command
|
In CMake versions prior to 3.0 this command returned a command
|
||||||
line that directly invokes the native build tool for the current
|
line that directly invokes the native build tool for the current
|
||||||
generator. Their implementation of the ``PROJECT_NAME`` option
|
generator. Their implementation of the ``PROJECT_NAME`` option
|
||||||
had no useful effects, so CMake now warns on use of the option.
|
had no useful effects, so CMake now warns on use of the option.
|
@ -1,15 +1,15 @@
|
|||||||
build_name
|
build_name
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Disallowed since version 3.0. See CMake Policy :policy:`CMP0036`.
|
Disallowed since version 3.0. See CMake Policy :policy:`CMP0036`.
|
||||||
|
|
||||||
Use ``${CMAKE_SYSTEM}`` and ``${CMAKE_CXX_COMPILER}`` instead.
|
Use ``${CMAKE_SYSTEM}`` and ``${CMAKE_CXX_COMPILER}`` instead.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
build_name(variable)
|
build_name(variable)
|
||||||
|
|
||||||
Sets the specified variable to a string representing the platform and
|
Sets the specified variable to a string representing the platform and
|
||||||
compiler settings. These values are now available through the
|
compiler settings. These values are now available through the
|
||||||
:variable:`CMAKE_SYSTEM` and
|
:variable:`CMAKE_SYSTEM` and
|
||||||
:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` variables.
|
:variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` variables.
|
@ -1,78 +1,78 @@
|
|||||||
cmake_file_api
|
cmake_file_api
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
.. versionadded:: 3.27
|
.. versionadded:: 3.27
|
||||||
|
|
||||||
Enables interacting with the :manual:`CMake file API <cmake-file-api(7)>`.
|
Enables interacting with the :manual:`CMake file API <cmake-file-api(7)>`.
|
||||||
|
|
||||||
.. signature::
|
.. signature::
|
||||||
cmake_file_api(QUERY ...)
|
cmake_file_api(QUERY ...)
|
||||||
|
|
||||||
The ``QUERY`` subcommand adds a file API query for the current CMake
|
The ``QUERY`` subcommand adds a file API query for the current CMake
|
||||||
invocation.
|
invocation.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_file_api(
|
cmake_file_api(
|
||||||
QUERY
|
QUERY
|
||||||
API_VERSION <version>
|
API_VERSION <version>
|
||||||
[CODEMODEL <versions>...]
|
[CODEMODEL <versions>...]
|
||||||
[CACHE <versions>...]
|
[CACHE <versions>...]
|
||||||
[CMAKEFILES <versions>...]
|
[CMAKEFILES <versions>...]
|
||||||
[TOOLCHAINS <versions>...]
|
[TOOLCHAINS <versions>...]
|
||||||
)
|
)
|
||||||
|
|
||||||
The ``API_VERSION`` must always be given. Currently, the only supported
|
The ``API_VERSION`` must always be given. Currently, the only supported
|
||||||
value for ``<version>`` is 1. See :ref:`file-api v1` for details of the
|
value for ``<version>`` is 1. See :ref:`file-api v1` for details of the
|
||||||
reply content and location.
|
reply content and location.
|
||||||
|
|
||||||
Each of the optional keywords ``CODEMODEL``, ``CACHE``, ``CMAKEFILES`` and
|
Each of the optional keywords ``CODEMODEL``, ``CACHE``, ``CMAKEFILES`` and
|
||||||
``TOOLCHAINS`` correspond to one of the object kinds that can be requested
|
``TOOLCHAINS`` correspond to one of the object kinds that can be requested
|
||||||
by the project. The ``configureLog`` object kind cannot be set with this
|
by the project. The ``configureLog`` object kind cannot be set with this
|
||||||
command, since it must be set before CMake starts reading the top level
|
command, since it must be set before CMake starts reading the top level
|
||||||
``CMakeLists.txt`` file.
|
``CMakeLists.txt`` file.
|
||||||
|
|
||||||
For each of the optional keywords, the ``<versions>`` list must contain one
|
For each of the optional keywords, the ``<versions>`` list must contain one
|
||||||
or more version values of the form ``major`` or ``major.minor``, where
|
or more version values of the form ``major`` or ``major.minor``, where
|
||||||
``major`` and ``minor`` are integers. Projects should list the versions they
|
``major`` and ``minor`` are integers. Projects should list the versions they
|
||||||
accept in their preferred order, as only the first supported value from the
|
accept in their preferred order, as only the first supported value from the
|
||||||
list will be selected. The command will ignore versions with a ``major``
|
list will be selected. The command will ignore versions with a ``major``
|
||||||
version higher than any major version it supports for that object kind.
|
version higher than any major version it supports for that object kind.
|
||||||
It will raise an error if it encounters an invalid version number, or if none
|
It will raise an error if it encounters an invalid version number, or if none
|
||||||
of the requested versions is supported.
|
of the requested versions is supported.
|
||||||
|
|
||||||
For each type of object kind requested, a query equivalent to a shared,
|
For each type of object kind requested, a query equivalent to a shared,
|
||||||
stateless query will be added internally. No query file will be created in
|
stateless query will be added internally. No query file will be created in
|
||||||
the file system. The reply *will* be written to the file system at
|
the file system. The reply *will* be written to the file system at
|
||||||
generation time.
|
generation time.
|
||||||
|
|
||||||
It is not an error to add a query for the same thing more than once, whether
|
It is not an error to add a query for the same thing more than once, whether
|
||||||
from query files or from multiple calls to ``cmake_file_api(QUERY)``.
|
from query files or from multiple calls to ``cmake_file_api(QUERY)``.
|
||||||
The final set of queries will be a merged combination of all queries
|
The final set of queries will be a merged combination of all queries
|
||||||
specified on disk and queries submitted by the project.
|
specified on disk and queries submitted by the project.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
|
|
||||||
A project may want to use replies from the file API at build time to implement
|
A project may want to use replies from the file API at build time to implement
|
||||||
some form of verification task. Instead of relying on something outside of
|
some form of verification task. Instead of relying on something outside of
|
||||||
CMake to create a query file, the project can use ``cmake_file_api(QUERY)``
|
CMake to create a query file, the project can use ``cmake_file_api(QUERY)``
|
||||||
to request the required information for the current run. It can then create
|
to request the required information for the current run. It can then create
|
||||||
a custom command to run at build time, knowing that the requested information
|
a custom command to run at build time, knowing that the requested information
|
||||||
should always be available.
|
should always be available.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_file_api(
|
cmake_file_api(
|
||||||
QUERY
|
QUERY
|
||||||
API_VERSION 1
|
API_VERSION 1
|
||||||
CODEMODEL 2.3
|
CODEMODEL 2.3
|
||||||
TOOLCHAINS 1
|
TOOLCHAINS 1
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(verify_project
|
add_custom_target(verify_project
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-D BUILD_DIR=${CMAKE_BINARY_DIR}
|
-D BUILD_DIR=${CMAKE_BINARY_DIR}
|
||||||
-D CONFIG=$<CONFIG>
|
-D CONFIG=$<CONFIG>
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/verify_project.cmake
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/verify_project.cmake
|
||||||
)
|
)
|
@ -1,396 +1,403 @@
|
|||||||
cmake_host_system_information
|
cmake_host_system_information
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
Query various host system information.
|
Query various host system information.
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
`Query host system specific information`_
|
`Query host system specific information`_
|
||||||
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
|
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
|
||||||
|
|
||||||
`Query Windows registry`_
|
`Query Windows registry`_
|
||||||
cmake_host_system_information(RESULT <variable> QUERY WINDOWS_REGISTRY <key> ...)
|
cmake_host_system_information(RESULT <variable> QUERY WINDOWS_REGISTRY <key> ...)
|
||||||
|
|
||||||
Query host system specific information
|
Query host system specific information
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
|
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
|
||||||
|
|
||||||
Queries system information of the host system on which cmake runs.
|
Queries system information of the host system on which cmake runs.
|
||||||
One or more ``<key>`` can be provided to select the information to be
|
One or more ``<key>`` can be provided to select the information to be
|
||||||
queried. The list of queried values is stored in ``<variable>``.
|
queried. The list of queried values is stored in ``<variable>``.
|
||||||
|
|
||||||
``<key>`` can be one of the following values:
|
``<key>`` can be one of the following values:
|
||||||
|
|
||||||
``NUMBER_OF_LOGICAL_CORES``
|
``NUMBER_OF_LOGICAL_CORES``
|
||||||
Number of logical cores
|
Number of logical cores
|
||||||
|
|
||||||
``NUMBER_OF_PHYSICAL_CORES``
|
``NUMBER_OF_PHYSICAL_CORES``
|
||||||
Number of physical cores
|
Number of physical cores
|
||||||
|
|
||||||
``HOSTNAME``
|
``HOSTNAME``
|
||||||
Hostname
|
Hostname
|
||||||
|
|
||||||
``FQDN``
|
``FQDN``
|
||||||
Fully qualified domain name
|
Fully qualified domain name
|
||||||
|
|
||||||
``TOTAL_VIRTUAL_MEMORY``
|
``TOTAL_VIRTUAL_MEMORY``
|
||||||
Total virtual memory in MiB [#mebibytes]_
|
Total virtual memory in MiB [#mebibytes]_
|
||||||
|
|
||||||
``AVAILABLE_VIRTUAL_MEMORY``
|
``AVAILABLE_VIRTUAL_MEMORY``
|
||||||
Available virtual memory in MiB [#mebibytes]_
|
Available virtual memory in MiB [#mebibytes]_
|
||||||
|
|
||||||
``TOTAL_PHYSICAL_MEMORY``
|
``TOTAL_PHYSICAL_MEMORY``
|
||||||
Total physical memory in MiB [#mebibytes]_
|
Total physical memory in MiB [#mebibytes]_
|
||||||
|
|
||||||
``AVAILABLE_PHYSICAL_MEMORY``
|
``AVAILABLE_PHYSICAL_MEMORY``
|
||||||
Available physical memory in MiB [#mebibytes]_
|
Available physical memory in MiB [#mebibytes]_
|
||||||
|
|
||||||
``IS_64BIT``
|
``IS_64BIT``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor is 64Bit
|
One if processor is 64Bit
|
||||||
|
|
||||||
``HAS_FPU``
|
``HAS_FPU``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor has floating point unit
|
One if processor has floating point unit
|
||||||
|
|
||||||
``HAS_MMX``
|
``HAS_MMX``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports MMX instructions
|
One if processor supports MMX instructions
|
||||||
|
|
||||||
``HAS_MMX_PLUS``
|
``HAS_MMX_PLUS``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports Ext. MMX instructions
|
One if processor supports Ext. MMX instructions
|
||||||
|
|
||||||
``HAS_SSE``
|
``HAS_SSE``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports SSE instructions
|
One if processor supports SSE instructions
|
||||||
|
|
||||||
``HAS_SSE2``
|
``HAS_SSE2``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports SSE2 instructions
|
One if processor supports SSE2 instructions
|
||||||
|
|
||||||
``HAS_SSE_FP``
|
``HAS_SSE_FP``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports SSE FP instructions
|
One if processor supports SSE FP instructions
|
||||||
|
|
||||||
``HAS_SSE_MMX``
|
``HAS_SSE_MMX``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports SSE MMX instructions
|
One if processor supports SSE MMX instructions
|
||||||
|
|
||||||
``HAS_AMD_3DNOW``
|
``HAS_AMD_3DNOW``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports 3DNow instructions
|
One if processor supports 3DNow instructions
|
||||||
|
|
||||||
``HAS_AMD_3DNOW_PLUS``
|
``HAS_AMD_3DNOW_PLUS``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor supports 3DNow+ instructions
|
One if processor supports 3DNow+ instructions
|
||||||
|
|
||||||
``HAS_IA64``
|
``HAS_IA64``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if IA64 processor emulating x86
|
One if IA64 processor emulating x86
|
||||||
|
|
||||||
``HAS_SERIAL_NUMBER``
|
``HAS_SERIAL_NUMBER``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
One if processor has serial number
|
One if processor has serial number
|
||||||
|
|
||||||
``PROCESSOR_SERIAL_NUMBER``
|
``PROCESSOR_SERIAL_NUMBER``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
Processor serial number
|
Processor serial number
|
||||||
|
|
||||||
``PROCESSOR_NAME``
|
``PROCESSOR_NAME``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
Human readable processor name
|
Human readable processor name
|
||||||
|
|
||||||
``PROCESSOR_DESCRIPTION``
|
``PROCESSOR_DESCRIPTION``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
Human readable full processor description
|
Human readable full processor description
|
||||||
|
|
||||||
``OS_NAME``
|
``OS_NAME``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
See :variable:`CMAKE_HOST_SYSTEM_NAME`
|
See :variable:`CMAKE_HOST_SYSTEM_NAME`
|
||||||
|
|
||||||
``OS_RELEASE``
|
``OS_RELEASE``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
The OS sub-type e.g. on Windows ``Professional``
|
The OS sub-type e.g. on Windows ``Professional``
|
||||||
|
|
||||||
``OS_VERSION``
|
``OS_VERSION``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
The OS build ID
|
The OS build ID
|
||||||
|
|
||||||
``OS_PLATFORM``
|
``OS_PLATFORM``
|
||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
See :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`
|
See :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`
|
||||||
|
|
||||||
``DISTRIB_INFO``
|
``MSYSTEM_PREFIX``
|
||||||
.. versionadded:: 3.22
|
.. versionadded:: 3.28
|
||||||
|
|
||||||
Read :file:`/etc/os-release` file and define the given ``<variable>``
|
Available only on Windows hosts. In a MSYS or MinGW development
|
||||||
into a list of read variables
|
environment that sets the ``MSYSTEM`` environment variable, this
|
||||||
|
is its installation prefix. Otherwise, this is the empty string.
|
||||||
``DISTRIB_<name>``
|
|
||||||
.. versionadded:: 3.22
|
``DISTRIB_INFO``
|
||||||
|
.. versionadded:: 3.22
|
||||||
Get the ``<name>`` variable (see `man 5 os-release`_) if it exists in the
|
|
||||||
:file:`/etc/os-release` file
|
Read :file:`/etc/os-release` file and define the given ``<variable>``
|
||||||
|
into a list of read variables
|
||||||
Example:
|
|
||||||
|
``DISTRIB_<name>``
|
||||||
.. code-block:: cmake
|
.. versionadded:: 3.22
|
||||||
|
|
||||||
cmake_host_system_information(RESULT PRETTY_NAME QUERY DISTRIB_PRETTY_NAME)
|
Get the ``<name>`` variable (see `man 5 os-release`_) if it exists in the
|
||||||
message(STATUS "${PRETTY_NAME}")
|
:file:`/etc/os-release` file
|
||||||
|
|
||||||
cmake_host_system_information(RESULT DISTRO QUERY DISTRIB_INFO)
|
Example:
|
||||||
|
|
||||||
foreach(VAR IN LISTS DISTRO)
|
.. code-block:: cmake
|
||||||
message(STATUS "${VAR}=`${${VAR}}`")
|
|
||||||
endforeach()
|
cmake_host_system_information(RESULT PRETTY_NAME QUERY DISTRIB_PRETTY_NAME)
|
||||||
|
message(STATUS "${PRETTY_NAME}")
|
||||||
|
|
||||||
Output::
|
cmake_host_system_information(RESULT DISTRO QUERY DISTRIB_INFO)
|
||||||
|
|
||||||
-- Ubuntu 20.04.2 LTS
|
foreach(VAR IN LISTS DISTRO)
|
||||||
-- DISTRO_BUG_REPORT_URL=`https://bugs.launchpad.net/ubuntu/`
|
message(STATUS "${VAR}=`${${VAR}}`")
|
||||||
-- DISTRO_HOME_URL=`https://www.ubuntu.com/`
|
endforeach()
|
||||||
-- DISTRO_ID=`ubuntu`
|
|
||||||
-- DISTRO_ID_LIKE=`debian`
|
|
||||||
-- DISTRO_NAME=`Ubuntu`
|
Output::
|
||||||
-- DISTRO_PRETTY_NAME=`Ubuntu 20.04.2 LTS`
|
|
||||||
-- DISTRO_PRIVACY_POLICY_URL=`https://www.ubuntu.com/legal/terms-and-policies/privacy-policy`
|
-- Ubuntu 20.04.2 LTS
|
||||||
-- DISTRO_SUPPORT_URL=`https://help.ubuntu.com/`
|
-- DISTRO_BUG_REPORT_URL=`https://bugs.launchpad.net/ubuntu/`
|
||||||
-- DISTRO_UBUNTU_CODENAME=`focal`
|
-- DISTRO_HOME_URL=`https://www.ubuntu.com/`
|
||||||
-- DISTRO_VERSION=`20.04.2 LTS (Focal Fossa)`
|
-- DISTRO_ID=`ubuntu`
|
||||||
-- DISTRO_VERSION_CODENAME=`focal`
|
-- DISTRO_ID_LIKE=`debian`
|
||||||
-- DISTRO_VERSION_ID=`20.04`
|
-- DISTRO_NAME=`Ubuntu`
|
||||||
|
-- DISTRO_PRETTY_NAME=`Ubuntu 20.04.2 LTS`
|
||||||
If :file:`/etc/os-release` file is not found, the command tries to gather OS
|
-- DISTRO_PRIVACY_POLICY_URL=`https://www.ubuntu.com/legal/terms-and-policies/privacy-policy`
|
||||||
identification via fallback scripts. The fallback script can use `various
|
-- DISTRO_SUPPORT_URL=`https://help.ubuntu.com/`
|
||||||
distribution-specific files`_ to collect OS identification data and map it
|
-- DISTRO_UBUNTU_CODENAME=`focal`
|
||||||
into `man 5 os-release`_ variables.
|
-- DISTRO_VERSION=`20.04.2 LTS (Focal Fossa)`
|
||||||
|
-- DISTRO_VERSION_CODENAME=`focal`
|
||||||
Fallback Interface Variables
|
-- DISTRO_VERSION_ID=`20.04`
|
||||||
""""""""""""""""""""""""""""
|
|
||||||
|
If :file:`/etc/os-release` file is not found, the command tries to gather OS
|
||||||
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS
|
identification via fallback scripts. The fallback script can use `various
|
||||||
|
distribution-specific files`_ to collect OS identification data and map it
|
||||||
In addition to the scripts shipped with CMake, a user may append full
|
into `man 5 os-release`_ variables.
|
||||||
paths to his script(s) to the this list. The script filename has the
|
|
||||||
following format: ``NNN-<name>.cmake``, where ``NNN`` is three digits
|
Fallback Interface Variables
|
||||||
used to apply collected scripts in a specific order.
|
""""""""""""""""""""""""""""
|
||||||
|
|
||||||
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>
|
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS
|
||||||
|
|
||||||
Variables collected by the user provided fallback script
|
In addition to the scripts shipped with CMake, a user may append full
|
||||||
ought to be assigned to CMake variables using this naming
|
paths to his script(s) to the this list. The script filename has the
|
||||||
convention. Example, the ``ID`` variable from the manual becomes
|
following format: ``NNN-<name>.cmake``, where ``NNN`` is three digits
|
||||||
``CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID``.
|
used to apply collected scripts in a specific order.
|
||||||
|
|
||||||
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_RESULT
|
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>
|
||||||
|
|
||||||
The fallback script ought to store names of all assigned
|
Variables collected by the user provided fallback script
|
||||||
``CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>`` variables in this list.
|
ought to be assigned to CMake variables using this naming
|
||||||
|
convention. Example, the ``ID`` variable from the manual becomes
|
||||||
Example:
|
``CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID``.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. variable:: CMAKE_GET_OS_RELEASE_FALLBACK_RESULT
|
||||||
|
|
||||||
# Try to detect some old distribution
|
The fallback script ought to store names of all assigned
|
||||||
# See also
|
``CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>`` variables in this list.
|
||||||
# - http://linuxmafia.com/faq/Admin/release-files.html
|
|
||||||
#
|
Example:
|
||||||
if(NOT EXISTS "${CMAKE_SYSROOT}/etc/foobar-release")
|
|
||||||
return()
|
.. code-block:: cmake
|
||||||
endif()
|
|
||||||
# Get the first string only
|
# Try to detect some old distribution
|
||||||
file(
|
# See also
|
||||||
STRINGS "${CMAKE_SYSROOT}/etc/foobar-release" CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT
|
# - http://linuxmafia.com/faq/Admin/release-files.html
|
||||||
LIMIT_COUNT 1
|
#
|
||||||
)
|
if(NOT EXISTS "${CMAKE_SYSROOT}/etc/foobar-release")
|
||||||
#
|
return()
|
||||||
# Example:
|
endif()
|
||||||
#
|
# Get the first string only
|
||||||
# Foobar distribution release 1.2.3 (server)
|
file(
|
||||||
#
|
STRINGS "${CMAKE_SYSROOT}/etc/foobar-release" CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT
|
||||||
if(CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT MATCHES "Foobar distribution release ([0-9\.]+) .*")
|
LIMIT_COUNT 1
|
||||||
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME Foobar)
|
)
|
||||||
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME "${CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT}")
|
#
|
||||||
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID foobar)
|
# Example:
|
||||||
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION ${CMAKE_MATCH_1})
|
#
|
||||||
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID ${CMAKE_MATCH_1})
|
# Foobar distribution release 1.2.3 (server)
|
||||||
list(
|
#
|
||||||
APPEND CMAKE_GET_OS_RELEASE_FALLBACK_RESULT
|
if(CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT MATCHES "Foobar distribution release ([0-9\.]+) .*")
|
||||||
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME
|
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME Foobar)
|
||||||
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME
|
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME "${CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT}")
|
||||||
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID
|
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID foobar)
|
||||||
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION
|
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION ${CMAKE_MATCH_1})
|
||||||
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID
|
set(CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID ${CMAKE_MATCH_1})
|
||||||
)
|
list(
|
||||||
endif()
|
APPEND CMAKE_GET_OS_RELEASE_FALLBACK_RESULT
|
||||||
unset(CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT)
|
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME
|
||||||
|
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME
|
||||||
|
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID
|
||||||
.. rubric:: Footnotes
|
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION
|
||||||
|
CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID
|
||||||
.. [#mebibytes] One MiB (mebibyte) is equal to 1024x1024 bytes.
|
)
|
||||||
|
endif()
|
||||||
.. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/os-release.html
|
unset(CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT)
|
||||||
.. _various distribution-specific files: http://linuxmafia.com/faq/Admin/release-files.html
|
|
||||||
|
|
||||||
.. _Query Windows registry:
|
.. rubric:: Footnotes
|
||||||
|
|
||||||
Query Windows registry
|
.. [#mebibytes] One MiB (mebibyte) is equal to 1024x1024 bytes.
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
.. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/latest/os-release.html
|
||||||
.. versionadded:: 3.24
|
.. _various distribution-specific files: http://linuxmafia.com/faq/Admin/release-files.html
|
||||||
|
|
||||||
::
|
.. _Query Windows registry:
|
||||||
|
|
||||||
cmake_host_system_information(RESULT <variable>
|
Query Windows registry
|
||||||
QUERY WINDOWS_REGISTRY <key> [VALUE_NAMES|SUBKEYS|VALUE <name>]
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
[VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
|
|
||||||
[SEPARATOR <separator>]
|
.. versionadded:: 3.24
|
||||||
[ERROR_VARIABLE <result>])
|
|
||||||
|
::
|
||||||
Performs query operations on local computer registry subkey. Returns a list of
|
|
||||||
subkeys or value names that are located under the specified subkey in the
|
cmake_host_system_information(RESULT <variable>
|
||||||
registry or the data of the specified value name. The result of the queried
|
QUERY WINDOWS_REGISTRY <key> [VALUE_NAMES|SUBKEYS|VALUE <name>]
|
||||||
entity is stored in ``<variable>``.
|
[VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
|
||||||
|
[SEPARATOR <separator>]
|
||||||
.. note::
|
[ERROR_VARIABLE <result>])
|
||||||
|
|
||||||
Querying registry for any other platforms than ``Windows``, including
|
Performs query operations on local computer registry subkey. Returns a list of
|
||||||
``CYGWIN``, will always returns an empty string and sets an error message in
|
subkeys or value names that are located under the specified subkey in the
|
||||||
the variable specified with sub-option ``ERROR_VARIABLE``.
|
registry or the data of the specified value name. The result of the queried
|
||||||
|
entity is stored in ``<variable>``.
|
||||||
``<key>`` specify the full path of a subkey on the local computer. The
|
|
||||||
``<key>`` must include a valid root key. Valid root keys for the local computer
|
.. note::
|
||||||
are:
|
|
||||||
|
Querying registry for any other platforms than ``Windows``, including
|
||||||
* ``HKLM`` or ``HKEY_LOCAL_MACHINE``
|
``CYGWIN``, will always returns an empty string and sets an error message in
|
||||||
* ``HKCU`` or ``HKEY_CURRENT_USER``
|
the variable specified with sub-option ``ERROR_VARIABLE``.
|
||||||
* ``HKCR`` or ``HKEY_CLASSES_ROOT``
|
|
||||||
* ``HKU`` or ``HKEY_USERS``
|
``<key>`` specify the full path of a subkey on the local computer. The
|
||||||
* ``HKCC`` or ``HKEY_CURRENT_CONFIG``
|
``<key>`` must include a valid root key. Valid root keys for the local computer
|
||||||
|
are:
|
||||||
And, optionally, the path to a subkey under the specified root key. The path
|
|
||||||
separator can be the slash or the backslash. ``<key>`` is not case sensitive.
|
* ``HKLM`` or ``HKEY_LOCAL_MACHINE``
|
||||||
For example:
|
* ``HKCU`` or ``HKEY_CURRENT_USER``
|
||||||
|
* ``HKCR`` or ``HKEY_CLASSES_ROOT``
|
||||||
.. code-block:: cmake
|
* ``HKU`` or ``HKEY_USERS``
|
||||||
|
* ``HKCC`` or ``HKEY_CURRENT_CONFIG``
|
||||||
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKLM")
|
|
||||||
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Kitware")
|
And, optionally, the path to a subkey under the specified root key. The path
|
||||||
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU\\SOFTWARE\\Kitware")
|
separator can be the slash or the backslash. ``<key>`` is not case sensitive.
|
||||||
|
For example:
|
||||||
``VALUE_NAMES``
|
|
||||||
Request the list of value names defined under ``<key>``. If a default value
|
.. code-block:: cmake
|
||||||
is defined, it will be identified with the special name ``(default)``.
|
|
||||||
|
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKLM")
|
||||||
``SUBKEYS``
|
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Kitware")
|
||||||
Request the list of subkeys defined under ``<key>``.
|
cmake_host_system_information(RESULT result QUERY WINDOWS_REGISTRY "HKCU\\SOFTWARE\\Kitware")
|
||||||
|
|
||||||
``VALUE <name>``
|
``VALUE_NAMES``
|
||||||
Request the data stored in value named ``<name>``. If ``VALUE`` is not
|
Request the list of value names defined under ``<key>``. If a default value
|
||||||
specified or argument is the special name ``(default)``, the content of the
|
is defined, it will be identified with the special name ``(default)``.
|
||||||
default value, if any, will be returned.
|
|
||||||
|
``SUBKEYS``
|
||||||
.. code-block:: cmake
|
Request the list of subkeys defined under ``<key>``.
|
||||||
|
|
||||||
# query default value for HKLM/SOFTWARE/Kitware key
|
``VALUE <name>``
|
||||||
cmake_host_system_information(RESULT result
|
Request the data stored in value named ``<name>``. If ``VALUE`` is not
|
||||||
QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Kitware")
|
specified or argument is the special name ``(default)``, the content of the
|
||||||
|
default value, if any, will be returned.
|
||||||
# query default value for HKLM/SOFTWARE/Kitware key using special value name
|
|
||||||
cmake_host_system_information(RESULT result
|
.. code-block:: cmake
|
||||||
QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Kitware"
|
|
||||||
VALUE "(default)")
|
# query default value for HKLM/SOFTWARE/Kitware key
|
||||||
|
cmake_host_system_information(RESULT result
|
||||||
Supported types are:
|
QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Kitware")
|
||||||
|
|
||||||
* ``REG_SZ``.
|
# query default value for HKLM/SOFTWARE/Kitware key using special value name
|
||||||
* ``REG_EXPAND_SZ``. The returned data is expanded.
|
cmake_host_system_information(RESULT result
|
||||||
* ``REG_MULTI_SZ``. The returned is expressed as a CMake list. See also
|
QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Kitware"
|
||||||
``SEPARATOR`` sub-option.
|
VALUE "(default)")
|
||||||
* ``REG_DWORD``.
|
|
||||||
* ``REG_QWORD``.
|
Supported types are:
|
||||||
|
|
||||||
For all other types, an empty string is returned.
|
* ``REG_SZ``.
|
||||||
|
* ``REG_EXPAND_SZ``. The returned data is expanded.
|
||||||
``VIEW``
|
* ``REG_MULTI_SZ``. The returned is expressed as a CMake list. See also
|
||||||
Specify which registry views must be queried. When not specified, ``BOTH``
|
``SEPARATOR`` sub-option.
|
||||||
view is used.
|
* ``REG_DWORD``.
|
||||||
|
* ``REG_QWORD``.
|
||||||
``64``
|
|
||||||
Query the 64bit registry. On ``32bit Windows``, returns always an empty
|
For all other types, an empty string is returned.
|
||||||
string.
|
|
||||||
|
``VIEW``
|
||||||
``32``
|
Specify which registry views must be queried. When not specified, ``BOTH``
|
||||||
Query the 32bit registry.
|
view is used.
|
||||||
|
|
||||||
``64_32``
|
``64``
|
||||||
For ``VALUE`` sub-option or default value, query the registry using view
|
Query the 64bit registry. On ``32bit Windows``, returns always an empty
|
||||||
``64``, and if the request failed, query the registry using view ``32``.
|
string.
|
||||||
For ``VALUE_NAMES`` and ``SUBKEYS`` sub-options, query both views (``64``
|
|
||||||
and ``32``) and merge the results (sorted and duplicates removed).
|
``32``
|
||||||
|
Query the 32bit registry.
|
||||||
``32_64``
|
|
||||||
For ``VALUE`` sub-option or default value, query the registry using view
|
``64_32``
|
||||||
``32``, and if the request failed, query the registry using view ``64``.
|
For ``VALUE`` sub-option or default value, query the registry using view
|
||||||
For ``VALUE_NAMES`` and ``SUBKEYS`` sub-options, query both views (``32``
|
``64``, and if the request failed, query the registry using view ``32``.
|
||||||
and ``64``) and merge the results (sorted and duplicates removed).
|
For ``VALUE_NAMES`` and ``SUBKEYS`` sub-options, query both views (``64``
|
||||||
|
and ``32``) and merge the results (sorted and duplicates removed).
|
||||||
``HOST``
|
|
||||||
Query the registry matching the architecture of the host: ``64`` on ``64bit
|
``32_64``
|
||||||
Windows`` and ``32`` on ``32bit Windows``.
|
For ``VALUE`` sub-option or default value, query the registry using view
|
||||||
|
``32``, and if the request failed, query the registry using view ``64``.
|
||||||
``TARGET``
|
For ``VALUE_NAMES`` and ``SUBKEYS`` sub-options, query both views (``32``
|
||||||
Query the registry matching the architecture specified by
|
and ``64``) and merge the results (sorted and duplicates removed).
|
||||||
:variable:`CMAKE_SIZEOF_VOID_P` variable. If not defined, fallback to
|
|
||||||
``HOST`` view.
|
``HOST``
|
||||||
|
Query the registry matching the architecture of the host: ``64`` on ``64bit
|
||||||
``BOTH``
|
Windows`` and ``32`` on ``32bit Windows``.
|
||||||
Query both views (``32`` and ``64``). The order depends of the following
|
|
||||||
rules: If :variable:`CMAKE_SIZEOF_VOID_P` variable is defined. Use the
|
``TARGET``
|
||||||
following view depending of the content of this variable:
|
Query the registry matching the architecture specified by
|
||||||
|
:variable:`CMAKE_SIZEOF_VOID_P` variable. If not defined, fallback to
|
||||||
* ``8``: ``64_32``
|
``HOST`` view.
|
||||||
* ``4``: ``32_64``
|
|
||||||
|
``BOTH``
|
||||||
If :variable:`CMAKE_SIZEOF_VOID_P` variable is not defined, rely on
|
Query both views (``32`` and ``64``). The order depends of the following
|
||||||
architecture of the host:
|
rules: If :variable:`CMAKE_SIZEOF_VOID_P` variable is defined. Use the
|
||||||
|
following view depending of the content of this variable:
|
||||||
* ``64bit``: ``64_32``
|
|
||||||
* ``32bit``: ``32``
|
* ``8``: ``64_32``
|
||||||
|
* ``4``: ``32_64``
|
||||||
``SEPARATOR``
|
|
||||||
Specify the separator character for ``REG_MULTI_SZ`` type. When not
|
If :variable:`CMAKE_SIZEOF_VOID_P` variable is not defined, rely on
|
||||||
specified, the character ``\0`` is used.
|
architecture of the host:
|
||||||
|
|
||||||
``ERROR_VARIABLE <result>``
|
* ``64bit``: ``64_32``
|
||||||
Returns any error raised during query operation. In case of success, the
|
* ``32bit``: ``32``
|
||||||
variable holds an empty string.
|
|
||||||
|
``SEPARATOR``
|
||||||
|
Specify the separator character for ``REG_MULTI_SZ`` type. When not
|
||||||
|
specified, the character ``\0`` is used.
|
||||||
|
|
||||||
|
``ERROR_VARIABLE <result>``
|
||||||
|
Returns any error raised during query operation. In case of success, the
|
||||||
|
variable holds an empty string.
|
File diff suppressed because it is too large
Load Diff
@ -1,88 +1,88 @@
|
|||||||
cmake_minimum_required
|
cmake_minimum_required
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
Require a minimum version of cmake.
|
Require a minimum version of cmake.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_minimum_required(VERSION <min>[...<policy_max>] [FATAL_ERROR])
|
cmake_minimum_required(VERSION <min>[...<policy_max>] [FATAL_ERROR])
|
||||||
|
|
||||||
.. versionadded:: 3.12
|
.. versionadded:: 3.12
|
||||||
The optional ``<policy_max>`` version.
|
The optional ``<policy_max>`` version.
|
||||||
|
|
||||||
Sets the minimum required version of cmake for a project.
|
Sets the minimum required version of cmake for a project.
|
||||||
Also updates the policy settings as explained below.
|
Also updates the policy settings as explained below.
|
||||||
|
|
||||||
``<min>`` and the optional ``<policy_max>`` are each CMake versions of the
|
``<min>`` and the optional ``<policy_max>`` are each CMake versions of the
|
||||||
form ``major.minor[.patch[.tweak]]``, and the ``...`` is literal.
|
form ``major.minor[.patch[.tweak]]``, and the ``...`` is literal.
|
||||||
|
|
||||||
If the running version of CMake is lower than the ``<min>`` required
|
If the running version of CMake is lower than the ``<min>`` required
|
||||||
version it will stop processing the project and report an error.
|
version it will stop processing the project and report an error.
|
||||||
The optional ``<policy_max>`` version, if specified, must be at least the
|
The optional ``<policy_max>`` version, if specified, must be at least the
|
||||||
``<min>`` version and affects policy settings as described in `Policy Settings`_.
|
``<min>`` version and affects policy settings as described in `Policy Settings`_.
|
||||||
If the running version of CMake is older than 3.12, the extra ``...``
|
If the running version of CMake is older than 3.12, the extra ``...``
|
||||||
dots will be seen as version component separators, resulting in the
|
dots will be seen as version component separators, resulting in the
|
||||||
``...<max>`` part being ignored and preserving the pre-3.12 behavior
|
``...<max>`` part being ignored and preserving the pre-3.12 behavior
|
||||||
of basing policies on ``<min>``.
|
of basing policies on ``<min>``.
|
||||||
|
|
||||||
This command will set the value of the
|
This command will set the value of the
|
||||||
:variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable to ``<min>``.
|
:variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable to ``<min>``.
|
||||||
|
|
||||||
The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and
|
The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and
|
||||||
higher. It should be specified so CMake versions 2.4 and lower fail
|
higher. It should be specified so CMake versions 2.4 and lower fail
|
||||||
with an error instead of just a warning.
|
with an error instead of just a warning.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
Call the ``cmake_minimum_required()`` command at the beginning of
|
Call the ``cmake_minimum_required()`` command at the beginning of
|
||||||
the top-level ``CMakeLists.txt`` file even before calling the
|
the top-level ``CMakeLists.txt`` file even before calling the
|
||||||
:command:`project` command. It is important to establish version
|
:command:`project` command. It is important to establish version
|
||||||
and policy settings before invoking other commands whose behavior
|
and policy settings before invoking other commands whose behavior
|
||||||
they may affect. See also policy :policy:`CMP0000`.
|
they may affect. See also policy :policy:`CMP0000`.
|
||||||
|
|
||||||
Calling ``cmake_minimum_required()`` inside a :command:`function`
|
Calling ``cmake_minimum_required()`` inside a :command:`function`
|
||||||
limits some effects to the function scope when invoked. For example,
|
limits some effects to the function scope when invoked. For example,
|
||||||
the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable won't be set
|
the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable won't be set
|
||||||
in the calling scope. Functions do not introduce their own policy
|
in the calling scope. Functions do not introduce their own policy
|
||||||
scope though, so policy settings of the caller *will* be affected
|
scope though, so policy settings of the caller *will* be affected
|
||||||
(see below). Due to this mix of things that do and do not affect the
|
(see below). Due to this mix of things that do and do not affect the
|
||||||
calling scope, calling ``cmake_minimum_required()`` inside a function
|
calling scope, calling ``cmake_minimum_required()`` inside a function
|
||||||
is generally discouraged.
|
is generally discouraged.
|
||||||
|
|
||||||
.. _`Policy Settings`:
|
.. _`Policy Settings`:
|
||||||
|
|
||||||
Policy Settings
|
Policy Settings
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The ``cmake_minimum_required(VERSION)`` command implicitly invokes the
|
The ``cmake_minimum_required(VERSION)`` command implicitly invokes the
|
||||||
:command:`cmake_policy(VERSION)` command to specify that the current
|
:command:`cmake_policy(VERSION)` command to specify that the current
|
||||||
project code is written for the given range of CMake versions.
|
project code is written for the given range of CMake versions.
|
||||||
All policies known to the running version of CMake and introduced
|
All policies known to the running version of CMake and introduced
|
||||||
in the ``<min>`` (or ``<max>``, if specified) version or earlier will
|
in the ``<min>`` (or ``<max>``, if specified) version or earlier will
|
||||||
be set to use ``NEW`` behavior. All policies introduced in later
|
be set to use ``NEW`` behavior. All policies introduced in later
|
||||||
versions will be unset. This effectively requests behavior preferred
|
versions will be unset. This effectively requests behavior preferred
|
||||||
as of a given CMake version and tells newer CMake versions to warn
|
as of a given CMake version and tells newer CMake versions to warn
|
||||||
about their new policies.
|
about their new policies.
|
||||||
|
|
||||||
When a ``<min>`` version higher than 2.4 is specified the command
|
When a ``<min>`` version higher than 2.4 is specified the command
|
||||||
implicitly invokes
|
implicitly invokes
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_policy(VERSION <min>[...<max>])
|
cmake_policy(VERSION <min>[...<max>])
|
||||||
|
|
||||||
which sets CMake policies based on the range of versions specified.
|
which sets CMake policies based on the range of versions specified.
|
||||||
When a ``<min>`` version 2.4 or lower is given the command implicitly
|
When a ``<min>`` version 2.4 or lower is given the command implicitly
|
||||||
invokes
|
invokes
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_policy(VERSION 2.4[...<max>])
|
cmake_policy(VERSION 2.4[...<max>])
|
||||||
|
|
||||||
which enables compatibility features for CMake 2.4 and lower.
|
which enables compatibility features for CMake 2.4 and lower.
|
||||||
|
|
||||||
.. include:: DEPRECATED_POLICY_VERSIONS.txt
|
.. include:: DEPRECATED_POLICY_VERSIONS.txt
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* :command:`cmake_policy`
|
* :command:`cmake_policy`
|
@ -1,121 +1,121 @@
|
|||||||
cmake_parse_arguments
|
cmake_parse_arguments
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
Parse function or macro arguments.
|
Parse function or macro arguments.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
cmake_parse_arguments(<prefix> <options> <one_value_keywords>
|
cmake_parse_arguments(<prefix> <options> <one_value_keywords>
|
||||||
<multi_value_keywords> <args>...)
|
<multi_value_keywords> <args>...)
|
||||||
|
|
||||||
cmake_parse_arguments(PARSE_ARGV <N> <prefix> <options>
|
cmake_parse_arguments(PARSE_ARGV <N> <prefix> <options>
|
||||||
<one_value_keywords> <multi_value_keywords>)
|
<one_value_keywords> <multi_value_keywords>)
|
||||||
|
|
||||||
.. versionadded:: 3.5
|
.. versionadded:: 3.5
|
||||||
This command is implemented natively. Previously, it has been defined in the
|
This command is implemented natively. Previously, it has been defined in the
|
||||||
module :module:`CMakeParseArguments`.
|
module :module:`CMakeParseArguments`.
|
||||||
|
|
||||||
This command is for use in macros or functions.
|
This command is for use in macros or functions.
|
||||||
It processes the arguments given to that macro or function,
|
It processes the arguments given to that macro or function,
|
||||||
and defines a set of variables which hold the values of the
|
and defines a set of variables which hold the values of the
|
||||||
respective options.
|
respective options.
|
||||||
|
|
||||||
The first signature reads processes arguments passed in the ``<args>...``.
|
The first signature reads processes arguments passed in the ``<args>...``.
|
||||||
This may be used in either a :command:`macro` or a :command:`function`.
|
This may be used in either a :command:`macro` or a :command:`function`.
|
||||||
|
|
||||||
.. versionadded:: 3.7
|
.. versionadded:: 3.7
|
||||||
The ``PARSE_ARGV`` signature is only for use in a :command:`function`
|
The ``PARSE_ARGV`` signature is only for use in a :command:`function`
|
||||||
body. In this case the arguments that are parsed come from the
|
body. In this case the arguments that are parsed come from the
|
||||||
``ARGV#`` variables of the calling function. The parsing starts with
|
``ARGV#`` variables of the calling function. The parsing starts with
|
||||||
the ``<N>``-th argument, where ``<N>`` is an unsigned integer.
|
the ``<N>``-th argument, where ``<N>`` is an unsigned integer.
|
||||||
This allows for the values to have special characters like ``;`` in them.
|
This allows for the values to have special characters like ``;`` in them.
|
||||||
|
|
||||||
The ``<options>`` argument contains all options for the respective macro,
|
The ``<options>`` argument contains all options for the respective macro,
|
||||||
i.e. keywords which can be used when calling the macro without any value
|
i.e. keywords which can be used when calling the macro without any value
|
||||||
following, like e.g. the ``OPTIONAL`` keyword of the :command:`install`
|
following, like e.g. the ``OPTIONAL`` keyword of the :command:`install`
|
||||||
command.
|
command.
|
||||||
|
|
||||||
The ``<one_value_keywords>`` argument contains all keywords for this macro
|
The ``<one_value_keywords>`` argument contains all keywords for this macro
|
||||||
which are followed by one value, like e.g. ``DESTINATION`` keyword of the
|
which are followed by one value, like e.g. ``DESTINATION`` keyword of the
|
||||||
:command:`install` command.
|
:command:`install` command.
|
||||||
|
|
||||||
The ``<multi_value_keywords>`` argument contains all keywords for this
|
The ``<multi_value_keywords>`` argument contains all keywords for this
|
||||||
macro which can be followed by more than one value, like e.g. the
|
macro which can be followed by more than one value, like e.g. the
|
||||||
``TARGETS`` or ``FILES`` keywords of the :command:`install` command.
|
``TARGETS`` or ``FILES`` keywords of the :command:`install` command.
|
||||||
|
|
||||||
.. versionchanged:: 3.5
|
.. versionchanged:: 3.5
|
||||||
All keywords shall be unique. I.e. every keyword shall only be specified
|
All keywords shall be unique. I.e. every keyword shall only be specified
|
||||||
once in either ``<options>``, ``<one_value_keywords>`` or
|
once in either ``<options>``, ``<one_value_keywords>`` or
|
||||||
``<multi_value_keywords>``. A warning will be emitted if uniqueness is
|
``<multi_value_keywords>``. A warning will be emitted if uniqueness is
|
||||||
violated.
|
violated.
|
||||||
|
|
||||||
When done, ``cmake_parse_arguments`` will consider for each of the
|
When done, ``cmake_parse_arguments`` will consider for each of the
|
||||||
keywords listed in ``<options>``, ``<one_value_keywords>`` and
|
keywords listed in ``<options>``, ``<one_value_keywords>`` and
|
||||||
``<multi_value_keywords>`` a variable composed of the given ``<prefix>``
|
``<multi_value_keywords>`` a variable composed of the given ``<prefix>``
|
||||||
followed by ``"_"`` and the name of the respective keyword. These
|
followed by ``"_"`` and the name of the respective keyword. These
|
||||||
variables will then hold the respective value from the argument list
|
variables will then hold the respective value from the argument list
|
||||||
or be undefined if the associated option could not be found.
|
or be undefined if the associated option could not be found.
|
||||||
For the ``<options>`` keywords, these will always be defined,
|
For the ``<options>`` keywords, these will always be defined,
|
||||||
to ``TRUE`` or ``FALSE``, whether the option is in the argument list or not.
|
to ``TRUE`` or ``FALSE``, whether the option is in the argument list or not.
|
||||||
|
|
||||||
All remaining arguments are collected in a variable
|
All remaining arguments are collected in a variable
|
||||||
``<prefix>_UNPARSED_ARGUMENTS`` that will be undefined if all arguments
|
``<prefix>_UNPARSED_ARGUMENTS`` that will be undefined if all arguments
|
||||||
were recognized. This can be checked afterwards to see
|
were recognized. This can be checked afterwards to see
|
||||||
whether your macro was called with unrecognized parameters.
|
whether your macro was called with unrecognized parameters.
|
||||||
|
|
||||||
.. versionadded:: 3.15
|
.. versionadded:: 3.15
|
||||||
``<one_value_keywords>`` and ``<multi_value_keywords>`` that were given no
|
``<one_value_keywords>`` and ``<multi_value_keywords>`` that were given no
|
||||||
values at all are collected in a variable
|
values at all are collected in a variable
|
||||||
``<prefix>_KEYWORDS_MISSING_VALUES`` that will be undefined if all keywords
|
``<prefix>_KEYWORDS_MISSING_VALUES`` that will be undefined if all keywords
|
||||||
received values. This can be checked to see if there were keywords without
|
received values. This can be checked to see if there were keywords without
|
||||||
any values given.
|
any values given.
|
||||||
|
|
||||||
Consider the following example macro, ``my_install()``, which takes similar
|
Consider the following example macro, ``my_install()``, which takes similar
|
||||||
arguments to the real :command:`install` command:
|
arguments to the real :command:`install` command:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
macro(my_install)
|
macro(my_install)
|
||||||
set(options OPTIONAL FAST)
|
set(options OPTIONAL FAST)
|
||||||
set(oneValueArgs DESTINATION RENAME)
|
set(oneValueArgs DESTINATION RENAME)
|
||||||
set(multiValueArgs TARGETS CONFIGURATIONS)
|
set(multiValueArgs TARGETS CONFIGURATIONS)
|
||||||
cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
|
cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
|
||||||
"${multiValueArgs}" ${ARGN} )
|
"${multiValueArgs}" ${ARGN} )
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
Assume ``my_install()`` has been called like this:
|
Assume ``my_install()`` has been called like this:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub CONFIGURATIONS)
|
my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub CONFIGURATIONS)
|
||||||
|
|
||||||
After the ``cmake_parse_arguments`` call the macro will have set or undefined
|
After the ``cmake_parse_arguments`` call the macro will have set or undefined
|
||||||
the following variables::
|
the following variables::
|
||||||
|
|
||||||
MY_INSTALL_OPTIONAL = TRUE
|
MY_INSTALL_OPTIONAL = TRUE
|
||||||
MY_INSTALL_FAST = FALSE # was not used in call to my_install
|
MY_INSTALL_FAST = FALSE # was not used in call to my_install
|
||||||
MY_INSTALL_DESTINATION = "bin"
|
MY_INSTALL_DESTINATION = "bin"
|
||||||
MY_INSTALL_RENAME <UNDEFINED> # was not used
|
MY_INSTALL_RENAME <UNDEFINED> # was not used
|
||||||
MY_INSTALL_TARGETS = "foo;bar"
|
MY_INSTALL_TARGETS = "foo;bar"
|
||||||
MY_INSTALL_CONFIGURATIONS <UNDEFINED> # was not used
|
MY_INSTALL_CONFIGURATIONS <UNDEFINED> # was not used
|
||||||
MY_INSTALL_UNPARSED_ARGUMENTS = "blub" # nothing expected after "OPTIONAL"
|
MY_INSTALL_UNPARSED_ARGUMENTS = "blub" # nothing expected after "OPTIONAL"
|
||||||
MY_INSTALL_KEYWORDS_MISSING_VALUES = "CONFIGURATIONS"
|
MY_INSTALL_KEYWORDS_MISSING_VALUES = "CONFIGURATIONS"
|
||||||
# No value for "CONFIGURATIONS" given
|
# No value for "CONFIGURATIONS" given
|
||||||
|
|
||||||
You can then continue and process these variables.
|
You can then continue and process these variables.
|
||||||
|
|
||||||
Keywords terminate lists of values, e.g. if directly after a
|
Keywords terminate lists of values, e.g. if directly after a
|
||||||
``one_value_keyword`` another recognized keyword follows, this is
|
``one_value_keyword`` another recognized keyword follows, this is
|
||||||
interpreted as the beginning of the new option. E.g.
|
interpreted as the beginning of the new option. E.g.
|
||||||
``my_install(TARGETS foo DESTINATION OPTIONAL)`` would result in
|
``my_install(TARGETS foo DESTINATION OPTIONAL)`` would result in
|
||||||
``MY_INSTALL_DESTINATION`` set to ``"OPTIONAL"``, but as ``OPTIONAL``
|
``MY_INSTALL_DESTINATION`` set to ``"OPTIONAL"``, but as ``OPTIONAL``
|
||||||
is a keyword itself ``MY_INSTALL_DESTINATION`` will be empty (but added
|
is a keyword itself ``MY_INSTALL_DESTINATION`` will be empty (but added
|
||||||
to ``MY_INSTALL_KEYWORDS_MISSING_VALUES``) and ``MY_INSTALL_OPTIONAL`` will
|
to ``MY_INSTALL_KEYWORDS_MISSING_VALUES``) and ``MY_INSTALL_OPTIONAL`` will
|
||||||
therefore be set to ``TRUE``.
|
therefore be set to ``TRUE``.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* :command:`function`
|
* :command:`function`
|
||||||
* :command:`macro`
|
* :command:`macro`
|
File diff suppressed because it is too large
Load Diff
@ -1,159 +1,159 @@
|
|||||||
cmake_policy
|
cmake_policy
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Manage CMake Policy settings. See the :manual:`cmake-policies(7)`
|
Manage CMake Policy settings. See the :manual:`cmake-policies(7)`
|
||||||
manual for defined policies.
|
manual for defined policies.
|
||||||
|
|
||||||
As CMake evolves it is sometimes necessary to change existing behavior
|
As CMake evolves it is sometimes necessary to change existing behavior
|
||||||
in order to fix bugs or improve implementations of existing features.
|
in order to fix bugs or improve implementations of existing features.
|
||||||
The CMake Policy mechanism is designed to help keep existing projects
|
The CMake Policy mechanism is designed to help keep existing projects
|
||||||
building as new versions of CMake introduce changes in behavior. Each
|
building as new versions of CMake introduce changes in behavior. Each
|
||||||
new policy (behavioral change) is given an identifier of the form
|
new policy (behavioral change) is given an identifier of the form
|
||||||
``CMP<NNNN>`` where ``<NNNN>`` is an integer index. Documentation
|
``CMP<NNNN>`` where ``<NNNN>`` is an integer index. Documentation
|
||||||
associated with each policy describes the ``OLD`` and ``NEW`` behavior
|
associated with each policy describes the ``OLD`` and ``NEW`` behavior
|
||||||
and the reason the policy was introduced. Projects may set each policy
|
and the reason the policy was introduced. Projects may set each policy
|
||||||
to select the desired behavior. When CMake needs to know which behavior
|
to select the desired behavior. When CMake needs to know which behavior
|
||||||
to use it checks for a setting specified by the project. If no
|
to use it checks for a setting specified by the project. If no
|
||||||
setting is available the ``OLD`` behavior is assumed and a warning is
|
setting is available the ``OLD`` behavior is assumed and a warning is
|
||||||
produced requesting that the policy be set.
|
produced requesting that the policy be set.
|
||||||
|
|
||||||
Setting Policies by CMake Version
|
Setting Policies by CMake Version
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The ``cmake_policy`` command is used to set policies to ``OLD`` or ``NEW``
|
The ``cmake_policy`` command is used to set policies to ``OLD`` or ``NEW``
|
||||||
behavior. While setting policies individually is supported, we
|
behavior. While setting policies individually is supported, we
|
||||||
encourage projects to set policies based on CMake versions:
|
encourage projects to set policies based on CMake versions:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. signature:: cmake_policy(VERSION <min>[...<max>])
|
||||||
|
:target: VERSION
|
||||||
cmake_policy(VERSION <min>[...<max>])
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
.. versionadded:: 3.12
|
The optional ``<max>`` version.
|
||||||
The optional ``<max>`` version.
|
|
||||||
|
``<min>`` and the optional ``<max>`` are each CMake versions of the form
|
||||||
``<min>`` and the optional ``<max>`` are each CMake versions of the form
|
``major.minor[.patch[.tweak]]``, and the ``...`` is literal. The ``<min>``
|
||||||
``major.minor[.patch[.tweak]]``, and the ``...`` is literal. The ``<min>``
|
version must be at least ``2.4`` and at most the running version of CMake.
|
||||||
version must be at least ``2.4`` and at most the running version of CMake.
|
The ``<max>`` version, if specified, must be at least the ``<min>`` version
|
||||||
The ``<max>`` version, if specified, must be at least the ``<min>`` version
|
but may exceed the running version of CMake. If the running version of
|
||||||
but may exceed the running version of CMake. If the running version of
|
CMake is older than 3.12, the extra ``...`` dots will be seen as version
|
||||||
CMake is older than 3.12, the extra ``...`` dots will be seen as version
|
component separators, resulting in the ``...<max>`` part being ignored and
|
||||||
component separators, resulting in the ``...<max>`` part being ignored and
|
preserving the pre-3.12 behavior of basing policies on ``<min>``.
|
||||||
preserving the pre-3.12 behavior of basing policies on ``<min>``.
|
|
||||||
|
This specifies that the current CMake code is written for the given
|
||||||
This specifies that the current CMake code is written for the given
|
range of CMake versions. All policies known to the running version of CMake
|
||||||
range of CMake versions. All policies known to the running version of CMake
|
and introduced in the ``<min>`` (or ``<max>``, if specified) version
|
||||||
and introduced in the ``<min>`` (or ``<max>``, if specified) version
|
or earlier will be set to use ``NEW`` behavior. All policies
|
||||||
or earlier will be set to use ``NEW`` behavior. All policies
|
introduced in later versions will be unset (unless the
|
||||||
introduced in later versions will be unset (unless the
|
:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable sets a default).
|
||||||
:variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable sets a default).
|
This effectively requests behavior preferred as of a given CMake
|
||||||
This effectively requests behavior preferred as of a given CMake
|
version and tells newer CMake versions to warn about their new policies.
|
||||||
version and tells newer CMake versions to warn about their new policies.
|
|
||||||
|
Note that the :command:`cmake_minimum_required(VERSION)`
|
||||||
Note that the :command:`cmake_minimum_required(VERSION)`
|
command implicitly calls ``cmake_policy(VERSION)`` too.
|
||||||
command implicitly calls ``cmake_policy(VERSION)`` too.
|
|
||||||
|
.. include:: DEPRECATED_POLICY_VERSIONS.txt
|
||||||
.. include:: DEPRECATED_POLICY_VERSIONS.txt
|
|
||||||
|
Setting Policies Explicitly
|
||||||
Setting Policies Explicitly
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
.. signature:: cmake_policy(SET CMP<NNNN> NEW|OLD)
|
||||||
.. code-block:: cmake
|
:target: SET
|
||||||
|
|
||||||
cmake_policy(SET CMP<NNNN> NEW)
|
Tell CMake to use the ``OLD`` or ``NEW`` behavior for a given policy.
|
||||||
cmake_policy(SET CMP<NNNN> OLD)
|
Projects depending on the old behavior of a given policy may silence a
|
||||||
|
policy warning by setting the policy state to ``OLD``. Alternatively
|
||||||
Tell CMake to use the ``OLD`` or ``NEW`` behavior for a given policy.
|
one may fix the project to work with the new behavior and set the
|
||||||
Projects depending on the old behavior of a given policy may silence a
|
policy state to ``NEW``.
|
||||||
policy warning by setting the policy state to ``OLD``. Alternatively
|
|
||||||
one may fix the project to work with the new behavior and set the
|
.. include:: ../policy/DEPRECATED.txt
|
||||||
policy state to ``NEW``.
|
|
||||||
|
Checking Policy Settings
|
||||||
.. include:: ../policy/DEPRECATED.txt
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Checking Policy Settings
|
.. signature:: cmake_policy(GET CMP<NNNN> <variable>)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
:target: GET
|
||||||
|
|
||||||
.. code-block:: cmake
|
Check whether a given policy is set to ``OLD`` or ``NEW`` behavior.
|
||||||
|
The output ``<variable>`` value will be ``OLD`` or ``NEW`` if the
|
||||||
cmake_policy(GET CMP<NNNN> <variable>)
|
policy is set, and empty otherwise.
|
||||||
|
|
||||||
Check whether a given policy is set to ``OLD`` or ``NEW`` behavior.
|
CMake Policy Stack
|
||||||
The output ``<variable>`` value will be ``OLD`` or ``NEW`` if the
|
^^^^^^^^^^^^^^^^^^
|
||||||
policy is set, and empty otherwise.
|
|
||||||
|
CMake keeps policy settings on a stack, so changes made by the
|
||||||
CMake Policy Stack
|
``cmake_policy`` command affect only the top of the stack. A new entry on
|
||||||
^^^^^^^^^^^^^^^^^^
|
the policy stack is managed automatically for each subdirectory to
|
||||||
|
protect its parents and siblings. CMake also manages a new entry for
|
||||||
CMake keeps policy settings on a stack, so changes made by the
|
scripts loaded by :command:`include` and :command:`find_package` commands
|
||||||
``cmake_policy`` command affect only the top of the stack. A new entry on
|
except when invoked with the ``NO_POLICY_SCOPE`` option
|
||||||
the policy stack is managed automatically for each subdirectory to
|
(see also policy :policy:`CMP0011`).
|
||||||
protect its parents and siblings. CMake also manages a new entry for
|
The ``cmake_policy`` command provides an interface to manage custom
|
||||||
scripts loaded by :command:`include` and :command:`find_package` commands
|
entries on the policy stack:
|
||||||
except when invoked with the ``NO_POLICY_SCOPE`` option
|
|
||||||
(see also policy :policy:`CMP0011`).
|
.. signature:: cmake_policy(PUSH)
|
||||||
The ``cmake_policy`` command provides an interface to manage custom
|
:target: PUSH
|
||||||
entries on the policy stack:
|
|
||||||
|
Create a new entry on the policy stack.
|
||||||
.. code-block:: cmake
|
|
||||||
|
.. signature:: cmake_policy(POP)
|
||||||
cmake_policy(PUSH)
|
:target: POP
|
||||||
cmake_policy(POP)
|
|
||||||
|
Remove the last policy stack entry created with ``cmake_policy(PUSH)``.
|
||||||
Each ``PUSH`` must have a matching ``POP`` to erase any changes.
|
|
||||||
This is useful to make temporary changes to policy settings.
|
Each ``PUSH`` must have a matching ``POP`` to erase any changes.
|
||||||
Calls to the :command:`cmake_minimum_required(VERSION)`,
|
This is useful to make temporary changes to policy settings.
|
||||||
``cmake_policy(VERSION)``, or ``cmake_policy(SET)`` commands
|
Calls to the :command:`cmake_minimum_required(VERSION)`,
|
||||||
influence only the current top of the policy stack.
|
:command:`cmake_policy(VERSION)`, or :command:`cmake_policy(SET)` commands
|
||||||
|
influence only the current top of the policy stack.
|
||||||
.. versionadded:: 3.25
|
|
||||||
The :command:`block` and :command:`endblock` commands offer a more flexible
|
.. versionadded:: 3.25
|
||||||
and more secure way to manage the policy stack. The pop action is done
|
The :command:`block(SCOPE_FOR POLICIES)` command offers a more flexible
|
||||||
automatically when the :command:`endblock` command is executed, so it avoid
|
and more secure way to manage the policy stack. The pop action is done
|
||||||
to call the :command:`cmake_policy(POP)` command before each
|
automatically when leaving the block scope, so there is no need to
|
||||||
:command:`return` command.
|
precede each :command:`return` with a call to :command:`cmake_policy(POP)`.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
# stack management with cmake_policy()
|
# stack management with cmake_policy()
|
||||||
function(my_func)
|
function(my_func)
|
||||||
cmake_policy(PUSH)
|
cmake_policy(PUSH)
|
||||||
cmake_policy(SET ...)
|
cmake_policy(SET ...)
|
||||||
if (<cond1>)
|
if (<cond1>)
|
||||||
...
|
...
|
||||||
cmake_policy(POP)
|
cmake_policy(POP)
|
||||||
return()
|
return()
|
||||||
elseif(<cond2>)
|
elseif(<cond2>)
|
||||||
...
|
...
|
||||||
cmake_policy(POP)
|
cmake_policy(POP)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
...
|
...
|
||||||
cmake_policy(POP)
|
cmake_policy(POP)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# stack management with block()/endblock()
|
# stack management with block()/endblock()
|
||||||
function(my_func)
|
function(my_func)
|
||||||
block(SCOPE_FOR POLICIES)
|
block(SCOPE_FOR POLICIES)
|
||||||
cmake_policy(SET ...)
|
cmake_policy(SET ...)
|
||||||
if (<cond1>)
|
if (<cond1>)
|
||||||
...
|
...
|
||||||
return()
|
return()
|
||||||
elseif(<cond2>)
|
elseif(<cond2>)
|
||||||
...
|
...
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
...
|
...
|
||||||
endblock()
|
endblock()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
Commands created by the :command:`function` and :command:`macro`
|
Commands created by the :command:`function` and :command:`macro`
|
||||||
commands record policy settings when they are created and
|
commands record policy settings when they are created and
|
||||||
use the pre-record policies when they are invoked. If the function or
|
use the pre-record policies when they are invoked. If the function or
|
||||||
macro implementation sets policies, the changes automatically
|
macro implementation sets policies, the changes automatically
|
||||||
propagate up through callers until they reach the closest nested
|
propagate up through callers until they reach the closest nested
|
||||||
policy stack entry.
|
policy stack entry.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
* :command:`cmake_minimum_required`
|
* :command:`cmake_minimum_required`
|
@ -1,189 +1,203 @@
|
|||||||
configure_file
|
configure_file
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
Copy a file to another location and modify its contents.
|
.. only:: html
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. contents::
|
||||||
|
|
||||||
configure_file(<input> <output>
|
Copy a file to another location and modify its contents.
|
||||||
[NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS |
|
|
||||||
FILE_PERMISSIONS <permissions>...]
|
.. code-block:: cmake
|
||||||
[COPYONLY] [ESCAPE_QUOTES] [@ONLY]
|
|
||||||
[NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
|
configure_file(<input> <output>
|
||||||
|
[NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS |
|
||||||
Copies an ``<input>`` file to an ``<output>`` file and substitutes
|
FILE_PERMISSIONS <permissions>...]
|
||||||
variable values referenced as ``@VAR@``, ``${VAR}``, ``$CACHE{VAR}`` or
|
[COPYONLY] [ESCAPE_QUOTES] [@ONLY]
|
||||||
``$ENV{VAR}`` in the input file content. Each variable reference will be
|
[NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
|
||||||
replaced with the current value of the variable, or the empty string if
|
|
||||||
the variable is not defined. Furthermore, input lines of the form
|
Copies an ``<input>`` file to an ``<output>`` file while performing
|
||||||
|
`transformations`_ of the input file content.
|
||||||
.. code-block:: c
|
|
||||||
|
If the input file is modified the build system will re-run CMake to
|
||||||
#cmakedefine VAR ...
|
re-configure the file and generate the build system again.
|
||||||
|
The generated file is modified and its timestamp updated on subsequent
|
||||||
will be replaced with either
|
cmake runs only if its content is changed.
|
||||||
|
|
||||||
.. code-block:: c
|
Options
|
||||||
|
^^^^^^^
|
||||||
#define VAR ...
|
|
||||||
|
The options are:
|
||||||
or
|
|
||||||
|
``<input>``
|
||||||
.. code-block:: c
|
Path to the input file. A relative path is treated with respect to
|
||||||
|
the value of :variable:`CMAKE_CURRENT_SOURCE_DIR`. The input path
|
||||||
/* #undef VAR */
|
must be a file, not a directory.
|
||||||
|
|
||||||
depending on whether ``VAR`` is set in CMake to any value not considered
|
``<output>``
|
||||||
a false constant by the :command:`if` command. The "..." content on the
|
Path to the output file or directory. A relative path is treated
|
||||||
line after the variable name, if any, is processed as above.
|
with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`.
|
||||||
|
If the path names an existing directory the output file is placed
|
||||||
Unlike lines of the form ``#cmakedefine VAR ...``, in lines of the form
|
in that directory with the same file name as the input file.
|
||||||
``#cmakedefine01 VAR``, ``VAR`` itself will expand to ``VAR 0`` or ``VAR 1``
|
If the path contains non-existent directories, they are created.
|
||||||
rather than being assigned the value ``...``. Therefore, input lines of the form
|
|
||||||
|
``NO_SOURCE_PERMISSIONS``
|
||||||
.. code-block:: c
|
.. versionadded:: 3.19
|
||||||
|
|
||||||
#cmakedefine01 VAR
|
Do not transfer the permissions of the input file to the output file.
|
||||||
|
The copied file permissions default to the standard 644 value
|
||||||
will be replaced with either
|
(-rw-r--r--).
|
||||||
|
|
||||||
.. code-block:: c
|
``USE_SOURCE_PERMISSIONS``
|
||||||
|
.. versionadded:: 3.20
|
||||||
#define VAR 0
|
|
||||||
|
Transfer the permissions of the input file to the output file.
|
||||||
or
|
This is already the default behavior if none of the three permissions-related
|
||||||
|
keywords are given (``NO_SOURCE_PERMISSIONS``, ``USE_SOURCE_PERMISSIONS``
|
||||||
.. code-block:: c
|
or ``FILE_PERMISSIONS``). The ``USE_SOURCE_PERMISSIONS`` keyword mostly
|
||||||
|
serves as a way of making the intended behavior clearer at the call site.
|
||||||
#define VAR 1
|
|
||||||
|
``FILE_PERMISSIONS <permissions>...``
|
||||||
Input lines of the form ``#cmakedefine01 VAR ...`` will expand
|
.. versionadded:: 3.20
|
||||||
as ``#cmakedefine01 VAR ... 0`` or ``#cmakedefine01 VAR ... 1``,
|
|
||||||
which may lead to undefined behavior.
|
Ignore the input file's permissions and use the specified ``<permissions>``
|
||||||
|
for the output file instead.
|
||||||
.. versionadded:: 3.10
|
|
||||||
The result lines (with the exception of the ``#undef`` comments) can be
|
``COPYONLY``
|
||||||
indented using spaces and/or tabs between the ``#`` character
|
Copy the file without replacing any variable references or other
|
||||||
and the ``cmakedefine`` or ``cmakedefine01`` words. This whitespace
|
content. This option may not be used with ``NEWLINE_STYLE``.
|
||||||
indentation will be preserved in the output lines:
|
|
||||||
|
``ESCAPE_QUOTES``
|
||||||
.. code-block:: c
|
Escape any substituted quotes with backslashes (C-style).
|
||||||
|
|
||||||
# cmakedefine VAR
|
``@ONLY``
|
||||||
# cmakedefine01 VAR
|
Restrict variable replacement to references of the form ``@VAR@``.
|
||||||
|
This is useful for configuring scripts that use ``${VAR}`` syntax.
|
||||||
will be replaced, if ``VAR`` is defined, with
|
|
||||||
|
``NEWLINE_STYLE <style>``
|
||||||
.. code-block:: c
|
Specify the newline style for the output file. Specify
|
||||||
|
``UNIX`` or ``LF`` for ``\n`` newlines, or specify
|
||||||
# define VAR
|
``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
|
||||||
# define VAR 1
|
This option may not be used with ``COPYONLY``.
|
||||||
|
|
||||||
If the input file is modified the build system will re-run CMake to
|
Transformations
|
||||||
re-configure the file and generate the build system again.
|
^^^^^^^^^^^^^^^
|
||||||
The generated file is modified and its timestamp updated on subsequent
|
|
||||||
cmake runs only if its content is changed.
|
:ref:`Variables <CMake Language Variables>` referenced in the input
|
||||||
|
file content as ``@VAR@``, ``${VAR}``, ``$CACHE{VAR}``, and
|
||||||
The arguments are:
|
:ref:`environment variables <CMake Language Environment Variables>`
|
||||||
|
referenced as ``$ENV{VAR}``, will each be replaced with the current value
|
||||||
``<input>``
|
of the variable, or the empty string if the variable is not defined.
|
||||||
Path to the input file. A relative path is treated with respect to
|
Furthermore, input lines of the form
|
||||||
the value of :variable:`CMAKE_CURRENT_SOURCE_DIR`. The input path
|
|
||||||
must be a file, not a directory.
|
.. code-block:: c
|
||||||
|
|
||||||
``<output>``
|
#cmakedefine VAR ...
|
||||||
Path to the output file or directory. A relative path is treated
|
|
||||||
with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`.
|
will be replaced with either
|
||||||
If the path names an existing directory the output file is placed
|
|
||||||
in that directory with the same file name as the input file.
|
.. code-block:: c
|
||||||
If the path contains non-existent directories, they are created.
|
|
||||||
|
#define VAR ...
|
||||||
``NO_SOURCE_PERMISSIONS``
|
|
||||||
.. versionadded:: 3.19
|
or
|
||||||
|
|
||||||
Do not transfer the permissions of the input file to the output file.
|
.. code-block:: c
|
||||||
The copied file permissions default to the standard 644 value
|
|
||||||
(-rw-r--r--).
|
/* #undef VAR */
|
||||||
|
|
||||||
``USE_SOURCE_PERMISSIONS``
|
depending on whether ``VAR`` is set in CMake to any value not considered
|
||||||
.. versionadded:: 3.20
|
a false constant by the :command:`if` command. The "..." content on the
|
||||||
|
line after the variable name, if any, is processed as above.
|
||||||
Transfer the permissions of the input file to the output file.
|
|
||||||
This is already the default behavior if none of the three permissions-related
|
Unlike lines of the form ``#cmakedefine VAR ...``, in lines of the form
|
||||||
keywords are given (``NO_SOURCE_PERMISSIONS``, ``USE_SOURCE_PERMISSIONS``
|
``#cmakedefine01 VAR``, ``VAR`` itself will expand to ``VAR 0`` or ``VAR 1``
|
||||||
or ``FILE_PERMISSIONS``). The ``USE_SOURCE_PERMISSIONS`` keyword mostly
|
rather than being assigned the value ``...``. Therefore, input lines of the form
|
||||||
serves as a way of making the intended behavior clearer at the call site.
|
|
||||||
|
.. code-block:: c
|
||||||
``FILE_PERMISSIONS <permissions>...``
|
|
||||||
.. versionadded:: 3.20
|
#cmakedefine01 VAR
|
||||||
|
|
||||||
Ignore the input file's permissions and use the specified ``<permissions>``
|
will be replaced with either
|
||||||
for the output file instead.
|
|
||||||
|
.. code-block:: c
|
||||||
``COPYONLY``
|
|
||||||
Copy the file without replacing any variable references or other
|
#define VAR 0
|
||||||
content. This option may not be used with ``NEWLINE_STYLE``.
|
|
||||||
|
or
|
||||||
``ESCAPE_QUOTES``
|
|
||||||
Escape any substituted quotes with backslashes (C-style).
|
.. code-block:: c
|
||||||
|
|
||||||
``@ONLY``
|
#define VAR 1
|
||||||
Restrict variable replacement to references of the form ``@VAR@``.
|
|
||||||
This is useful for configuring scripts that use ``${VAR}`` syntax.
|
Input lines of the form ``#cmakedefine01 VAR ...`` will expand
|
||||||
|
as ``#cmakedefine01 VAR ... 0`` or ``#cmakedefine01 VAR ... 1``,
|
||||||
``NEWLINE_STYLE <style>``
|
which may lead to undefined behavior.
|
||||||
Specify the newline style for the output file. Specify
|
|
||||||
``UNIX`` or ``LF`` for ``\n`` newlines, or specify
|
.. versionadded:: 3.10
|
||||||
``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
|
The result lines (with the exception of the ``#undef`` comments) can be
|
||||||
This option may not be used with ``COPYONLY``.
|
indented using spaces and/or tabs between the ``#`` character
|
||||||
|
and the ``cmakedefine`` or ``cmakedefine01`` words. This whitespace
|
||||||
Example
|
indentation will be preserved in the output lines:
|
||||||
^^^^^^^
|
|
||||||
|
.. code-block:: c
|
||||||
Consider a source tree containing a ``foo.h.in`` file:
|
|
||||||
|
# cmakedefine VAR
|
||||||
.. code-block:: c
|
# cmakedefine01 VAR
|
||||||
|
|
||||||
#cmakedefine FOO_ENABLE
|
will be replaced, if ``VAR`` is defined, with
|
||||||
#cmakedefine FOO_STRING "@FOO_STRING@"
|
|
||||||
|
.. code-block:: c
|
||||||
An adjacent ``CMakeLists.txt`` may use ``configure_file`` to
|
|
||||||
configure the header:
|
# define VAR
|
||||||
|
# define VAR 1
|
||||||
.. code-block:: cmake
|
|
||||||
|
Example
|
||||||
option(FOO_ENABLE "Enable Foo" ON)
|
^^^^^^^
|
||||||
if(FOO_ENABLE)
|
|
||||||
set(FOO_STRING "foo")
|
Consider a source tree containing a ``foo.h.in`` file:
|
||||||
endif()
|
|
||||||
configure_file(foo.h.in foo.h @ONLY)
|
.. code-block:: c
|
||||||
|
|
||||||
This creates a ``foo.h`` in the build directory corresponding to
|
#cmakedefine FOO_ENABLE
|
||||||
this source directory. If the ``FOO_ENABLE`` option is on, the
|
#cmakedefine FOO_STRING "@FOO_STRING@"
|
||||||
configured file will contain:
|
|
||||||
|
An adjacent ``CMakeLists.txt`` may use ``configure_file`` to
|
||||||
.. code-block:: c
|
configure the header:
|
||||||
|
|
||||||
#define FOO_ENABLE
|
.. code-block:: cmake
|
||||||
#define FOO_STRING "foo"
|
|
||||||
|
option(FOO_ENABLE "Enable Foo" ON)
|
||||||
Otherwise it will contain:
|
if(FOO_ENABLE)
|
||||||
|
set(FOO_STRING "foo")
|
||||||
.. code-block:: c
|
endif()
|
||||||
|
configure_file(foo.h.in foo.h @ONLY)
|
||||||
/* #undef FOO_ENABLE */
|
|
||||||
/* #undef FOO_STRING */
|
This creates a ``foo.h`` in the build directory corresponding to
|
||||||
|
this source directory. If the ``FOO_ENABLE`` option is on, the
|
||||||
One may then use the :command:`target_include_directories` command to
|
configured file will contain:
|
||||||
specify the output directory as an include directory:
|
|
||||||
|
.. code-block:: c
|
||||||
.. code-block:: cmake
|
|
||||||
|
#define FOO_ENABLE
|
||||||
target_include_directories(<target> [SYSTEM] <INTERFACE|PUBLIC|PRIVATE> "${CMAKE_CURRENT_BINARY_DIR}")
|
#define FOO_STRING "foo"
|
||||||
|
|
||||||
so that sources may include the header as ``#include <foo.h>``.
|
Otherwise it will contain:
|
||||||
|
|
||||||
See Also
|
.. code-block:: c
|
||||||
^^^^^^^^
|
|
||||||
|
/* #undef FOO_ENABLE */
|
||||||
* :command:`file(GENERATE)`
|
/* #undef FOO_STRING */
|
||||||
|
|
||||||
|
One may then use the :command:`target_include_directories` command to
|
||||||
|
specify the output directory as an include directory:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
target_include_directories(<target> [SYSTEM] <INTERFACE|PUBLIC|PRIVATE> "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
|
so that sources may include the header as ``#include <foo.h>``.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
* :command:`file(GENERATE)`
|
@ -1,16 +1,16 @@
|
|||||||
continue
|
continue
|
||||||
--------
|
--------
|
||||||
|
|
||||||
.. versionadded:: 3.2
|
.. versionadded:: 3.2
|
||||||
|
|
||||||
Continue to the top of enclosing foreach or while loop.
|
Continue to the top of enclosing foreach or while loop.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
continue()
|
continue()
|
||||||
|
|
||||||
The ``continue()`` command allows a cmake script to abort the rest of the
|
The ``continue()`` command allows a cmake script to abort the rest of the
|
||||||
current iteration of a :command:`foreach` or :command:`while` loop, and start
|
current iteration of a :command:`foreach` or :command:`while` loop, and start
|
||||||
at the top of the next iteration.
|
at the top of the next iteration.
|
||||||
|
|
||||||
See also the :command:`break` command.
|
See also the :command:`break` command.
|
@ -0,0 +1,62 @@
|
|||||||
|
create_test_sourcelist
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Create a test driver program that links together many small tests into a
|
||||||
|
single executable. This is useful when building static executables with
|
||||||
|
large libraries to shrink the total required size.
|
||||||
|
|
||||||
|
.. signature::
|
||||||
|
create_test_sourcelist(<sourceListName> <driverName> <test>... <options>...)
|
||||||
|
:target: original
|
||||||
|
|
||||||
|
Generate a test driver source file from a list of individual test sources
|
||||||
|
and provide a combined list of sources that can be built as an executable.
|
||||||
|
|
||||||
|
The options are:
|
||||||
|
|
||||||
|
``<sourceListName>``
|
||||||
|
The name of a variable in which to store the list of source files needed
|
||||||
|
to build the test driver. The list will contain the ``<test>...`` sources
|
||||||
|
and the generated ``<driverName>`` source.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.29
|
||||||
|
|
||||||
|
The test driver source is listed by absolute path in the build tree.
|
||||||
|
Previously it was listed only as ``<driverName>``.
|
||||||
|
|
||||||
|
``<driverName>``
|
||||||
|
Name of the test driver source file to be generated into the build tree.
|
||||||
|
The source file will contain a ``main()`` program entry point that
|
||||||
|
dispatches to whatever test is named on the command line.
|
||||||
|
|
||||||
|
``<test>...``
|
||||||
|
Test source files to be added to the driver binary. Each test source
|
||||||
|
file must have a function in it that is the same name as the file with the
|
||||||
|
extension removed. For example, a ``foo.cxx`` test source might contain:
|
||||||
|
|
||||||
|
.. code-block:: c++
|
||||||
|
|
||||||
|
int foo(int argc, char** argv)
|
||||||
|
|
||||||
|
``EXTRA_INCLUDE <header>``
|
||||||
|
Specify a header file to ``#include`` in the generated test driver source.
|
||||||
|
|
||||||
|
``FUNCTION <function>``
|
||||||
|
Specify a function to be called with pointers to ``argc`` and ``argv``.
|
||||||
|
The function may be provided in the ``EXTRA_INCLUDE`` header:
|
||||||
|
|
||||||
|
.. code-block:: c++
|
||||||
|
|
||||||
|
void function(int* pargc, char*** pargv)
|
||||||
|
|
||||||
|
This can be used to add extra command line processing to each test.
|
||||||
|
|
||||||
|
Additionally, some CMake variables affect test driver generation:
|
||||||
|
|
||||||
|
.. variable:: CMAKE_TESTDRIVER_BEFORE_TESTMAIN
|
||||||
|
|
||||||
|
Code to be placed directly before calling each test's function.
|
||||||
|
|
||||||
|
.. variable:: CMAKE_TESTDRIVER_AFTER_TESTMAIN
|
||||||
|
|
||||||
|
Code to be placed directly after the call to each test's function.
|
@ -1,93 +1,93 @@
|
|||||||
ctest_build
|
ctest_build
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Perform the :ref:`CTest Build Step` as a :ref:`Dashboard Client`.
|
Perform the :ref:`CTest Build Step` as a :ref:`Dashboard Client`.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
ctest_build([BUILD <build-dir>] [APPEND]
|
ctest_build([BUILD <build-dir>] [APPEND]
|
||||||
[CONFIGURATION <config>]
|
[CONFIGURATION <config>]
|
||||||
[PARALLEL_LEVEL <parallel>]
|
[PARALLEL_LEVEL <parallel>]
|
||||||
[FLAGS <flags>]
|
[FLAGS <flags>]
|
||||||
[PROJECT_NAME <project-name>]
|
[PROJECT_NAME <project-name>]
|
||||||
[TARGET <target-name>]
|
[TARGET <target-name>]
|
||||||
[NUMBER_ERRORS <num-err-var>]
|
[NUMBER_ERRORS <num-err-var>]
|
||||||
[NUMBER_WARNINGS <num-warn-var>]
|
[NUMBER_WARNINGS <num-warn-var>]
|
||||||
[RETURN_VALUE <result-var>]
|
[RETURN_VALUE <result-var>]
|
||||||
[CAPTURE_CMAKE_ERROR <result-var>]
|
[CAPTURE_CMAKE_ERROR <result-var>]
|
||||||
)
|
)
|
||||||
|
|
||||||
Build the project and store results in ``Build.xml``
|
Build the project and store results in ``Build.xml``
|
||||||
for submission with the :command:`ctest_submit` command.
|
for submission with the :command:`ctest_submit` command.
|
||||||
|
|
||||||
The :variable:`CTEST_BUILD_COMMAND` variable may be set to explicitly
|
The :variable:`CTEST_BUILD_COMMAND` variable may be set to explicitly
|
||||||
specify the build command line. Otherwise the build command line is
|
specify the build command line. Otherwise the build command line is
|
||||||
computed automatically based on the options given.
|
computed automatically based on the options given.
|
||||||
|
|
||||||
The options are:
|
The options are:
|
||||||
|
|
||||||
``BUILD <build-dir>``
|
``BUILD <build-dir>``
|
||||||
Specify the top-level build directory. If not given, the
|
Specify the top-level build directory. If not given, the
|
||||||
:variable:`CTEST_BINARY_DIRECTORY` variable is used.
|
:variable:`CTEST_BINARY_DIRECTORY` variable is used.
|
||||||
|
|
||||||
``APPEND``
|
``APPEND``
|
||||||
Mark ``Build.xml`` for append to results previously submitted to a
|
Mark ``Build.xml`` for append to results previously submitted to a
|
||||||
dashboard server since the last :command:`ctest_start` call.
|
dashboard server since the last :command:`ctest_start` call.
|
||||||
Append semantics are defined by the dashboard server in use.
|
Append semantics are defined by the dashboard server in use.
|
||||||
This does *not* cause results to be appended to a ``.xml`` file
|
This does *not* cause results to be appended to a ``.xml`` file
|
||||||
produced by a previous call to this command.
|
produced by a previous call to this command.
|
||||||
|
|
||||||
``CONFIGURATION <config>``
|
``CONFIGURATION <config>``
|
||||||
Specify the build configuration (e.g. ``Debug``). If not
|
Specify the build configuration (e.g. ``Debug``). If not
|
||||||
specified the ``CTEST_BUILD_CONFIGURATION`` variable will be checked.
|
specified the ``CTEST_BUILD_CONFIGURATION`` variable will be checked.
|
||||||
Otherwise the :option:`-C \<cfg\> <ctest -C>` option given to the
|
Otherwise the :option:`-C \<cfg\> <ctest -C>` option given to the
|
||||||
:manual:`ctest(1)` command will be used, if any.
|
:manual:`ctest(1)` command will be used, if any.
|
||||||
|
|
||||||
``PARALLEL_LEVEL <parallel>``
|
``PARALLEL_LEVEL <parallel>``
|
||||||
.. versionadded:: 3.21
|
.. versionadded:: 3.21
|
||||||
|
|
||||||
Specify the parallel level of the underlying build system. If not
|
Specify the parallel level of the underlying build system. If not
|
||||||
specified, the :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment
|
specified, the :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment
|
||||||
variable will be checked.
|
variable will be checked.
|
||||||
|
|
||||||
``FLAGS <flags>``
|
``FLAGS <flags>``
|
||||||
Pass additional arguments to the underlying build command.
|
Pass additional arguments to the underlying build command.
|
||||||
If not specified the ``CTEST_BUILD_FLAGS`` variable will be checked.
|
If not specified the ``CTEST_BUILD_FLAGS`` variable will be checked.
|
||||||
This can, e.g., be used to trigger a parallel build using the
|
This can, e.g., be used to trigger a parallel build using the
|
||||||
``-j`` option of ``make``. See the :module:`ProcessorCount` module
|
``-j`` option of ``make``. See the :module:`ProcessorCount` module
|
||||||
for an example.
|
for an example.
|
||||||
|
|
||||||
``PROJECT_NAME <project-name>``
|
``PROJECT_NAME <project-name>``
|
||||||
Ignored since CMake 3.0.
|
Ignored since CMake 3.0.
|
||||||
|
|
||||||
.. versionchanged:: 3.14
|
.. versionchanged:: 3.14
|
||||||
This value is no longer required.
|
This value is no longer required.
|
||||||
|
|
||||||
``TARGET <target-name>``
|
``TARGET <target-name>``
|
||||||
Specify the name of a target to build. If not specified the
|
Specify the name of a target to build. If not specified the
|
||||||
``CTEST_BUILD_TARGET`` variable will be checked. Otherwise the
|
``CTEST_BUILD_TARGET`` variable will be checked. Otherwise the
|
||||||
default target will be built. This is the "all" target
|
default target will be built. This is the "all" target
|
||||||
(called ``ALL_BUILD`` in :ref:`Visual Studio Generators`).
|
(called ``ALL_BUILD`` in :ref:`Visual Studio Generators`).
|
||||||
|
|
||||||
``NUMBER_ERRORS <num-err-var>``
|
``NUMBER_ERRORS <num-err-var>``
|
||||||
Store the number of build errors detected in the given variable.
|
Store the number of build errors detected in the given variable.
|
||||||
|
|
||||||
``NUMBER_WARNINGS <num-warn-var>``
|
``NUMBER_WARNINGS <num-warn-var>``
|
||||||
Store the number of build warnings detected in the given variable.
|
Store the number of build warnings detected in the given variable.
|
||||||
|
|
||||||
``RETURN_VALUE <result-var>``
|
``RETURN_VALUE <result-var>``
|
||||||
Store the return value of the native build tool in the given variable.
|
Store the return value of the native build tool in the given variable.
|
||||||
|
|
||||||
``CAPTURE_CMAKE_ERROR <result-var>``
|
``CAPTURE_CMAKE_ERROR <result-var>``
|
||||||
.. versionadded:: 3.7
|
.. versionadded:: 3.7
|
||||||
|
|
||||||
Store in the ``<result-var>`` variable -1 if there are any errors running
|
Store in the ``<result-var>`` variable -1 if there are any errors running
|
||||||
the command and prevent ctest from returning non-zero if an error occurs.
|
the command and prevent ctest from returning non-zero if an error occurs.
|
||||||
|
|
||||||
``QUIET``
|
``QUIET``
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
Suppress any CTest-specific non-error output that would have been
|
Suppress any CTest-specific non-error output that would have been
|
||||||
printed to the console otherwise. The summary of warnings / errors,
|
printed to the console otherwise. The summary of warnings / errors,
|
||||||
as well as the output from the native build tool is unaffected by
|
as well as the output from the native build tool is unaffected by
|
||||||
this option.
|
this option.
|
@ -1,50 +1,50 @@
|
|||||||
ctest_configure
|
ctest_configure
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Perform the :ref:`CTest Configure Step` as a :ref:`Dashboard Client`.
|
Perform the :ref:`CTest Configure Step` as a :ref:`Dashboard Client`.
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
ctest_configure([BUILD <build-dir>] [SOURCE <source-dir>] [APPEND]
|
ctest_configure([BUILD <build-dir>] [SOURCE <source-dir>] [APPEND]
|
||||||
[OPTIONS <options>] [RETURN_VALUE <result-var>] [QUIET]
|
[OPTIONS <options>] [RETURN_VALUE <result-var>] [QUIET]
|
||||||
[CAPTURE_CMAKE_ERROR <result-var>])
|
[CAPTURE_CMAKE_ERROR <result-var>])
|
||||||
|
|
||||||
Configure the project build tree and record results in ``Configure.xml``
|
Configure the project build tree and record results in ``Configure.xml``
|
||||||
for submission with the :command:`ctest_submit` command.
|
for submission with the :command:`ctest_submit` command.
|
||||||
|
|
||||||
The options are:
|
The options are:
|
||||||
|
|
||||||
``BUILD <build-dir>``
|
``BUILD <build-dir>``
|
||||||
Specify the top-level build directory. If not given, the
|
Specify the top-level build directory. If not given, the
|
||||||
:variable:`CTEST_BINARY_DIRECTORY` variable is used.
|
:variable:`CTEST_BINARY_DIRECTORY` variable is used.
|
||||||
|
|
||||||
``SOURCE <source-dir>``
|
``SOURCE <source-dir>``
|
||||||
Specify the source directory. If not given, the
|
Specify the source directory. If not given, the
|
||||||
:variable:`CTEST_SOURCE_DIRECTORY` variable is used.
|
:variable:`CTEST_SOURCE_DIRECTORY` variable is used.
|
||||||
|
|
||||||
``APPEND``
|
``APPEND``
|
||||||
Mark ``Configure.xml`` for append to results previously submitted to a
|
Mark ``Configure.xml`` for append to results previously submitted to a
|
||||||
dashboard server since the last :command:`ctest_start` call.
|
dashboard server since the last :command:`ctest_start` call.
|
||||||
Append semantics are defined by the dashboard server in use.
|
Append semantics are defined by the dashboard server in use.
|
||||||
This does *not* cause results to be appended to a ``.xml`` file
|
This does *not* cause results to be appended to a ``.xml`` file
|
||||||
produced by a previous call to this command.
|
produced by a previous call to this command.
|
||||||
|
|
||||||
``OPTIONS <options>``
|
``OPTIONS <options>``
|
||||||
Specify command-line arguments to pass to the configuration tool.
|
Specify command-line arguments to pass to the configuration tool.
|
||||||
|
|
||||||
``RETURN_VALUE <result-var>``
|
``RETURN_VALUE <result-var>``
|
||||||
Store in the ``<result-var>`` variable the return value of the native
|
Store in the ``<result-var>`` variable the return value of the native
|
||||||
configuration tool.
|
configuration tool.
|
||||||
|
|
||||||
``CAPTURE_CMAKE_ERROR <result-var>``
|
``CAPTURE_CMAKE_ERROR <result-var>``
|
||||||
.. versionadded:: 3.7
|
.. versionadded:: 3.7
|
||||||
|
|
||||||
Store in the ``<result-var>`` variable -1 if there are any errors running
|
Store in the ``<result-var>`` variable -1 if there are any errors running
|
||||||
the command and prevent ctest from returning non-zero if an error occurs.
|
the command and prevent ctest from returning non-zero if an error occurs.
|
||||||
|
|
||||||
``QUIET``
|
``QUIET``
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
Suppress any CTest-specific non-error messages that would have
|
Suppress any CTest-specific non-error messages that would have
|
||||||
otherwise been printed to the console. Output from the underlying
|
otherwise been printed to the console. Output from the underlying
|
||||||
configure command is not affected.
|
configure command is not affected.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user