mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
update cmake third-party windows
This commit is contained in:
parent
6337b21b9a
commit
5adab5f497
171
cmake/SOURCE.txt
Normal file
171
cmake/SOURCE.txt
Normal file
@ -0,0 +1,171 @@
|
||||
============================================================================ 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.
|
Binary file not shown.
@ -2,14 +2,22 @@
|
||||
|
||||
_cmake()
|
||||
{
|
||||
local cur prev words cword split=false
|
||||
if type -t _init_completion >/dev/null; then
|
||||
_init_completion -n = || return
|
||||
local is_old_completion=false
|
||||
local is_init_completion=false
|
||||
|
||||
local cur prev words cword split was_split
|
||||
if type -t _comp_initialize >/dev/null; then
|
||||
_comp_initialize -s || return
|
||||
elif type -t _init_completion >/dev/null; then
|
||||
_init_completion -s || return
|
||||
is_init_completion=true
|
||||
else
|
||||
# manual initialization for older bash completion versions
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
is_old_completion=true
|
||||
split=false
|
||||
fi
|
||||
|
||||
# Workaround for options like -DCMAKE_BUILD_TYPE=Release
|
||||
@ -89,7 +97,9 @@ _cmake()
|
||||
;;
|
||||
esac
|
||||
|
||||
_split_longopt && split=true
|
||||
if $is_old_completion; then
|
||||
_split_longopt && split=true
|
||||
fi
|
||||
|
||||
case "$prev" in
|
||||
-C|-P|--graphviz|--system-information)
|
||||
@ -187,7 +197,11 @@ _cmake()
|
||||
;;
|
||||
esac
|
||||
|
||||
$split && return
|
||||
if ($is_old_completion || $is_init_completion); then
|
||||
$split && return
|
||||
else
|
||||
[[ $was_split ]] && return
|
||||
fi
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
|
||||
|
@ -3,7 +3,9 @@
|
||||
_cpack()
|
||||
{
|
||||
local cur prev words cword
|
||||
if type -t _init_completion >/dev/null; then
|
||||
if type -t _comp_initialize >/dev/null; then
|
||||
_comp_initialize -n = || return
|
||||
elif type -t _init_completion >/dev/null; then
|
||||
_init_completion -n = || return
|
||||
else
|
||||
# manual initialization for older bash completion versions
|
||||
|
@ -3,7 +3,9 @@
|
||||
_ctest()
|
||||
{
|
||||
local cur prev words cword
|
||||
if type -t _init_completion >/dev/null; then
|
||||
if type -t _comp_initialize >/dev/null; then
|
||||
_comp_initialize -n = || return
|
||||
elif type -t _init_completion >/dev/null; then
|
||||
_init_completion -n = || return
|
||||
else
|
||||
# manual initialization for older bash completion versions
|
||||
|
@ -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,8 +0,0 @@
|
||||
CMAKE_SIZEOF_VOID_P
|
||||
-------------------
|
||||
|
||||
Size of a ``void`` pointer.
|
||||
|
||||
This is set to the size of a pointer on the target machine, and is determined
|
||||
by a try compile. If a 64-bit size is found, then the library search
|
||||
path is modified to look for 64-bit libraries first.
|
@ -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
|
@ -211,7 +211,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
|
||||
setting the :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``.
|
||||
|
||||
* |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
|
@ -24,6 +24,7 @@ The first signature is for adding a custom command to produce an output:
|
||||
[COMMENT comment]
|
||||
[DEPFILE depfile]
|
||||
[JOB_POOL job_pool]
|
||||
[JOB_SERVER_AWARE <bool>]
|
||||
[VERBATIM] [APPEND] [USES_TERMINAL]
|
||||
[COMMAND_EXPAND_LISTS]
|
||||
[DEPENDS_EXPLICIT_ONLY])
|
||||
@ -83,8 +84,13 @@ The options are:
|
||||
.. versionadded:: 3.20
|
||||
Arguments to ``BYPRODUCTS`` may use a restricted set of
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
:ref:`Target-dependent expressions <Target-Dependent Queries>` are not
|
||||
permitted.
|
||||
:ref:`Target-dependent expressions <Target-Dependent Expressions>`
|
||||
are not permitted.
|
||||
|
||||
.. versionchanged:: 3.28
|
||||
In targets using :ref:`file sets`, custom command byproducts are now
|
||||
considered private unless they are listed in a non-private file set.
|
||||
See policy :policy:`CMP0154`.
|
||||
|
||||
``COMMAND``
|
||||
Specify the command-line(s) to execute at build time.
|
||||
@ -221,6 +227,19 @@ The options are:
|
||||
Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes
|
||||
an error by ninja at build time.
|
||||
|
||||
``JOB_SERVER_AWARE``
|
||||
.. versionadded:: 3.28
|
||||
|
||||
Specify that the command is GNU Make job server aware.
|
||||
|
||||
For the :generator:`Unix Makefiles`, :generator:`MSYS Makefiles`, and
|
||||
:generator:`MinGW Makefiles` generators this will add the ``+`` prefix to the
|
||||
recipe line. See the `GNU Make Documentation`_ for more information.
|
||||
|
||||
This option is silently ignored by other generators.
|
||||
|
||||
.. _`GNU Make Documentation`: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html
|
||||
|
||||
``MAIN_DEPENDENCY``
|
||||
Specify the primary input source file to the command. This is
|
||||
treated just like any value given to the ``DEPENDS`` option
|
||||
@ -250,11 +269,22 @@ The options are:
|
||||
source tree is mentioned as an absolute source file path elsewhere
|
||||
in the current directory.
|
||||
|
||||
The output file path may not contain ``<`` or ``>`` characters.
|
||||
|
||||
.. versionadded:: 3.20
|
||||
Arguments to ``OUTPUT`` may use a restricted set of
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
:ref:`Target-dependent expressions <Target-Dependent Queries>` are not
|
||||
permitted.
|
||||
:ref:`Target-dependent expressions <Target-Dependent Expressions>`
|
||||
are not permitted.
|
||||
|
||||
.. versionchanged:: 3.28
|
||||
In targets using :ref:`file sets`, custom command outputs are now
|
||||
considered private unless they are listed in a non-private file set.
|
||||
See policy :policy:`CMP0154`.
|
||||
|
||||
.. versionchanged:: 3.30
|
||||
The output file path may now use ``#`` characters, except
|
||||
when using the :generator:`Borland Makefiles` generator.
|
||||
|
||||
``USES_TERMINAL``
|
||||
.. versionadded:: 3.2
|
||||
@ -349,6 +379,11 @@ The options are:
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>` was also
|
||||
added.
|
||||
|
||||
.. versionadded:: 3.29
|
||||
The :ref:`Ninja Generators` will now incorporate the dependencies into its
|
||||
"deps log" database if the file is not listed in ``OUTPUTS`` or
|
||||
``BYPRODUCTS``.
|
||||
|
||||
Using ``DEPFILE`` with generators other than those listed above is an error.
|
||||
|
||||
If the ``DEPFILE`` argument is relative, it should be relative to
|
||||
@ -516,15 +551,18 @@ one of the keywords to make clear the behavior they expect.
|
||||
Because generator expressions can be used in custom commands,
|
||||
it is possible to define ``COMMAND`` lines or whole custom commands
|
||||
which evaluate to empty strings for certain configurations.
|
||||
For **Visual Studio 11 2012 (and newer)** generators these command
|
||||
For **Visual Studio 12 2013 (and newer)** generators these command
|
||||
lines or custom commands will be omitted for the specific
|
||||
configuration and no "empty-string-command" will be added.
|
||||
|
||||
This allows to add individual build events for every configuration.
|
||||
This allows adding individual build events for every configuration.
|
||||
|
||||
.. versionadded:: 3.21
|
||||
Support for target-dependent generator expressions.
|
||||
|
||||
.. versionadded:: 3.29
|
||||
The ``<target>`` may be an :ref:`ALIAS target <Alias Targets>`.
|
||||
|
||||
Examples: Build Events
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -12,6 +12,7 @@ Add a target with no output so it will always be built.
|
||||
[WORKING_DIRECTORY dir]
|
||||
[COMMENT comment]
|
||||
[JOB_POOL job_pool]
|
||||
[JOB_SERVER_AWARE <bool>]
|
||||
[VERBATIM] [USES_TERMINAL]
|
||||
[COMMAND_EXPAND_LISTS]
|
||||
[SOURCES src1 [src2...]])
|
||||
@ -59,8 +60,13 @@ The options are:
|
||||
.. versionadded:: 3.20
|
||||
Arguments to ``BYPRODUCTS`` may use a restricted set of
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
:ref:`Target-dependent expressions <Target-Dependent Queries>` are not
|
||||
permitted.
|
||||
:ref:`Target-dependent expressions <Target-Dependent Expressions>`
|
||||
are not permitted.
|
||||
|
||||
.. versionchanged:: 3.28
|
||||
In custom targets using :ref:`file sets`, byproducts are now
|
||||
considered private unless they are listed in a non-private file set.
|
||||
See policy :policy:`CMP0154`.
|
||||
|
||||
``COMMAND``
|
||||
Specify the command-line(s) to execute at build time.
|
||||
@ -146,6 +152,19 @@ The options are:
|
||||
Using a pool that is not defined by :prop_gbl:`JOB_POOLS` causes
|
||||
an error by ninja at build time.
|
||||
|
||||
``JOB_SERVER_AWARE``
|
||||
.. versionadded:: 3.28
|
||||
|
||||
Specify that the command is GNU Make job server aware.
|
||||
|
||||
For the :generator:`Unix Makefiles`, :generator:`MSYS Makefiles`, and
|
||||
:generator:`MinGW Makefiles` generators this will add the ``+`` prefix to the
|
||||
recipe line. See the `GNU Make Documentation`_ for more information.
|
||||
|
||||
This option is silently ignored by other generators.
|
||||
|
||||
.. _`GNU Make Documentation`: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html
|
||||
|
||||
``SOURCES``
|
||||
Specify additional source files to be included in the custom target.
|
||||
Specified source files will be added to IDE project files for
|
@ -20,6 +20,17 @@ transitively in its place since the target itself does not build.
|
||||
.. versionadded:: 3.3
|
||||
Allow adding dependencies to interface libraries.
|
||||
|
||||
.. versionadded:: 3.8
|
||||
Dependencies will populate the :prop_tgt:`MANUALLY_ADDED_DEPENDENCIES`
|
||||
property of ``<target>``.
|
||||
|
||||
.. versionchanged:: 3.9
|
||||
The :ref:`Ninja Generators` use weaker ordering than
|
||||
other generators in order to improve available concurrency.
|
||||
They only guarantee that the dependencies' custom commands are
|
||||
finished before sources in ``<target>`` start compiling; this
|
||||
ensures generated sources are available.
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
@ -10,15 +10,28 @@ Add an executable to the project using the specified source files.
|
||||
Normal Executables
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: cmake
|
||||
.. signature::
|
||||
add_executable(<name> <options>... <sources>...)
|
||||
:target: normal
|
||||
|
||||
add_executable(<name> [WIN32] [MACOSX_BUNDLE]
|
||||
[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
|
||||
``<name>`` corresponds to the logical target name and must be globally
|
||||
The options are:
|
||||
|
||||
``WIN32``
|
||||
Set the :prop_tgt:`WIN32_EXECUTABLE` target property automatically.
|
||||
See documentation of that target property for details.
|
||||
|
||||
``MACOSX_BUNDLE``
|
||||
Set the :prop_tgt:`MACOSX_BUNDLE` target property automatically.
|
||||
See documentation of that target property for details.
|
||||
|
||||
``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 executable built is
|
||||
constructed based on conventions of the native platform (such as
|
||||
``<name>.exe`` or just ``<name>``).
|
||||
@ -39,18 +52,6 @@ command was invoked. See documentation of the
|
||||
location. See documentation of the :prop_tgt:`OUTPUT_NAME` target property
|
||||
to change the ``<name>`` part of the final file name.
|
||||
|
||||
If ``WIN32`` is given the property :prop_tgt:`WIN32_EXECUTABLE` will be
|
||||
set on the target created. See documentation of that target property for
|
||||
details.
|
||||
|
||||
If ``MACOSX_BUNDLE`` is given the corresponding property will be set on
|
||||
the created target. See documentation of the :prop_tgt:`MACOSX_BUNDLE`
|
||||
target property for details.
|
||||
|
||||
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.
|
||||
|
||||
@ -61,17 +62,25 @@ within IDE.
|
||||
Imported Executables
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
.. signature::
|
||||
add_executable(<name> IMPORTED [GLOBAL])
|
||||
:target: IMPORTED
|
||||
|
||||
Add an :ref:`IMPORTED executable target <Imported Targets>` to reference
|
||||
an executable file located outside the project. 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 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 executables are useful for convenient
|
||||
reference from commands like :command:`add_custom_command`.
|
||||
|
||||
An :ref:`IMPORTED executable target <Imported Targets>` references an
|
||||
executable file located outside the project. 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`` executables are useful
|
||||
for convenient reference from commands like :command:`add_custom_command`.
|
||||
Details about the imported executable are specified by setting properties
|
||||
whose names begin in ``IMPORTED_``. The most important such property is
|
||||
:prop_tgt:`IMPORTED_LOCATION` (and its per-configuration version
|
||||
@ -82,14 +91,14 @@ properties for more information.
|
||||
Alias Executables
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
.. signature::
|
||||
add_executable(<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``.
|
||||
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>`
|
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`
|
@ -20,19 +20,10 @@ typical usage). The ``CMakeLists.txt`` file in the specified source
|
||||
directory will be processed immediately by CMake before processing in
|
||||
the current input file continues beyond this command.
|
||||
|
||||
If the ``EXCLUDE_FROM_ALL`` argument is provided then targets in the
|
||||
subdirectory will not be included in the ``ALL`` target of the parent
|
||||
directory by default, and will be excluded from IDE project files.
|
||||
Users must explicitly build targets in the subdirectory. This is
|
||||
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.
|
||||
Typically the subdirectory should contain its own :command:`project`
|
||||
command invocation so that a full build system will be generated in the
|
||||
subdirectory (such as a Visual Studio IDE solution file). Note that
|
||||
inter-target dependencies supersede this exclusion. If a target built by
|
||||
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.
|
||||
If the ``EXCLUDE_FROM_ALL`` argument is provided then the
|
||||
:prop_dir:`EXCLUDE_FROM_ALL` property will be set on the added directory.
|
||||
This will exclude the directory from a default build. See the directory
|
||||
property :prop_dir:`EXCLUDE_FROM_ALL` for full details.
|
||||
|
||||
.. versionadded:: 3.25
|
||||
If the ``SYSTEM`` argument is provided, the :prop_dir:`SYSTEM` directory
|
@ -27,9 +27,37 @@ directory the test is created in.
|
||||
``add_test`` options are:
|
||||
|
||||
``COMMAND``
|
||||
Specify the test command-line. If ``<command>`` specifies an executable
|
||||
target created by :command:`add_executable`, it will automatically be
|
||||
replaced by the location of the executable created at build time.
|
||||
Specify the test command-line.
|
||||
|
||||
If ``<command>`` specifies an executable target created by
|
||||
:command:`add_executable`:
|
||||
|
||||
* It will automatically be replaced by the location of the executable
|
||||
created at build time.
|
||||
|
||||
* .. versionadded:: 3.3
|
||||
|
||||
The target's :prop_tgt:`CROSSCOMPILING_EMULATOR`, if set, will be
|
||||
used to run the command on the host::
|
||||
|
||||
<emulator> <command>
|
||||
|
||||
.. versionchanged:: 3.29
|
||||
|
||||
The emulator is used only when
|
||||
:variable:`cross-compiling <CMAKE_CROSSCOMPILING>`.
|
||||
See policy :policy:`CMP0158`.
|
||||
|
||||
* .. versionadded:: 3.29
|
||||
|
||||
The target's :prop_tgt:`TEST_LAUNCHER`, if set, will be
|
||||
used to launch the command::
|
||||
|
||||
<launcher> <command>
|
||||
|
||||
If the :prop_tgt:`CROSSCOMPILING_EMULATOR` is also set, both are used::
|
||||
|
||||
<launcher> <emulator> <command>
|
||||
|
||||
The command may be specified using
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
@ -52,7 +80,7 @@ directory the test is created in.
|
||||
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
|
||||
logic. Note that system-level test failures such as segmentation faults or
|
||||
heap errors will still fail the test even if ``WILL_FALL`` is true. Output
|
||||
heap errors will still fail the test even if ``WILL_FAIL`` is true. Output
|
||||
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`,
|
||||
:prop_test:`FAIL_REGULAR_EXPRESSION`, or :prop_test:`SKIP_REGULAR_EXPRESSION`
|
@ -21,7 +21,8 @@ scopes created by the ``block()`` command are removed.
|
||||
|
||||
``POLICIES``
|
||||
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.
|
@ -146,6 +146,13 @@ queried. The list of queried values is stored in ``<variable>``.
|
||||
|
||||
See :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`
|
||||
|
||||
``MSYSTEM_PREFIX``
|
||||
.. versionadded:: 3.28
|
||||
|
||||
Available only on Windows hosts. In a MSYS or MinGW development
|
||||
environment that sets the ``MSYSTEM`` environment variable, this
|
||||
is its installation prefix. Otherwise, this is the empty string.
|
||||
|
||||
``DISTRIB_INFO``
|
||||
.. versionadded:: 3.22
|
||||
|
||||
@ -258,7 +265,7 @@ Example:
|
||||
|
||||
.. [#mebibytes] One MiB (mebibyte) is equal to 1024x1024 bytes.
|
||||
|
||||
.. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/os-release.html
|
||||
.. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/latest/os-release.html
|
||||
.. _various distribution-specific files: http://linuxmafia.com/faq/Admin/release-files.html
|
||||
|
||||
.. _Query Windows registry:
|
@ -15,6 +15,7 @@ Synopsis
|
||||
cmake_language(`DEFER`_ <options>... CALL <command> [<arg>...])
|
||||
cmake_language(`SET_DEPENDENCY_PROVIDER`_ <command> SUPPORTED_METHODS <methods>...)
|
||||
cmake_language(`GET_MESSAGE_LOG_LEVEL`_ <out-var>)
|
||||
cmake_language(`EXIT`_ <exit-code>)
|
||||
|
||||
Introduction
|
||||
^^^^^^^^^^^^
|
||||
@ -195,7 +196,7 @@ prints::
|
||||
Immediate Message
|
||||
Deferred Message
|
||||
|
||||
The ``Cancelled Message`` is never printed because its command is
|
||||
The ``Canceled Message`` is never printed because its command is
|
||||
canceled. The ``deferred_message`` variable reference is not evaluated
|
||||
until the call site, so it can be set after the deferred call is scheduled.
|
||||
|
||||
@ -270,6 +271,11 @@ Dependency Providers
|
||||
:command:`project`. Calling ``cmake_language(SET_DEPENDENCY_PROVIDER)``
|
||||
outside of that context will result in an error.
|
||||
|
||||
.. versionadded:: 3.30
|
||||
The :prop_gbl:`PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE` global
|
||||
property can be set if the dependency provider also wants to be enabled
|
||||
in whole-project calls to :command:`try_compile`.
|
||||
|
||||
.. note::
|
||||
The choice of dependency provider should always be under the user's control.
|
||||
As a convenience, a project may choose to provide a file that users can
|
||||
@ -317,7 +323,7 @@ be one of the ``<methods>`` that was specified when setting the provider.
|
||||
implementation as part of its processing, it can do so by including the
|
||||
``BYPASS_PROVIDER`` keyword as one of the arguments.
|
||||
|
||||
``FETCHCONTENT_MAKEAVAILABE_SERIAL``
|
||||
``FETCHCONTENT_MAKEAVAILABLE_SERIAL``
|
||||
The ``<method-specific-args>`` will be everything passed to the
|
||||
:command:`FetchContent_Declare` call that corresponds to the requested
|
||||
dependency, with the following exceptions:
|
||||
@ -506,3 +512,25 @@ Getting current message log level
|
||||
If both the command line option and the variable are set, the command line
|
||||
option takes precedence. If neither are set, the default logging level
|
||||
is returned.
|
||||
|
||||
Terminating Scripts
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 3.29
|
||||
|
||||
.. signature::
|
||||
cmake_language(EXIT <exit-code>)
|
||||
|
||||
Terminate the current :option:`cmake -P` script and exit with ``<exit-code>``.
|
||||
|
||||
This command works only in :ref:`script mode <Script Processing Mode>`.
|
||||
If used outside of that context, it will cause a fatal error.
|
||||
|
||||
The ``<exit-code>`` should be non-negative.
|
||||
If ``<exit-code>`` is negative, then the behavior
|
||||
is unspecified (e.g., on Windows the error code -1
|
||||
becomes ``0xffffffff``, and on Linux it becomes 255).
|
||||
Exit codes above 255 may not be supported by the underlying
|
||||
shell or platform, and some shells may interpret values
|
||||
above 125 specially. Therefore, it is advisable to only
|
||||
specify an ``<exit-code>`` in the range 0 to 125.
|
@ -600,7 +600,7 @@ For example:
|
||||
|
||||
# filename is now already empty, the following removes nothing
|
||||
cmake_path(REMOVE_FILENAME path)
|
||||
message("Second path is \"${result}\"")
|
||||
message("Second path is \"${path}\"")
|
||||
|
||||
Output::
|
||||
|
@ -24,9 +24,8 @@ The ``cmake_policy`` command is used to set policies to ``OLD`` or ``NEW``
|
||||
behavior. While setting policies individually is supported, we
|
||||
encourage projects to set policies based on CMake versions:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
cmake_policy(VERSION <min>[...<max>])
|
||||
.. signature:: cmake_policy(VERSION <min>[...<max>])
|
||||
:target: VERSION
|
||||
|
||||
.. versionadded:: 3.12
|
||||
The optional ``<max>`` version.
|
||||
@ -57,10 +56,8 @@ command implicitly calls ``cmake_policy(VERSION)`` too.
|
||||
Setting Policies Explicitly
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
cmake_policy(SET CMP<NNNN> NEW)
|
||||
cmake_policy(SET CMP<NNNN> OLD)
|
||||
.. signature:: cmake_policy(SET CMP<NNNN> NEW|OLD)
|
||||
:target: SET
|
||||
|
||||
Tell CMake to use the ``OLD`` or ``NEW`` behavior for a given policy.
|
||||
Projects depending on the old behavior of a given policy may silence a
|
||||
@ -73,9 +70,8 @@ policy state to ``NEW``.
|
||||
Checking Policy Settings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
cmake_policy(GET CMP<NNNN> <variable>)
|
||||
.. signature:: cmake_policy(GET CMP<NNNN> <variable>)
|
||||
:target: GET
|
||||
|
||||
Check whether a given policy is set to ``OLD`` or ``NEW`` behavior.
|
||||
The output ``<variable>`` value will be ``OLD`` or ``NEW`` if the
|
||||
@ -94,23 +90,27 @@ except when invoked with the ``NO_POLICY_SCOPE`` option
|
||||
The ``cmake_policy`` command provides an interface to manage custom
|
||||
entries on the policy stack:
|
||||
|
||||
.. code-block:: cmake
|
||||
.. signature:: cmake_policy(PUSH)
|
||||
:target: PUSH
|
||||
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(POP)
|
||||
Create a new entry on the policy stack.
|
||||
|
||||
.. signature:: cmake_policy(POP)
|
||||
:target: 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.
|
||||
Calls to the :command:`cmake_minimum_required(VERSION)`,
|
||||
``cmake_policy(VERSION)``, or ``cmake_policy(SET)`` commands
|
||||
: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
|
||||
The :command:`block(SCOPE_FOR POLICIES)` command offers a more flexible
|
||||
and more secure way to manage the policy stack. The pop action is done
|
||||
automatically when the :command:`endblock` command is executed, so it avoid
|
||||
to call the :command:`cmake_policy(POP)` command before each
|
||||
:command:`return` command.
|
||||
automatically when leaving the block scope, so there is no need to
|
||||
precede each :command:`return` with a call to :command:`cmake_policy(POP)`.
|
||||
|
||||
.. code-block:: cmake
|
||||
|
@ -1,6 +1,10 @@
|
||||
configure_file
|
||||
--------------
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. contents::
|
||||
|
||||
Copy a file to another location and modify its contents.
|
||||
|
||||
.. code-block:: cmake
|
||||
@ -11,11 +15,79 @@ Copy a file to another location and modify its contents.
|
||||
[COPYONLY] [ESCAPE_QUOTES] [@ONLY]
|
||||
[NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
|
||||
|
||||
Copies an ``<input>`` file to an ``<output>`` file and substitutes
|
||||
variable values referenced as ``@VAR@``, ``${VAR}``, ``$CACHE{VAR}`` or
|
||||
``$ENV{VAR}`` in the input file content. Each variable reference will be
|
||||
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.
|
||||
|
||||
If the input file is modified the build system will re-run CMake to
|
||||
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.
|
||||
|
||||
Options
|
||||
^^^^^^^
|
||||
|
||||
The options are:
|
||||
|
||||
``<input>``
|
||||
Path to the input file. A relative path is treated with respect to
|
||||
the value of :variable:`CMAKE_CURRENT_SOURCE_DIR`. The input path
|
||||
must be a file, not a directory.
|
||||
|
||||
``<output>``
|
||||
Path to the output file or directory. A relative path is treated
|
||||
with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`.
|
||||
If the path names an existing directory the output file is placed
|
||||
in that directory with the same file name as the input file.
|
||||
If the path contains non-existent directories, they are created.
|
||||
|
||||
``NO_SOURCE_PERMISSIONS``
|
||||
.. versionadded:: 3.19
|
||||
|
||||
Do not transfer the permissions of the input file to the output file.
|
||||
The copied file permissions default to the standard 644 value
|
||||
(-rw-r--r--).
|
||||
|
||||
``USE_SOURCE_PERMISSIONS``
|
||||
.. versionadded:: 3.20
|
||||
|
||||
Transfer the permissions of the input file to the output file.
|
||||
This is already the default behavior if none of the three permissions-related
|
||||
keywords are given (``NO_SOURCE_PERMISSIONS``, ``USE_SOURCE_PERMISSIONS``
|
||||
or ``FILE_PERMISSIONS``). The ``USE_SOURCE_PERMISSIONS`` keyword mostly
|
||||
serves as a way of making the intended behavior clearer at the call site.
|
||||
|
||||
``FILE_PERMISSIONS <permissions>...``
|
||||
.. versionadded:: 3.20
|
||||
|
||||
Ignore the input file's permissions and use the specified ``<permissions>``
|
||||
for the output file instead.
|
||||
|
||||
``COPYONLY``
|
||||
Copy the file without replacing any variable references or other
|
||||
content. This option may not be used with ``NEWLINE_STYLE``.
|
||||
|
||||
``ESCAPE_QUOTES``
|
||||
Escape any substituted quotes with backslashes (C-style).
|
||||
|
||||
``@ONLY``
|
||||
Restrict variable replacement to references of the form ``@VAR@``.
|
||||
This is useful for configuring scripts that use ``${VAR}`` syntax.
|
||||
|
||||
``NEWLINE_STYLE <style>``
|
||||
Specify the newline style for the output file. Specify
|
||||
``UNIX`` or ``LF`` for ``\n`` newlines, or specify
|
||||
``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
|
||||
This option may not be used with ``COPYONLY``.
|
||||
|
||||
Transformations
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
:ref:`Variables <CMake Language Variables>` referenced in the input
|
||||
file content as ``@VAR@``, ``${VAR}``, ``$CACHE{VAR}``, and
|
||||
:ref:`environment variables <CMake Language Environment Variables>`
|
||||
referenced as ``$ENV{VAR}``, will each be replaced with the current value
|
||||
of the variable, or the empty string if the variable is not defined.
|
||||
Furthermore, input lines of the form
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
@ -79,64 +151,6 @@ which may lead to undefined behavior.
|
||||
# define VAR
|
||||
# define VAR 1
|
||||
|
||||
If the input file is modified the build system will re-run CMake to
|
||||
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.
|
||||
|
||||
The arguments are:
|
||||
|
||||
``<input>``
|
||||
Path to the input file. A relative path is treated with respect to
|
||||
the value of :variable:`CMAKE_CURRENT_SOURCE_DIR`. The input path
|
||||
must be a file, not a directory.
|
||||
|
||||
``<output>``
|
||||
Path to the output file or directory. A relative path is treated
|
||||
with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`.
|
||||
If the path names an existing directory the output file is placed
|
||||
in that directory with the same file name as the input file.
|
||||
If the path contains non-existent directories, they are created.
|
||||
|
||||
``NO_SOURCE_PERMISSIONS``
|
||||
.. versionadded:: 3.19
|
||||
|
||||
Do not transfer the permissions of the input file to the output file.
|
||||
The copied file permissions default to the standard 644 value
|
||||
(-rw-r--r--).
|
||||
|
||||
``USE_SOURCE_PERMISSIONS``
|
||||
.. versionadded:: 3.20
|
||||
|
||||
Transfer the permissions of the input file to the output file.
|
||||
This is already the default behavior if none of the three permissions-related
|
||||
keywords are given (``NO_SOURCE_PERMISSIONS``, ``USE_SOURCE_PERMISSIONS``
|
||||
or ``FILE_PERMISSIONS``). The ``USE_SOURCE_PERMISSIONS`` keyword mostly
|
||||
serves as a way of making the intended behavior clearer at the call site.
|
||||
|
||||
``FILE_PERMISSIONS <permissions>...``
|
||||
.. versionadded:: 3.20
|
||||
|
||||
Ignore the input file's permissions and use the specified ``<permissions>``
|
||||
for the output file instead.
|
||||
|
||||
``COPYONLY``
|
||||
Copy the file without replacing any variable references or other
|
||||
content. This option may not be used with ``NEWLINE_STYLE``.
|
||||
|
||||
``ESCAPE_QUOTES``
|
||||
Escape any substituted quotes with backslashes (C-style).
|
||||
|
||||
``@ONLY``
|
||||
Restrict variable replacement to references of the form ``@VAR@``.
|
||||
This is useful for configuring scripts that use ``${VAR}`` syntax.
|
||||
|
||||
``NEWLINE_STYLE <style>``
|
||||
Specify the newline style for the output file. Specify
|
||||
``UNIX`` or ``LF`` for ``\n`` newlines, or specify
|
||||
``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
|
||||
This option may not be used with ``COPYONLY``.
|
||||
|
||||
Example
|
||||
^^^^^^^
|
||||
|
@ -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.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user