Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- cmake/doc/cmake/Copyright.txt +136 -0
- cmake/doc/cmake/cmake.org.html +7 -0
- cmake/doc/cmake/cmcppdap/NOTICE +5 -0
- cmake/doc/cmake/cmcurl/COPYING +22 -0
- cmake/doc/cmake/cmlibarchive/COPYING +65 -0
- cmake/doc/cmake/cmliblzma/COPYING +65 -0
- cmake/doc/cmake/cmlibrhash/COPYING +15 -0
- cmake/doc/cmake/cmlibuv/LICENSE +66 -0
- cmake/doc/cmake/cmnghttp2/COPYING +23 -0
- cmake/doc/cmake/cmsys/Copyright.txt +38 -0
- cmake/doc/cmake/cmzlib/Copyright.txt +23 -0
- cmake/doc/cmake/cmzstd/LICENSE +30 -0
- cmake/doc/cmake/html/command/add_compile_definitions.html +173 -0
- cmake/doc/cmake/html/command/add_compile_options.html +216 -0
- cmake/doc/cmake/html/command/add_custom_command.html +767 -0
- cmake/doc/cmake/html/command/add_custom_target.html +340 -0
- cmake/doc/cmake/html/command/add_definitions.html +178 -0
- cmake/doc/cmake/html/command/add_dependencies.html +180 -0
- cmake/doc/cmake/html/command/add_executable.html +268 -0
- cmake/doc/cmake/html/command/add_library.html +438 -0
- cmake/doc/cmake/html/command/add_link_options.html +232 -0
- cmake/doc/cmake/html/command/add_subdirectory.html +160 -0
- cmake/doc/cmake/html/command/add_test.html +233 -0
- cmake/doc/cmake/html/command/aux_source_directory.html +152 -0
- cmake/doc/cmake/html/command/block.html +211 -0
- cmake/doc/cmake/html/command/break.html +140 -0
- cmake/doc/cmake/html/command/build_command.html +177 -0
- cmake/doc/cmake/html/command/build_name.html +143 -0
- cmake/doc/cmake/html/command/cmake_file_api.html +213 -0
- cmake/doc/cmake/html/command/cmake_host_system_information.html +522 -0
- cmake/doc/cmake/html/command/cmake_language.html +652 -0
- cmake/doc/cmake/html/command/cmake_minimum_required.html +236 -0
- cmake/doc/cmake/html/command/cmake_parse_arguments.html +311 -0
- cmake/doc/cmake/html/command/cmake_path.html +784 -0
- cmake/doc/cmake/html/command/cmake_pkg_config.html +440 -0
- cmake/doc/cmake/html/command/cmake_policy.html +325 -0
- cmake/doc/cmake/html/command/configure_file.html +321 -0
- cmake/doc/cmake/html/command/continue.html +145 -0
- cmake/doc/cmake/html/command/create_test_sourcelist.html +188 -0
- cmake/doc/cmake/html/command/ctest_build.html +213 -0
- cmake/doc/cmake/html/command/ctest_configure.html +175 -0
- cmake/doc/cmake/html/command/ctest_coverage.html +176 -0
- cmake/doc/cmake/html/command/ctest_empty_binary_directory.html +141 -0
- cmake/doc/cmake/html/command/ctest_memcheck.html +173 -0
- cmake/doc/cmake/html/command/ctest_read_custom_files.html +142 -0
- cmake/doc/cmake/html/command/ctest_run_script.html +144 -0
- cmake/doc/cmake/html/command/ctest_sleep.html +143 -0
- cmake/doc/cmake/html/command/ctest_start.html +205 -0
- cmake/doc/cmake/html/command/ctest_submit.html +263 -0
- cmake/doc/cmake/html/command/ctest_test.html +431 -0
cmake/doc/cmake/Copyright.txt
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
CMake - Cross Platform Makefile Generator
|
| 2 |
+
Copyright 2000-2024 Kitware, Inc. and Contributors
|
| 3 |
+
All rights reserved.
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions
|
| 7 |
+
are met:
|
| 8 |
+
|
| 9 |
+
* Redistributions of source code must retain the above copyright
|
| 10 |
+
notice, this list of conditions and the following disclaimer.
|
| 11 |
+
|
| 12 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 13 |
+
notice, this list of conditions and the following disclaimer in the
|
| 14 |
+
documentation and/or other materials provided with the distribution.
|
| 15 |
+
|
| 16 |
+
* Neither the name of Kitware, Inc. nor the names of Contributors
|
| 17 |
+
may be used to endorse or promote products derived from this
|
| 18 |
+
software without specific prior written permission.
|
| 19 |
+
|
| 20 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 21 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 22 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 23 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 24 |
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 25 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 26 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 27 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 28 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 29 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 30 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 31 |
+
|
| 32 |
+
------------------------------------------------------------------------------
|
| 33 |
+
|
| 34 |
+
The following individuals and institutions are among the Contributors:
|
| 35 |
+
|
| 36 |
+
* Aaron C. Meadows <cmake@shadowguarddev.com>
|
| 37 |
+
* Adriaan de Groot <groot@kde.org>
|
| 38 |
+
* Aleksey Avdeev <solo@altlinux.ru>
|
| 39 |
+
* Alexander Neundorf <neundorf@kde.org>
|
| 40 |
+
* Alexander Smorkalov <alexander.smorkalov@itseez.com>
|
| 41 |
+
* Alexey Sokolov <sokolov@google.com>
|
| 42 |
+
* Alex Merry <alex.merry@kde.org>
|
| 43 |
+
* Alex Turbov <i.zaufi@gmail.com>
|
| 44 |
+
* Andreas Pakulat <apaku@gmx.de>
|
| 45 |
+
* Andreas Schneider <asn@cryptomilk.org>
|
| 46 |
+
* André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
|
| 47 |
+
* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
|
| 48 |
+
* Benjamin Eikel
|
| 49 |
+
* Bjoern Ricks <bjoern.ricks@gmail.com>
|
| 50 |
+
* Brad Hards <bradh@kde.org>
|
| 51 |
+
* Christopher Harvey
|
| 52 |
+
* Christoph Grüninger <foss@grueninger.de>
|
| 53 |
+
* Clement Creusot <creusot@cs.york.ac.uk>
|
| 54 |
+
* Daniel Blezek <blezek@gmail.com>
|
| 55 |
+
* Daniel Pfeifer <daniel@pfeifer-mail.de>
|
| 56 |
+
* Dawid Wróbel <me@dawidwrobel.com>
|
| 57 |
+
* Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
| 58 |
+
* Eran Ifrah <eran.ifrah@gmail.com>
|
| 59 |
+
* Esben Mose Hansen, Ange Optimization ApS
|
| 60 |
+
* Geoffrey Viola <geoffrey.viola@asirobots.com>
|
| 61 |
+
* Google Inc
|
| 62 |
+
* Gregor Jasny
|
| 63 |
+
* Helio Chissini de Castro <helio@kde.org>
|
| 64 |
+
* Ilya Lavrenov <ilya.lavrenov@itseez.com>
|
| 65 |
+
* Insight Software Consortium <insightsoftwareconsortium.org>
|
| 66 |
+
* Intel Corporation <www.intel.com>
|
| 67 |
+
* Jan Woetzel
|
| 68 |
+
* Jordan Williams <jordan@jwillikers.com>
|
| 69 |
+
* Julien Schueller
|
| 70 |
+
* Kelly Thompson <kgt@lanl.gov>
|
| 71 |
+
* Konstantin Podsvirov <konstantin@podsvirov.pro>
|
| 72 |
+
* Laurent Montel <montel@kde.org>
|
| 73 |
+
* Mario Bensi <mbensi@ipsquad.net>
|
| 74 |
+
* Martin Gräßlin <mgraesslin@kde.org>
|
| 75 |
+
* Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
| 76 |
+
* Matthaeus G. Chajdas
|
| 77 |
+
* Matthias Kretz <kretz@kde.org>
|
| 78 |
+
* Matthias Maennich <matthias@maennich.net>
|
| 79 |
+
* Michael Hirsch, Ph.D. <www.scivision.co>
|
| 80 |
+
* Michael Stürmer
|
| 81 |
+
* Miguel A. Figueroa-Villanueva
|
| 82 |
+
* Mike Durso <rbprogrammer@gmail.com>
|
| 83 |
+
* Mike Jackson
|
| 84 |
+
* Mike McQuaid <mike@mikemcquaid.com>
|
| 85 |
+
* Nicolas Bock <nicolasbock@gmail.com>
|
| 86 |
+
* Nicolas Despres <nicolas.despres@gmail.com>
|
| 87 |
+
* Nikita Krupen'ko <krnekit@gmail.com>
|
| 88 |
+
* NVIDIA Corporation <www.nvidia.com>
|
| 89 |
+
* OpenGamma Ltd. <opengamma.com>
|
| 90 |
+
* Patrick Stotko <stotko@cs.uni-bonn.de>
|
| 91 |
+
* Per Øyvind Karlsen <peroyvind@mandriva.org>
|
| 92 |
+
* Peter Collingbourne <peter@pcc.me.uk>
|
| 93 |
+
* Petr Gotthard <gotthard@honeywell.com>
|
| 94 |
+
* Philip Lowman <philip@yhbt.com>
|
| 95 |
+
* Philippe Proulx <pproulx@efficios.com>
|
| 96 |
+
* Raffi Enficiaud, Max Planck Society
|
| 97 |
+
* Raumfeld <raumfeld.com>
|
| 98 |
+
* Roger Leigh <rleigh@codelibre.net>
|
| 99 |
+
* Rolf Eike Beer <eike@sf-mail.de>
|
| 100 |
+
* Roman Donchenko <roman.donchenko@itseez.com>
|
| 101 |
+
* Roman Kharitonov <roman.kharitonov@itseez.com>
|
| 102 |
+
* Ruslan Baratov
|
| 103 |
+
* Sebastian Holtermann <sebholt@xwmw.org>
|
| 104 |
+
* Stephen Kelly <steveire@gmail.com>
|
| 105 |
+
* Sylvain Joubert <joubert.sy@gmail.com>
|
| 106 |
+
* The Qt Company Ltd.
|
| 107 |
+
* Thomas Sondergaard <ts@medical-insight.com>
|
| 108 |
+
* Tobias Hunger <tobias.hunger@qt.io>
|
| 109 |
+
* Todd Gamblin <tgamblin@llnl.gov>
|
| 110 |
+
* Tristan Carel
|
| 111 |
+
* University of Dundee
|
| 112 |
+
* Vadim Zhukov
|
| 113 |
+
* Will Dicharry <wdicharry@stellarscience.com>
|
| 114 |
+
|
| 115 |
+
See version control history for details of individual contributions.
|
| 116 |
+
|
| 117 |
+
The above copyright and license notice applies to distributions of
|
| 118 |
+
CMake in source and binary form. Third-party software packages supplied
|
| 119 |
+
with CMake under compatible licenses provide their own copyright notices
|
| 120 |
+
documented in corresponding subdirectories or source files.
|
| 121 |
+
|
| 122 |
+
------------------------------------------------------------------------------
|
| 123 |
+
|
| 124 |
+
CMake was initially developed by Kitware with the following sponsorship:
|
| 125 |
+
|
| 126 |
+
* National Library of Medicine at the National Institutes of Health
|
| 127 |
+
as part of the Insight Segmentation and Registration Toolkit (ITK).
|
| 128 |
+
|
| 129 |
+
* US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
|
| 130 |
+
Visualization Initiative.
|
| 131 |
+
|
| 132 |
+
* National Alliance for Medical Image Computing (NAMIC) is funded by the
|
| 133 |
+
National Institutes of Health through the NIH Roadmap for Medical Research,
|
| 134 |
+
Grant U54 EB005149.
|
| 135 |
+
|
| 136 |
+
* Kitware, Inc.
|
cmake/doc/cmake/cmake.org.html
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
<head>
|
| 3 |
+
<meta http-equiv="Refresh" content="0; url=https://cmake.org/" />
|
| 4 |
+
</head>
|
| 5 |
+
<body>
|
| 6 |
+
</body>
|
| 7 |
+
</html>
|
cmake/doc/cmake/cmcppdap/NOTICE
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'cppdap' is a C++11 library implementation of the Debug Adapter Protocol.
|
| 2 |
+
Version as of 2023-01-06
|
| 3 |
+
Copyright Google LLC
|
| 4 |
+
|
| 5 |
+
This product includes software developed at Google.
|
cmake/doc/cmake/cmcurl/COPYING
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
COPYRIGHT AND PERMISSION NOTICE
|
| 2 |
+
|
| 3 |
+
Copyright (c) 1996 - 2024, Daniel Stenberg, <daniel@haxx.se>, and many
|
| 4 |
+
contributors, see the THANKS file.
|
| 5 |
+
|
| 6 |
+
All rights reserved.
|
| 7 |
+
|
| 8 |
+
Permission to use, copy, modify, and distribute this software for any purpose
|
| 9 |
+
with or without fee is hereby granted, provided that the above copyright
|
| 10 |
+
notice and this permission notice appear in all copies.
|
| 11 |
+
|
| 12 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 13 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 14 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
|
| 15 |
+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
| 16 |
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
| 17 |
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
| 18 |
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
| 19 |
+
|
| 20 |
+
Except as contained in this notice, the name of a copyright holder shall not
|
| 21 |
+
be used in advertising or otherwise to promote the sale, use or other dealings
|
| 22 |
+
in this Software without prior written authorization of the copyright holder.
|
cmake/doc/cmake/cmlibarchive/COPYING
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The libarchive distribution as a whole is Copyright by Tim Kientzle
|
| 2 |
+
and is subject to the copyright notice reproduced at the bottom of
|
| 3 |
+
this file.
|
| 4 |
+
|
| 5 |
+
Each individual file in this distribution should have a clear
|
| 6 |
+
copyright/licensing statement at the beginning of the file. If any do
|
| 7 |
+
not, please let me know and I will rectify it. The following is
|
| 8 |
+
intended to summarize the copyright status of the individual files;
|
| 9 |
+
the actual statements in the files are controlling.
|
| 10 |
+
|
| 11 |
+
* Except as listed below, all C sources (including .c and .h files)
|
| 12 |
+
and documentation files are subject to the copyright notice reproduced
|
| 13 |
+
at the bottom of this file.
|
| 14 |
+
|
| 15 |
+
* The following source files are also subject in whole or in part to
|
| 16 |
+
a 3-clause UC Regents copyright; please read the individual source
|
| 17 |
+
files for details:
|
| 18 |
+
libarchive/archive_read_support_filter_compress.c
|
| 19 |
+
libarchive/archive_write_add_filter_compress.c
|
| 20 |
+
libarchive/mtree.5
|
| 21 |
+
|
| 22 |
+
* The following source files are in the public domain:
|
| 23 |
+
libarchive/archive_getdate.c
|
| 24 |
+
|
| 25 |
+
* The following source files are triple-licensed with the ability to choose
|
| 26 |
+
from CC0 1.0 Universal, OpenSSL or Apache 2.0 licenses:
|
| 27 |
+
libarchive/archive_blake2.h
|
| 28 |
+
libarchive/archive_blake2_impl.h
|
| 29 |
+
libarchive/archive_blake2s_ref.c
|
| 30 |
+
libarchive/archive_blake2sp_ref.c
|
| 31 |
+
|
| 32 |
+
* The build files---including Makefiles, configure scripts,
|
| 33 |
+
and auxiliary scripts used as part of the compile process---have
|
| 34 |
+
widely varying licensing terms. Please check individual files before
|
| 35 |
+
distributing them to see if those restrictions apply to you.
|
| 36 |
+
|
| 37 |
+
I intend for all new source code to use the license below and hope over
|
| 38 |
+
time to replace code with other licenses with new implementations that
|
| 39 |
+
do use the license below. The varying licensing of the build scripts
|
| 40 |
+
seems to be an unavoidable mess.
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
Copyright (c) 2003-2018 <author(s)>
|
| 44 |
+
All rights reserved.
|
| 45 |
+
|
| 46 |
+
Redistribution and use in source and binary forms, with or without
|
| 47 |
+
modification, are permitted provided that the following conditions
|
| 48 |
+
are met:
|
| 49 |
+
1. Redistributions of source code must retain the above copyright
|
| 50 |
+
notice, this list of conditions and the following disclaimer
|
| 51 |
+
in this position and unchanged.
|
| 52 |
+
2. Redistributions in binary form must reproduce the above copyright
|
| 53 |
+
notice, this list of conditions and the following disclaimer in the
|
| 54 |
+
documentation and/or other materials provided with the distribution.
|
| 55 |
+
|
| 56 |
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
| 57 |
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 58 |
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
| 59 |
+
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
| 60 |
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
| 61 |
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 62 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 63 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 64 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 65 |
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
cmake/doc/cmake/cmliblzma/COPYING
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
XZ Utils Licensing
|
| 3 |
+
==================
|
| 4 |
+
|
| 5 |
+
Different licenses apply to different files in this package. Here
|
| 6 |
+
is a rough summary of which licenses apply to which parts of this
|
| 7 |
+
package (but check the individual files to be sure!):
|
| 8 |
+
|
| 9 |
+
- liblzma is in the public domain.
|
| 10 |
+
|
| 11 |
+
- xz, xzdec, and lzmadec command line tools are in the public
|
| 12 |
+
domain unless GNU getopt_long had to be compiled and linked
|
| 13 |
+
in from the lib directory. The getopt_long code is under
|
| 14 |
+
GNU LGPLv2.1+.
|
| 15 |
+
|
| 16 |
+
- The scripts to grep, diff, and view compressed files have been
|
| 17 |
+
adapted from gzip. These scripts and their documentation are
|
| 18 |
+
under GNU GPLv2+.
|
| 19 |
+
|
| 20 |
+
- All the documentation in the doc directory and most of the
|
| 21 |
+
XZ Utils specific documentation files in other directories
|
| 22 |
+
are in the public domain.
|
| 23 |
+
|
| 24 |
+
- Translated messages are in the public domain.
|
| 25 |
+
|
| 26 |
+
- The build system contains public domain files, and files that
|
| 27 |
+
are under GNU GPLv2+ or GNU GPLv3+. None of these files end up
|
| 28 |
+
in the binaries being built.
|
| 29 |
+
|
| 30 |
+
- Test files and test code in the tests directory, and debugging
|
| 31 |
+
utilities in the debug directory are in the public domain.
|
| 32 |
+
|
| 33 |
+
- The extra directory may contain public domain files, and files
|
| 34 |
+
that are under various free software licenses.
|
| 35 |
+
|
| 36 |
+
You can do whatever you want with the files that have been put into
|
| 37 |
+
the public domain. If you find public domain legally problematic,
|
| 38 |
+
take the previous sentence as a license grant. If you still find
|
| 39 |
+
the lack of copyright legally problematic, you have too many
|
| 40 |
+
lawyers.
|
| 41 |
+
|
| 42 |
+
As usual, this software is provided "as is", without any warranty.
|
| 43 |
+
|
| 44 |
+
If you copy significant amounts of public domain code from XZ Utils
|
| 45 |
+
into your project, acknowledging this somewhere in your software is
|
| 46 |
+
polite (especially if it is proprietary, non-free software), but
|
| 47 |
+
naturally it is not legally required. Here is an example of a good
|
| 48 |
+
notice to put into "about box" or into documentation:
|
| 49 |
+
|
| 50 |
+
This software includes code from XZ Utils <https://tukaani.org/xz/>.
|
| 51 |
+
|
| 52 |
+
The following license texts are included in the following files:
|
| 53 |
+
- COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
|
| 54 |
+
- COPYING.GPLv2: GNU General Public License version 2
|
| 55 |
+
- COPYING.GPLv3: GNU General Public License version 3
|
| 56 |
+
|
| 57 |
+
Note that the toolchain (compiler, linker etc.) may add some code
|
| 58 |
+
pieces that are copyrighted. Thus, it is possible that e.g. liblzma
|
| 59 |
+
binary wouldn't actually be in the public domain in its entirety
|
| 60 |
+
even though it contains no copyrighted code from the XZ Utils source
|
| 61 |
+
package.
|
| 62 |
+
|
| 63 |
+
If you have questions, don't hesitate to ask the author(s) for more
|
| 64 |
+
information.
|
| 65 |
+
|
cmake/doc/cmake/cmlibrhash/COPYING
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
BSD Zero Clause License
|
| 3 |
+
|
| 4 |
+
Copyright (c) 2005, Aleksey Kravchenko <rhash.admin@gmail.com>
|
| 5 |
+
|
| 6 |
+
Permission to use, copy, modify, and/or distribute this software for any
|
| 7 |
+
purpose with or without fee is hereby granted.
|
| 8 |
+
|
| 9 |
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
| 10 |
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
| 11 |
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
| 12 |
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
| 13 |
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
| 14 |
+
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
| 15 |
+
PERFORMANCE OF THIS SOFTWARE.
|
cmake/doc/cmake/cmlibuv/LICENSE
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
libuv is licensed for use as follows:
|
| 2 |
+
|
| 3 |
+
====
|
| 4 |
+
Copyright (c) 2015-present libuv project contributors.
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 7 |
+
of this software and associated documentation files (the "Software"), to
|
| 8 |
+
deal in the Software without restriction, including without limitation the
|
| 9 |
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
| 10 |
+
sell copies of the Software, and to permit persons to whom the Software is
|
| 11 |
+
furnished to do so, subject to the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be included in
|
| 14 |
+
all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 17 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 18 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 19 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 20 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 21 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
| 22 |
+
IN THE SOFTWARE.
|
| 23 |
+
====
|
| 24 |
+
|
| 25 |
+
This license applies to parts of libuv originating from the
|
| 26 |
+
https://github.com/joyent/libuv repository:
|
| 27 |
+
|
| 28 |
+
====
|
| 29 |
+
|
| 30 |
+
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
| 31 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 32 |
+
of this software and associated documentation files (the "Software"), to
|
| 33 |
+
deal in the Software without restriction, including without limitation the
|
| 34 |
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
| 35 |
+
sell copies of the Software, and to permit persons to whom the Software is
|
| 36 |
+
furnished to do so, subject to the following conditions:
|
| 37 |
+
|
| 38 |
+
The above copyright notice and this permission notice shall be included in
|
| 39 |
+
all copies or substantial portions of the Software.
|
| 40 |
+
|
| 41 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 42 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 43 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 44 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 45 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
| 46 |
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
| 47 |
+
IN THE SOFTWARE.
|
| 48 |
+
|
| 49 |
+
====
|
| 50 |
+
|
| 51 |
+
This license applies to all parts of libuv that are not externally
|
| 52 |
+
maintained libraries.
|
| 53 |
+
|
| 54 |
+
The externally maintained libraries used by libuv are:
|
| 55 |
+
|
| 56 |
+
- tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license.
|
| 57 |
+
|
| 58 |
+
- inet_pton and inet_ntop implementations, contained in src/inet.c, are
|
| 59 |
+
copyright the Internet Systems Consortium, Inc., and licensed under the ISC
|
| 60 |
+
license.
|
| 61 |
+
|
| 62 |
+
- stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three
|
| 63 |
+
clause BSD license.
|
| 64 |
+
|
| 65 |
+
- pthread-fixes.c, copyright Google Inc. and Sony Mobile Communications AB.
|
| 66 |
+
Three clause BSD license.
|
cmake/doc/cmake/cmnghttp2/COPYING
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2012, 2014, 2015, 2016 Tatsuhiro Tsujikawa
|
| 4 |
+
Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 7 |
+
a copy of this software and associated documentation files (the
|
| 8 |
+
"Software"), to deal in the Software without restriction, including
|
| 9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 12 |
+
the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be
|
| 15 |
+
included in all copies or substantial portions of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 20 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 21 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 22 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 23 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
cmake/doc/cmake/cmsys/Copyright.txt
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
KWSys - Kitware System Library
|
| 2 |
+
Copyright 2000-2016 Kitware, Inc. and Contributors
|
| 3 |
+
All rights reserved.
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions
|
| 7 |
+
are met:
|
| 8 |
+
|
| 9 |
+
* Redistributions of source code must retain the above copyright
|
| 10 |
+
notice, this list of conditions and the following disclaimer.
|
| 11 |
+
|
| 12 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 13 |
+
notice, this list of conditions and the following disclaimer in the
|
| 14 |
+
documentation and/or other materials provided with the distribution.
|
| 15 |
+
|
| 16 |
+
* Neither the name of Kitware, Inc. nor the names of Contributors
|
| 17 |
+
may be used to endorse or promote products derived from this
|
| 18 |
+
software without specific prior written permission.
|
| 19 |
+
|
| 20 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 21 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 22 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 23 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 24 |
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 25 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 26 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 27 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 28 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 29 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 30 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 31 |
+
|
| 32 |
+
------------------------------------------------------------------------------
|
| 33 |
+
|
| 34 |
+
The following individuals and institutions are among the Contributors:
|
| 35 |
+
|
| 36 |
+
* Insight Software Consortium <insightsoftwareconsortium.org>
|
| 37 |
+
|
| 38 |
+
See version control history for details of individual contributions.
|
cmake/doc/cmake/cmzlib/Copyright.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'zlib' general purpose compression library
|
| 2 |
+
version 1.3.1, January 22nd, 2024
|
| 3 |
+
|
| 4 |
+
Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
| 5 |
+
|
| 6 |
+
This software is provided 'as-is', without any express or implied
|
| 7 |
+
warranty. In no event will the authors be held liable for any damages
|
| 8 |
+
arising from the use of this software.
|
| 9 |
+
|
| 10 |
+
Permission is granted to anyone to use this software for any purpose,
|
| 11 |
+
including commercial applications, and to alter it and redistribute it
|
| 12 |
+
freely, subject to the following restrictions:
|
| 13 |
+
|
| 14 |
+
1. The origin of this software must not be misrepresented; you must not
|
| 15 |
+
claim that you wrote the original software. If you use this software
|
| 16 |
+
in a product, an acknowledgment in the product documentation would be
|
| 17 |
+
appreciated but is not required.
|
| 18 |
+
2. Altered source versions must be plainly marked as such, and must not be
|
| 19 |
+
misrepresented as being the original software.
|
| 20 |
+
3. This notice may not be removed or altered from any source distribution.
|
| 21 |
+
|
| 22 |
+
Jean-loup Gailly Mark Adler
|
| 23 |
+
jloup@gzip.org madler@alumni.caltech.edu
|
cmake/doc/cmake/cmzstd/LICENSE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BSD License
|
| 2 |
+
|
| 3 |
+
For Zstandard software
|
| 4 |
+
|
| 5 |
+
Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
|
| 6 |
+
|
| 7 |
+
Redistribution and use in source and binary forms, with or without modification,
|
| 8 |
+
are permitted provided that the following conditions are met:
|
| 9 |
+
|
| 10 |
+
* Redistributions of source code must retain the above copyright notice, this
|
| 11 |
+
list of conditions and the following disclaimer.
|
| 12 |
+
|
| 13 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
| 14 |
+
this list of conditions and the following disclaimer in the documentation
|
| 15 |
+
and/or other materials provided with the distribution.
|
| 16 |
+
|
| 17 |
+
* Neither the name Facebook, nor Meta, nor the names of its contributors may
|
| 18 |
+
be used to endorse or promote products derived from this software without
|
| 19 |
+
specific prior written permission.
|
| 20 |
+
|
| 21 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 22 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 23 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 24 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
| 25 |
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 26 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 27 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
| 28 |
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 29 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 30 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
cmake/doc/cmake/html/command/add_compile_definitions.html
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_compile_definitions — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_compile_options" href="add_compile_options.html" />
|
| 21 |
+
<link rel="prev" title="while" href="while.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_compile_options.html" title="add_compile_options"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="while.html" title="while"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_compile_definitions</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-compile-definitions">
|
| 60 |
+
<span id="command:add_compile_definitions"></span><h1>add_compile_definitions<a class="headerlink" href="#add-compile-definitions" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.12.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<p>Add preprocessor definitions to the compilation of source files.</p>
|
| 65 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_compile_definitions(</span><span class="nv"><definition></span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 66 |
+
</pre></div>
|
| 67 |
+
</div>
|
| 68 |
+
<p>Adds preprocessor definitions to the compiler command line.</p>
|
| 69 |
+
<p>The preprocessor definitions are added to the <span class="target" id="index-0-prop_dir:COMPILE_DEFINITIONS"></span><a class="reference internal" href="../prop_dir/COMPILE_DEFINITIONS.html#prop_dir:COMPILE_DEFINITIONS" title="COMPILE_DEFINITIONS"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">COMPILE_DEFINITIONS</span></code></a>
|
| 70 |
+
directory property for the current <code class="docutils literal notranslate"><span class="pre">CMakeLists</span></code> file. They are also added to
|
| 71 |
+
the <span class="target" id="index-0-prop_tgt:COMPILE_DEFINITIONS"></span><a class="reference internal" href="../prop_tgt/COMPILE_DEFINITIONS.html#prop_tgt:COMPILE_DEFINITIONS" title="COMPILE_DEFINITIONS"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">COMPILE_DEFINITIONS</span></code></a> target property for each target in the
|
| 72 |
+
current <code class="docutils literal notranslate"><span class="pre">CMakeLists</span></code> file.</p>
|
| 73 |
+
<p>Definitions are specified using the syntax <code class="docutils literal notranslate"><span class="pre">VAR</span></code> or <code class="docutils literal notranslate"><span class="pre">VAR=value</span></code>.
|
| 74 |
+
Function-style definitions are not supported. CMake will automatically
|
| 75 |
+
escape the value correctly for the native build system (note that CMake
|
| 76 |
+
language syntax may require escapes to specify some values).</p>
|
| 77 |
+
<div class="versionadded">
|
| 78 |
+
<p><span class="versionmodified added">Added in version 3.26: </span>Any leading <code class="docutils literal notranslate"><span class="pre">-D</span></code> on an item will be removed.</p>
|
| 79 |
+
</div>
|
| 80 |
+
<p>Arguments to <code class="docutils literal notranslate"><span class="pre">add_compile_definitions</span></code> may use generator expressions
|
| 81 |
+
with the syntax <code class="docutils literal notranslate"><span class="pre">$<...></span></code>. See the <span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-generator-expressions(7)</span></code></a>
|
| 82 |
+
manual for available expressions. See the <span class="target" id="index-1-manual:cmake-buildsystem(7)"></span><a class="reference internal" href="../manual/cmake-buildsystem.7.html#manual:cmake-buildsystem(7)" title="cmake-buildsystem(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-buildsystem(7)</span></code></a> manual
|
| 83 |
+
for more on defining buildsystem properties.</p>
|
| 84 |
+
<section id="see-also">
|
| 85 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 86 |
+
<ul class="simple">
|
| 87 |
+
<li><p>The command <span class="target" id="index-0-command:target_compile_definitions"></span><a class="reference internal" href="target_compile_definitions.html#command:target_compile_definitions" title="target_compile_definitions"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_compile_definitions()</span></code></a> adds target-specific definitions.</p></li>
|
| 88 |
+
</ul>
|
| 89 |
+
</section>
|
| 90 |
+
</section>
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
<div class="clearer"></div>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 98 |
+
<div class="sphinxsidebarwrapper">
|
| 99 |
+
<div>
|
| 100 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 101 |
+
<ul>
|
| 102 |
+
<li><a class="reference internal" href="#">add_compile_definitions</a><ul>
|
| 103 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 104 |
+
</ul>
|
| 105 |
+
</li>
|
| 106 |
+
</ul>
|
| 107 |
+
|
| 108 |
+
</div>
|
| 109 |
+
<div>
|
| 110 |
+
<h4>Previous topic</h4>
|
| 111 |
+
<p class="topless"><a href="while.html"
|
| 112 |
+
title="previous chapter">while</a></p>
|
| 113 |
+
</div>
|
| 114 |
+
<div>
|
| 115 |
+
<h4>Next topic</h4>
|
| 116 |
+
<p class="topless"><a href="add_compile_options.html"
|
| 117 |
+
title="next chapter">add_compile_options</a></p>
|
| 118 |
+
</div>
|
| 119 |
+
<div role="note" aria-label="source link">
|
| 120 |
+
<h3>This Page</h3>
|
| 121 |
+
<ul class="this-page-menu">
|
| 122 |
+
<li><a href="../_sources/command/add_compile_definitions.rst.txt"
|
| 123 |
+
rel="nofollow">Show Source</a></li>
|
| 124 |
+
</ul>
|
| 125 |
+
</div>
|
| 126 |
+
<search id="searchbox" style="display: none" role="search">
|
| 127 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 128 |
+
<div class="searchformwrapper">
|
| 129 |
+
<form class="search" action="../search.html" method="get">
|
| 130 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 131 |
+
<input type="submit" value="Go" />
|
| 132 |
+
</form>
|
| 133 |
+
</div>
|
| 134 |
+
</search>
|
| 135 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
<div class="clearer"></div>
|
| 139 |
+
</div>
|
| 140 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 141 |
+
<h3>Navigation</h3>
|
| 142 |
+
<ul>
|
| 143 |
+
<li class="right" style="margin-right: 10px">
|
| 144 |
+
<a href="../genindex.html" title="General Index"
|
| 145 |
+
>index</a></li>
|
| 146 |
+
<li class="right" >
|
| 147 |
+
<a href="add_compile_options.html" title="add_compile_options"
|
| 148 |
+
>next</a> |</li>
|
| 149 |
+
<li class="right" >
|
| 150 |
+
<a href="while.html" title="while"
|
| 151 |
+
>previous</a> |</li>
|
| 152 |
+
<li>
|
| 153 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 154 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 155 |
+
</li>
|
| 156 |
+
<li>
|
| 157 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 158 |
+
</li>
|
| 159 |
+
<li>
|
| 160 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 161 |
+
</li>
|
| 162 |
+
|
| 163 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 164 |
+
<li class="nav-item nav-item-this"><a href="">add_compile_definitions</a></li>
|
| 165 |
+
</ul>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div class="footer" role="contentinfo">
|
| 169 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 170 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 171 |
+
</div>
|
| 172 |
+
</body>
|
| 173 |
+
</html>
|
cmake/doc/cmake/html/command/add_compile_options.html
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_compile_options — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_custom_command" href="add_custom_command.html" />
|
| 21 |
+
<link rel="prev" title="add_compile_definitions" href="add_compile_definitions.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_custom_command.html" title="add_custom_command"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_compile_definitions.html" title="add_compile_definitions"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_compile_options</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-compile-options">
|
| 60 |
+
<span id="command:add_compile_options"></span><h1>add_compile_options<a class="headerlink" href="#add-compile-options" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Add options to the compilation of source files.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_compile_options(</span><span class="nv"><option></span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Adds options to the <span class="target" id="index-0-prop_dir:COMPILE_OPTIONS"></span><a class="reference internal" href="../prop_dir/COMPILE_OPTIONS.html#prop_dir:COMPILE_OPTIONS" title="COMPILE_OPTIONS"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">COMPILE_OPTIONS</span></code></a> directory property.
|
| 66 |
+
These options are used when compiling targets from the current
|
| 67 |
+
directory and below.</p>
|
| 68 |
+
<div class="admonition note">
|
| 69 |
+
<p class="admonition-title">Note</p>
|
| 70 |
+
<p>These options are not used when linking.
|
| 71 |
+
See the <span class="target" id="index-0-command:add_link_options"></span><a class="reference internal" href="add_link_options.html#command:add_link_options" title="add_link_options"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_link_options()</span></code></a> command for that.</p>
|
| 72 |
+
</div>
|
| 73 |
+
<section id="arguments">
|
| 74 |
+
<h2>Arguments<a class="headerlink" href="#arguments" title="Link to this heading">¶</a></h2>
|
| 75 |
+
<p>Arguments to <code class="docutils literal notranslate"><span class="pre">add_compile_options</span></code> may use generator expressions
|
| 76 |
+
with the syntax <code class="docutils literal notranslate"><span class="pre">$<...></span></code>. See the <span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-generator-expressions(7)</span></code></a>
|
| 77 |
+
manual for available expressions. See the <span class="target" id="index-1-manual:cmake-buildsystem(7)"></span><a class="reference internal" href="../manual/cmake-buildsystem.7.html#manual:cmake-buildsystem(7)" title="cmake-buildsystem(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-buildsystem(7)</span></code></a> manual
|
| 78 |
+
for more on defining buildsystem properties.</p>
|
| 79 |
+
</section>
|
| 80 |
+
<section id="option-de-duplication">
|
| 81 |
+
<h2>Option De-duplication<a class="headerlink" href="#option-de-duplication" title="Link to this heading">¶</a></h2>
|
| 82 |
+
<p>The final set of options used for a target is constructed by
|
| 83 |
+
accumulating options from the current target and the usage requirements of
|
| 84 |
+
its dependencies. The set of options is de-duplicated to avoid repetition.</p>
|
| 85 |
+
<div class="versionadded">
|
| 86 |
+
<p><span class="versionmodified added">Added in version 3.12: </span>While beneficial for individual options, the de-duplication step can break
|
| 87 |
+
up option groups. For example, <code class="docutils literal notranslate"><span class="pre">-option</span> <span class="pre">A</span> <span class="pre">-option</span> <span class="pre">B</span></code> becomes
|
| 88 |
+
<code class="docutils literal notranslate"><span class="pre">-option</span> <span class="pre">A</span> <span class="pre">B</span></code>. One may specify a group of options using shell-like
|
| 89 |
+
quoting along with a <code class="docutils literal notranslate"><span class="pre">SHELL:</span></code> prefix. The <code class="docutils literal notranslate"><span class="pre">SHELL:</span></code> prefix is dropped,
|
| 90 |
+
and the rest of the option string is parsed using the
|
| 91 |
+
<span class="target" id="index-0-command:separate_arguments"></span><a class="reference internal" href="separate_arguments.html#command:separate_arguments" title="separate_arguments"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">separate_arguments()</span></code></a> <code class="docutils literal notranslate"><span class="pre">UNIX_COMMAND</span></code> mode. For example,
|
| 92 |
+
<code class="docutils literal notranslate"><span class="pre">"SHELL:-option</span> <span class="pre">A"</span> <span class="pre">"SHELL:-option</span> <span class="pre">B"</span></code> becomes <code class="docutils literal notranslate"><span class="pre">-option</span> <span class="pre">A</span> <span class="pre">-option</span> <span class="pre">B</span></code>.</p>
|
| 93 |
+
</div>
|
| 94 |
+
</section>
|
| 95 |
+
<section id="example">
|
| 96 |
+
<h2>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h2>
|
| 97 |
+
<p>Since different compilers support different options, a typical use of
|
| 98 |
+
this command is in a compiler-specific conditional clause:</p>
|
| 99 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">if</span> <span class="nf">(</span><span class="no">MSVC</span><span class="nf">)</span>
|
| 100 |
+
<span class="w"> </span><span class="c"># warning level 4</span>
|
| 101 |
+
<span class="w"> </span><span class="nf">add_compile_options(</span><span class="na">/W4</span><span class="nf">)</span>
|
| 102 |
+
<span class="nf">else()</span>
|
| 103 |
+
<span class="w"> </span><span class="c"># additional warnings</span>
|
| 104 |
+
<span class="w"> </span><span class="nf">add_compile_options(</span><span class="p">-</span><span class="nb">Wall</span><span class="w"> </span><span class="p">-</span><span class="nb">Wextra</span><span class="w"> </span><span class="p">-</span><span class="nb">Wpedantic</span><span class="nf">)</span>
|
| 105 |
+
<span class="nf">endif()</span>
|
| 106 |
+
</pre></div>
|
| 107 |
+
</div>
|
| 108 |
+
<p>To set per-language options, use the <span class="target" id="index-0-genex:COMPILE_LANGUAGE"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:COMPILE_LANGUAGE" title="COMPILE_LANGUAGE"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">$<COMPILE_LANGUAGE></span></code></a>
|
| 109 |
+
or <span class="target" id="index-1-genex:COMPILE_LANGUAGE"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:COMPILE_LANGUAGE" title="COMPILE_LANGUAGE"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">$<COMPILE_LANGUAGE:languages></span></code></a> generator expressions.</p>
|
| 110 |
+
</section>
|
| 111 |
+
<section id="see-also">
|
| 112 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 113 |
+
<ul class="simple">
|
| 114 |
+
<li><p>This command can be used to add any options. However, for
|
| 115 |
+
adding preprocessor definitions and include directories it is recommended
|
| 116 |
+
to use the more specific commands <span class="target" id="index-0-command:add_compile_definitions"></span><a class="reference internal" href="add_compile_definitions.html#command:add_compile_definitions" title="add_compile_definitions"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_compile_definitions()</span></code></a>
|
| 117 |
+
and <span class="target" id="index-0-command:include_directories"></span><a class="reference internal" href="include_directories.html#command:include_directories" title="include_directories"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">include_directories()</span></code></a>.</p></li>
|
| 118 |
+
<li><p>The command <span class="target" id="index-0-command:target_compile_options"></span><a class="reference internal" href="target_compile_options.html#command:target_compile_options" title="target_compile_options"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_compile_options()</span></code></a> adds target-specific options.</p></li>
|
| 119 |
+
<li><p>This command adds compile options for all languages.
|
| 120 |
+
Use the <span class="target" id="index-2-genex:COMPILE_LANGUAGE"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:COMPILE_LANGUAGE" title="COMPILE_LANGUAGE"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">COMPILE_LANGUAGE</span></code></a> generator expression to specify
|
| 121 |
+
per-language compile options.</p></li>
|
| 122 |
+
<li><p>The source file property <span class="target" id="index-0-prop_sf:COMPILE_OPTIONS"></span><a class="reference internal" href="../prop_sf/COMPILE_OPTIONS.html#prop_sf:COMPILE_OPTIONS" title="COMPILE_OPTIONS"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">COMPILE_OPTIONS</span></code></a> adds options to one
|
| 123 |
+
source file.</p></li>
|
| 124 |
+
<li><p><span class="target" id="index-1-command:add_link_options"></span><a class="reference internal" href="add_link_options.html#command:add_link_options" title="add_link_options"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_link_options()</span></code></a> adds options for linking.</p></li>
|
| 125 |
+
<li><p><span class="target" id="index-0-variable:CMAKE_<LANG>_FLAGS"></span><a class="reference internal" href="../variable/CMAKE_LANG_FLAGS.html#variable:CMAKE_<LANG>_FLAGS" title="CMAKE_<LANG>_FLAGS"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_<LANG>_FLAGS</span></code></a> and <span class="target" id="index-0-variable:CMAKE_<LANG>_FLAGS_<CONFIG>"></span><a class="reference internal" href="../variable/CMAKE_LANG_FLAGS_CONFIG.html#variable:CMAKE_<LANG>_FLAGS_<CONFIG>" title="CMAKE_<LANG>_FLAGS_<CONFIG>"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_<LANG>_FLAGS_<CONFIG></span></code></a>
|
| 126 |
+
add language-wide flags passed to all invocations of the compiler.
|
| 127 |
+
This includes invocations that drive compiling and those that drive linking.</p></li>
|
| 128 |
+
</ul>
|
| 129 |
+
</section>
|
| 130 |
+
</section>
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
<div class="clearer"></div>
|
| 134 |
+
</div>
|
| 135 |
+
</div>
|
| 136 |
+
</div>
|
| 137 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 138 |
+
<div class="sphinxsidebarwrapper">
|
| 139 |
+
<div>
|
| 140 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 141 |
+
<ul>
|
| 142 |
+
<li><a class="reference internal" href="#">add_compile_options</a><ul>
|
| 143 |
+
<li><a class="reference internal" href="#arguments">Arguments</a></li>
|
| 144 |
+
<li><a class="reference internal" href="#option-de-duplication">Option De-duplication</a></li>
|
| 145 |
+
<li><a class="reference internal" href="#example">Example</a></li>
|
| 146 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 147 |
+
</ul>
|
| 148 |
+
</li>
|
| 149 |
+
</ul>
|
| 150 |
+
|
| 151 |
+
</div>
|
| 152 |
+
<div>
|
| 153 |
+
<h4>Previous topic</h4>
|
| 154 |
+
<p class="topless"><a href="add_compile_definitions.html"
|
| 155 |
+
title="previous chapter">add_compile_definitions</a></p>
|
| 156 |
+
</div>
|
| 157 |
+
<div>
|
| 158 |
+
<h4>Next topic</h4>
|
| 159 |
+
<p class="topless"><a href="add_custom_command.html"
|
| 160 |
+
title="next chapter">add_custom_command</a></p>
|
| 161 |
+
</div>
|
| 162 |
+
<div role="note" aria-label="source link">
|
| 163 |
+
<h3>This Page</h3>
|
| 164 |
+
<ul class="this-page-menu">
|
| 165 |
+
<li><a href="../_sources/command/add_compile_options.rst.txt"
|
| 166 |
+
rel="nofollow">Show Source</a></li>
|
| 167 |
+
</ul>
|
| 168 |
+
</div>
|
| 169 |
+
<search id="searchbox" style="display: none" role="search">
|
| 170 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 171 |
+
<div class="searchformwrapper">
|
| 172 |
+
<form class="search" action="../search.html" method="get">
|
| 173 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 174 |
+
<input type="submit" value="Go" />
|
| 175 |
+
</form>
|
| 176 |
+
</div>
|
| 177 |
+
</search>
|
| 178 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
<div class="clearer"></div>
|
| 182 |
+
</div>
|
| 183 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 184 |
+
<h3>Navigation</h3>
|
| 185 |
+
<ul>
|
| 186 |
+
<li class="right" style="margin-right: 10px">
|
| 187 |
+
<a href="../genindex.html" title="General Index"
|
| 188 |
+
>index</a></li>
|
| 189 |
+
<li class="right" >
|
| 190 |
+
<a href="add_custom_command.html" title="add_custom_command"
|
| 191 |
+
>next</a> |</li>
|
| 192 |
+
<li class="right" >
|
| 193 |
+
<a href="add_compile_definitions.html" title="add_compile_definitions"
|
| 194 |
+
>previous</a> |</li>
|
| 195 |
+
<li>
|
| 196 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 197 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 198 |
+
</li>
|
| 199 |
+
<li>
|
| 200 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 201 |
+
</li>
|
| 202 |
+
<li>
|
| 203 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 204 |
+
</li>
|
| 205 |
+
|
| 206 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 207 |
+
<li class="nav-item nav-item-this"><a href="">add_compile_options</a></li>
|
| 208 |
+
</ul>
|
| 209 |
+
</div>
|
| 210 |
+
|
| 211 |
+
<div class="footer" role="contentinfo">
|
| 212 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 213 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 214 |
+
</div>
|
| 215 |
+
</body>
|
| 216 |
+
</html>
|
cmake/doc/cmake/html/command/add_custom_command.html
ADDED
|
@@ -0,0 +1,767 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_custom_command — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_custom_target" href="add_custom_target.html" />
|
| 21 |
+
<link rel="prev" title="add_compile_options" href="add_compile_options.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_custom_target.html" title="add_custom_target"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_compile_options.html" title="add_compile_options"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_custom_command</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-custom-command">
|
| 60 |
+
<span id="command:add_custom_command"></span><h1>add_custom_command<a class="headerlink" href="#add-custom-command" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Add a custom build rule to the generated build system.</p>
|
| 62 |
+
<p>There are two main signatures for <code class="docutils literal notranslate"><span class="pre">add_custom_command</span></code>.</p>
|
| 63 |
+
<section id="generating-files">
|
| 64 |
+
<span id="add-custom-command-output"></span><h2>Generating Files<a class="headerlink" href="#generating-files" title="Link to this heading">¶</a></h2>
|
| 65 |
+
<p>The first signature is for adding a custom command to produce an output:</p>
|
| 66 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_custom_command(</span><span class="no">OUTPUT</span><span class="w"> </span><span class="nb">output1</span><span class="w"> </span><span class="p">[</span><span class="nb">output2</span><span class="w"> </span><span class="p">...]</span>
|
| 67 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">command1</span><span class="w"> </span><span class="p">[</span><span class="no">ARGS</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="nb">args1...</span><span class="p">]</span>
|
| 68 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">command2</span><span class="w"> </span><span class="p">[</span><span class="no">ARGS</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="nb">args2...</span><span class="p">]</span><span class="w"> </span><span class="p">...]</span>
|
| 69 |
+
<span class="w"> </span><span class="p">[</span><span class="no">MAIN_DEPENDENCY</span><span class="w"> </span><span class="nb">depend</span><span class="p">]</span>
|
| 70 |
+
<span class="w"> </span><span class="p">[</span><span class="no">DEPENDS</span><span class="w"> </span><span class="p">[</span><span class="nb">depends...</span><span class="p">]]</span>
|
| 71 |
+
<span class="w"> </span><span class="p">[</span><span class="no">BYPRODUCTS</span><span class="w"> </span><span class="p">[</span><span class="nb">files...</span><span class="p">]]</span>
|
| 72 |
+
<span class="w"> </span><span class="p">[</span><span class="no">IMPLICIT_DEPENDS</span><span class="w"> </span><span class="nv"><lang1></span><span class="w"> </span><span class="nb">depend1</span>
|
| 73 |
+
<span class="w"> </span><span class="p">[</span><span class="nv"><lang2></span><span class="w"> </span><span class="nb">depend2</span><span class="p">]</span><span class="w"> </span><span class="p">...]</span>
|
| 74 |
+
<span class="w"> </span><span class="p">[</span><span class="no">WORKING_DIRECTORY</span><span class="w"> </span><span class="nb">dir</span><span class="p">]</span>
|
| 75 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMENT</span><span class="w"> </span><span class="nb">comment</span><span class="p">]</span>
|
| 76 |
+
<span class="w"> </span><span class="p">[</span><span class="no">DEPFILE</span><span class="w"> </span><span class="nb">depfile</span><span class="p">]</span>
|
| 77 |
+
<span class="w"> </span><span class="p">[</span><span class="no">JOB_POOL</span><span class="w"> </span><span class="nb">job_pool</span><span class="p">]</span>
|
| 78 |
+
<span class="w"> </span><span class="p">[</span><span class="no">JOB_SERVER_AWARE</span><span class="w"> </span><span class="nv"><bool></span><span class="p">]</span>
|
| 79 |
+
<span class="w"> </span><span class="p">[</span><span class="no">VERBATIM</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">APPEND</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">USES_TERMINAL</span><span class="p">]</span>
|
| 80 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CODEGEN</span><span class="p">]</span>
|
| 81 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMAND_EXPAND_LISTS</span><span class="p">]</span>
|
| 82 |
+
<span class="w"> </span><span class="p">[</span><span class="no">DEPENDS_EXPLICIT_ONLY</span><span class="p">]</span><span class="nf">)</span>
|
| 83 |
+
</pre></div>
|
| 84 |
+
</div>
|
| 85 |
+
<p>This defines a command to generate specified <code class="docutils literal notranslate"><span class="pre">OUTPUT</span></code> file(s).
|
| 86 |
+
A target created in the same directory (<code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file)
|
| 87 |
+
that specifies any output of the custom command as a source file
|
| 88 |
+
is given a rule to generate the file using the command at build time.</p>
|
| 89 |
+
<p>Do not list the output in more than one independent target that
|
| 90 |
+
may build in parallel or the instances of the rule may conflict.
|
| 91 |
+
Instead, use the <span class="target" id="index-0-command:add_custom_target"></span><a class="reference internal" href="add_custom_target.html#command:add_custom_target" title="add_custom_target"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_target()</span></code></a> command to drive the
|
| 92 |
+
command and make the other targets depend on that one. See the
|
| 93 |
+
<a class="reference internal" href="#example-generating-files-for-multiple-targets">Example: Generating Files for Multiple Targets</a> below.</p>
|
| 94 |
+
<p>The options are:</p>
|
| 95 |
+
<dl>
|
| 96 |
+
<dt><code class="docutils literal notranslate"><span class="pre">APPEND</span></code></dt><dd><p>Append the <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> and <code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code> option values to the custom
|
| 97 |
+
command for the first output specified. There must have already
|
| 98 |
+
been a previous call to this command with the same output.</p>
|
| 99 |
+
<p>If the previous call specified the output via a generator expression,
|
| 100 |
+
the output specified by the current call must match in at least one
|
| 101 |
+
configuration after evaluating generator expressions. In this case,
|
| 102 |
+
the appended commands and dependencies apply to all configurations.</p>
|
| 103 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">COMMENT</span></code>, <code class="docutils literal notranslate"><span class="pre">MAIN_DEPENDENCY</span></code>, and <code class="docutils literal notranslate"><span class="pre">WORKING_DIRECTORY</span></code>
|
| 104 |
+
options are currently ignored when <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> is given, but may be
|
| 105 |
+
used in the future.</p>
|
| 106 |
+
</dd>
|
| 107 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code></dt><dd><div class="versionadded">
|
| 108 |
+
<p><span class="versionmodified added">Added in version 3.2.</span></p>
|
| 109 |
+
</div>
|
| 110 |
+
<p>Specify the files the command is expected to produce but whose
|
| 111 |
+
modification time may or may not be newer than the dependencies.
|
| 112 |
+
If a byproduct name is a relative path it will be interpreted
|
| 113 |
+
relative to the build tree directory corresponding to the
|
| 114 |
+
current source directory.
|
| 115 |
+
Each byproduct file will be marked with the <span class="target" id="index-0-prop_sf:GENERATED"></span><a class="reference internal" href="../prop_sf/GENERATED.html#prop_sf:GENERATED" title="GENERATED"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">GENERATED</span></code></a>
|
| 116 |
+
source file property automatically.</p>
|
| 117 |
+
<p><em>See policy</em> <span class="target" id="index-0-policy:CMP0058"></span><a class="reference internal" href="../policy/CMP0058.html#policy:CMP0058" title="CMP0058"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0058</span></code></a> <em>for the motivation behind this feature.</em></p>
|
| 118 |
+
<p>Explicit specification of byproducts is supported by the
|
| 119 |
+
<span class="target" id="index-0-generator:Ninja"></span><a class="reference internal" href="../generator/Ninja.html#generator:Ninja" title="Ninja"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span></code></a> generator to tell the <code class="docutils literal notranslate"><span class="pre">ninja</span></code> build tool
|
| 120 |
+
how to regenerate byproducts when they are missing. It is
|
| 121 |
+
also useful when other build rules (e.g. custom commands)
|
| 122 |
+
depend on the byproducts. Ninja requires a build rule for any
|
| 123 |
+
generated file on which another rule depends even if there are
|
| 124 |
+
order-only dependencies to ensure the byproducts will be
|
| 125 |
+
available before their dependents build.</p>
|
| 126 |
+
<p>The <a class="reference internal" href="../manual/cmake-generators.7.html#makefile-generators"><span class="std std-ref">Makefile Generators</span></a> will remove <code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code> and other
|
| 127 |
+
<span class="target" id="index-1-prop_sf:GENERATED"></span><a class="reference internal" href="../prop_sf/GENERATED.html#prop_sf:GENERATED" title="GENERATED"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">GENERATED</span></code></a> files during <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code>.</p>
|
| 128 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-0-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 129 |
+
All byproducts must be set in the first call to
|
| 130 |
+
<code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code> for the output files.</p>
|
| 131 |
+
<div class="versionadded">
|
| 132 |
+
<p><span class="versionmodified added">Added in version 3.20: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code> may use a restricted set of
|
| 133 |
+
<span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.
|
| 134 |
+
<a class="reference internal" href="../manual/cmake-generator-expressions.7.html#target-dependent-expressions"><span class="std std-ref">Target-dependent expressions</span></a>
|
| 135 |
+
are not permitted.</p>
|
| 136 |
+
</div>
|
| 137 |
+
<div class="versionchanged">
|
| 138 |
+
<p><span class="versionmodified changed">Changed in version 3.28: </span>In targets using <a class="reference internal" href="target_sources.html#file-sets"><span class="std std-ref">File Sets</span></a>, custom command byproducts are now
|
| 139 |
+
considered private unless they are listed in a non-private file set.
|
| 140 |
+
See policy <span class="target" id="index-0-policy:CMP0154"></span><a class="reference internal" href="../policy/CMP0154.html#policy:CMP0154" title="CMP0154"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0154</span></code></a>.</p>
|
| 141 |
+
</div>
|
| 142 |
+
</dd>
|
| 143 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMAND</span></code></dt><dd><p>Specify the command-line(s) to execute at build time.
|
| 144 |
+
At least one <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> would normally be given, but certain patterns
|
| 145 |
+
may omit it, such as adding commands in separate calls using <cite>APPEND</cite>.</p>
|
| 146 |
+
<p>If more than one <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> is specified, they will be executed in order,
|
| 147 |
+
but <em>not</em> necessarily composed into a stateful shell or batch script.
|
| 148 |
+
To run a full script, use the <span class="target" id="index-0-command:configure_file"></span><a class="reference internal" href="configure_file.html#command:configure_file" title="configure_file"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">configure_file()</span></code></a> command or the
|
| 149 |
+
<span class="target" id="index-0-command:file"></span><a class="reference internal" href="file.html#generate" title="file(generate)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">file(GENERATE)</span></code></a> command to create it, and then specify
|
| 150 |
+
a <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> to launch it.</p>
|
| 151 |
+
<p>The optional <code class="docutils literal notranslate"><span class="pre">ARGS</span></code> argument is for backward compatibility and
|
| 152 |
+
will be ignored.</p>
|
| 153 |
+
<p>If <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> specifies an executable target name (created by the
|
| 154 |
+
<span class="target" id="index-0-command:add_executable"></span><a class="reference internal" href="add_executable.html#command:add_executable" title="add_executable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_executable()</span></code></a> command), it will automatically be replaced
|
| 155 |
+
by the location of the executable created at build time if either of
|
| 156 |
+
the following is true:</p>
|
| 157 |
+
<ul>
|
| 158 |
+
<li><p>The target is not being cross-compiled (i.e. the
|
| 159 |
+
<span class="target" id="index-0-variable:CMAKE_CROSSCOMPILING"></span><a class="reference internal" href="../variable/CMAKE_CROSSCOMPILING.html#variable:CMAKE_CROSSCOMPILING" title="CMAKE_CROSSCOMPILING"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CROSSCOMPILING</span></code></a> variable is not set to true).</p></li>
|
| 160 |
+
<li><div class="versionadded">
|
| 161 |
+
<p><span class="versionmodified added">Added in version 3.6: </span>The target is being cross-compiled and an emulator is provided (i.e.
|
| 162 |
+
its <span class="target" id="index-0-prop_tgt:CROSSCOMPILING_EMULATOR"></span><a class="reference internal" href="../prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR" title="CROSSCOMPILING_EMULATOR"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CROSSCOMPILING_EMULATOR</span></code></a> target property is set).
|
| 163 |
+
In this case, the contents of <span class="target" id="index-1-prop_tgt:CROSSCOMPILING_EMULATOR"></span><a class="reference internal" href="../prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR" title="CROSSCOMPILING_EMULATOR"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CROSSCOMPILING_EMULATOR</span></code></a> will be
|
| 164 |
+
prepended to the command before the location of the target executable.</p>
|
| 165 |
+
</div>
|
| 166 |
+
</li>
|
| 167 |
+
</ul>
|
| 168 |
+
<p>If neither of the above conditions are met, it is assumed that the
|
| 169 |
+
command name is a program to be found on the <code class="docutils literal notranslate"><span class="pre">PATH</span></code> at build time.</p>
|
| 170 |
+
<p>Arguments to <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> may use
|
| 171 |
+
<span class="target" id="index-1-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.
|
| 172 |
+
Use the <span class="target" id="index-0-genex:TARGET_FILE"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:TARGET_FILE" title="TARGET_FILE"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">TARGET_FILE</span></code></a> generator expression to refer to the location
|
| 173 |
+
of a target later in the command line (i.e. as a command argument rather
|
| 174 |
+
than as the command to execute).</p>
|
| 175 |
+
<p>Whenever one of the following target based generator expressions are used as
|
| 176 |
+
a command to execute or is mentioned in a command argument, a target-level
|
| 177 |
+
dependency will be added automatically so that the mentioned target will be
|
| 178 |
+
built before any target using this custom command
|
| 179 |
+
(see policy <span class="target" id="index-0-policy:CMP0112"></span><a class="reference internal" href="../policy/CMP0112.html#policy:CMP0112" title="CMP0112"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0112</span></code></a>).</p>
|
| 180 |
+
<blockquote>
|
| 181 |
+
<div><ul class="simple">
|
| 182 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_FILE</span></code></p></li>
|
| 183 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_LINKER_FILE</span></code></p></li>
|
| 184 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_SONAME_FILE</span></code></p></li>
|
| 185 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_PDB_FILE</span></code></p></li>
|
| 186 |
+
</ul>
|
| 187 |
+
</div></blockquote>
|
| 188 |
+
<p>This target-level dependency does NOT add a file-level dependency that would
|
| 189 |
+
cause the custom command to re-run whenever the executable is recompiled.
|
| 190 |
+
List target names with the <code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code> option to add such file-level
|
| 191 |
+
dependencies.</p>
|
| 192 |
+
</dd>
|
| 193 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMENT</span></code></dt><dd><p>Display the given message before the commands are executed at
|
| 194 |
+
build time. This will be ignored if <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> is given, although a future
|
| 195 |
+
version may use it.</p>
|
| 196 |
+
<div class="versionadded">
|
| 197 |
+
<p><span class="versionmodified added">Added in version 3.26: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">COMMENT</span></code> may use
|
| 198 |
+
<span class="target" id="index-2-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 199 |
+
</div>
|
| 200 |
+
</dd>
|
| 201 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code></dt><dd><p>Specify files on which the command depends. Each argument is converted
|
| 202 |
+
to a dependency as follows:</p>
|
| 203 |
+
<ol class="arabic simple">
|
| 204 |
+
<li><p>If the argument is the name of a target (created by the
|
| 205 |
+
<span class="target" id="index-1-command:add_custom_target"></span><a class="reference internal" href="add_custom_target.html#command:add_custom_target" title="add_custom_target"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_target()</span></code></a>, <span class="target" id="index-1-command:add_executable"></span><a class="reference internal" href="add_executable.html#command:add_executable" title="add_executable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_executable()</span></code></a>, or
|
| 206 |
+
<span class="target" id="index-0-command:add_library"></span><a class="reference internal" href="add_library.html#command:add_library" title="add_library"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_library()</span></code></a> command) a target-level dependency is
|
| 207 |
+
created to make sure the target is built before any target
|
| 208 |
+
using this custom command. Additionally, if the target is an
|
| 209 |
+
executable or library, a file-level dependency is created to
|
| 210 |
+
cause the custom command to re-run whenever the target is
|
| 211 |
+
recompiled.</p></li>
|
| 212 |
+
<li><p>If the argument is an absolute path, a file-level dependency
|
| 213 |
+
is created on that path.</p></li>
|
| 214 |
+
<li><p>If the argument is the name of a source file that has been
|
| 215 |
+
added to a target or on which a source file property has been set,
|
| 216 |
+
a file-level dependency is created on that source file.</p></li>
|
| 217 |
+
<li><p>If the argument is a relative path and it exists in the current
|
| 218 |
+
source directory, a file-level dependency is created on that
|
| 219 |
+
file in the current source directory.</p></li>
|
| 220 |
+
<li><p>Otherwise, a file-level dependency is created on that path relative
|
| 221 |
+
to the current binary directory.</p></li>
|
| 222 |
+
</ol>
|
| 223 |
+
<p>If any dependency is an <code class="docutils literal notranslate"><span class="pre">OUTPUT</span></code> of another custom command in the same
|
| 224 |
+
directory (<code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file), CMake automatically brings the other
|
| 225 |
+
custom command into the target in which this command is built.</p>
|
| 226 |
+
<div class="versionadded">
|
| 227 |
+
<p><span class="versionmodified added">Added in version 3.16: </span>A target-level dependency is added if any dependency is listed as
|
| 228 |
+
<code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code> of a target or any of its build events in the same
|
| 229 |
+
directory to ensure the byproducts will be available.</p>
|
| 230 |
+
</div>
|
| 231 |
+
<p>If <code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code> is not specified, the command will run whenever
|
| 232 |
+
the <code class="docutils literal notranslate"><span class="pre">OUTPUT</span></code> is missing; if the command does not actually
|
| 233 |
+
create the <code class="docutils literal notranslate"><span class="pre">OUTPUT</span></code>, the rule will always run.</p>
|
| 234 |
+
<div class="versionadded">
|
| 235 |
+
<p><span class="versionmodified added">Added in version 3.1: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code> may use
|
| 236 |
+
<span class="target" id="index-3-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 237 |
+
</div>
|
| 238 |
+
</dd>
|
| 239 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMAND_EXPAND_LISTS</span></code></dt><dd><div class="versionadded">
|
| 240 |
+
<p><span class="versionmodified added">Added in version 3.8.</span></p>
|
| 241 |
+
</div>
|
| 242 |
+
<p>Lists in <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> arguments will be expanded, including those
|
| 243 |
+
created with
|
| 244 |
+
<span class="target" id="index-4-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>,
|
| 245 |
+
allowing <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> arguments such as
|
| 246 |
+
<code class="docutils literal notranslate"><span class="pre">${CC}</span> <span class="pre">"-I$<JOIN:$<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>,;-I>"</span> <span class="pre">foo.cc</span></code>
|
| 247 |
+
to be properly expanded.</p>
|
| 248 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-1-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 249 |
+
If the appended commands need this option to be set, it must be set on the
|
| 250 |
+
first call to <code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code> for the output files.</p>
|
| 251 |
+
</dd>
|
| 252 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CODEGEN</span></code></dt><dd><div class="versionadded">
|
| 253 |
+
<p><span class="versionmodified added">Added in version 3.31.</span></p>
|
| 254 |
+
</div>
|
| 255 |
+
<p>Adds the custom command to a global <code class="docutils literal notranslate"><span class="pre">codegen</span></code> target that can be
|
| 256 |
+
used to execute the custom command while avoiding the majority of the
|
| 257 |
+
build graph.</p>
|
| 258 |
+
<p>This option is supported only by <a class="reference internal" href="../manual/cmake-generators.7.html#ninja-generators"><span class="std std-ref">Ninja Generators</span></a> and
|
| 259 |
+
<a class="reference internal" href="../manual/cmake-generators.7.html#makefile-generators"><span class="std std-ref">Makefile Generators</span></a>, and is ignored by other generators.
|
| 260 |
+
Furthermore, this option is allowed only if policy <span class="target" id="index-0-policy:CMP0171"></span><a class="reference internal" href="../policy/CMP0171.html#policy:CMP0171" title="CMP0171"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0171</span></code></a>
|
| 261 |
+
is set to <code class="docutils literal notranslate"><span class="pre">NEW</span></code>.</p>
|
| 262 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-2-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 263 |
+
It can only be set on the first call to <code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code>
|
| 264 |
+
for the output files.</p>
|
| 265 |
+
</dd>
|
| 266 |
+
<dt><code class="docutils literal notranslate"><span class="pre">IMPLICIT_DEPENDS</span></code></dt><dd><p>Request scanning of implicit dependencies of an input file.
|
| 267 |
+
The language given specifies the programming language whose
|
| 268 |
+
corresponding dependency scanner should be used.
|
| 269 |
+
Currently only <code class="docutils literal notranslate"><span class="pre">C</span></code> and <code class="docutils literal notranslate"><span class="pre">CXX</span></code> language scanners are supported.
|
| 270 |
+
The language has to be specified for every file in the
|
| 271 |
+
<code class="docutils literal notranslate"><span class="pre">IMPLICIT_DEPENDS</span></code> list. Dependencies discovered from the
|
| 272 |
+
scanning are added to those of the custom command at build time.
|
| 273 |
+
Note that the <code class="docutils literal notranslate"><span class="pre">IMPLICIT_DEPENDS</span></code> option is currently supported
|
| 274 |
+
only for Makefile generators and will be ignored by other generators.</p>
|
| 275 |
+
<div class="admonition note">
|
| 276 |
+
<p class="admonition-title">Note</p>
|
| 277 |
+
<p>This option cannot be specified at the same time as <code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code> option.</p>
|
| 278 |
+
</div>
|
| 279 |
+
</dd>
|
| 280 |
+
<dt><code class="docutils literal notranslate"><span class="pre">JOB_POOL</span></code></dt><dd><div class="versionadded">
|
| 281 |
+
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
| 282 |
+
</div>
|
| 283 |
+
<p>Specify a <span class="target" id="index-0-prop_gbl:JOB_POOLS"></span><a class="reference internal" href="../prop_gbl/JOB_POOLS.html#prop_gbl:JOB_POOLS" title="JOB_POOLS"><code class="xref cmake cmake-prop_gbl docutils literal notranslate"><span class="pre">pool</span></code></a> for the <span class="target" id="index-1-generator:Ninja"></span><a class="reference internal" href="../generator/Ninja.html#generator:Ninja" title="Ninja"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span></code></a>
|
| 284 |
+
generator. Incompatible with <code class="docutils literal notranslate"><span class="pre">USES_TERMINAL</span></code>, which implies
|
| 285 |
+
the <code class="docutils literal notranslate"><span class="pre">console</span></code> pool.
|
| 286 |
+
Using a pool that is not defined by <span class="target" id="index-1-prop_gbl:JOB_POOLS"></span><a class="reference internal" href="../prop_gbl/JOB_POOLS.html#prop_gbl:JOB_POOLS" title="JOB_POOLS"><code class="xref cmake cmake-prop_gbl docutils literal notranslate"><span class="pre">JOB_POOLS</span></code></a> causes
|
| 287 |
+
an error by ninja at build time.</p>
|
| 288 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-3-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 289 |
+
Job pools can only be specified in the first call to
|
| 290 |
+
<code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code> for the output files.</p>
|
| 291 |
+
</dd>
|
| 292 |
+
<dt><code class="docutils literal notranslate"><span class="pre">JOB_SERVER_AWARE</span></code></dt><dd><div class="versionadded">
|
| 293 |
+
<p><span class="versionmodified added">Added in version 3.28.</span></p>
|
| 294 |
+
</div>
|
| 295 |
+
<p>Specify that the command is GNU Make job server aware.</p>
|
| 296 |
+
<p>For the <span class="target" id="index-0-generator:Unix Makefiles"></span><a class="reference internal" href="../generator/Unix%20Makefiles.html#generator:Unix Makefiles" title="Unix Makefiles"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Unix</span> <span class="pre">Makefiles</span></code></a>, <span class="target" id="index-0-generator:MSYS Makefiles"></span><a class="reference internal" href="../generator/MSYS%20Makefiles.html#generator:MSYS Makefiles" title="MSYS Makefiles"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">MSYS</span> <span class="pre">Makefiles</span></code></a>, and
|
| 297 |
+
<span class="target" id="index-0-generator:MinGW Makefiles"></span><a class="reference internal" href="../generator/MinGW%20Makefiles.html#generator:MinGW Makefiles" title="MinGW Makefiles"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">MinGW</span> <span class="pre">Makefiles</span></code></a> generators this will add the <code class="docutils literal notranslate"><span class="pre">+</span></code> prefix to the
|
| 298 |
+
recipe line. See the <a class="reference external" href="https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html">GNU Make Documentation</a> for more information.</p>
|
| 299 |
+
<p>This option is silently ignored by other generators.</p>
|
| 300 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-4-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 301 |
+
Job server awareness can only be specified in the first call to
|
| 302 |
+
<code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code> for the output files.</p>
|
| 303 |
+
</dd>
|
| 304 |
+
</dl>
|
| 305 |
+
<dl>
|
| 306 |
+
<dt><code class="docutils literal notranslate"><span class="pre">MAIN_DEPENDENCY</span></code></dt><dd><p>Specify the primary input source file to the command. This is
|
| 307 |
+
treated just like any value given to the <code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code> option
|
| 308 |
+
but also suggests to Visual Studio generators where to hang
|
| 309 |
+
the custom command. Each source file may have at most one command
|
| 310 |
+
specifying it as its main dependency. A compile command (i.e. for a
|
| 311 |
+
library or an executable) counts as an implicit main dependency which
|
| 312 |
+
gets silently overwritten by a custom command specification.</p>
|
| 313 |
+
<p>This option is currently ignored if <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> is given, but a future
|
| 314 |
+
version may use it.</p>
|
| 315 |
+
</dd>
|
| 316 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OUTPUT</span></code></dt><dd><p>Specify the output files the command is expected to produce.
|
| 317 |
+
Each output file will be marked with the <span class="target" id="index-2-prop_sf:GENERATED"></span><a class="reference internal" href="../prop_sf/GENERATED.html#prop_sf:GENERATED" title="GENERATED"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">GENERATED</span></code></a>
|
| 318 |
+
source file property automatically.
|
| 319 |
+
If the output of the custom command is not actually created
|
| 320 |
+
as a file on disk it should be marked with the <span class="target" id="index-0-prop_sf:SYMBOLIC"></span><a class="reference internal" href="../prop_sf/SYMBOLIC.html#prop_sf:SYMBOLIC" title="SYMBOLIC"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">SYMBOLIC</span></code></a>
|
| 321 |
+
source file property.</p>
|
| 322 |
+
<p>If an output file name is a relative path, its absolute path is
|
| 323 |
+
determined by interpreting it relative to:</p>
|
| 324 |
+
<ol class="arabic simple">
|
| 325 |
+
<li><p>the build directory corresponding to the current source directory
|
| 326 |
+
(<span class="target" id="index-0-variable:CMAKE_CURRENT_BINARY_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_BINARY_DIR.html#variable:CMAKE_CURRENT_BINARY_DIR" title="CMAKE_CURRENT_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_BINARY_DIR</span></code></a>), or</p></li>
|
| 327 |
+
<li><p>the current source directory (<span class="target" id="index-0-variable:CMAKE_CURRENT_SOURCE_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_SOURCE_DIR.html#variable:CMAKE_CURRENT_SOURCE_DIR" title="CMAKE_CURRENT_SOURCE_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_SOURCE_DIR</span></code></a>).</p></li>
|
| 328 |
+
</ol>
|
| 329 |
+
<p>The path in the build directory is preferred unless the path in the
|
| 330 |
+
source tree is mentioned as an absolute source file path elsewhere
|
| 331 |
+
in the current directory.</p>
|
| 332 |
+
<p>The output file path may not contain <code class="docutils literal notranslate"><span class="pre"><</span></code> or <code class="docutils literal notranslate"><span class="pre">></span></code> characters.</p>
|
| 333 |
+
<div class="versionadded">
|
| 334 |
+
<p><span class="versionmodified added">Added in version 3.20: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">OUTPUT</span></code> may use a restricted set of
|
| 335 |
+
<span class="target" id="index-5-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.
|
| 336 |
+
<a class="reference internal" href="../manual/cmake-generator-expressions.7.html#target-dependent-expressions"><span class="std std-ref">Target-dependent expressions</span></a>
|
| 337 |
+
are not permitted.</p>
|
| 338 |
+
</div>
|
| 339 |
+
<div class="versionchanged">
|
| 340 |
+
<p><span class="versionmodified changed">Changed in version 3.28: </span>In targets using <a class="reference internal" href="target_sources.html#file-sets"><span class="std std-ref">File Sets</span></a>, custom command outputs are now
|
| 341 |
+
considered private unless they are listed in a non-private file set.
|
| 342 |
+
See policy <span class="target" id="index-1-policy:CMP0154"></span><a class="reference internal" href="../policy/CMP0154.html#policy:CMP0154" title="CMP0154"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0154</span></code></a>.</p>
|
| 343 |
+
</div>
|
| 344 |
+
<div class="versionchanged">
|
| 345 |
+
<p><span class="versionmodified changed">Changed in version 3.30: </span>The output file path may now use <code class="docutils literal notranslate"><span class="pre">#</span></code> characters, except
|
| 346 |
+
when using the <span class="target" id="index-0-generator:Borland Makefiles"></span><a class="reference internal" href="../generator/Borland%20Makefiles.html#generator:Borland Makefiles" title="Borland Makefiles"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Borland</span> <span class="pre">Makefiles</span></code></a> generator.</p>
|
| 347 |
+
</div>
|
| 348 |
+
</dd>
|
| 349 |
+
<dt><code class="docutils literal notranslate"><span class="pre">USES_TERMINAL</span></code></dt><dd><div class="versionadded">
|
| 350 |
+
<p><span class="versionmodified added">Added in version 3.2.</span></p>
|
| 351 |
+
</div>
|
| 352 |
+
<p>The command will be given direct access to the terminal if possible.
|
| 353 |
+
With the <span class="target" id="index-2-generator:Ninja"></span><a class="reference internal" href="../generator/Ninja.html#generator:Ninja" title="Ninja"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span></code></a> generator, this places the command in
|
| 354 |
+
the <code class="docutils literal notranslate"><span class="pre">console</span></code> <span class="target" id="index-2-prop_gbl:JOB_POOLS"></span><a class="reference internal" href="../prop_gbl/JOB_POOLS.html#prop_gbl:JOB_POOLS" title="JOB_POOLS"><code class="xref cmake cmake-prop_gbl docutils literal notranslate"><span class="pre">pool</span></code></a>.</p>
|
| 355 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-5-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 356 |
+
If the appended commands need access to the terminal, it must be set on
|
| 357 |
+
the first call to <code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code> for the output files.</p>
|
| 358 |
+
</dd>
|
| 359 |
+
<dt><code class="docutils literal notranslate"><span class="pre">VERBATIM</span></code></dt><dd><p>All arguments to the commands will be escaped properly for the
|
| 360 |
+
build tool so that the invoked command receives each argument
|
| 361 |
+
unchanged. Note that one level of escapes is still used by the
|
| 362 |
+
CMake language processor before add_custom_command even sees the
|
| 363 |
+
arguments. Use of <code class="docutils literal notranslate"><span class="pre">VERBATIM</span></code> is recommended as it enables
|
| 364 |
+
correct behavior. When <code class="docutils literal notranslate"><span class="pre">VERBATIM</span></code> is not given the behavior
|
| 365 |
+
is platform specific because there is no protection of
|
| 366 |
+
tool-specific special characters.</p>
|
| 367 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-6-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 368 |
+
If the appended commands need to be treated as <code class="docutils literal notranslate"><span class="pre">VERBATIM</span></code>, it must be set
|
| 369 |
+
on the first call to <code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code> for the output files.</p>
|
| 370 |
+
</dd>
|
| 371 |
+
<dt><code class="docutils literal notranslate"><span class="pre">WORKING_DIRECTORY</span></code></dt><dd><p>Execute the command with the given current working directory.
|
| 372 |
+
If it is a relative path, it will be interpreted relative to the
|
| 373 |
+
build tree directory corresponding to the current source directory.</p>
|
| 374 |
+
<p>This option is currently ignored if <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> is given, but a future
|
| 375 |
+
version may use it.</p>
|
| 376 |
+
<div class="versionadded">
|
| 377 |
+
<p><span class="versionmodified added">Added in version 3.13: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">WORKING_DIRECTORY</span></code> may use
|
| 378 |
+
<span class="target" id="index-6-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 379 |
+
</div>
|
| 380 |
+
</dd>
|
| 381 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code></dt><dd><div class="versionadded">
|
| 382 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 383 |
+
</div>
|
| 384 |
+
<p>Specify a depfile which holds dependencies for the custom command. It is
|
| 385 |
+
usually emitted by the custom command itself. This keyword may only be used
|
| 386 |
+
if the generator supports it, as detailed below.</p>
|
| 387 |
+
<p>The expected format, compatible with what is generated by <code class="docutils literal notranslate"><span class="pre">gcc</span></code> with the
|
| 388 |
+
option <code class="docutils literal notranslate"><span class="pre">-M</span></code>, is independent of the generator or platform.</p>
|
| 389 |
+
<p>The formal syntax, as specified using
|
| 390 |
+
<a class="reference external" href="https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form">BNF</a> notation with
|
| 391 |
+
the regular extensions, is the following:</p>
|
| 392 |
+
<pre>
|
| 393 |
+
<strong id="grammar-token-depfile-depfile">depfile </strong> ::= <a class="reference internal" href="#grammar-token-depfile-rule"><code class="xref docutils literal notranslate"><span class="pre">rule</span></code></a>*
|
| 394 |
+
<strong id="grammar-token-depfile-rule">rule </strong> ::= <a class="reference internal" href="#grammar-token-depfile-targets"><code class="xref docutils literal notranslate"><span class="pre">targets</span></code></a> (':' (<a class="reference internal" href="#grammar-token-depfile-separator"><code class="xref docutils literal notranslate"><span class="pre">separator</span></code></a> <a class="reference internal" href="#grammar-token-depfile-dependencies"><code class="xref docutils literal notranslate"><span class="pre">dependencies</span></code></a>?)?)? <a class="reference internal" href="#grammar-token-depfile-eol"><code class="xref docutils literal notranslate"><span class="pre">eol</span></code></a>
|
| 395 |
+
<strong id="grammar-token-depfile-targets">targets </strong> ::= <a class="reference internal" href="#grammar-token-depfile-target"><code class="xref docutils literal notranslate"><span class="pre">target</span></code></a> (<a class="reference internal" href="#grammar-token-depfile-separator"><code class="xref docutils literal notranslate"><span class="pre">separator</span></code></a> <a class="reference internal" href="#grammar-token-depfile-target"><code class="xref docutils literal notranslate"><span class="pre">target</span></code></a>)* <a class="reference internal" href="#grammar-token-depfile-separator"><code class="xref docutils literal notranslate"><span class="pre">separator</span></code></a>*
|
| 396 |
+
<strong id="grammar-token-depfile-target">target </strong> ::= <a class="reference internal" href="#grammar-token-depfile-pathname"><code class="xref docutils literal notranslate"><span class="pre">pathname</span></code></a>
|
| 397 |
+
<strong id="grammar-token-depfile-dependencies">dependencies </strong> ::= <a class="reference internal" href="#grammar-token-depfile-dependency"><code class="xref docutils literal notranslate"><span class="pre">dependency</span></code></a> (<a class="reference internal" href="#grammar-token-depfile-separator"><code class="xref docutils literal notranslate"><span class="pre">separator</span></code></a> <a class="reference internal" href="#grammar-token-depfile-dependency"><code class="xref docutils literal notranslate"><span class="pre">dependency</span></code></a>)* <a class="reference internal" href="#grammar-token-depfile-separator"><code class="xref docutils literal notranslate"><span class="pre">separator</span></code></a>*
|
| 398 |
+
<strong id="grammar-token-depfile-dependency">dependency </strong> ::= <a class="reference internal" href="#grammar-token-depfile-pathname"><code class="xref docutils literal notranslate"><span class="pre">pathname</span></code></a>
|
| 399 |
+
<strong id="grammar-token-depfile-separator">separator </strong> ::= (<a class="reference internal" href="#grammar-token-depfile-space"><code class="xref docutils literal notranslate"><span class="pre">space</span></code></a> | <a class="reference internal" href="#grammar-token-depfile-line_continue"><code class="xref docutils literal notranslate"><span class="pre">line_continue</span></code></a>)+
|
| 400 |
+
<strong id="grammar-token-depfile-line_continue">line_continue</strong> ::= '\' <a class="reference internal" href="#grammar-token-depfile-eol"><code class="xref docutils literal notranslate"><span class="pre">eol</span></code></a>
|
| 401 |
+
<strong id="grammar-token-depfile-space">space </strong> ::= ' ' | '\t'
|
| 402 |
+
<strong id="grammar-token-depfile-pathname">pathname </strong> ::= <a class="reference internal" href="#grammar-token-depfile-character"><code class="xref docutils literal notranslate"><span class="pre">character</span></code></a>+
|
| 403 |
+
<strong id="grammar-token-depfile-character">character </strong> ::= <a class="reference internal" href="#grammar-token-depfile-std_character"><code class="xref docutils literal notranslate"><span class="pre">std_character</span></code></a> | <a class="reference internal" href="#grammar-token-depfile-dollar"><code class="xref docutils literal notranslate"><span class="pre">dollar</span></code></a> | <a class="reference internal" href="#grammar-token-depfile-hash"><code class="xref docutils literal notranslate"><span class="pre">hash</span></code></a> | <a class="reference internal" href="#grammar-token-depfile-whitespace"><code class="xref docutils literal notranslate"><span class="pre">whitespace</span></code></a>
|
| 404 |
+
<strong id="grammar-token-depfile-std_character">std_character</strong> ::= <any character except '$', '#' or ' '>
|
| 405 |
+
<strong id="grammar-token-depfile-dollar">dollar </strong> ::= '$$'
|
| 406 |
+
<strong id="grammar-token-depfile-hash">hash </strong> ::= '\#'
|
| 407 |
+
<strong id="grammar-token-depfile-whitespace">whitespace </strong> ::= '\ '
|
| 408 |
+
<strong id="grammar-token-depfile-eol">eol </strong> ::= '\r'? '\n'
|
| 409 |
+
</pre>
|
| 410 |
+
<div class="admonition note">
|
| 411 |
+
<p class="admonition-title">Note</p>
|
| 412 |
+
<p>As part of <code class="docutils literal notranslate"><span class="pre">pathname</span></code>, any slash and backslash is interpreted as
|
| 413 |
+
a directory separator.</p>
|
| 414 |
+
</div>
|
| 415 |
+
<div class="versionadded">
|
| 416 |
+
<p><span class="versionmodified added">Added in version 3.7: </span>The <span class="target" id="index-3-generator:Ninja"></span><a class="reference internal" href="../generator/Ninja.html#generator:Ninja" title="Ninja"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span></code></a> generator supports <code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code> since the keyword
|
| 417 |
+
was first added.</p>
|
| 418 |
+
</div>
|
| 419 |
+
<div class="versionadded">
|
| 420 |
+
<p><span class="versionmodified added">Added in version 3.17: </span>Added the <span class="target" id="index-0-generator:Ninja Multi-Config"></span><a class="reference internal" href="../generator/Ninja%20Multi-Config.html#generator:Ninja Multi-Config" title="Ninja Multi-Config"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span> <span class="pre">Multi-Config</span></code></a> generator, which included
|
| 421 |
+
support for the <code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code> keyword.</p>
|
| 422 |
+
</div>
|
| 423 |
+
<div class="versionadded">
|
| 424 |
+
<p><span class="versionmodified added">Added in version 3.20: </span>Added support for <a class="reference internal" href="../manual/cmake-generators.7.html#makefile-generators"><span class="std std-ref">Makefile Generators</span></a>.</p>
|
| 425 |
+
<div class="admonition note">
|
| 426 |
+
<p class="admonition-title">Note</p>
|
| 427 |
+
<p><code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code> cannot be specified at the same time as the
|
| 428 |
+
<code class="docutils literal notranslate"><span class="pre">IMPLICIT_DEPENDS</span></code> option for <a class="reference internal" href="../manual/cmake-generators.7.html#makefile-generators"><span class="std std-ref">Makefile Generators</span></a>.</p>
|
| 429 |
+
</div>
|
| 430 |
+
</div>
|
| 431 |
+
<div class="versionadded">
|
| 432 |
+
<p><span class="versionmodified added">Added in version 3.21: </span>Added support for <a class="reference internal" href="../manual/cmake-generators.7.html#visual-studio-generators"><span class="std std-ref">Visual Studio Generators</span></a> with VS 2012 and above,
|
| 433 |
+
and for the <span class="target" id="index-0-generator:Xcode"></span><a class="reference internal" href="../generator/Xcode.html#generator:Xcode" title="Xcode"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Xcode</span></code></a> generator. Support for
|
| 434 |
+
<span class="target" id="index-7-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a> was also
|
| 435 |
+
added.</p>
|
| 436 |
+
</div>
|
| 437 |
+
<div class="versionadded">
|
| 438 |
+
<p><span class="versionmodified added">Added in version 3.29: </span>The <a class="reference internal" href="../manual/cmake-generators.7.html#ninja-generators"><span class="std std-ref">Ninja Generators</span></a> will now incorporate the dependencies into its
|
| 439 |
+
"deps log" database if the file is not listed in <code class="docutils literal notranslate"><span class="pre">OUTPUTS</span></code> or
|
| 440 |
+
<code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code>.</p>
|
| 441 |
+
</div>
|
| 442 |
+
<p>Using <code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code> with generators other than those listed above is an error.</p>
|
| 443 |
+
<p>If the <code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code> argument is relative, it should be relative to
|
| 444 |
+
<span class="target" id="index-1-variable:CMAKE_CURRENT_BINARY_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_BINARY_DIR.html#variable:CMAKE_CURRENT_BINARY_DIR" title="CMAKE_CURRENT_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_BINARY_DIR</span></code></a>, and any relative paths inside the
|
| 445 |
+
<code class="docutils literal notranslate"><span class="pre">DEPFILE</span></code> should also be relative to <span class="target" id="index-2-variable:CMAKE_CURRENT_BINARY_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_BINARY_DIR.html#variable:CMAKE_CURRENT_BINARY_DIR" title="CMAKE_CURRENT_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_BINARY_DIR</span></code></a>.
|
| 446 |
+
See policy <span class="target" id="index-0-policy:CMP0116"></span><a class="reference internal" href="../policy/CMP0116.html#policy:CMP0116" title="CMP0116"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0116</span></code></a>, which is always <code class="docutils literal notranslate"><span class="pre">NEW</span></code> for
|
| 447 |
+
<a class="reference internal" href="../manual/cmake-generators.7.html#makefile-generators"><span class="std std-ref">Makefile Generators</span></a>, <a class="reference internal" href="../manual/cmake-generators.7.html#visual-studio-generators"><span class="std std-ref">Visual Studio Generators</span></a>,
|
| 448 |
+
and the <span class="target" id="index-1-generator:Xcode"></span><a class="reference internal" href="../generator/Xcode.html#generator:Xcode" title="Xcode"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Xcode</span></code></a> generator.</p>
|
| 449 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-7-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 450 |
+
Depfiles can only be set on the first call to
|
| 451 |
+
<code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code> for the output files.</p>
|
| 452 |
+
</dd>
|
| 453 |
+
</dl>
|
| 454 |
+
<p><code class="docutils literal notranslate"><span class="pre">DEPENDS_EXPLICIT_ONLY</span></code></p>
|
| 455 |
+
<blockquote>
|
| 456 |
+
<div><div class="versionadded">
|
| 457 |
+
<p><span class="versionmodified added">Added in version 3.27.</span></p>
|
| 458 |
+
</div>
|
| 459 |
+
<p>Indicates that the command's <code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code> argument represents all files
|
| 460 |
+
required by the command and implicit dependencies are not required.</p>
|
| 461 |
+
<p>Without this option, if any target uses the output of the custom command,
|
| 462 |
+
CMake will consider that target's dependencies as implicit dependencies for
|
| 463 |
+
the custom command in case this custom command requires files implicitly
|
| 464 |
+
created by those targets.</p>
|
| 465 |
+
<p>This option can be enabled on all custom commands by setting
|
| 466 |
+
<span class="target" id="index-0-variable:CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY"></span><a class="reference internal" href="../variable/CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY.html#variable:CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY" title="CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY</span></code></a> to <code class="docutils literal notranslate"><span class="pre">ON</span></code>.</p>
|
| 467 |
+
<p>This keyword cannot be used with <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> (see policy <span class="target" id="index-8-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>).
|
| 468 |
+
It can only be set on the first call to <code class="docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT...)</span></code>
|
| 469 |
+
for the output files.</p>
|
| 470 |
+
<p>Only the <a class="reference internal" href="../manual/cmake-generators.7.html#ninja-generators"><span class="std std-ref">Ninja Generators</span></a> actually use this information to remove
|
| 471 |
+
unnecessary implicit dependencies.</p>
|
| 472 |
+
<p>See also the <span class="target" id="index-0-prop_tgt:OPTIMIZE_DEPENDENCIES"></span><a class="reference internal" href="../prop_tgt/OPTIMIZE_DEPENDENCIES.html#prop_tgt:OPTIMIZE_DEPENDENCIES" title="OPTIMIZE_DEPENDENCIES"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">OPTIMIZE_DEPENDENCIES</span></code></a> target property, which may
|
| 473 |
+
provide another way for reducing the impact of target dependencies in some
|
| 474 |
+
scenarios.</p>
|
| 475 |
+
</div></blockquote>
|
| 476 |
+
</section>
|
| 477 |
+
<section id="examples-generating-files">
|
| 478 |
+
<h2>Examples: Generating Files<a class="headerlink" href="#examples-generating-files" title="Link to this heading">¶</a></h2>
|
| 479 |
+
<p>Custom commands may be used to generate source files.
|
| 480 |
+
For example, the code:</p>
|
| 481 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_custom_command(</span>
|
| 482 |
+
<span class="w"> </span><span class="no">OUTPUT</span><span class="w"> </span><span class="nb">out.c</span>
|
| 483 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">someTool</span><span class="w"> </span><span class="p">-</span><span class="nb">i</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="na">/in.txt</span>
|
| 484 |
+
<span class="w"> </span><span class="p">-</span><span class="nb">o</span><span class="w"> </span><span class="nb">out.c</span>
|
| 485 |
+
<span class="w"> </span><span class="no">DEPENDS</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="na">/in.txt</span>
|
| 486 |
+
<span class="w"> </span><span class="no">VERBATIM</span><span class="nf">)</span>
|
| 487 |
+
<span class="nf">add_library(</span><span class="nb">myLib</span><span class="w"> </span><span class="nb">out.c</span><span class="nf">)</span>
|
| 488 |
+
</pre></div>
|
| 489 |
+
</div>
|
| 490 |
+
<p>adds a custom command to run <code class="docutils literal notranslate"><span class="pre">someTool</span></code> to generate <code class="docutils literal notranslate"><span class="pre">out.c</span></code> and then
|
| 491 |
+
compile the generated source as part of a library. The generation rule
|
| 492 |
+
will re-run whenever <code class="docutils literal notranslate"><span class="pre">in.txt</span></code> changes.</p>
|
| 493 |
+
<div class="versionadded">
|
| 494 |
+
<p><span class="versionmodified added">Added in version 3.20: </span>One may use generator expressions to specify per-configuration outputs.
|
| 495 |
+
For example, the code:</p>
|
| 496 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_custom_command(</span>
|
| 497 |
+
<span class="w"> </span><span class="no">OUTPUT</span><span class="w"> </span><span class="s">"out-$<CONFIG>.c"</span>
|
| 498 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">someTool</span><span class="w"> </span><span class="p">-</span><span class="nb">i</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="na">/in.txt</span>
|
| 499 |
+
<span class="w"> </span><span class="p">-</span><span class="nb">o</span><span class="w"> </span><span class="s">"out-$<CONFIG>.c"</span>
|
| 500 |
+
<span class="w"> </span><span class="p">-</span><span class="nb">c</span><span class="w"> </span><span class="s">"$<CONFIG>"</span>
|
| 501 |
+
<span class="w"> </span><span class="no">DEPENDS</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="na">/in.txt</span>
|
| 502 |
+
<span class="w"> </span><span class="no">VERBATIM</span><span class="nf">)</span>
|
| 503 |
+
<span class="nf">add_library(</span><span class="nb">myLib</span><span class="w"> </span><span class="s">"out-$<CONFIG>.c"</span><span class="nf">)</span>
|
| 504 |
+
</pre></div>
|
| 505 |
+
</div>
|
| 506 |
+
<p>adds a custom command to run <code class="docutils literal notranslate"><span class="pre">someTool</span></code> to generate <code class="docutils literal notranslate"><span class="pre">out-<config>.c</span></code>,
|
| 507 |
+
where <code class="docutils literal notranslate"><span class="pre"><config></span></code> is the build configuration, and then compile the generated
|
| 508 |
+
source as part of a library.</p>
|
| 509 |
+
</div>
|
| 510 |
+
<div class="versionadded">
|
| 511 |
+
<p><span class="versionmodified added">Added in version 3.31: </span>Use the <code class="docutils literal notranslate"><span class="pre">CODEGEN</span></code> option to add a custom command's outputs to the builtin
|
| 512 |
+
<code class="docutils literal notranslate"><span class="pre">codegen</span></code> target. This is useful to make generated code available for
|
| 513 |
+
static analysis without building the entire project. For example:</p>
|
| 514 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_executable(</span><span class="nb">someTool</span><span class="w"> </span><span class="nb">someTool.c</span><span class="nf">)</span>
|
| 515 |
+
|
| 516 |
+
<span class="nf">add_custom_command(</span>
|
| 517 |
+
<span class="w"> </span><span class="no">OUTPUT</span><span class="w"> </span><span class="nb">out.c</span>
|
| 518 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">someTool</span><span class="w"> </span><span class="p">-</span><span class="nb">o</span><span class="w"> </span><span class="nb">out.c</span>
|
| 519 |
+
<span class="w"> </span><span class="no">CODEGEN</span><span class="nf">)</span>
|
| 520 |
+
|
| 521 |
+
<span class="nf">add_library(</span><span class="nb">myLib</span><span class="w"> </span><span class="nb">out.c</span><span class="nf">)</span>
|
| 522 |
+
</pre></div>
|
| 523 |
+
</div>
|
| 524 |
+
<p>A user may build the <code class="docutils literal notranslate"><span class="pre">codegen</span></code> target to generate <code class="docutils literal notranslate"><span class="pre">out.c</span></code>.
|
| 525 |
+
<code class="docutils literal notranslate"><span class="pre">someTool</span></code> is built as dependency, but <code class="docutils literal notranslate"><span class="pre">myLib</span></code> is not built at all.</p>
|
| 526 |
+
</div>
|
| 527 |
+
<section id="example-generating-files-for-multiple-targets">
|
| 528 |
+
<h3>Example: Generating Files for Multiple Targets<a class="headerlink" href="#example-generating-files-for-multiple-targets" title="Link to this heading">¶</a></h3>
|
| 529 |
+
<p>If multiple independent targets need the same custom command output,
|
| 530 |
+
it must be attached to a single custom target on which they all depend.
|
| 531 |
+
Consider the following example:</p>
|
| 532 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_custom_command(</span>
|
| 533 |
+
<span class="w"> </span><span class="no">OUTPUT</span><span class="w"> </span><span class="nb">table.csv</span>
|
| 534 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">makeTable</span><span class="w"> </span><span class="p">-</span><span class="nb">i</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="na">/input.dat</span>
|
| 535 |
+
<span class="w"> </span><span class="p">-</span><span class="nb">o</span><span class="w"> </span><span class="nb">table.csv</span>
|
| 536 |
+
<span class="w"> </span><span class="no">DEPENDS</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="na">/input.dat</span>
|
| 537 |
+
<span class="w"> </span><span class="no">VERBATIM</span><span class="nf">)</span>
|
| 538 |
+
<span class="nf">add_custom_target(</span><span class="nb">generate_table_csv</span><span class="w"> </span><span class="no">DEPENDS</span><span class="w"> </span><span class="nb">table.csv</span><span class="nf">)</span>
|
| 539 |
+
|
| 540 |
+
<span class="nf">add_custom_command(</span>
|
| 541 |
+
<span class="w"> </span><span class="no">OUTPUT</span><span class="w"> </span><span class="nb">foo.cxx</span>
|
| 542 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">genFromTable</span><span class="w"> </span><span class="p">-</span><span class="nb">i</span><span class="w"> </span><span class="nb">table.csv</span><span class="w"> </span><span class="p">-</span><span class="nb">case</span><span class="w"> </span><span class="nb">foo</span><span class="w"> </span><span class="p">-</span><span class="nb">o</span><span class="w"> </span><span class="nb">foo.cxx</span>
|
| 543 |
+
<span class="w"> </span><span class="no">DEPENDS</span><span class="w"> </span><span class="nb">table.csv</span><span class="w"> </span><span class="c"># file-level dependency</span>
|
| 544 |
+
<span class="w"> </span><span class="nb">generate_table_csv</span><span class="w"> </span><span class="c"># target-level dependency</span>
|
| 545 |
+
<span class="w"> </span><span class="no">VERBATIM</span><span class="nf">)</span>
|
| 546 |
+
<span class="nf">add_library(</span><span class="nb">foo</span><span class="w"> </span><span class="nb">foo.cxx</span><span class="nf">)</span>
|
| 547 |
+
|
| 548 |
+
<span class="nf">add_custom_command(</span>
|
| 549 |
+
<span class="w"> </span><span class="no">OUTPUT</span><span class="w"> </span><span class="nb">bar.cxx</span>
|
| 550 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">genFromTable</span><span class="w"> </span><span class="p">-</span><span class="nb">i</span><span class="w"> </span><span class="nb">table.csv</span><span class="w"> </span><span class="p">-</span><span class="nb">case</span><span class="w"> </span><span class="nb">bar</span><span class="w"> </span><span class="p">-</span><span class="nb">o</span><span class="w"> </span><span class="nb">bar.cxx</span>
|
| 551 |
+
<span class="w"> </span><span class="no">DEPENDS</span><span class="w"> </span><span class="nb">table.csv</span><span class="w"> </span><span class="c"># file-level dependency</span>
|
| 552 |
+
<span class="w"> </span><span class="nb">generate_table_csv</span><span class="w"> </span><span class="c"># target-level dependency</span>
|
| 553 |
+
<span class="w"> </span><span class="no">VERBATIM</span><span class="nf">)</span>
|
| 554 |
+
<span class="nf">add_library(</span><span class="nb">bar</span><span class="w"> </span><span class="nb">bar.cxx</span><span class="nf">)</span>
|
| 555 |
+
</pre></div>
|
| 556 |
+
</div>
|
| 557 |
+
<p>Output <code class="docutils literal notranslate"><span class="pre">foo.cxx</span></code> is needed only by target <code class="docutils literal notranslate"><span class="pre">foo</span></code> and output <code class="docutils literal notranslate"><span class="pre">bar.cxx</span></code>
|
| 558 |
+
is needed only by target <code class="docutils literal notranslate"><span class="pre">bar</span></code>, but <em>both</em> targets need <code class="docutils literal notranslate"><span class="pre">table.csv</span></code>,
|
| 559 |
+
transitively. Since <code class="docutils literal notranslate"><span class="pre">foo</span></code> and <code class="docutils literal notranslate"><span class="pre">bar</span></code> are independent targets that may
|
| 560 |
+
build concurrently, we prevent them from racing to generate <code class="docutils literal notranslate"><span class="pre">table.csv</span></code>
|
| 561 |
+
by placing its custom command in a separate target, <code class="docutils literal notranslate"><span class="pre">generate_table_csv</span></code>.
|
| 562 |
+
The custom commands generating <code class="docutils literal notranslate"><span class="pre">foo.cxx</span></code> and <code class="docutils literal notranslate"><span class="pre">bar.cxx</span></code> each specify a
|
| 563 |
+
target-level dependency on <code class="docutils literal notranslate"><span class="pre">generate_table_csv</span></code>, so the targets using them,
|
| 564 |
+
<code class="docutils literal notranslate"><span class="pre">foo</span></code> and <code class="docutils literal notranslate"><span class="pre">bar</span></code>, will not build until after target <code class="docutils literal notranslate"><span class="pre">generate_table_csv</span></code>
|
| 565 |
+
is built.</p>
|
| 566 |
+
</section>
|
| 567 |
+
</section>
|
| 568 |
+
<section id="build-events">
|
| 569 |
+
<span id="add-custom-command-target"></span><h2>Build Events<a class="headerlink" href="#build-events" title="Link to this heading">¶</a></h2>
|
| 570 |
+
<p>The second signature adds a custom command to a target such as a
|
| 571 |
+
library or executable. This is useful for performing an operation
|
| 572 |
+
before or after building the target. The command becomes part of the
|
| 573 |
+
target and will only execute when the target itself is built. If the
|
| 574 |
+
target is already built, the command will not execute.</p>
|
| 575 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_custom_command(</span><span class="no">TARGET</span><span class="w"> </span><span class="nv"><target></span>
|
| 576 |
+
<span class="w"> </span><span class="no">PRE_BUILD</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="no">PRE_LINK</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="no">POST_BUILD</span>
|
| 577 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">command1</span><span class="w"> </span><span class="p">[</span><span class="no">ARGS</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="nb">args1...</span><span class="p">]</span>
|
| 578 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">command2</span><span class="w"> </span><span class="p">[</span><span class="no">ARGS</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="nb">args2...</span><span class="p">]</span><span class="w"> </span><span class="p">...]</span>
|
| 579 |
+
<span class="w"> </span><span class="p">[</span><span class="no">BYPRODUCTS</span><span class="w"> </span><span class="p">[</span><span class="nb">files...</span><span class="p">]]</span>
|
| 580 |
+
<span class="w"> </span><span class="p">[</span><span class="no">WORKING_DIRECTORY</span><span class="w"> </span><span class="nb">dir</span><span class="p">]</span>
|
| 581 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMENT</span><span class="w"> </span><span class="nb">comment</span><span class="p">]</span>
|
| 582 |
+
<span class="w"> </span><span class="p">[</span><span class="no">VERBATIM</span><span class="p">]</span>
|
| 583 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMAND_EXPAND_LISTS</span><span class="p">]</span>
|
| 584 |
+
<span class="w"> </span><span class="p">[</span><span class="no">USES_TERMINAL</span><span class="p">]</span><span class="nf">)</span>
|
| 585 |
+
</pre></div>
|
| 586 |
+
</div>
|
| 587 |
+
<p>This defines a new command that will be associated with building the
|
| 588 |
+
specified <code class="docutils literal notranslate"><span class="pre"><target></span></code>. The <code class="docutils literal notranslate"><span class="pre"><target></span></code> must be defined in the current
|
| 589 |
+
directory; targets defined in other directories may not be specified.</p>
|
| 590 |
+
<p>When the command will happen is determined by which
|
| 591 |
+
of the following is specified:</p>
|
| 592 |
+
<dl class="simple">
|
| 593 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PRE_BUILD</span></code></dt><dd><p>This option has unique behavior for the <a class="reference internal" href="../manual/cmake-generators.7.html#visual-studio-generators"><span class="std std-ref">Visual Studio Generators</span></a>.
|
| 594 |
+
When using one of the Visual Studio generators, the command will run before
|
| 595 |
+
any other rules are executed within the target. With all other generators,
|
| 596 |
+
this option behaves the same as <code class="docutils literal notranslate"><span class="pre">PRE_LINK</span></code> instead. Because of this,
|
| 597 |
+
it is recommended to avoid using <code class="docutils literal notranslate"><span class="pre">PRE_BUILD</span></code> except when it is known that
|
| 598 |
+
a Visual Studio generator is being used.</p>
|
| 599 |
+
</dd>
|
| 600 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PRE_LINK</span></code></dt><dd><p>Run after sources have been compiled but before linking the binary
|
| 601 |
+
or running the librarian or archiver tool of a static library.
|
| 602 |
+
This is not defined for targets created by the
|
| 603 |
+
<span class="target" id="index-2-command:add_custom_target"></span><a class="reference internal" href="add_custom_target.html#command:add_custom_target" title="add_custom_target"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_target()</span></code></a> command.</p>
|
| 604 |
+
</dd>
|
| 605 |
+
<dt><code class="docutils literal notranslate"><span class="pre">POST_BUILD</span></code></dt><dd><p>Run after all other rules within the target have been executed.</p>
|
| 606 |
+
</dd>
|
| 607 |
+
</dl>
|
| 608 |
+
<p>Projects should always specify one of the above three keywords when using
|
| 609 |
+
the <code class="docutils literal notranslate"><span class="pre">TARGET</span></code> form. See policy <span class="target" id="index-9-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>.</p>
|
| 610 |
+
<p>All other keywords shown in the signature above have the same meaning as they
|
| 611 |
+
do for the <span class="target" id="index-0-command:add_custom_command"></span><a class="reference internal" href="#command:add_custom_command" title="add_custom_command(output)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_command(OUTPUT)</span></code></a> form of the command.
|
| 612 |
+
At least one <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> must be given, see policy <span class="target" id="index-10-policy:CMP0175"></span><a class="reference internal" href="../policy/CMP0175.html#policy:CMP0175" title="CMP0175"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0175</span></code></a>.</p>
|
| 613 |
+
<div class="admonition note">
|
| 614 |
+
<p class="admonition-title">Note</p>
|
| 615 |
+
<p>Because generator expressions can be used in custom commands,
|
| 616 |
+
it is possible to define <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> lines or whole custom commands
|
| 617 |
+
which evaluate to empty strings for certain configurations.
|
| 618 |
+
For <a class="reference internal" href="../manual/cmake-generators.7.html#visual-studio-generators"><span class="std std-ref">Visual Studio Generators</span></a> these command
|
| 619 |
+
lines or custom commands will be omitted for the specific
|
| 620 |
+
configuration and no "empty-string-command" will be added.</p>
|
| 621 |
+
<p>This allows adding individual build events for every configuration.</p>
|
| 622 |
+
</div>
|
| 623 |
+
<div class="versionadded">
|
| 624 |
+
<p><span class="versionmodified added">Added in version 3.21: </span>Support for target-dependent generator expressions.</p>
|
| 625 |
+
</div>
|
| 626 |
+
<div class="versionadded">
|
| 627 |
+
<p><span class="versionmodified added">Added in version 3.29: </span>The <code class="docutils literal notranslate"><span class="pre"><target></span></code> may be an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#alias-targets"><span class="std std-ref">ALIAS target</span></a>.</p>
|
| 628 |
+
</div>
|
| 629 |
+
</section>
|
| 630 |
+
<section id="examples-build-events">
|
| 631 |
+
<h2>Examples: Build Events<a class="headerlink" href="#examples-build-events" title="Link to this heading">¶</a></h2>
|
| 632 |
+
<p>A <code class="docutils literal notranslate"><span class="pre">POST_BUILD</span></code> event may be used to post-process a binary after linking.
|
| 633 |
+
For example, the code:</p>
|
| 634 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_executable(</span><span class="nb">myExe</span><span class="w"> </span><span class="nb">myExe.c</span><span class="nf">)</span>
|
| 635 |
+
<span class="nf">add_custom_command(</span>
|
| 636 |
+
<span class="w"> </span><span class="no">TARGET</span><span class="w"> </span><span class="nb">myExe</span><span class="w"> </span><span class="no">POST_BUILD</span>
|
| 637 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">someHasher</span><span class="w"> </span><span class="p">-</span><span class="nb">i</span><span class="w"> </span><span class="s">"$<TARGET_FILE:myExe>"</span>
|
| 638 |
+
<span class="w"> </span><span class="p">-</span><span class="nb">o</span><span class="w"> </span><span class="s">"$<TARGET_FILE:myExe>.hash"</span>
|
| 639 |
+
<span class="w"> </span><span class="no">VERBATIM</span><span class="nf">)</span>
|
| 640 |
+
</pre></div>
|
| 641 |
+
</div>
|
| 642 |
+
<p>will run <code class="docutils literal notranslate"><span class="pre">someHasher</span></code> to produce a <code class="docutils literal notranslate"><span class="pre">.hash</span></code> file next to the executable
|
| 643 |
+
after linking.</p>
|
| 644 |
+
<div class="versionadded">
|
| 645 |
+
<p><span class="versionmodified added">Added in version 3.20: </span>One may use generator expressions to specify per-configuration byproducts.
|
| 646 |
+
For example, the code:</p>
|
| 647 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_library(</span><span class="nb">myPlugin</span><span class="w"> </span><span class="no">MODULE</span><span class="w"> </span><span class="nb">myPlugin.c</span><span class="nf">)</span>
|
| 648 |
+
<span class="nf">add_custom_command(</span>
|
| 649 |
+
<span class="w"> </span><span class="no">TARGET</span><span class="w"> </span><span class="nb">myPlugin</span><span class="w"> </span><span class="no">POST_BUILD</span>
|
| 650 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">someHasher</span><span class="w"> </span><span class="p">-</span><span class="nb">i</span><span class="w"> </span><span class="s">"$<TARGET_FILE:myPlugin>"</span>
|
| 651 |
+
<span class="w"> </span><span class="p">--</span><span class="nb">as-code</span><span class="w"> </span><span class="s">"myPlugin-hash-$<CONFIG>.c"</span>
|
| 652 |
+
<span class="w"> </span><span class="no">BYPRODUCTS</span><span class="w"> </span><span class="s">"myPlugin-hash-$<CONFIG>.c"</span>
|
| 653 |
+
<span class="w"> </span><span class="no">VERBATIM</span><span class="nf">)</span>
|
| 654 |
+
<span class="nf">add_executable(</span><span class="nb">myExe</span><span class="w"> </span><span class="nb">myExe.c</span><span class="w"> </span><span class="s">"myPlugin-hash-$<CONFIG>.c"</span><span class="nf">)</span>
|
| 655 |
+
</pre></div>
|
| 656 |
+
</div>
|
| 657 |
+
<p>will run <code class="docutils literal notranslate"><span class="pre">someHasher</span></code> after linking <code class="docutils literal notranslate"><span class="pre">myPlugin</span></code>, e.g. to produce a <code class="docutils literal notranslate"><span class="pre">.c</span></code>
|
| 658 |
+
file containing code to check the hash of <code class="docutils literal notranslate"><span class="pre">myPlugin</span></code> that the <code class="docutils literal notranslate"><span class="pre">myExe</span></code>
|
| 659 |
+
executable can use to verify it before loading.</p>
|
| 660 |
+
</div>
|
| 661 |
+
</section>
|
| 662 |
+
<section id="ninja-multi-config">
|
| 663 |
+
<h2>Ninja Multi-Config<a class="headerlink" href="#ninja-multi-config" title="Link to this heading">¶</a></h2>
|
| 664 |
+
<div class="versionadded">
|
| 665 |
+
<p><span class="versionmodified added">Added in version 3.20: </span><code class="docutils literal notranslate"><span class="pre">add_custom_command</span></code> supports the <span class="target" id="index-1-generator:Ninja Multi-Config"></span><a class="reference internal" href="../generator/Ninja%20Multi-Config.html#generator:Ninja Multi-Config" title="Ninja Multi-Config"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span> <span class="pre">Multi-Config</span></code></a>
|
| 666 |
+
generator's cross-config capabilities. See the generator documentation
|
| 667 |
+
for more information.</p>
|
| 668 |
+
</div>
|
| 669 |
+
</section>
|
| 670 |
+
<section id="see-also">
|
| 671 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 672 |
+
<ul class="simple">
|
| 673 |
+
<li><p><span class="target" id="index-3-command:add_custom_target"></span><a class="reference internal" href="add_custom_target.html#command:add_custom_target" title="add_custom_target"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_target()</span></code></a></p></li>
|
| 674 |
+
</ul>
|
| 675 |
+
</section>
|
| 676 |
+
</section>
|
| 677 |
+
|
| 678 |
+
|
| 679 |
+
<div class="clearer"></div>
|
| 680 |
+
</div>
|
| 681 |
+
</div>
|
| 682 |
+
</div>
|
| 683 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 684 |
+
<div class="sphinxsidebarwrapper">
|
| 685 |
+
<div>
|
| 686 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 687 |
+
<ul>
|
| 688 |
+
<li><a class="reference internal" href="#">add_custom_command</a><ul>
|
| 689 |
+
<li><a class="reference internal" href="#generating-files">Generating Files</a></li>
|
| 690 |
+
<li><a class="reference internal" href="#examples-generating-files">Examples: Generating Files</a><ul>
|
| 691 |
+
<li><a class="reference internal" href="#example-generating-files-for-multiple-targets">Example: Generating Files for Multiple Targets</a></li>
|
| 692 |
+
</ul>
|
| 693 |
+
</li>
|
| 694 |
+
<li><a class="reference internal" href="#build-events">Build Events</a></li>
|
| 695 |
+
<li><a class="reference internal" href="#examples-build-events">Examples: Build Events</a></li>
|
| 696 |
+
<li><a class="reference internal" href="#ninja-multi-config">Ninja Multi-Config</a></li>
|
| 697 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 698 |
+
</ul>
|
| 699 |
+
</li>
|
| 700 |
+
</ul>
|
| 701 |
+
|
| 702 |
+
</div>
|
| 703 |
+
<div>
|
| 704 |
+
<h4>Previous topic</h4>
|
| 705 |
+
<p class="topless"><a href="add_compile_options.html"
|
| 706 |
+
title="previous chapter">add_compile_options</a></p>
|
| 707 |
+
</div>
|
| 708 |
+
<div>
|
| 709 |
+
<h4>Next topic</h4>
|
| 710 |
+
<p class="topless"><a href="add_custom_target.html"
|
| 711 |
+
title="next chapter">add_custom_target</a></p>
|
| 712 |
+
</div>
|
| 713 |
+
<div role="note" aria-label="source link">
|
| 714 |
+
<h3>This Page</h3>
|
| 715 |
+
<ul class="this-page-menu">
|
| 716 |
+
<li><a href="../_sources/command/add_custom_command.rst.txt"
|
| 717 |
+
rel="nofollow">Show Source</a></li>
|
| 718 |
+
</ul>
|
| 719 |
+
</div>
|
| 720 |
+
<search id="searchbox" style="display: none" role="search">
|
| 721 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 722 |
+
<div class="searchformwrapper">
|
| 723 |
+
<form class="search" action="../search.html" method="get">
|
| 724 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 725 |
+
<input type="submit" value="Go" />
|
| 726 |
+
</form>
|
| 727 |
+
</div>
|
| 728 |
+
</search>
|
| 729 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 730 |
+
</div>
|
| 731 |
+
</div>
|
| 732 |
+
<div class="clearer"></div>
|
| 733 |
+
</div>
|
| 734 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 735 |
+
<h3>Navigation</h3>
|
| 736 |
+
<ul>
|
| 737 |
+
<li class="right" style="margin-right: 10px">
|
| 738 |
+
<a href="../genindex.html" title="General Index"
|
| 739 |
+
>index</a></li>
|
| 740 |
+
<li class="right" >
|
| 741 |
+
<a href="add_custom_target.html" title="add_custom_target"
|
| 742 |
+
>next</a> |</li>
|
| 743 |
+
<li class="right" >
|
| 744 |
+
<a href="add_compile_options.html" title="add_compile_options"
|
| 745 |
+
>previous</a> |</li>
|
| 746 |
+
<li>
|
| 747 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 748 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 749 |
+
</li>
|
| 750 |
+
<li>
|
| 751 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 752 |
+
</li>
|
| 753 |
+
<li>
|
| 754 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 755 |
+
</li>
|
| 756 |
+
|
| 757 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 758 |
+
<li class="nav-item nav-item-this"><a href="">add_custom_command</a></li>
|
| 759 |
+
</ul>
|
| 760 |
+
</div>
|
| 761 |
+
|
| 762 |
+
<div class="footer" role="contentinfo">
|
| 763 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 764 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 765 |
+
</div>
|
| 766 |
+
</body>
|
| 767 |
+
</html>
|
cmake/doc/cmake/html/command/add_custom_target.html
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_custom_target — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_definitions" href="add_definitions.html" />
|
| 21 |
+
<link rel="prev" title="add_custom_command" href="add_custom_command.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_definitions.html" title="add_definitions"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_custom_command.html" title="add_custom_command"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_custom_target</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-custom-target">
|
| 60 |
+
<span id="command:add_custom_target"></span><h1>add_custom_target<a class="headerlink" href="#add-custom-target" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Add a target with no output so it will always be built.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_custom_target(</span><span class="nb">Name</span><span class="w"> </span><span class="p">[</span><span class="no">ALL</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="nb">command1</span><span class="w"> </span><span class="p">[</span><span class="nb">args1...</span><span class="p">]]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">command2</span><span class="w"> </span><span class="p">[</span><span class="nb">args2...</span><span class="p">]</span><span class="w"> </span><span class="p">...]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">DEPENDS</span><span class="w"> </span><span class="nb">depend</span><span class="w"> </span><span class="nb">depend</span><span class="w"> </span><span class="nb">depend</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">BYPRODUCTS</span><span class="w"> </span><span class="p">[</span><span class="nb">files...</span><span class="p">]]</span>
|
| 66 |
+
<span class="w"> </span><span class="p">[</span><span class="no">WORKING_DIRECTORY</span><span class="w"> </span><span class="nb">dir</span><span class="p">]</span>
|
| 67 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMENT</span><span class="w"> </span><span class="nb">comment</span><span class="p">]</span>
|
| 68 |
+
<span class="w"> </span><span class="p">[</span><span class="no">JOB_POOL</span><span class="w"> </span><span class="nb">job_pool</span><span class="p">]</span>
|
| 69 |
+
<span class="w"> </span><span class="p">[</span><span class="no">JOB_SERVER_AWARE</span><span class="w"> </span><span class="nv"><bool></span><span class="p">]</span>
|
| 70 |
+
<span class="w"> </span><span class="p">[</span><span class="no">VERBATIM</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">USES_TERMINAL</span><span class="p">]</span>
|
| 71 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMAND_EXPAND_LISTS</span><span class="p">]</span>
|
| 72 |
+
<span class="w"> </span><span class="p">[</span><span class="no">SOURCES</span><span class="w"> </span><span class="nb">src1</span><span class="w"> </span><span class="p">[</span><span class="nb">src2...</span><span class="p">]]</span><span class="nf">)</span>
|
| 73 |
+
</pre></div>
|
| 74 |
+
</div>
|
| 75 |
+
<p>Adds a target with the given name that executes the given commands.
|
| 76 |
+
The target has no output file and is <em>always considered out of date</em>
|
| 77 |
+
even if the commands try to create a file with the name of the target.
|
| 78 |
+
Use the <span class="target" id="index-0-command:add_custom_command"></span><a class="reference internal" href="add_custom_command.html#command:add_custom_command" title="add_custom_command"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_command()</span></code></a> command to generate a file with
|
| 79 |
+
dependencies. By default nothing depends on the custom target. Use
|
| 80 |
+
the <span class="target" id="index-0-command:add_dependencies"></span><a class="reference internal" href="add_dependencies.html#command:add_dependencies" title="add_dependencies"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_dependencies()</span></code></a> command to add dependencies to or
|
| 81 |
+
from other targets.</p>
|
| 82 |
+
<p>The options are:</p>
|
| 83 |
+
<dl>
|
| 84 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ALL</span></code></dt><dd><p>Indicate that this target should be added to the default build
|
| 85 |
+
target so that it will be run every time (the command cannot be
|
| 86 |
+
called <code class="docutils literal notranslate"><span class="pre">ALL</span></code>).</p>
|
| 87 |
+
</dd>
|
| 88 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code></dt><dd><div class="versionadded">
|
| 89 |
+
<p><span class="versionmodified added">Added in version 3.2.</span></p>
|
| 90 |
+
</div>
|
| 91 |
+
<p>Specify the files the command is expected to produce but whose
|
| 92 |
+
modification time may or may not be updated on subsequent builds.
|
| 93 |
+
If a byproduct name is a relative path it will be interpreted
|
| 94 |
+
relative to the build tree directory corresponding to the
|
| 95 |
+
current source directory.
|
| 96 |
+
Each byproduct file will be marked with the <span class="target" id="index-0-prop_sf:GENERATED"></span><a class="reference internal" href="../prop_sf/GENERATED.html#prop_sf:GENERATED" title="GENERATED"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">GENERATED</span></code></a>
|
| 97 |
+
source file property automatically.</p>
|
| 98 |
+
<p><em>See policy</em> <span class="target" id="index-0-policy:CMP0058"></span><a class="reference internal" href="../policy/CMP0058.html#policy:CMP0058" title="CMP0058"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0058</span></code></a> <em>for the motivation behind this feature.</em></p>
|
| 99 |
+
<p>Explicit specification of byproducts is supported by the
|
| 100 |
+
<span class="target" id="index-0-generator:Ninja"></span><a class="reference internal" href="../generator/Ninja.html#generator:Ninja" title="Ninja"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span></code></a> generator to tell the <code class="docutils literal notranslate"><span class="pre">ninja</span></code> build tool
|
| 101 |
+
how to regenerate byproducts when they are missing. It is
|
| 102 |
+
also useful when other build rules (e.g. custom commands)
|
| 103 |
+
depend on the byproducts. Ninja requires a build rule for any
|
| 104 |
+
generated file on which another rule depends even if there are
|
| 105 |
+
order-only dependencies to ensure the byproducts will be
|
| 106 |
+
available before their dependents build.</p>
|
| 107 |
+
<p>The <a class="reference internal" href="../manual/cmake-generators.7.html#makefile-generators"><span class="std std-ref">Makefile Generators</span></a> will remove <code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code> and other
|
| 108 |
+
<span class="target" id="index-1-prop_sf:GENERATED"></span><a class="reference internal" href="../prop_sf/GENERATED.html#prop_sf:GENERATED" title="GENERATED"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">GENERATED</span></code></a> files during <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code>.</p>
|
| 109 |
+
<div class="versionadded">
|
| 110 |
+
<p><span class="versionmodified added">Added in version 3.20: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">BYPRODUCTS</span></code> may use a restricted set of
|
| 111 |
+
<span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.
|
| 112 |
+
<a class="reference internal" href="../manual/cmake-generator-expressions.7.html#target-dependent-expressions"><span class="std std-ref">Target-dependent expressions</span></a>
|
| 113 |
+
are not permitted.</p>
|
| 114 |
+
</div>
|
| 115 |
+
<div class="versionchanged">
|
| 116 |
+
<p><span class="versionmodified changed">Changed in version 3.28: </span>In custom targets using <a class="reference internal" href="target_sources.html#file-sets"><span class="std std-ref">File Sets</span></a>, byproducts are now
|
| 117 |
+
considered private unless they are listed in a non-private file set.
|
| 118 |
+
See policy <span class="target" id="index-0-policy:CMP0154"></span><a class="reference internal" href="../policy/CMP0154.html#policy:CMP0154" title="CMP0154"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0154</span></code></a>.</p>
|
| 119 |
+
</div>
|
| 120 |
+
</dd>
|
| 121 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMAND</span></code></dt><dd><p>Specify the command-line(s) to execute at build time.
|
| 122 |
+
If more than one <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> is specified they will be executed in order,
|
| 123 |
+
but <em>not</em> necessarily composed into a stateful shell or batch script.
|
| 124 |
+
(To run a full script, use the <span class="target" id="index-0-command:configure_file"></span><a class="reference internal" href="configure_file.html#command:configure_file" title="configure_file"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">configure_file()</span></code></a> command or the
|
| 125 |
+
<span class="target" id="index-0-command:file"></span><a class="reference internal" href="file.html#generate" title="file(generate)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">file(GENERATE)</span></code></a> command to create it, and then specify
|
| 126 |
+
a <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> to launch it.)</p>
|
| 127 |
+
<p>If <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> specifies an executable target name (created by the
|
| 128 |
+
<span class="target" id="index-0-command:add_executable"></span><a class="reference internal" href="add_executable.html#command:add_executable" title="add_executable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_executable()</span></code></a> command), it will automatically be replaced
|
| 129 |
+
by the location of the executable created at build time if either of
|
| 130 |
+
the following is true:</p>
|
| 131 |
+
<ul>
|
| 132 |
+
<li><p>The target is not being cross-compiled (i.e. the
|
| 133 |
+
<span class="target" id="index-0-variable:CMAKE_CROSSCOMPILING"></span><a class="reference internal" href="../variable/CMAKE_CROSSCOMPILING.html#variable:CMAKE_CROSSCOMPILING" title="CMAKE_CROSSCOMPILING"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CROSSCOMPILING</span></code></a> variable is not set to true).</p></li>
|
| 134 |
+
<li><div class="versionadded">
|
| 135 |
+
<p><span class="versionmodified added">Added in version 3.6: </span>The target is being cross-compiled and an emulator is provided (i.e.
|
| 136 |
+
its <span class="target" id="index-0-prop_tgt:CROSSCOMPILING_EMULATOR"></span><a class="reference internal" href="../prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR" title="CROSSCOMPILING_EMULATOR"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CROSSCOMPILING_EMULATOR</span></code></a> target property is set).
|
| 137 |
+
In this case, the contents of <span class="target" id="index-1-prop_tgt:CROSSCOMPILING_EMULATOR"></span><a class="reference internal" href="../prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR" title="CROSSCOMPILING_EMULATOR"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CROSSCOMPILING_EMULATOR</span></code></a> will be
|
| 138 |
+
prepended to the command before the location of the target executable.</p>
|
| 139 |
+
</div>
|
| 140 |
+
</li>
|
| 141 |
+
</ul>
|
| 142 |
+
<p>If neither of the above conditions are met, it is assumed that the
|
| 143 |
+
command name is a program to be found on the <code class="docutils literal notranslate"><span class="pre">PATH</span></code> at build time.</p>
|
| 144 |
+
<p>Arguments to <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> may use
|
| 145 |
+
<span class="target" id="index-1-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.
|
| 146 |
+
Use the <span class="target" id="index-0-genex:TARGET_FILE"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:TARGET_FILE" title="TARGET_FILE"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">TARGET_FILE</span></code></a> generator expression to refer to the location
|
| 147 |
+
of a target later in the command line (i.e. as a command argument rather
|
| 148 |
+
than as the command to execute).</p>
|
| 149 |
+
<p>Whenever one of the following target based generator expressions are used as
|
| 150 |
+
a command to execute or is mentioned in a command argument, a target-level
|
| 151 |
+
dependency will be added automatically so that the mentioned target will be
|
| 152 |
+
built before this custom target (see policy <span class="target" id="index-0-policy:CMP0112"></span><a class="reference internal" href="../policy/CMP0112.html#policy:CMP0112" title="CMP0112"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0112</span></code></a>).</p>
|
| 153 |
+
<blockquote>
|
| 154 |
+
<div><ul class="simple">
|
| 155 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_FILE</span></code></p></li>
|
| 156 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_LINKER_FILE</span></code></p></li>
|
| 157 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_SONAME_FILE</span></code></p></li>
|
| 158 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TARGET_PDB_FILE</span></code></p></li>
|
| 159 |
+
</ul>
|
| 160 |
+
</div></blockquote>
|
| 161 |
+
<p>The command and arguments are optional and if not specified an empty
|
| 162 |
+
target will be created.</p>
|
| 163 |
+
</dd>
|
| 164 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMENT</span></code></dt><dd><p>Display the given message before the commands are executed at
|
| 165 |
+
build time.</p>
|
| 166 |
+
<div class="versionadded">
|
| 167 |
+
<p><span class="versionmodified added">Added in version 3.26: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">COMMENT</span></code> may use
|
| 168 |
+
<span class="target" id="index-2-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 169 |
+
</div>
|
| 170 |
+
</dd>
|
| 171 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code></dt><dd><p>Reference files and outputs of custom commands created with
|
| 172 |
+
<span class="target" id="index-1-command:add_custom_command"></span><a class="reference internal" href="add_custom_command.html#command:add_custom_command" title="add_custom_command"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_command()</span></code></a> command calls in the same directory
|
| 173 |
+
(<code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file). They will be brought up to date when
|
| 174 |
+
the target is built.</p>
|
| 175 |
+
<div class="versionchanged">
|
| 176 |
+
<p><span class="versionmodified changed">Changed in version 3.16: </span>A target-level dependency is added if any dependency is a byproduct
|
| 177 |
+
of a target or any of its build events in the same directory to ensure
|
| 178 |
+
the byproducts will be available before this target is built.</p>
|
| 179 |
+
</div>
|
| 180 |
+
<p>Use the <span class="target" id="index-1-command:add_dependencies"></span><a class="reference internal" href="add_dependencies.html#command:add_dependencies" title="add_dependencies"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_dependencies()</span></code></a> command to add dependencies
|
| 181 |
+
on other targets.</p>
|
| 182 |
+
</dd>
|
| 183 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMAND_EXPAND_LISTS</span></code></dt><dd><div class="versionadded">
|
| 184 |
+
<p><span class="versionmodified added">Added in version 3.8.</span></p>
|
| 185 |
+
</div>
|
| 186 |
+
<p>Lists in <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> arguments will be expanded, including those
|
| 187 |
+
created with
|
| 188 |
+
<span class="target" id="index-3-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>,
|
| 189 |
+
allowing <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> arguments such as
|
| 190 |
+
<code class="docutils literal notranslate"><span class="pre">${CC}</span> <span class="pre">"-I$<JOIN:$<TARGET_PROPERTY:foo,INCLUDE_DIRECTORIES>,;-I>"</span> <span class="pre">foo.cc</span></code>
|
| 191 |
+
to be properly expanded.</p>
|
| 192 |
+
</dd>
|
| 193 |
+
<dt><code class="docutils literal notranslate"><span class="pre">JOB_POOL</span></code></dt><dd><div class="versionadded">
|
| 194 |
+
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
| 195 |
+
</div>
|
| 196 |
+
<p>Specify a <span class="target" id="index-0-prop_gbl:JOB_POOLS"></span><a class="reference internal" href="../prop_gbl/JOB_POOLS.html#prop_gbl:JOB_POOLS" title="JOB_POOLS"><code class="xref cmake cmake-prop_gbl docutils literal notranslate"><span class="pre">pool</span></code></a> for the <span class="target" id="index-1-generator:Ninja"></span><a class="reference internal" href="../generator/Ninja.html#generator:Ninja" title="Ninja"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span></code></a>
|
| 197 |
+
generator. Incompatible with <code class="docutils literal notranslate"><span class="pre">USES_TERMINAL</span></code>, which implies
|
| 198 |
+
the <code class="docutils literal notranslate"><span class="pre">console</span></code> pool.
|
| 199 |
+
Using a pool that is not defined by <span class="target" id="index-1-prop_gbl:JOB_POOLS"></span><a class="reference internal" href="../prop_gbl/JOB_POOLS.html#prop_gbl:JOB_POOLS" title="JOB_POOLS"><code class="xref cmake cmake-prop_gbl docutils literal notranslate"><span class="pre">JOB_POOLS</span></code></a> causes
|
| 200 |
+
an error by ninja at build time.</p>
|
| 201 |
+
</dd>
|
| 202 |
+
<dt><code class="docutils literal notranslate"><span class="pre">JOB_SERVER_AWARE</span></code></dt><dd><div class="versionadded">
|
| 203 |
+
<p><span class="versionmodified added">Added in version 3.28.</span></p>
|
| 204 |
+
</div>
|
| 205 |
+
<p>Specify that the command is GNU Make job server aware.</p>
|
| 206 |
+
<p>For the <span class="target" id="index-0-generator:Unix Makefiles"></span><a class="reference internal" href="../generator/Unix%20Makefiles.html#generator:Unix Makefiles" title="Unix Makefiles"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Unix</span> <span class="pre">Makefiles</span></code></a>, <span class="target" id="index-0-generator:MSYS Makefiles"></span><a class="reference internal" href="../generator/MSYS%20Makefiles.html#generator:MSYS Makefiles" title="MSYS Makefiles"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">MSYS</span> <span class="pre">Makefiles</span></code></a>, and
|
| 207 |
+
<span class="target" id="index-0-generator:MinGW Makefiles"></span><a class="reference internal" href="../generator/MinGW%20Makefiles.html#generator:MinGW Makefiles" title="MinGW Makefiles"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">MinGW</span> <span class="pre">Makefiles</span></code></a> generators this will add the <code class="docutils literal notranslate"><span class="pre">+</span></code> prefix to the
|
| 208 |
+
recipe line. See the <a class="reference external" href="https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html">GNU Make Documentation</a> for more information.</p>
|
| 209 |
+
<p>This option is silently ignored by other generators.</p>
|
| 210 |
+
</dd>
|
| 211 |
+
</dl>
|
| 212 |
+
<dl>
|
| 213 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SOURCES</span></code></dt><dd><p>Specify additional source files to be included in the custom target.
|
| 214 |
+
Specified source files will be added to IDE project files for
|
| 215 |
+
convenience in editing even if they have no build rules.</p>
|
| 216 |
+
</dd>
|
| 217 |
+
<dt><code class="docutils literal notranslate"><span class="pre">VERBATIM</span></code></dt><dd><p>All arguments to the commands will be escaped properly for the
|
| 218 |
+
build tool so that the invoked command receives each argument
|
| 219 |
+
unchanged. Note that one level of escapes is still used by the
|
| 220 |
+
CMake language processor before <code class="docutils literal notranslate"><span class="pre">add_custom_target</span></code> even sees
|
| 221 |
+
the arguments. Use of <code class="docutils literal notranslate"><span class="pre">VERBATIM</span></code> is recommended as it enables
|
| 222 |
+
correct behavior. When <code class="docutils literal notranslate"><span class="pre">VERBATIM</span></code> is not given the behavior
|
| 223 |
+
is platform specific because there is no protection of
|
| 224 |
+
tool-specific special characters.</p>
|
| 225 |
+
</dd>
|
| 226 |
+
<dt><code class="docutils literal notranslate"><span class="pre">USES_TERMINAL</span></code></dt><dd><div class="versionadded">
|
| 227 |
+
<p><span class="versionmodified added">Added in version 3.2.</span></p>
|
| 228 |
+
</div>
|
| 229 |
+
<p>The command will be given direct access to the terminal if possible.
|
| 230 |
+
With the <span class="target" id="index-2-generator:Ninja"></span><a class="reference internal" href="../generator/Ninja.html#generator:Ninja" title="Ninja"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span></code></a> generator, this places the command in
|
| 231 |
+
the <code class="docutils literal notranslate"><span class="pre">console</span></code> <span class="target" id="index-2-prop_gbl:JOB_POOLS"></span><a class="reference internal" href="../prop_gbl/JOB_POOLS.html#prop_gbl:JOB_POOLS" title="JOB_POOLS"><code class="xref cmake cmake-prop_gbl docutils literal notranslate"><span class="pre">pool</span></code></a>.</p>
|
| 232 |
+
</dd>
|
| 233 |
+
<dt><code class="docutils literal notranslate"><span class="pre">WORKING_DIRECTORY</span></code></dt><dd><p>Execute the command with the given current working directory.
|
| 234 |
+
If it is a relative path it will be interpreted relative to the
|
| 235 |
+
build tree directory corresponding to the current source directory.</p>
|
| 236 |
+
<div class="versionadded">
|
| 237 |
+
<p><span class="versionmodified added">Added in version 3.13: </span>Arguments to <code class="docutils literal notranslate"><span class="pre">WORKING_DIRECTORY</span></code> may use
|
| 238 |
+
<span class="target" id="index-4-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 239 |
+
</div>
|
| 240 |
+
</dd>
|
| 241 |
+
</dl>
|
| 242 |
+
<section id="ninja-multi-config">
|
| 243 |
+
<h2>Ninja Multi-Config<a class="headerlink" href="#ninja-multi-config" title="Link to this heading">¶</a></h2>
|
| 244 |
+
<div class="versionadded">
|
| 245 |
+
<p><span class="versionmodified added">Added in version 3.20: </span><code class="docutils literal notranslate"><span class="pre">add_custom_target</span></code> supports the <span class="target" id="index-0-generator:Ninja Multi-Config"></span><a class="reference internal" href="../generator/Ninja%20Multi-Config.html#generator:Ninja Multi-Config" title="Ninja Multi-Config"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Ninja</span> <span class="pre">Multi-Config</span></code></a>
|
| 246 |
+
generator's cross-config capabilities. See the generator documentation
|
| 247 |
+
for more information.</p>
|
| 248 |
+
</div>
|
| 249 |
+
</section>
|
| 250 |
+
<section id="see-also">
|
| 251 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 252 |
+
<ul class="simple">
|
| 253 |
+
<li><p><span class="target" id="index-2-command:add_custom_command"></span><a class="reference internal" href="add_custom_command.html#command:add_custom_command" title="add_custom_command"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_command()</span></code></a></p></li>
|
| 254 |
+
</ul>
|
| 255 |
+
</section>
|
| 256 |
+
</section>
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
<div class="clearer"></div>
|
| 260 |
+
</div>
|
| 261 |
+
</div>
|
| 262 |
+
</div>
|
| 263 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 264 |
+
<div class="sphinxsidebarwrapper">
|
| 265 |
+
<div>
|
| 266 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 267 |
+
<ul>
|
| 268 |
+
<li><a class="reference internal" href="#">add_custom_target</a><ul>
|
| 269 |
+
<li><a class="reference internal" href="#ninja-multi-config">Ninja Multi-Config</a></li>
|
| 270 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 271 |
+
</ul>
|
| 272 |
+
</li>
|
| 273 |
+
</ul>
|
| 274 |
+
|
| 275 |
+
</div>
|
| 276 |
+
<div>
|
| 277 |
+
<h4>Previous topic</h4>
|
| 278 |
+
<p class="topless"><a href="add_custom_command.html"
|
| 279 |
+
title="previous chapter">add_custom_command</a></p>
|
| 280 |
+
</div>
|
| 281 |
+
<div>
|
| 282 |
+
<h4>Next topic</h4>
|
| 283 |
+
<p class="topless"><a href="add_definitions.html"
|
| 284 |
+
title="next chapter">add_definitions</a></p>
|
| 285 |
+
</div>
|
| 286 |
+
<div role="note" aria-label="source link">
|
| 287 |
+
<h3>This Page</h3>
|
| 288 |
+
<ul class="this-page-menu">
|
| 289 |
+
<li><a href="../_sources/command/add_custom_target.rst.txt"
|
| 290 |
+
rel="nofollow">Show Source</a></li>
|
| 291 |
+
</ul>
|
| 292 |
+
</div>
|
| 293 |
+
<search id="searchbox" style="display: none" role="search">
|
| 294 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 295 |
+
<div class="searchformwrapper">
|
| 296 |
+
<form class="search" action="../search.html" method="get">
|
| 297 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 298 |
+
<input type="submit" value="Go" />
|
| 299 |
+
</form>
|
| 300 |
+
</div>
|
| 301 |
+
</search>
|
| 302 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
<div class="clearer"></div>
|
| 306 |
+
</div>
|
| 307 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 308 |
+
<h3>Navigation</h3>
|
| 309 |
+
<ul>
|
| 310 |
+
<li class="right" style="margin-right: 10px">
|
| 311 |
+
<a href="../genindex.html" title="General Index"
|
| 312 |
+
>index</a></li>
|
| 313 |
+
<li class="right" >
|
| 314 |
+
<a href="add_definitions.html" title="add_definitions"
|
| 315 |
+
>next</a> |</li>
|
| 316 |
+
<li class="right" >
|
| 317 |
+
<a href="add_custom_command.html" title="add_custom_command"
|
| 318 |
+
>previous</a> |</li>
|
| 319 |
+
<li>
|
| 320 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 321 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 322 |
+
</li>
|
| 323 |
+
<li>
|
| 324 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 325 |
+
</li>
|
| 326 |
+
<li>
|
| 327 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 328 |
+
</li>
|
| 329 |
+
|
| 330 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 331 |
+
<li class="nav-item nav-item-this"><a href="">add_custom_target</a></li>
|
| 332 |
+
</ul>
|
| 333 |
+
</div>
|
| 334 |
+
|
| 335 |
+
<div class="footer" role="contentinfo">
|
| 336 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 337 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 338 |
+
</div>
|
| 339 |
+
</body>
|
| 340 |
+
</html>
|
cmake/doc/cmake/html/command/add_definitions.html
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_definitions — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_dependencies" href="add_dependencies.html" />
|
| 21 |
+
<link rel="prev" title="add_custom_target" href="add_custom_target.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_dependencies.html" title="add_dependencies"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_custom_target.html" title="add_custom_target"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_definitions</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-definitions">
|
| 60 |
+
<span id="command:add_definitions"></span><h1>add_definitions<a class="headerlink" href="#add-definitions" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Add <code class="docutils literal notranslate"><span class="pre">-D</span></code> define flags to the compilation of source files.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_definitions(</span><span class="p">-</span><span class="no">DFOO</span><span class="w"> </span><span class="p">-</span><span class="no">DBAR</span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Adds definitions to the compiler command line for targets in the current
|
| 66 |
+
directory, whether added before or after this command is invoked, and for
|
| 67 |
+
the ones in sub-directories added after. This command can be used to add any
|
| 68 |
+
flags, but it is intended to add preprocessor definitions.</p>
|
| 69 |
+
<div class="admonition note">
|
| 70 |
+
<p class="admonition-title">Note</p>
|
| 71 |
+
<p>This command has been superseded by alternatives:</p>
|
| 72 |
+
<ul class="simple">
|
| 73 |
+
<li><p>Use <span class="target" id="index-0-command:add_compile_definitions"></span><a class="reference internal" href="add_compile_definitions.html#command:add_compile_definitions" title="add_compile_definitions"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_compile_definitions()</span></code></a> to add preprocessor definitions.</p></li>
|
| 74 |
+
<li><p>Use <span class="target" id="index-0-command:include_directories"></span><a class="reference internal" href="include_directories.html#command:include_directories" title="include_directories"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">include_directories()</span></code></a> to add include directories.</p></li>
|
| 75 |
+
<li><p>Use <span class="target" id="index-0-command:add_compile_options"></span><a class="reference internal" href="add_compile_options.html#command:add_compile_options" title="add_compile_options"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_compile_options()</span></code></a> to add other options.</p></li>
|
| 76 |
+
</ul>
|
| 77 |
+
</div>
|
| 78 |
+
<p>Flags beginning in <code class="docutils literal notranslate"><span class="pre">-D</span></code> or <code class="docutils literal notranslate"><span class="pre">/D</span></code> that look like preprocessor definitions are
|
| 79 |
+
automatically added to the <span class="target" id="index-0-prop_dir:COMPILE_DEFINITIONS"></span><a class="reference internal" href="../prop_dir/COMPILE_DEFINITIONS.html#prop_dir:COMPILE_DEFINITIONS" title="COMPILE_DEFINITIONS"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">COMPILE_DEFINITIONS</span></code></a> directory
|
| 80 |
+
property for the current directory. Definitions with non-trivial values
|
| 81 |
+
may be left in the set of flags instead of being converted for reasons of
|
| 82 |
+
backwards compatibility. See documentation of the
|
| 83 |
+
<span class="target" id="index-1-prop_dir:COMPILE_DEFINITIONS"></span><a class="reference internal" href="../prop_dir/COMPILE_DEFINITIONS.html#prop_dir:COMPILE_DEFINITIONS" title="COMPILE_DEFINITIONS"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">directory</span></code></a>,
|
| 84 |
+
<span class="target" id="index-0-prop_tgt:COMPILE_DEFINITIONS"></span><a class="reference internal" href="../prop_tgt/COMPILE_DEFINITIONS.html#prop_tgt:COMPILE_DEFINITIONS" title="COMPILE_DEFINITIONS"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">target</span></code></a>,
|
| 85 |
+
<span class="target" id="index-0-prop_sf:COMPILE_DEFINITIONS"></span><a class="reference internal" href="../prop_sf/COMPILE_DEFINITIONS.html#prop_sf:COMPILE_DEFINITIONS" title="COMPILE_DEFINITIONS"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">source</span> <span class="pre">file</span></code></a> <code class="docutils literal notranslate"><span class="pre">COMPILE_DEFINITIONS</span></code>
|
| 86 |
+
properties for details on adding preprocessor definitions to specific
|
| 87 |
+
scopes and configurations.</p>
|
| 88 |
+
<section id="see-also">
|
| 89 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 90 |
+
<ul class="simple">
|
| 91 |
+
<li><p>The <span class="target" id="index-0-manual:cmake-buildsystem(7)"></span><a class="reference internal" href="../manual/cmake-buildsystem.7.html#manual:cmake-buildsystem(7)" title="cmake-buildsystem(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-buildsystem(7)</span></code></a> manual for more on defining
|
| 92 |
+
buildsystem properties.</p></li>
|
| 93 |
+
</ul>
|
| 94 |
+
</section>
|
| 95 |
+
</section>
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
<div class="clearer"></div>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 103 |
+
<div class="sphinxsidebarwrapper">
|
| 104 |
+
<div>
|
| 105 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 106 |
+
<ul>
|
| 107 |
+
<li><a class="reference internal" href="#">add_definitions</a><ul>
|
| 108 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 109 |
+
</ul>
|
| 110 |
+
</li>
|
| 111 |
+
</ul>
|
| 112 |
+
|
| 113 |
+
</div>
|
| 114 |
+
<div>
|
| 115 |
+
<h4>Previous topic</h4>
|
| 116 |
+
<p class="topless"><a href="add_custom_target.html"
|
| 117 |
+
title="previous chapter">add_custom_target</a></p>
|
| 118 |
+
</div>
|
| 119 |
+
<div>
|
| 120 |
+
<h4>Next topic</h4>
|
| 121 |
+
<p class="topless"><a href="add_dependencies.html"
|
| 122 |
+
title="next chapter">add_dependencies</a></p>
|
| 123 |
+
</div>
|
| 124 |
+
<div role="note" aria-label="source link">
|
| 125 |
+
<h3>This Page</h3>
|
| 126 |
+
<ul class="this-page-menu">
|
| 127 |
+
<li><a href="../_sources/command/add_definitions.rst.txt"
|
| 128 |
+
rel="nofollow">Show Source</a></li>
|
| 129 |
+
</ul>
|
| 130 |
+
</div>
|
| 131 |
+
<search id="searchbox" style="display: none" role="search">
|
| 132 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 133 |
+
<div class="searchformwrapper">
|
| 134 |
+
<form class="search" action="../search.html" method="get">
|
| 135 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 136 |
+
<input type="submit" value="Go" />
|
| 137 |
+
</form>
|
| 138 |
+
</div>
|
| 139 |
+
</search>
|
| 140 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
<div class="clearer"></div>
|
| 144 |
+
</div>
|
| 145 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 146 |
+
<h3>Navigation</h3>
|
| 147 |
+
<ul>
|
| 148 |
+
<li class="right" style="margin-right: 10px">
|
| 149 |
+
<a href="../genindex.html" title="General Index"
|
| 150 |
+
>index</a></li>
|
| 151 |
+
<li class="right" >
|
| 152 |
+
<a href="add_dependencies.html" title="add_dependencies"
|
| 153 |
+
>next</a> |</li>
|
| 154 |
+
<li class="right" >
|
| 155 |
+
<a href="add_custom_target.html" title="add_custom_target"
|
| 156 |
+
>previous</a> |</li>
|
| 157 |
+
<li>
|
| 158 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 159 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 160 |
+
</li>
|
| 161 |
+
<li>
|
| 162 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 163 |
+
</li>
|
| 164 |
+
<li>
|
| 165 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 166 |
+
</li>
|
| 167 |
+
|
| 168 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 169 |
+
<li class="nav-item nav-item-this"><a href="">add_definitions</a></li>
|
| 170 |
+
</ul>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<div class="footer" role="contentinfo">
|
| 174 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 175 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 176 |
+
</div>
|
| 177 |
+
</body>
|
| 178 |
+
</html>
|
cmake/doc/cmake/html/command/add_dependencies.html
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_dependencies — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_executable" href="add_executable.html" />
|
| 21 |
+
<link rel="prev" title="add_definitions" href="add_definitions.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_executable.html" title="add_executable"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_definitions.html" title="add_definitions"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_dependencies</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-dependencies">
|
| 60 |
+
<span id="command:add_dependencies"></span><h1>add_dependencies<a class="headerlink" href="#add-dependencies" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Add a dependency between top-level targets.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_dependencies(</span><span class="nv"><target></span><span class="w"> </span><span class="p">[</span><span class="nv"><target-dependency></span><span class="p">]...</span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Makes a top-level <code class="docutils literal notranslate"><span class="pre"><target></span></code> depend on other top-level targets to
|
| 66 |
+
ensure that they build before <code class="docutils literal notranslate"><span class="pre"><target></span></code> does. A top-level target
|
| 67 |
+
is one created by one of the <span class="target" id="index-0-command:add_executable"></span><a class="reference internal" href="add_executable.html#command:add_executable" title="add_executable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_executable()</span></code></a>,
|
| 68 |
+
<span class="target" id="index-0-command:add_library"></span><a class="reference internal" href="add_library.html#command:add_library" title="add_library"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_library()</span></code></a>, or <span class="target" id="index-0-command:add_custom_target"></span><a class="reference internal" href="add_custom_target.html#command:add_custom_target" title="add_custom_target"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_target()</span></code></a> commands
|
| 69 |
+
(but not targets generated by CMake like <code class="docutils literal notranslate"><span class="pre">install</span></code>).</p>
|
| 70 |
+
<p>Dependencies added to an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#imported-targets"><span class="std std-ref">imported target</span></a>
|
| 71 |
+
or an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#interface-libraries"><span class="std std-ref">interface library</span></a> are followed
|
| 72 |
+
transitively in its place since the target itself does not build.</p>
|
| 73 |
+
<div class="versionadded">
|
| 74 |
+
<p><span class="versionmodified added">Added in version 3.3: </span>Allow adding dependencies to interface libraries.</p>
|
| 75 |
+
</div>
|
| 76 |
+
<div class="versionadded">
|
| 77 |
+
<p><span class="versionmodified added">Added in version 3.8: </span>Dependencies will populate the <span class="target" id="index-0-prop_tgt:MANUALLY_ADDED_DEPENDENCIES"></span><a class="reference internal" href="../prop_tgt/MANUALLY_ADDED_DEPENDENCIES.html#prop_tgt:MANUALLY_ADDED_DEPENDENCIES" title="MANUALLY_ADDED_DEPENDENCIES"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">MANUALLY_ADDED_DEPENDENCIES</span></code></a>
|
| 78 |
+
property of <code class="docutils literal notranslate"><span class="pre"><target></span></code>.</p>
|
| 79 |
+
</div>
|
| 80 |
+
<div class="versionchanged">
|
| 81 |
+
<p><span class="versionmodified changed">Changed in version 3.9: </span>The <a class="reference internal" href="../manual/cmake-generators.7.html#ninja-generators"><span class="std std-ref">Ninja Generators</span></a> use weaker ordering than
|
| 82 |
+
other generators in order to improve available concurrency.
|
| 83 |
+
They only guarantee that the dependencies' custom commands are
|
| 84 |
+
finished before sources in <code class="docutils literal notranslate"><span class="pre"><target></span></code> start compiling; this
|
| 85 |
+
ensures generated sources are available.</p>
|
| 86 |
+
</div>
|
| 87 |
+
<section id="see-also">
|
| 88 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 89 |
+
<ul class="simple">
|
| 90 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">DEPENDS</span></code> option of <span class="target" id="index-1-command:add_custom_target"></span><a class="reference internal" href="add_custom_target.html#command:add_custom_target" title="add_custom_target"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_target()</span></code></a> and
|
| 91 |
+
<span class="target" id="index-0-command:add_custom_command"></span><a class="reference internal" href="add_custom_command.html#command:add_custom_command" title="add_custom_command"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_command()</span></code></a> commands for adding file-level
|
| 92 |
+
dependencies in custom rules.</p></li>
|
| 93 |
+
<li><p>The <span class="target" id="index-0-prop_sf:OBJECT_DEPENDS"></span><a class="reference internal" href="../prop_sf/OBJECT_DEPENDS.html#prop_sf:OBJECT_DEPENDS" title="OBJECT_DEPENDS"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">OBJECT_DEPENDS</span></code></a> source file property to add
|
| 94 |
+
file-level dependencies to object files.</p></li>
|
| 95 |
+
</ul>
|
| 96 |
+
</section>
|
| 97 |
+
</section>
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
<div class="clearer"></div>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 105 |
+
<div class="sphinxsidebarwrapper">
|
| 106 |
+
<div>
|
| 107 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 108 |
+
<ul>
|
| 109 |
+
<li><a class="reference internal" href="#">add_dependencies</a><ul>
|
| 110 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 111 |
+
</ul>
|
| 112 |
+
</li>
|
| 113 |
+
</ul>
|
| 114 |
+
|
| 115 |
+
</div>
|
| 116 |
+
<div>
|
| 117 |
+
<h4>Previous topic</h4>
|
| 118 |
+
<p class="topless"><a href="add_definitions.html"
|
| 119 |
+
title="previous chapter">add_definitions</a></p>
|
| 120 |
+
</div>
|
| 121 |
+
<div>
|
| 122 |
+
<h4>Next topic</h4>
|
| 123 |
+
<p class="topless"><a href="add_executable.html"
|
| 124 |
+
title="next chapter">add_executable</a></p>
|
| 125 |
+
</div>
|
| 126 |
+
<div role="note" aria-label="source link">
|
| 127 |
+
<h3>This Page</h3>
|
| 128 |
+
<ul class="this-page-menu">
|
| 129 |
+
<li><a href="../_sources/command/add_dependencies.rst.txt"
|
| 130 |
+
rel="nofollow">Show Source</a></li>
|
| 131 |
+
</ul>
|
| 132 |
+
</div>
|
| 133 |
+
<search id="searchbox" style="display: none" role="search">
|
| 134 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 135 |
+
<div class="searchformwrapper">
|
| 136 |
+
<form class="search" action="../search.html" method="get">
|
| 137 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 138 |
+
<input type="submit" value="Go" />
|
| 139 |
+
</form>
|
| 140 |
+
</div>
|
| 141 |
+
</search>
|
| 142 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
<div class="clearer"></div>
|
| 146 |
+
</div>
|
| 147 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 148 |
+
<h3>Navigation</h3>
|
| 149 |
+
<ul>
|
| 150 |
+
<li class="right" style="margin-right: 10px">
|
| 151 |
+
<a href="../genindex.html" title="General Index"
|
| 152 |
+
>index</a></li>
|
| 153 |
+
<li class="right" >
|
| 154 |
+
<a href="add_executable.html" title="add_executable"
|
| 155 |
+
>next</a> |</li>
|
| 156 |
+
<li class="right" >
|
| 157 |
+
<a href="add_definitions.html" title="add_definitions"
|
| 158 |
+
>previous</a> |</li>
|
| 159 |
+
<li>
|
| 160 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 161 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 162 |
+
</li>
|
| 163 |
+
<li>
|
| 164 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 165 |
+
</li>
|
| 166 |
+
<li>
|
| 167 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 168 |
+
</li>
|
| 169 |
+
|
| 170 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 171 |
+
<li class="nav-item nav-item-this"><a href="">add_dependencies</a></li>
|
| 172 |
+
</ul>
|
| 173 |
+
</div>
|
| 174 |
+
|
| 175 |
+
<div class="footer" role="contentinfo">
|
| 176 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 177 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 178 |
+
</div>
|
| 179 |
+
</body>
|
| 180 |
+
</html>
|
cmake/doc/cmake/html/command/add_executable.html
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_executable — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_library" href="add_library.html" />
|
| 21 |
+
<link rel="prev" title="add_dependencies" href="add_dependencies.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_library.html" title="add_library"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_dependencies.html" title="add_dependencies"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_executable</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-executable">
|
| 60 |
+
<span id="command:add_executable"></span><h1><a class="toc-backref" href="#id1" role="doc-backlink">add_executable</a><a class="headerlink" href="#add-executable" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<nav class="contents" id="contents">
|
| 62 |
+
<p class="topic-title">Contents</p>
|
| 63 |
+
<ul class="simple">
|
| 64 |
+
<li><p><a class="reference internal" href="#add-executable" id="id1">add_executable</a></p>
|
| 65 |
+
<ul>
|
| 66 |
+
<li><p><a class="reference internal" href="#normal-executables" id="id2">Normal Executables</a></p></li>
|
| 67 |
+
<li><p><a class="reference internal" href="#imported-executables" id="id3">Imported Executables</a></p></li>
|
| 68 |
+
<li><p><a class="reference internal" href="#alias-executables" id="id4">Alias Executables</a></p></li>
|
| 69 |
+
<li><p><a class="reference internal" href="#see-also" id="id5">See Also</a></p></li>
|
| 70 |
+
</ul>
|
| 71 |
+
</li>
|
| 72 |
+
</ul>
|
| 73 |
+
</nav>
|
| 74 |
+
<p>Add an executable to the project using the specified source files.</p>
|
| 75 |
+
<section id="normal-executables">
|
| 76 |
+
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Normal Executables</a><a class="headerlink" href="#normal-executables" title="Link to this heading">¶</a></h2>
|
| 77 |
+
<dl class="cmake signature">
|
| 78 |
+
<dt class="sig sig-object cmake" id="normal">
|
| 79 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_executable(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="nv"><span class="pre"><options>...</span></span><span class="w"> </span><span class="nv"><span class="pre"><sources>...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#normal" title="Link to this definition">¶</a></dt>
|
| 80 |
+
<dd><p>Add an executable target called <code class="docutils literal notranslate"><span class="pre"><name></span></code> to be built from the source
|
| 81 |
+
files listed in the command invocation.</p>
|
| 82 |
+
<p>The options are:</p>
|
| 83 |
+
<dl class="simple">
|
| 84 |
+
<dt><code class="docutils literal notranslate"><span class="pre">WIN32</span></code></dt><dd><p>Set the <span class="target" id="index-0-prop_tgt:WIN32_EXECUTABLE"></span><a class="reference internal" href="../prop_tgt/WIN32_EXECUTABLE.html#prop_tgt:WIN32_EXECUTABLE" title="WIN32_EXECUTABLE"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">WIN32_EXECUTABLE</span></code></a> target property automatically.
|
| 85 |
+
See documentation of that target property for details.</p>
|
| 86 |
+
</dd>
|
| 87 |
+
<dt><code class="docutils literal notranslate"><span class="pre">MACOSX_BUNDLE</span></code></dt><dd><p>Set the <span class="target" id="index-0-prop_tgt:MACOSX_BUNDLE"></span><a class="reference internal" href="../prop_tgt/MACOSX_BUNDLE.html#prop_tgt:MACOSX_BUNDLE" title="MACOSX_BUNDLE"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">MACOSX_BUNDLE</span></code></a> target property automatically.
|
| 88 |
+
See documentation of that target property for details.</p>
|
| 89 |
+
</dd>
|
| 90 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></dt><dd><p>Set the <span class="target" id="index-0-prop_tgt:EXCLUDE_FROM_ALL"></span><a class="reference internal" href="../prop_tgt/EXCLUDE_FROM_ALL.html#prop_tgt:EXCLUDE_FROM_ALL" title="EXCLUDE_FROM_ALL"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></a> target property automatically.
|
| 91 |
+
See documentation of that target property for details.</p>
|
| 92 |
+
</dd>
|
| 93 |
+
</dl>
|
| 94 |
+
</dd></dl>
|
| 95 |
+
|
| 96 |
+
<p>The <code class="docutils literal notranslate"><span class="pre"><name></span></code> corresponds to the logical target name and must be globally
|
| 97 |
+
unique within a project. The actual file name of the executable built is
|
| 98 |
+
constructed based on conventions of the native platform (such as
|
| 99 |
+
<code class="docutils literal notranslate"><span class="pre"><name>.exe</span></code> or just <code class="docutils literal notranslate"><span class="pre"><name></span></code>).</p>
|
| 100 |
+
<div class="versionadded">
|
| 101 |
+
<p><span class="versionmodified added">Added in version 3.1: </span>Source arguments to <code class="docutils literal notranslate"><span class="pre">add_executable</span></code> may use "generator expressions" with
|
| 102 |
+
the syntax <code class="docutils literal notranslate"><span class="pre">$<...></span></code>. See the <span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-generator-expressions(7)</span></code></a>
|
| 103 |
+
manual for available expressions.</p>
|
| 104 |
+
</div>
|
| 105 |
+
<div class="versionadded">
|
| 106 |
+
<p><span class="versionmodified added">Added in version 3.11: </span>The source files can be omitted if they are added later using
|
| 107 |
+
<span class="target" id="index-0-command:target_sources"></span><a class="reference internal" href="target_sources.html#command:target_sources" title="target_sources"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_sources()</span></code></a>.</p>
|
| 108 |
+
</div>
|
| 109 |
+
<p>By default the executable file will be created in the build tree
|
| 110 |
+
directory corresponding to the source tree directory in which the
|
| 111 |
+
command was invoked. See documentation of the
|
| 112 |
+
<span class="target" id="index-0-prop_tgt:RUNTIME_OUTPUT_DIRECTORY"></span><a class="reference internal" href="../prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html#prop_tgt:RUNTIME_OUTPUT_DIRECTORY" title="RUNTIME_OUTPUT_DIRECTORY"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">RUNTIME_OUTPUT_DIRECTORY</span></code></a> target property to change this
|
| 113 |
+
location. See documentation of the <span class="target" id="index-0-prop_tgt:OUTPUT_NAME"></span><a class="reference internal" href="../prop_tgt/OUTPUT_NAME.html#prop_tgt:OUTPUT_NAME" title="OUTPUT_NAME"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">OUTPUT_NAME</span></code></a> target property
|
| 114 |
+
to change the <code class="docutils literal notranslate"><span class="pre"><name></span></code> part of the final file name.</p>
|
| 115 |
+
<p>See the <span class="target" id="index-0-manual:cmake-buildsystem(7)"></span><a class="reference internal" href="../manual/cmake-buildsystem.7.html#manual:cmake-buildsystem(7)" title="cmake-buildsystem(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-buildsystem(7)</span></code></a> manual for more on defining
|
| 116 |
+
buildsystem properties.</p>
|
| 117 |
+
<p>See also <span class="target" id="index-0-prop_sf:HEADER_FILE_ONLY"></span><a class="reference internal" href="../prop_sf/HEADER_FILE_ONLY.html#prop_sf:HEADER_FILE_ONLY" title="HEADER_FILE_ONLY"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">HEADER_FILE_ONLY</span></code></a> on what to do if some sources are
|
| 118 |
+
pre-processed, and you want to have the original sources reachable from
|
| 119 |
+
within IDE.</p>
|
| 120 |
+
</section>
|
| 121 |
+
<section id="imported-executables">
|
| 122 |
+
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Imported Executables</a><a class="headerlink" href="#imported-executables" title="Link to this heading">¶</a></h2>
|
| 123 |
+
<dl class="cmake signature">
|
| 124 |
+
<dt class="sig sig-object cmake" id="imported">
|
| 125 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_executable(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="no"><span class="pre">IMPORTED</span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="no"><span class="pre">GLOBAL</span></span><span class="p"><span class="pre">]</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#imported" title="Link to this definition">¶</a></dt>
|
| 126 |
+
<dd><p>Add an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#imported-targets"><span class="std std-ref">IMPORTED executable target</span></a> to reference
|
| 127 |
+
an executable file located outside the project. The target name may be
|
| 128 |
+
referenced like any target built within the project, except that by
|
| 129 |
+
default it is visible only in the directory in which it is created,
|
| 130 |
+
and below.</p>
|
| 131 |
+
<p>The options are:</p>
|
| 132 |
+
<dl class="simple">
|
| 133 |
+
<dt><code class="docutils literal notranslate"><span class="pre">GLOBAL</span></code></dt><dd><p>Make the target name globally visible.</p>
|
| 134 |
+
</dd>
|
| 135 |
+
</dl>
|
| 136 |
+
</dd></dl>
|
| 137 |
+
|
| 138 |
+
<p>No rules are generated to build imported targets, and the <span class="target" id="index-0-prop_tgt:IMPORTED"></span><a class="reference internal" href="../prop_tgt/IMPORTED.html#prop_tgt:IMPORTED" title="IMPORTED"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED</span></code></a>
|
| 139 |
+
target property is <code class="docutils literal notranslate"><span class="pre">True</span></code>. Imported executables are useful for convenient
|
| 140 |
+
reference from commands like <span class="target" id="index-0-command:add_custom_command"></span><a class="reference internal" href="add_custom_command.html#command:add_custom_command" title="add_custom_command"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_command()</span></code></a>.</p>
|
| 141 |
+
<p>Details about the imported executable are specified by setting properties
|
| 142 |
+
whose names begin in <code class="docutils literal notranslate"><span class="pre">IMPORTED_</span></code>. The most important such property is
|
| 143 |
+
<span class="target" id="index-0-prop_tgt:IMPORTED_LOCATION"></span><a class="reference internal" href="../prop_tgt/IMPORTED_LOCATION.html#prop_tgt:IMPORTED_LOCATION" title="IMPORTED_LOCATION"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_LOCATION</span></code></a> (and its per-configuration version
|
| 144 |
+
<span class="target" id="index-0-prop_tgt:IMPORTED_LOCATION_<CONFIG>"></span><a class="reference internal" href="../prop_tgt/IMPORTED_LOCATION_CONFIG.html#prop_tgt:IMPORTED_LOCATION_<CONFIG>" title="IMPORTED_LOCATION_<CONFIG>"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_LOCATION_<CONFIG></span></code></a>) which specifies the location of
|
| 145 |
+
the main executable file on disk. See documentation of the <code class="docutils literal notranslate"><span class="pre">IMPORTED_*</span></code>
|
| 146 |
+
properties for more information.</p>
|
| 147 |
+
</section>
|
| 148 |
+
<section id="alias-executables">
|
| 149 |
+
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Alias Executables</a><a class="headerlink" href="#alias-executables" title="Link to this heading">¶</a></h2>
|
| 150 |
+
<dl class="cmake signature">
|
| 151 |
+
<dt class="sig sig-object cmake" id="alias">
|
| 152 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_executable(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="no"><span class="pre">ALIAS</span></span><span class="w"> </span><span class="nv"><span class="pre"><target></span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#alias" title="Link to this definition">¶</a></dt>
|
| 153 |
+
<dd><p>Creates an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#alias-targets"><span class="std std-ref">Alias Target</span></a>, such that <code class="docutils literal notranslate"><span class="pre"><name></span></code> can
|
| 154 |
+
be used to refer to <code class="docutils literal notranslate"><span class="pre"><target></span></code> in subsequent commands. The <code class="docutils literal notranslate"><span class="pre"><name></span></code>
|
| 155 |
+
does not appear in the generated buildsystem as a make target. The
|
| 156 |
+
<code class="docutils literal notranslate"><span class="pre"><target></span></code> may not be an <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code>.</p>
|
| 157 |
+
</dd></dl>
|
| 158 |
+
|
| 159 |
+
<div class="versionadded">
|
| 160 |
+
<p><span class="versionmodified added">Added in version 3.11: </span>An <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> can target a <code class="docutils literal notranslate"><span class="pre">GLOBAL</span></code> <a class="reference internal" href="../manual/cmake-buildsystem.7.html#imported-targets"><span class="std std-ref">Imported Target</span></a></p>
|
| 161 |
+
</div>
|
| 162 |
+
<div class="versionadded">
|
| 163 |
+
<p><span class="versionmodified added">Added in version 3.18: </span>An <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> can target a non-<code class="docutils literal notranslate"><span class="pre">GLOBAL</span></code> Imported Target. Such alias is
|
| 164 |
+
scoped to the directory in which it is created and subdirectories.
|
| 165 |
+
The <span class="target" id="index-0-prop_tgt:ALIAS_GLOBAL"></span><a class="reference internal" href="../prop_tgt/ALIAS_GLOBAL.html#prop_tgt:ALIAS_GLOBAL" title="ALIAS_GLOBAL"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">ALIAS_GLOBAL</span></code></a> target property can be used to check if the
|
| 166 |
+
alias is global or not.</p>
|
| 167 |
+
</div>
|
| 168 |
+
<p><code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> targets can be used as targets to read properties
|
| 169 |
+
from, executables for custom commands and custom targets. They can also be
|
| 170 |
+
tested for existence with the regular <span class="target" id="index-0-command:if"></span><a class="reference internal" href="if.html#target" title="if(target)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">if(TARGET)</span></code></a> subcommand.
|
| 171 |
+
The <code class="docutils literal notranslate"><span class="pre"><name></span></code> may not be used to modify properties of <code class="docutils literal notranslate"><span class="pre"><target></span></code>, that
|
| 172 |
+
is, it may not be used as the operand of <span class="target" id="index-0-command:set_property"></span><a class="reference internal" href="set_property.html#command:set_property" title="set_property"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set_property()</span></code></a>,
|
| 173 |
+
<span class="target" id="index-0-command:set_target_properties"></span><a class="reference internal" href="set_target_properties.html#command:set_target_properties" title="set_target_properties"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set_target_properties()</span></code></a>, <span class="target" id="index-0-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries()</span></code></a> etc.
|
| 174 |
+
An <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> target may not be installed or exported.</p>
|
| 175 |
+
</section>
|
| 176 |
+
<section id="see-also">
|
| 177 |
+
<h2><a class="toc-backref" href="#id5" role="doc-backlink">See Also</a><a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 178 |
+
<ul class="simple">
|
| 179 |
+
<li><p><span class="target" id="index-0-command:add_library"></span><a class="reference internal" href="add_library.html#command:add_library" title="add_library"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_library()</span></code></a></p></li>
|
| 180 |
+
</ul>
|
| 181 |
+
</section>
|
| 182 |
+
</section>
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
<div class="clearer"></div>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 190 |
+
<div class="sphinxsidebarwrapper">
|
| 191 |
+
<div>
|
| 192 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 193 |
+
<ul>
|
| 194 |
+
<li><a class="reference internal" href="#">add_executable</a><ul>
|
| 195 |
+
<li><a class="reference internal" href="#normal-executables">Normal Executables</a></li>
|
| 196 |
+
<li><a class="reference internal" href="#imported-executables">Imported Executables</a></li>
|
| 197 |
+
<li><a class="reference internal" href="#alias-executables">Alias Executables</a></li>
|
| 198 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 199 |
+
</ul>
|
| 200 |
+
</li>
|
| 201 |
+
</ul>
|
| 202 |
+
|
| 203 |
+
</div>
|
| 204 |
+
<div>
|
| 205 |
+
<h4>Previous topic</h4>
|
| 206 |
+
<p class="topless"><a href="add_dependencies.html"
|
| 207 |
+
title="previous chapter">add_dependencies</a></p>
|
| 208 |
+
</div>
|
| 209 |
+
<div>
|
| 210 |
+
<h4>Next topic</h4>
|
| 211 |
+
<p class="topless"><a href="add_library.html"
|
| 212 |
+
title="next chapter">add_library</a></p>
|
| 213 |
+
</div>
|
| 214 |
+
<div role="note" aria-label="source link">
|
| 215 |
+
<h3>This Page</h3>
|
| 216 |
+
<ul class="this-page-menu">
|
| 217 |
+
<li><a href="../_sources/command/add_executable.rst.txt"
|
| 218 |
+
rel="nofollow">Show Source</a></li>
|
| 219 |
+
</ul>
|
| 220 |
+
</div>
|
| 221 |
+
<search id="searchbox" style="display: none" role="search">
|
| 222 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 223 |
+
<div class="searchformwrapper">
|
| 224 |
+
<form class="search" action="../search.html" method="get">
|
| 225 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 226 |
+
<input type="submit" value="Go" />
|
| 227 |
+
</form>
|
| 228 |
+
</div>
|
| 229 |
+
</search>
|
| 230 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 231 |
+
</div>
|
| 232 |
+
</div>
|
| 233 |
+
<div class="clearer"></div>
|
| 234 |
+
</div>
|
| 235 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 236 |
+
<h3>Navigation</h3>
|
| 237 |
+
<ul>
|
| 238 |
+
<li class="right" style="margin-right: 10px">
|
| 239 |
+
<a href="../genindex.html" title="General Index"
|
| 240 |
+
>index</a></li>
|
| 241 |
+
<li class="right" >
|
| 242 |
+
<a href="add_library.html" title="add_library"
|
| 243 |
+
>next</a> |</li>
|
| 244 |
+
<li class="right" >
|
| 245 |
+
<a href="add_dependencies.html" title="add_dependencies"
|
| 246 |
+
>previous</a> |</li>
|
| 247 |
+
<li>
|
| 248 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 249 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 250 |
+
</li>
|
| 251 |
+
<li>
|
| 252 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 253 |
+
</li>
|
| 254 |
+
<li>
|
| 255 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 256 |
+
</li>
|
| 257 |
+
|
| 258 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 259 |
+
<li class="nav-item nav-item-this"><a href="">add_executable</a></li>
|
| 260 |
+
</ul>
|
| 261 |
+
</div>
|
| 262 |
+
|
| 263 |
+
<div class="footer" role="contentinfo">
|
| 264 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 265 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 266 |
+
</div>
|
| 267 |
+
</body>
|
| 268 |
+
</html>
|
cmake/doc/cmake/html/command/add_library.html
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_library — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_link_options" href="add_link_options.html" />
|
| 21 |
+
<link rel="prev" title="add_executable" href="add_executable.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_link_options.html" title="add_link_options"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_executable.html" title="add_executable"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_library</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-library">
|
| 60 |
+
<span id="command:add_library"></span><h1><a class="toc-backref" href="#id1" role="doc-backlink">add_library</a><a class="headerlink" href="#add-library" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<nav class="contents" id="contents">
|
| 62 |
+
<p class="topic-title">Contents</p>
|
| 63 |
+
<ul class="simple">
|
| 64 |
+
<li><p><a class="reference internal" href="#add-library" id="id1">add_library</a></p>
|
| 65 |
+
<ul>
|
| 66 |
+
<li><p><a class="reference internal" href="#normal-libraries" id="id2">Normal Libraries</a></p></li>
|
| 67 |
+
<li><p><a class="reference internal" href="#object-libraries" id="id3">Object Libraries</a></p></li>
|
| 68 |
+
<li><p><a class="reference internal" href="#interface-libraries" id="id4">Interface Libraries</a></p></li>
|
| 69 |
+
<li><p><a class="reference internal" href="#imported-libraries" id="id5">Imported Libraries</a></p></li>
|
| 70 |
+
<li><p><a class="reference internal" href="#alias-libraries" id="id6">Alias Libraries</a></p></li>
|
| 71 |
+
<li><p><a class="reference internal" href="#see-also" id="id7">See Also</a></p></li>
|
| 72 |
+
</ul>
|
| 73 |
+
</li>
|
| 74 |
+
</ul>
|
| 75 |
+
</nav>
|
| 76 |
+
<p>Add a library to the project using the specified source files.</p>
|
| 77 |
+
<section id="normal-libraries">
|
| 78 |
+
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Normal Libraries</a><a class="headerlink" href="#normal-libraries" title="Link to this heading">¶</a></h2>
|
| 79 |
+
<dl class="cmake signature">
|
| 80 |
+
<dt class="sig sig-object cmake" id="normal">
|
| 81 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_library(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="nv"><span class="pre"><type></span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="no"><span class="pre">EXCLUDE_FROM_ALL</span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="nv"><span class="pre"><sources>...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#normal" title="Link to this definition">¶</a></dt>
|
| 82 |
+
<dd><p>Add a library target called <code class="docutils literal notranslate"><span class="pre"><name></span></code> to be built from the source files
|
| 83 |
+
listed in the command invocation.</p>
|
| 84 |
+
<p>The optional <code class="docutils literal notranslate"><span class="pre"><type></span></code> specifies the type of library to be created:</p>
|
| 85 |
+
<dl class="simple">
|
| 86 |
+
<dt><code class="docutils literal notranslate"><span class="pre">STATIC</span></code></dt><dd><p>An archive of object files for use when linking other targets.</p>
|
| 87 |
+
</dd>
|
| 88 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SHARED</span></code></dt><dd><p>A dynamic library that may be linked by other targets and loaded
|
| 89 |
+
at runtime.</p>
|
| 90 |
+
</dd>
|
| 91 |
+
<dt><code class="docutils literal notranslate"><span class="pre">MODULE</span></code></dt><dd><p>A plugin that may not be linked by other targets, but may be
|
| 92 |
+
dynamically loaded at runtime using dlopen-like functionality.</p>
|
| 93 |
+
</dd>
|
| 94 |
+
</dl>
|
| 95 |
+
<p>If no <code class="docutils literal notranslate"><span class="pre"><type></span></code> is given the default is <code class="docutils literal notranslate"><span class="pre">STATIC</span></code> or <code class="docutils literal notranslate"><span class="pre">SHARED</span></code>
|
| 96 |
+
based on the value of the <span class="target" id="index-0-variable:BUILD_SHARED_LIBS"></span><a class="reference internal" href="../variable/BUILD_SHARED_LIBS.html#variable:BUILD_SHARED_LIBS" title="BUILD_SHARED_LIBS"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">BUILD_SHARED_LIBS</span></code></a> variable.</p>
|
| 97 |
+
<p>The options are:</p>
|
| 98 |
+
<dl class="simple">
|
| 99 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></dt><dd><p>Set the <span class="target" id="index-0-prop_tgt:EXCLUDE_FROM_ALL"></span><a class="reference internal" href="../prop_tgt/EXCLUDE_FROM_ALL.html#prop_tgt:EXCLUDE_FROM_ALL" title="EXCLUDE_FROM_ALL"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></a> target property automatically.
|
| 100 |
+
See documentation of that target property for details.</p>
|
| 101 |
+
</dd>
|
| 102 |
+
</dl>
|
| 103 |
+
</dd></dl>
|
| 104 |
+
|
| 105 |
+
<p>The <code class="docutils literal notranslate"><span class="pre"><name></span></code> corresponds to the logical target name and must be globally
|
| 106 |
+
unique within a project. The actual file name of the library built is
|
| 107 |
+
constructed based on conventions of the native platform (such as
|
| 108 |
+
<code class="docutils literal notranslate"><span class="pre">lib<name>.a</span></code> or <code class="docutils literal notranslate"><span class="pre"><name>.lib</span></code>).</p>
|
| 109 |
+
<div class="versionadded">
|
| 110 |
+
<p><span class="versionmodified added">Added in version 3.1: </span>Source arguments to <code class="docutils literal notranslate"><span class="pre">add_library</span></code> may use "generator expressions" with
|
| 111 |
+
the syntax <code class="docutils literal notranslate"><span class="pre">$<...></span></code>. See the <span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-generator-expressions(7)</span></code></a>
|
| 112 |
+
manual for available expressions.</p>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="versionadded">
|
| 115 |
+
<p><span class="versionmodified added">Added in version 3.11: </span>The source files can be omitted if they are added later using
|
| 116 |
+
<span class="target" id="index-0-command:target_sources"></span><a class="reference internal" href="target_sources.html#command:target_sources" title="target_sources"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_sources()</span></code></a>.</p>
|
| 117 |
+
</div>
|
| 118 |
+
<p>For <code class="docutils literal notranslate"><span class="pre">SHARED</span></code> and <code class="docutils literal notranslate"><span class="pre">MODULE</span></code> libraries the
|
| 119 |
+
<span class="target" id="index-0-prop_tgt:POSITION_INDEPENDENT_CODE"></span><a class="reference internal" href="../prop_tgt/POSITION_INDEPENDENT_CODE.html#prop_tgt:POSITION_INDEPENDENT_CODE" title="POSITION_INDEPENDENT_CODE"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">POSITION_INDEPENDENT_CODE</span></code></a> target
|
| 120 |
+
property is set to <code class="docutils literal notranslate"><span class="pre">ON</span></code> automatically.
|
| 121 |
+
A <code class="docutils literal notranslate"><span class="pre">SHARED</span></code> library may be marked with the <span class="target" id="index-0-prop_tgt:FRAMEWORK"></span><a class="reference internal" href="../prop_tgt/FRAMEWORK.html#prop_tgt:FRAMEWORK" title="FRAMEWORK"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">FRAMEWORK</span></code></a>
|
| 122 |
+
target property to create an macOS Framework.</p>
|
| 123 |
+
<div class="versionadded">
|
| 124 |
+
<p><span class="versionmodified added">Added in version 3.8: </span>A <code class="docutils literal notranslate"><span class="pre">STATIC</span></code> library may be marked with the <span class="target" id="index-1-prop_tgt:FRAMEWORK"></span><a class="reference internal" href="../prop_tgt/FRAMEWORK.html#prop_tgt:FRAMEWORK" title="FRAMEWORK"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">FRAMEWORK</span></code></a>
|
| 125 |
+
target property to create a static Framework.</p>
|
| 126 |
+
</div>
|
| 127 |
+
<p>If a library does not export any symbols, it must not be declared as a
|
| 128 |
+
<code class="docutils literal notranslate"><span class="pre">SHARED</span></code> library. For example, a Windows resource DLL or a managed C++/CLI
|
| 129 |
+
DLL that exports no unmanaged symbols would need to be a <code class="docutils literal notranslate"><span class="pre">MODULE</span></code> library.
|
| 130 |
+
This is because CMake expects a <code class="docutils literal notranslate"><span class="pre">SHARED</span></code> library to always have an
|
| 131 |
+
associated import library on Windows.</p>
|
| 132 |
+
<p>By default the library file will be created in the build tree directory
|
| 133 |
+
corresponding to the source tree directory in which the command was
|
| 134 |
+
invoked. See documentation of the <span class="target" id="index-0-prop_tgt:ARCHIVE_OUTPUT_DIRECTORY"></span><a class="reference internal" href="../prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.html#prop_tgt:ARCHIVE_OUTPUT_DIRECTORY" title="ARCHIVE_OUTPUT_DIRECTORY"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">ARCHIVE_OUTPUT_DIRECTORY</span></code></a>,
|
| 135 |
+
<span class="target" id="index-0-prop_tgt:LIBRARY_OUTPUT_DIRECTORY"></span><a class="reference internal" href="../prop_tgt/LIBRARY_OUTPUT_DIRECTORY.html#prop_tgt:LIBRARY_OUTPUT_DIRECTORY" title="LIBRARY_OUTPUT_DIRECTORY"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">LIBRARY_OUTPUT_DIRECTORY</span></code></a>, and
|
| 136 |
+
<span class="target" id="index-0-prop_tgt:RUNTIME_OUTPUT_DIRECTORY"></span><a class="reference internal" href="../prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html#prop_tgt:RUNTIME_OUTPUT_DIRECTORY" title="RUNTIME_OUTPUT_DIRECTORY"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">RUNTIME_OUTPUT_DIRECTORY</span></code></a> target properties to change this
|
| 137 |
+
location. See documentation of the <span class="target" id="index-0-prop_tgt:OUTPUT_NAME"></span><a class="reference internal" href="../prop_tgt/OUTPUT_NAME.html#prop_tgt:OUTPUT_NAME" title="OUTPUT_NAME"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">OUTPUT_NAME</span></code></a> target
|
| 138 |
+
property to change the <code class="docutils literal notranslate"><span class="pre"><name></span></code> part of the final file name.</p>
|
| 139 |
+
<p>See the <span class="target" id="index-0-manual:cmake-buildsystem(7)"></span><a class="reference internal" href="../manual/cmake-buildsystem.7.html#manual:cmake-buildsystem(7)" title="cmake-buildsystem(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-buildsystem(7)</span></code></a> manual for more on defining
|
| 140 |
+
buildsystem properties.</p>
|
| 141 |
+
<p>See also <span class="target" id="index-0-prop_sf:HEADER_FILE_ONLY"></span><a class="reference internal" href="../prop_sf/HEADER_FILE_ONLY.html#prop_sf:HEADER_FILE_ONLY" title="HEADER_FILE_ONLY"><code class="xref cmake cmake-prop_sf docutils literal notranslate"><span class="pre">HEADER_FILE_ONLY</span></code></a> on what to do if some sources are
|
| 142 |
+
pre-processed, and you want to have the original sources reachable from
|
| 143 |
+
within IDE.</p>
|
| 144 |
+
<div class="versionchanged">
|
| 145 |
+
<p><span class="versionmodified changed">Changed in version 3.30: </span>On platforms that do not support shared libraries, <code class="docutils literal notranslate"><span class="pre">add_library</span></code>
|
| 146 |
+
now fails on calls creating <code class="docutils literal notranslate"><span class="pre">SHARED</span></code> libraries instead of
|
| 147 |
+
automatically converting them to <code class="docutils literal notranslate"><span class="pre">STATIC</span></code> libraries as before.
|
| 148 |
+
See policy <span class="target" id="index-0-policy:CMP0164"></span><a class="reference internal" href="../policy/CMP0164.html#policy:CMP0164" title="CMP0164"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0164</span></code></a>.</p>
|
| 149 |
+
</div>
|
| 150 |
+
</section>
|
| 151 |
+
<section id="object-libraries">
|
| 152 |
+
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Object Libraries</a><a class="headerlink" href="#object-libraries" title="Link to this heading">¶</a></h2>
|
| 153 |
+
<dl class="cmake signature">
|
| 154 |
+
<dt class="sig sig-object cmake" id="object">
|
| 155 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_library(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="no"><span class="pre">OBJECT</span></span><span class="w"> </span><span class="nv"><span class="pre"><sources>...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#object" title="Link to this definition">¶</a></dt>
|
| 156 |
+
<dd><p>Add an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#object-libraries"><span class="std std-ref">Object Library</span></a> to compile source files
|
| 157 |
+
without archiving or linking their object files into a library.</p>
|
| 158 |
+
</dd></dl>
|
| 159 |
+
|
| 160 |
+
<p>Other targets created by <code class="docutils literal notranslate"><span class="pre">add_library</span></code> or <span class="target" id="index-0-command:add_executable"></span><a class="reference internal" href="add_executable.html#command:add_executable" title="add_executable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_executable()</span></code></a>
|
| 161 |
+
may reference the objects using an expression of the
|
| 162 |
+
form <span class="target" id="index-0-genex:TARGET_OBJECTS"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:TARGET_OBJECTS" title="TARGET_OBJECTS"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">$<TARGET_OBJECTS:objlib></span></code></a> as a source, where
|
| 163 |
+
<code class="docutils literal notranslate"><span class="pre">objlib</span></code> is the object library name. For example:</p>
|
| 164 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_library(</span><span class="p">...</span><span class="w"> </span><span class="o">$<</span><span class="no">TARGET_OBJECTS</span><span class="o">:</span><span class="nb">objlib</span><span class="o">></span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 165 |
+
<span class="nf">add_executable(</span><span class="p">...</span><span class="w"> </span><span class="o">$<</span><span class="no">TARGET_OBJECTS</span><span class="o">:</span><span class="nb">objlib</span><span class="o">></span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 166 |
+
</pre></div>
|
| 167 |
+
</div>
|
| 168 |
+
<p>will include objlib's object files in a library and an executable
|
| 169 |
+
along with those compiled from their own sources. Object libraries
|
| 170 |
+
may contain only sources that compile, header files, and other files
|
| 171 |
+
that would not affect linking of a normal library (e.g. <code class="docutils literal notranslate"><span class="pre">.txt</span></code>).
|
| 172 |
+
They may contain custom commands generating such sources, but not
|
| 173 |
+
<code class="docutils literal notranslate"><span class="pre">PRE_BUILD</span></code>, <code class="docutils literal notranslate"><span class="pre">PRE_LINK</span></code>, or <code class="docutils literal notranslate"><span class="pre">POST_BUILD</span></code> commands. Some native build
|
| 174 |
+
systems (such as Xcode) may not like targets that have only object files, so
|
| 175 |
+
consider adding at least one real source file to any target that references
|
| 176 |
+
<span class="target" id="index-1-genex:TARGET_OBJECTS"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:TARGET_OBJECTS" title="TARGET_OBJECTS"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">$<TARGET_OBJECTS:objlib></span></code></a>.</p>
|
| 177 |
+
<div class="versionadded">
|
| 178 |
+
<p><span class="versionmodified added">Added in version 3.12: </span>Object libraries can be linked to with <span class="target" id="index-0-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries()</span></code></a>.</p>
|
| 179 |
+
</div>
|
| 180 |
+
</section>
|
| 181 |
+
<section id="interface-libraries">
|
| 182 |
+
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Interface Libraries</a><a class="headerlink" href="#interface-libraries" title="Link to this heading">¶</a></h2>
|
| 183 |
+
<dl class="cmake signature">
|
| 184 |
+
<dt class="sig sig-object cmake" id="interface">
|
| 185 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_library(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="no"><span class="pre">INTERFACE</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#interface" title="Link to this definition">¶</a></dt>
|
| 186 |
+
<dd><p>Add an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#interface-libraries"><span class="std std-ref">Interface Library</span></a> target that may
|
| 187 |
+
specify usage requirements for dependents but does not compile sources
|
| 188 |
+
and does not produce a library artifact on disk.</p>
|
| 189 |
+
<p>An interface library with no source files is not included as a target
|
| 190 |
+
in the generated buildsystem. However, it may have
|
| 191 |
+
properties set on it and it may be installed and exported.
|
| 192 |
+
Typically, <code class="docutils literal notranslate"><span class="pre">INTERFACE_*</span></code> properties are populated on an interface
|
| 193 |
+
target using the commands:</p>
|
| 194 |
+
<ul class="simple">
|
| 195 |
+
<li><p><span class="target" id="index-0-command:set_property"></span><a class="reference internal" href="set_property.html#command:set_property" title="set_property"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set_property()</span></code></a>,</p></li>
|
| 196 |
+
<li><p><span class="target" id="index-1-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries(interface)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries(INTERFACE)</span></code></a>,</p></li>
|
| 197 |
+
<li><p><span class="target" id="index-0-command:target_link_options"></span><a class="reference internal" href="target_link_options.html#command:target_link_options" title="target_link_options(interface)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_options(INTERFACE)</span></code></a>,</p></li>
|
| 198 |
+
<li><p><span class="target" id="index-0-command:target_include_directories"></span><a class="reference internal" href="target_include_directories.html#command:target_include_directories" title="target_include_directories(interface)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_include_directories(INTERFACE)</span></code></a>,</p></li>
|
| 199 |
+
<li><p><span class="target" id="index-0-command:target_compile_options"></span><a class="reference internal" href="target_compile_options.html#command:target_compile_options" title="target_compile_options(interface)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_compile_options(INTERFACE)</span></code></a>,</p></li>
|
| 200 |
+
<li><p><span class="target" id="index-0-command:target_compile_definitions"></span><a class="reference internal" href="target_compile_definitions.html#command:target_compile_definitions" title="target_compile_definitions(interface)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_compile_definitions(INTERFACE)</span></code></a>, and</p></li>
|
| 201 |
+
<li><p><span class="target" id="index-1-command:target_sources"></span><a class="reference internal" href="target_sources.html#command:target_sources" title="target_sources(interface)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_sources(INTERFACE)</span></code></a>,</p></li>
|
| 202 |
+
</ul>
|
| 203 |
+
<p>and then it is used as an argument to <span class="target" id="index-2-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries()</span></code></a>
|
| 204 |
+
like any other target.</p>
|
| 205 |
+
<div class="versionadded">
|
| 206 |
+
<p><span class="versionmodified added">Added in version 3.15: </span>An interface library can have <span class="target" id="index-0-prop_tgt:PUBLIC_HEADER"></span><a class="reference internal" href="../prop_tgt/PUBLIC_HEADER.html#prop_tgt:PUBLIC_HEADER" title="PUBLIC_HEADER"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">PUBLIC_HEADER</span></code></a> and
|
| 207 |
+
<span class="target" id="index-0-prop_tgt:PRIVATE_HEADER"></span><a class="reference internal" href="../prop_tgt/PRIVATE_HEADER.html#prop_tgt:PRIVATE_HEADER" title="PRIVATE_HEADER"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">PRIVATE_HEADER</span></code></a> properties. The headers specified by those
|
| 208 |
+
properties can be installed using the <span class="target" id="index-0-command:install"></span><a class="reference internal" href="install.html#targets" title="install(targets)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">install(TARGETS)</span></code></a> command.</p>
|
| 209 |
+
</div>
|
| 210 |
+
</dd></dl>
|
| 211 |
+
|
| 212 |
+
<dl class="cmake signature">
|
| 213 |
+
<dt class="sig sig-object cmake" id="interface-with-sources">
|
| 214 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_library(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="no"><span class="pre">INTERFACE</span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="no"><span class="pre">EXCLUDE_FROM_ALL</span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="nv"><span class="pre"><sources>...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#interface-with-sources" title="Link to this definition">¶</a></dt>
|
| 215 |
+
<dd><div class="versionadded">
|
| 216 |
+
<p><span class="versionmodified added">Added in version 3.19.</span></p>
|
| 217 |
+
</div>
|
| 218 |
+
<p>Add an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#interface-libraries"><span class="std std-ref">Interface Library</span></a> target with
|
| 219 |
+
source files (in addition to usage requirements and properties as
|
| 220 |
+
documented by the <span class="target" id="index-0-command:add_library"></span><a class="reference internal" href="#interface" title="add_library(interface)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">above</span> <span class="pre">signature</span></code></a>).
|
| 221 |
+
Source files may be listed directly in the <code class="docutils literal notranslate"><span class="pre">add_library</span></code> call
|
| 222 |
+
or added later by calls to <span class="target" id="index-2-command:target_sources"></span><a class="reference internal" href="target_sources.html#command:target_sources" title="target_sources"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_sources()</span></code></a> with the
|
| 223 |
+
<code class="docutils literal notranslate"><span class="pre">PRIVATE</span></code> or <code class="docutils literal notranslate"><span class="pre">PUBLIC</span></code> keywords.</p>
|
| 224 |
+
<p>If an interface library has source files (i.e. the <span class="target" id="index-0-prop_tgt:SOURCES"></span><a class="reference internal" href="../prop_tgt/SOURCES.html#prop_tgt:SOURCES" title="SOURCES"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">SOURCES</span></code></a>
|
| 225 |
+
target property is set), or header sets (i.e. the <span class="target" id="index-0-prop_tgt:HEADER_SETS"></span><a class="reference internal" href="../prop_tgt/HEADER_SETS.html#prop_tgt:HEADER_SETS" title="HEADER_SETS"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">HEADER_SETS</span></code></a>
|
| 226 |
+
target property is set), it will appear in the generated buildsystem
|
| 227 |
+
as a build target much like a target defined by the
|
| 228 |
+
<span class="target" id="index-0-command:add_custom_target"></span><a class="reference internal" href="add_custom_target.html#command:add_custom_target" title="add_custom_target"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_target()</span></code></a> command. It does not compile any sources,
|
| 229 |
+
but does contain build rules for custom commands created by the
|
| 230 |
+
<span class="target" id="index-0-command:add_custom_command"></span><a class="reference internal" href="add_custom_command.html#command:add_custom_command" title="add_custom_command"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_custom_command()</span></code></a> command.</p>
|
| 231 |
+
<p>The options are:</p>
|
| 232 |
+
<dl class="simple">
|
| 233 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></dt><dd><p>Set the <span class="target" id="index-1-prop_tgt:EXCLUDE_FROM_ALL"></span><a class="reference internal" href="../prop_tgt/EXCLUDE_FROM_ALL.html#prop_tgt:EXCLUDE_FROM_ALL" title="EXCLUDE_FROM_ALL"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></a> target property automatically.
|
| 234 |
+
See documentation of that target property for details.</p>
|
| 235 |
+
</dd>
|
| 236 |
+
</dl>
|
| 237 |
+
<div class="admonition note">
|
| 238 |
+
<p class="admonition-title">Note</p>
|
| 239 |
+
<p>In most command signatures where the <code class="docutils literal notranslate"><span class="pre">INTERFACE</span></code> keyword appears,
|
| 240 |
+
the items listed after it only become part of that target's usage
|
| 241 |
+
requirements and are not part of the target's own settings. However,
|
| 242 |
+
in this signature of <code class="docutils literal notranslate"><span class="pre">add_library</span></code>, the <code class="docutils literal notranslate"><span class="pre">INTERFACE</span></code> keyword refers
|
| 243 |
+
to the library type only. Sources listed after it in the <code class="docutils literal notranslate"><span class="pre">add_library</span></code>
|
| 244 |
+
call are <code class="docutils literal notranslate"><span class="pre">PRIVATE</span></code> to the interface library and do not appear in its
|
| 245 |
+
<span class="target" id="index-0-prop_tgt:INTERFACE_SOURCES"></span><a class="reference internal" href="../prop_tgt/INTERFACE_SOURCES.html#prop_tgt:INTERFACE_SOURCES" title="INTERFACE_SOURCES"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">INTERFACE_SOURCES</span></code></a> target property.</p>
|
| 246 |
+
</div>
|
| 247 |
+
</dd></dl>
|
| 248 |
+
|
| 249 |
+
</section>
|
| 250 |
+
<section id="imported-libraries">
|
| 251 |
+
<span id="add-library-imported-libraries"></span><h2><a class="toc-backref" href="#id5" role="doc-backlink">Imported Libraries</a><a class="headerlink" href="#imported-libraries" title="Link to this heading">¶</a></h2>
|
| 252 |
+
<dl class="cmake signature">
|
| 253 |
+
<dt class="sig sig-object cmake" id="imported">
|
| 254 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_library(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="nv"><span class="pre"><type></span></span><span class="w"> </span><span class="no"><span class="pre">IMPORTED</span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="no"><span class="pre">GLOBAL</span></span><span class="p"><span class="pre">]</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#imported" title="Link to this definition">¶</a></dt>
|
| 255 |
+
<dd><p>Add an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#imported-targets"><span class="std std-ref">IMPORTED library target</span></a> called <code class="docutils literal notranslate"><span class="pre"><name></span></code>.
|
| 256 |
+
The target name may be referenced like any target built within the project,
|
| 257 |
+
except that by default it is visible only in the directory in which it is
|
| 258 |
+
created, and below.</p>
|
| 259 |
+
<p>The <code class="docutils literal notranslate"><span class="pre"><type></span></code> must be one of:</p>
|
| 260 |
+
<dl>
|
| 261 |
+
<dt><code class="docutils literal notranslate"><span class="pre">STATIC</span></code>, <code class="docutils literal notranslate"><span class="pre">SHARED</span></code>, <code class="docutils literal notranslate"><span class="pre">MODULE</span></code>, <code class="docutils literal notranslate"><span class="pre">UNKNOWN</span></code></dt><dd><p>References a library file located outside the project. The
|
| 262 |
+
<span class="target" id="index-0-prop_tgt:IMPORTED_LOCATION"></span><a class="reference internal" href="../prop_tgt/IMPORTED_LOCATION.html#prop_tgt:IMPORTED_LOCATION" title="IMPORTED_LOCATION"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_LOCATION</span></code></a> target property (or its per-configuration
|
| 263 |
+
variant <span class="target" id="index-0-prop_tgt:IMPORTED_LOCATION_<CONFIG>"></span><a class="reference internal" href="../prop_tgt/IMPORTED_LOCATION_CONFIG.html#prop_tgt:IMPORTED_LOCATION_<CONFIG>" title="IMPORTED_LOCATION_<CONFIG>"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_LOCATION_<CONFIG></span></code></a>) specifies the
|
| 264 |
+
location of the main library file on disk:</p>
|
| 265 |
+
<ul class="simple">
|
| 266 |
+
<li><p>For a <code class="docutils literal notranslate"><span class="pre">SHARED</span></code> library on most non-Windows platforms, the main library
|
| 267 |
+
file is the <code class="docutils literal notranslate"><span class="pre">.so</span></code> or <code class="docutils literal notranslate"><span class="pre">.dylib</span></code> file used by both linkers and dynamic
|
| 268 |
+
loaders. If the referenced library file has a <code class="docutils literal notranslate"><span class="pre">SONAME</span></code> (or on macOS,
|
| 269 |
+
has a <code class="docutils literal notranslate"><span class="pre">LC_ID_DYLIB</span></code> starting in <code class="docutils literal notranslate"><span class="pre">@rpath/</span></code>), the value of that field
|
| 270 |
+
should be set in the <span class="target" id="index-0-prop_tgt:IMPORTED_SONAME"></span><a class="reference internal" href="../prop_tgt/IMPORTED_SONAME.html#prop_tgt:IMPORTED_SONAME" title="IMPORTED_SONAME"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_SONAME</span></code></a> target property.
|
| 271 |
+
If the referenced library file does not have a <code class="docutils literal notranslate"><span class="pre">SONAME</span></code>, but the
|
| 272 |
+
platform supports it, then the <span class="target" id="index-0-prop_tgt:IMPORTED_NO_SONAME"></span><a class="reference internal" href="../prop_tgt/IMPORTED_NO_SONAME.html#prop_tgt:IMPORTED_NO_SONAME" title="IMPORTED_NO_SONAME"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_NO_SONAME</span></code></a> target
|
| 273 |
+
property should be set.</p></li>
|
| 274 |
+
<li><p>For a <code class="docutils literal notranslate"><span class="pre">SHARED</span></code> library on Windows, the <span class="target" id="index-0-prop_tgt:IMPORTED_IMPLIB"></span><a class="reference internal" href="../prop_tgt/IMPORTED_IMPLIB.html#prop_tgt:IMPORTED_IMPLIB" title="IMPORTED_IMPLIB"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_IMPLIB</span></code></a>
|
| 275 |
+
target property (or its per-configuration variant
|
| 276 |
+
<span class="target" id="index-0-prop_tgt:IMPORTED_IMPLIB_<CONFIG>"></span><a class="reference internal" href="../prop_tgt/IMPORTED_IMPLIB_CONFIG.html#prop_tgt:IMPORTED_IMPLIB_<CONFIG>" title="IMPORTED_IMPLIB_<CONFIG>"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_IMPLIB_<CONFIG></span></code></a>) specifies the location of the
|
| 277 |
+
DLL import library file (<code class="docutils literal notranslate"><span class="pre">.lib</span></code> or <code class="docutils literal notranslate"><span class="pre">.dll.a</span></code>) on disk, and the
|
| 278 |
+
<code class="docutils literal notranslate"><span class="pre">IMPORTED_LOCATION</span></code> is the location of the <code class="docutils literal notranslate"><span class="pre">.dll</span></code> runtime
|
| 279 |
+
library (and is optional, but needed by the <span class="target" id="index-0-genex:TARGET_RUNTIME_DLLS"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS" title="TARGET_RUNTIME_DLLS"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">TARGET_RUNTIME_DLLS</span></code></a>
|
| 280 |
+
generator expression).</p></li>
|
| 281 |
+
</ul>
|
| 282 |
+
<p>Additional usage requirements may be specified in <code class="docutils literal notranslate"><span class="pre">INTERFACE_*</span></code>
|
| 283 |
+
properties.</p>
|
| 284 |
+
<p>An <code class="docutils literal notranslate"><span class="pre">UNKNOWN</span></code> library type is typically only used in the implementation
|
| 285 |
+
of <a class="reference internal" href="../manual/cmake-developer.7.html#find-modules"><span class="std std-ref">Find Modules</span></a>. It allows the path to an imported library
|
| 286 |
+
(often found using the <span class="target" id="index-0-command:find_library"></span><a class="reference internal" href="find_library.html#command:find_library" title="find_library"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_library()</span></code></a> command) to be used
|
| 287 |
+
without having to know what type of library it is. This is especially
|
| 288 |
+
useful on Windows where a static library and a DLL's import library
|
| 289 |
+
both have the same file extension.</p>
|
| 290 |
+
</dd>
|
| 291 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OBJECT</span></code></dt><dd><p>References a set of object files located outside the project.
|
| 292 |
+
The <span class="target" id="index-0-prop_tgt:IMPORTED_OBJECTS"></span><a class="reference internal" href="../prop_tgt/IMPORTED_OBJECTS.html#prop_tgt:IMPORTED_OBJECTS" title="IMPORTED_OBJECTS"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_OBJECTS</span></code></a> target property (or its per-configuration
|
| 293 |
+
variant <span class="target" id="index-0-prop_tgt:IMPORTED_OBJECTS_<CONFIG>"></span><a class="reference internal" href="../prop_tgt/IMPORTED_OBJECTS_CONFIG.html#prop_tgt:IMPORTED_OBJECTS_<CONFIG>" title="IMPORTED_OBJECTS_<CONFIG>"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED_OBJECTS_<CONFIG></span></code></a>) specifies the locations of
|
| 294 |
+
object files on disk.
|
| 295 |
+
Additional usage requirements may be specified in <code class="docutils literal notranslate"><span class="pre">INTERFACE_*</span></code>
|
| 296 |
+
properties.</p>
|
| 297 |
+
</dd>
|
| 298 |
+
<dt><code class="docutils literal notranslate"><span class="pre">INTERFACE</span></code></dt><dd><p>Does not reference any library or object files on disk, but may
|
| 299 |
+
specify usage requirements in <code class="docutils literal notranslate"><span class="pre">INTERFACE_*</span></code> properties.</p>
|
| 300 |
+
</dd>
|
| 301 |
+
</dl>
|
| 302 |
+
<p>The options are:</p>
|
| 303 |
+
<dl class="simple">
|
| 304 |
+
<dt><code class="docutils literal notranslate"><span class="pre">GLOBAL</span></code></dt><dd><p>Make the target name globally visible.</p>
|
| 305 |
+
</dd>
|
| 306 |
+
</dl>
|
| 307 |
+
</dd></dl>
|
| 308 |
+
|
| 309 |
+
<p>No rules are generated to build imported targets, and the <span class="target" id="index-0-prop_tgt:IMPORTED"></span><a class="reference internal" href="../prop_tgt/IMPORTED.html#prop_tgt:IMPORTED" title="IMPORTED"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">IMPORTED</span></code></a>
|
| 310 |
+
target property is <code class="docutils literal notranslate"><span class="pre">True</span></code>. Imported libraries are useful for convenient
|
| 311 |
+
reference from commands like <span class="target" id="index-3-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries()</span></code></a>.</p>
|
| 312 |
+
<p>Details about the imported library are specified by setting properties whose
|
| 313 |
+
names begin in <code class="docutils literal notranslate"><span class="pre">IMPORTED_</span></code> and <code class="docutils literal notranslate"><span class="pre">INTERFACE_</span></code>. See documentation of
|
| 314 |
+
such properties for more information.</p>
|
| 315 |
+
</section>
|
| 316 |
+
<section id="alias-libraries">
|
| 317 |
+
<h2><a class="toc-backref" href="#id6" role="doc-backlink">Alias Libraries</a><a class="headerlink" href="#alias-libraries" title="Link to this heading">¶</a></h2>
|
| 318 |
+
<dl class="cmake signature">
|
| 319 |
+
<dt class="sig sig-object cmake" id="alias">
|
| 320 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">add_library(</span></span><span class="nv"><span class="pre"><name></span></span><span class="w"> </span><span class="no"><span class="pre">ALIAS</span></span><span class="w"> </span><span class="nv"><span class="pre"><target></span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#alias" title="Link to this definition">¶</a></dt>
|
| 321 |
+
<dd><p>Creates an <a class="reference internal" href="../manual/cmake-buildsystem.7.html#alias-targets"><span class="std std-ref">Alias Target</span></a>, such that <code class="docutils literal notranslate"><span class="pre"><name></span></code> can be
|
| 322 |
+
used to refer to <code class="docutils literal notranslate"><span class="pre"><target></span></code> in subsequent commands. The <code class="docutils literal notranslate"><span class="pre"><name></span></code> does
|
| 323 |
+
not appear in the generated buildsystem as a make target. The <code class="docutils literal notranslate"><span class="pre"><target></span></code>
|
| 324 |
+
may not be an <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code>.</p>
|
| 325 |
+
</dd></dl>
|
| 326 |
+
|
| 327 |
+
<div class="versionadded">
|
| 328 |
+
<p><span class="versionmodified added">Added in version 3.11: </span>An <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> can target a <code class="docutils literal notranslate"><span class="pre">GLOBAL</span></code> <a class="reference internal" href="../manual/cmake-buildsystem.7.html#imported-targets"><span class="std std-ref">Imported Target</span></a></p>
|
| 329 |
+
</div>
|
| 330 |
+
<div class="versionadded">
|
| 331 |
+
<p><span class="versionmodified added">Added in version 3.18: </span>An <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> can target a non-<code class="docutils literal notranslate"><span class="pre">GLOBAL</span></code> Imported Target. Such alias is
|
| 332 |
+
scoped to the directory in which it is created and below.
|
| 333 |
+
The <span class="target" id="index-0-prop_tgt:ALIAS_GLOBAL"></span><a class="reference internal" href="../prop_tgt/ALIAS_GLOBAL.html#prop_tgt:ALIAS_GLOBAL" title="ALIAS_GLOBAL"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">ALIAS_GLOBAL</span></code></a> target property can be used to check if the
|
| 334 |
+
alias is global or not.</p>
|
| 335 |
+
</div>
|
| 336 |
+
<p><code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> targets can be used as linkable targets and as targets to
|
| 337 |
+
read properties from. They can also be tested for existence with the
|
| 338 |
+
regular <span class="target" id="index-0-command:if"></span><a class="reference internal" href="if.html#target" title="if(target)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">if(TARGET)</span></code></a> subcommand. The <code class="docutils literal notranslate"><span class="pre"><name></span></code> may not be used
|
| 339 |
+
to modify properties of <code class="docutils literal notranslate"><span class="pre"><target></span></code>, that is, it may not be used as the
|
| 340 |
+
operand of <span class="target" id="index-1-command:set_property"></span><a class="reference internal" href="set_property.html#command:set_property" title="set_property"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set_property()</span></code></a>, <span class="target" id="index-0-command:set_target_properties"></span><a class="reference internal" href="set_target_properties.html#command:set_target_properties" title="set_target_properties"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set_target_properties()</span></code></a>,
|
| 341 |
+
<span class="target" id="index-4-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries()</span></code></a> etc. An <code class="docutils literal notranslate"><span class="pre">ALIAS</span></code> target may not be
|
| 342 |
+
installed or exported.</p>
|
| 343 |
+
</section>
|
| 344 |
+
<section id="see-also">
|
| 345 |
+
<h2><a class="toc-backref" href="#id7" role="doc-backlink">See Also</a><a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 346 |
+
<ul class="simple">
|
| 347 |
+
<li><p><span class="target" id="index-1-command:add_executable"></span><a class="reference internal" href="add_executable.html#command:add_executable" title="add_executable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_executable()</span></code></a></p></li>
|
| 348 |
+
</ul>
|
| 349 |
+
</section>
|
| 350 |
+
</section>
|
| 351 |
+
|
| 352 |
+
|
| 353 |
+
<div class="clearer"></div>
|
| 354 |
+
</div>
|
| 355 |
+
</div>
|
| 356 |
+
</div>
|
| 357 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 358 |
+
<div class="sphinxsidebarwrapper">
|
| 359 |
+
<div>
|
| 360 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 361 |
+
<ul>
|
| 362 |
+
<li><a class="reference internal" href="#">add_library</a><ul>
|
| 363 |
+
<li><a class="reference internal" href="#normal-libraries">Normal Libraries</a></li>
|
| 364 |
+
<li><a class="reference internal" href="#object-libraries">Object Libraries</a></li>
|
| 365 |
+
<li><a class="reference internal" href="#interface-libraries">Interface Libraries</a></li>
|
| 366 |
+
<li><a class="reference internal" href="#imported-libraries">Imported Libraries</a></li>
|
| 367 |
+
<li><a class="reference internal" href="#alias-libraries">Alias Libraries</a></li>
|
| 368 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 369 |
+
</ul>
|
| 370 |
+
</li>
|
| 371 |
+
</ul>
|
| 372 |
+
|
| 373 |
+
</div>
|
| 374 |
+
<div>
|
| 375 |
+
<h4>Previous topic</h4>
|
| 376 |
+
<p class="topless"><a href="add_executable.html"
|
| 377 |
+
title="previous chapter">add_executable</a></p>
|
| 378 |
+
</div>
|
| 379 |
+
<div>
|
| 380 |
+
<h4>Next topic</h4>
|
| 381 |
+
<p class="topless"><a href="add_link_options.html"
|
| 382 |
+
title="next chapter">add_link_options</a></p>
|
| 383 |
+
</div>
|
| 384 |
+
<div role="note" aria-label="source link">
|
| 385 |
+
<h3>This Page</h3>
|
| 386 |
+
<ul class="this-page-menu">
|
| 387 |
+
<li><a href="../_sources/command/add_library.rst.txt"
|
| 388 |
+
rel="nofollow">Show Source</a></li>
|
| 389 |
+
</ul>
|
| 390 |
+
</div>
|
| 391 |
+
<search id="searchbox" style="display: none" role="search">
|
| 392 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 393 |
+
<div class="searchformwrapper">
|
| 394 |
+
<form class="search" action="../search.html" method="get">
|
| 395 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 396 |
+
<input type="submit" value="Go" />
|
| 397 |
+
</form>
|
| 398 |
+
</div>
|
| 399 |
+
</search>
|
| 400 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 401 |
+
</div>
|
| 402 |
+
</div>
|
| 403 |
+
<div class="clearer"></div>
|
| 404 |
+
</div>
|
| 405 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 406 |
+
<h3>Navigation</h3>
|
| 407 |
+
<ul>
|
| 408 |
+
<li class="right" style="margin-right: 10px">
|
| 409 |
+
<a href="../genindex.html" title="General Index"
|
| 410 |
+
>index</a></li>
|
| 411 |
+
<li class="right" >
|
| 412 |
+
<a href="add_link_options.html" title="add_link_options"
|
| 413 |
+
>next</a> |</li>
|
| 414 |
+
<li class="right" >
|
| 415 |
+
<a href="add_executable.html" title="add_executable"
|
| 416 |
+
>previous</a> |</li>
|
| 417 |
+
<li>
|
| 418 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 419 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 420 |
+
</li>
|
| 421 |
+
<li>
|
| 422 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 423 |
+
</li>
|
| 424 |
+
<li>
|
| 425 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 426 |
+
</li>
|
| 427 |
+
|
| 428 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 429 |
+
<li class="nav-item nav-item-this"><a href="">add_library</a></li>
|
| 430 |
+
</ul>
|
| 431 |
+
</div>
|
| 432 |
+
|
| 433 |
+
<div class="footer" role="contentinfo">
|
| 434 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 435 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 436 |
+
</div>
|
| 437 |
+
</body>
|
| 438 |
+
</html>
|
cmake/doc/cmake/html/command/add_link_options.html
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_link_options — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_subdirectory" href="add_subdirectory.html" />
|
| 21 |
+
<link rel="prev" title="add_library" href="add_library.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_subdirectory.html" title="add_subdirectory"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_library.html" title="add_library"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_link_options</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-link-options">
|
| 60 |
+
<span id="command:add_link_options"></span><h1>add_link_options<a class="headerlink" href="#add-link-options" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.13.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<p>Add options to the link step for executable, shared library or module
|
| 65 |
+
library targets in the current directory and below that are added after
|
| 66 |
+
this command is invoked.</p>
|
| 67 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_link_options(</span><span class="nv"><option></span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 68 |
+
</pre></div>
|
| 69 |
+
</div>
|
| 70 |
+
<p>This command can be used to add any link options, but alternative commands
|
| 71 |
+
exist to add libraries (<span class="target" id="index-0-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries()</span></code></a> or
|
| 72 |
+
<span class="target" id="index-0-command:link_libraries"></span><a class="reference internal" href="link_libraries.html#command:link_libraries" title="link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">link_libraries()</span></code></a>). See documentation of the
|
| 73 |
+
<span class="target" id="index-0-prop_dir:LINK_OPTIONS"></span><a class="reference internal" href="../prop_dir/LINK_OPTIONS.html#prop_dir:LINK_OPTIONS" title="LINK_OPTIONS"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">directory</span></code></a> and
|
| 74 |
+
<span class="target" id="index-0-prop_tgt:LINK_OPTIONS"></span><a class="reference internal" href="../prop_tgt/LINK_OPTIONS.html#prop_tgt:LINK_OPTIONS" title="LINK_OPTIONS"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">target</span></code></a> <code class="docutils literal notranslate"><span class="pre">LINK_OPTIONS</span></code> properties.</p>
|
| 75 |
+
<div class="admonition note">
|
| 76 |
+
<p class="admonition-title">Note</p>
|
| 77 |
+
<p>This command cannot be used to add options for static library targets,
|
| 78 |
+
since they do not use a linker. To add archiver or MSVC librarian flags,
|
| 79 |
+
see the <span class="target" id="index-0-prop_tgt:STATIC_LIBRARY_OPTIONS"></span><a class="reference internal" href="../prop_tgt/STATIC_LIBRARY_OPTIONS.html#prop_tgt:STATIC_LIBRARY_OPTIONS" title="STATIC_LIBRARY_OPTIONS"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">STATIC_LIBRARY_OPTIONS</span></code></a> target property.</p>
|
| 80 |
+
</div>
|
| 81 |
+
<p>Arguments to <code class="docutils literal notranslate"><span class="pre">add_link_options</span></code> may use generator expressions
|
| 82 |
+
with the syntax <code class="docutils literal notranslate"><span class="pre">$<...></span></code>. See the <span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-generator-expressions(7)</span></code></a>
|
| 83 |
+
manual for available expressions. See the <span class="target" id="index-1-manual:cmake-buildsystem(7)"></span><a class="reference internal" href="../manual/cmake-buildsystem.7.html#manual:cmake-buildsystem(7)" title="cmake-buildsystem(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-buildsystem(7)</span></code></a> manual
|
| 84 |
+
for more on defining buildsystem properties.</p>
|
| 85 |
+
<section id="host-and-device-specific-link-options">
|
| 86 |
+
<h2>Host And Device Specific Link Options<a class="headerlink" href="#host-and-device-specific-link-options" title="Link to this heading">¶</a></h2>
|
| 87 |
+
<div class="versionadded">
|
| 88 |
+
<p><span class="versionmodified added">Added in version 3.18: </span>When a device link step is involved, which is controlled by
|
| 89 |
+
<span class="target" id="index-0-prop_tgt:CUDA_SEPARABLE_COMPILATION"></span><a class="reference internal" href="../prop_tgt/CUDA_SEPARABLE_COMPILATION.html#prop_tgt:CUDA_SEPARABLE_COMPILATION" title="CUDA_SEPARABLE_COMPILATION"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CUDA_SEPARABLE_COMPILATION</span></code></a> and
|
| 90 |
+
<span class="target" id="index-0-prop_tgt:CUDA_RESOLVE_DEVICE_SYMBOLS"></span><a class="reference internal" href="../prop_tgt/CUDA_RESOLVE_DEVICE_SYMBOLS.html#prop_tgt:CUDA_RESOLVE_DEVICE_SYMBOLS" title="CUDA_RESOLVE_DEVICE_SYMBOLS"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CUDA_RESOLVE_DEVICE_SYMBOLS</span></code></a> properties and policy <span class="target" id="index-0-policy:CMP0105"></span><a class="reference internal" href="../policy/CMP0105.html#policy:CMP0105" title="CMP0105"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0105</span></code></a>,
|
| 91 |
+
the raw options will be delivered to the host and device link steps (wrapped in
|
| 92 |
+
<code class="docutils literal notranslate"><span class="pre">-Xcompiler</span></code> or equivalent for device link). Options wrapped with
|
| 93 |
+
<span class="target" id="index-0-genex:DEVICE_LINK"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:DEVICE_LINK" title="DEVICE_LINK"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">$<DEVICE_LINK:...></span></code></a> generator expression will be used
|
| 94 |
+
only for the device link step. Options wrapped with <span class="target" id="index-0-genex:HOST_LINK"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#genex:HOST_LINK" title="HOST_LINK"><code class="xref cmake cmake-genex docutils literal notranslate"><span class="pre">$<HOST_LINK:...></span></code></a>
|
| 95 |
+
generator expression will be used only for the host link step.</p>
|
| 96 |
+
</div>
|
| 97 |
+
</section>
|
| 98 |
+
<section id="option-de-duplication">
|
| 99 |
+
<h2>Option De-duplication<a class="headerlink" href="#option-de-duplication" title="Link to this heading">¶</a></h2>
|
| 100 |
+
<p>The final set of options used for a target is constructed by
|
| 101 |
+
accumulating options from the current target and the usage requirements of
|
| 102 |
+
its dependencies. The set of options is de-duplicated to avoid repetition.</p>
|
| 103 |
+
<div class="versionadded">
|
| 104 |
+
<p><span class="versionmodified added">Added in version 3.12: </span>While beneficial for individual options, the de-duplication step can break
|
| 105 |
+
up option groups. For example, <code class="docutils literal notranslate"><span class="pre">-option</span> <span class="pre">A</span> <span class="pre">-option</span> <span class="pre">B</span></code> becomes
|
| 106 |
+
<code class="docutils literal notranslate"><span class="pre">-option</span> <span class="pre">A</span> <span class="pre">B</span></code>. One may specify a group of options using shell-like
|
| 107 |
+
quoting along with a <code class="docutils literal notranslate"><span class="pre">SHELL:</span></code> prefix. The <code class="docutils literal notranslate"><span class="pre">SHELL:</span></code> prefix is dropped,
|
| 108 |
+
and the rest of the option string is parsed using the
|
| 109 |
+
<span class="target" id="index-0-command:separate_arguments"></span><a class="reference internal" href="separate_arguments.html#command:separate_arguments" title="separate_arguments"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">separate_arguments()</span></code></a> <code class="docutils literal notranslate"><span class="pre">UNIX_COMMAND</span></code> mode. For example,
|
| 110 |
+
<code class="docutils literal notranslate"><span class="pre">"SHELL:-option</span> <span class="pre">A"</span> <span class="pre">"SHELL:-option</span> <span class="pre">B"</span></code> becomes <code class="docutils literal notranslate"><span class="pre">-option</span> <span class="pre">A</span> <span class="pre">-option</span> <span class="pre">B</span></code>.</p>
|
| 111 |
+
</div>
|
| 112 |
+
</section>
|
| 113 |
+
<section id="handling-compiler-driver-differences">
|
| 114 |
+
<h2>Handling Compiler Driver Differences<a class="headerlink" href="#handling-compiler-driver-differences" title="Link to this heading">¶</a></h2>
|
| 115 |
+
<p>To pass options to the linker tool, each compiler driver has its own syntax.
|
| 116 |
+
The <code class="docutils literal notranslate"><span class="pre">LINKER:</span></code> prefix and <code class="docutils literal notranslate"><span class="pre">,</span></code> separator can be used to specify, in a portable
|
| 117 |
+
way, options to pass to the linker tool. <code class="docutils literal notranslate"><span class="pre">LINKER:</span></code> is replaced by the
|
| 118 |
+
appropriate driver option and <code class="docutils literal notranslate"><span class="pre">,</span></code> by the appropriate driver separator.
|
| 119 |
+
The driver prefix and driver separator are given by the values of the
|
| 120 |
+
<span class="target" id="index-0-variable:CMAKE_<LANG>_LINKER_WRAPPER_FLAG"></span><a class="reference internal" href="../variable/CMAKE_LANG_LINKER_WRAPPER_FLAG.html#variable:CMAKE_<LANG>_LINKER_WRAPPER_FLAG" title="CMAKE_<LANG>_LINKER_WRAPPER_FLAG"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_<LANG>_LINKER_WRAPPER_FLAG</span></code></a> and
|
| 121 |
+
<span class="target" id="index-0-variable:CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP"></span><a class="reference internal" href="../variable/CMAKE_LANG_LINKER_WRAPPER_FLAG_SEP.html#variable:CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP" title="CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP</span></code></a> variables.</p>
|
| 122 |
+
<p>For example, <code class="docutils literal notranslate"><span class="pre">"LINKER:-z,defs"</span></code> becomes <code class="docutils literal notranslate"><span class="pre">-Xlinker</span> <span class="pre">-z</span> <span class="pre">-Xlinker</span> <span class="pre">defs</span></code> for
|
| 123 |
+
<code class="docutils literal notranslate"><span class="pre">Clang</span></code> and <code class="docutils literal notranslate"><span class="pre">-Wl,-z,defs</span></code> for <code class="docutils literal notranslate"><span class="pre">GNU</span> <span class="pre">GCC</span></code>.</p>
|
| 124 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">LINKER:</span></code> prefix can be specified as part of a <code class="docutils literal notranslate"><span class="pre">SHELL:</span></code> prefix
|
| 125 |
+
expression.</p>
|
| 126 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">LINKER:</span></code> prefix supports, as an alternative syntax, specification of
|
| 127 |
+
arguments using the <code class="docutils literal notranslate"><span class="pre">SHELL:</span></code> prefix and space as separator. The previous
|
| 128 |
+
example then becomes <code class="docutils literal notranslate"><span class="pre">"LINKER:SHELL:-z</span> <span class="pre">defs"</span></code>.</p>
|
| 129 |
+
<div class="admonition note">
|
| 130 |
+
<p class="admonition-title">Note</p>
|
| 131 |
+
<p>Specifying the <code class="docutils literal notranslate"><span class="pre">SHELL:</span></code> prefix anywhere other than at the beginning of the
|
| 132 |
+
<code class="docutils literal notranslate"><span class="pre">LINKER:</span></code> prefix is not supported.</p>
|
| 133 |
+
</div>
|
| 134 |
+
</section>
|
| 135 |
+
<section id="see-also">
|
| 136 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 137 |
+
<ul class="simple">
|
| 138 |
+
<li><p><span class="target" id="index-1-command:link_libraries"></span><a class="reference internal" href="link_libraries.html#command:link_libraries" title="link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">link_libraries()</span></code></a></p></li>
|
| 139 |
+
<li><p><span class="target" id="index-1-command:target_link_libraries"></span><a class="reference internal" href="target_link_libraries.html#command:target_link_libraries" title="target_link_libraries"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_libraries()</span></code></a></p></li>
|
| 140 |
+
<li><p><span class="target" id="index-0-command:target_link_options"></span><a class="reference internal" href="target_link_options.html#command:target_link_options" title="target_link_options"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_link_options()</span></code></a></p></li>
|
| 141 |
+
<li><p><span class="target" id="index-0-variable:CMAKE_<LANG>_FLAGS"></span><a class="reference internal" href="../variable/CMAKE_LANG_FLAGS.html#variable:CMAKE_<LANG>_FLAGS" title="CMAKE_<LANG>_FLAGS"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_<LANG>_FLAGS</span></code></a> and <span class="target" id="index-0-variable:CMAKE_<LANG>_FLAGS_<CONFIG>"></span><a class="reference internal" href="../variable/CMAKE_LANG_FLAGS_CONFIG.html#variable:CMAKE_<LANG>_FLAGS_<CONFIG>" title="CMAKE_<LANG>_FLAGS_<CONFIG>"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_<LANG>_FLAGS_<CONFIG></span></code></a>
|
| 142 |
+
add language-wide flags passed to all invocations of the compiler.
|
| 143 |
+
This includes invocations that drive compiling and those that drive linking.</p></li>
|
| 144 |
+
</ul>
|
| 145 |
+
</section>
|
| 146 |
+
</section>
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
<div class="clearer"></div>
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 154 |
+
<div class="sphinxsidebarwrapper">
|
| 155 |
+
<div>
|
| 156 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 157 |
+
<ul>
|
| 158 |
+
<li><a class="reference internal" href="#">add_link_options</a><ul>
|
| 159 |
+
<li><a class="reference internal" href="#host-and-device-specific-link-options">Host And Device Specific Link Options</a></li>
|
| 160 |
+
<li><a class="reference internal" href="#option-de-duplication">Option De-duplication</a></li>
|
| 161 |
+
<li><a class="reference internal" href="#handling-compiler-driver-differences">Handling Compiler Driver Differences</a></li>
|
| 162 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 163 |
+
</ul>
|
| 164 |
+
</li>
|
| 165 |
+
</ul>
|
| 166 |
+
|
| 167 |
+
</div>
|
| 168 |
+
<div>
|
| 169 |
+
<h4>Previous topic</h4>
|
| 170 |
+
<p class="topless"><a href="add_library.html"
|
| 171 |
+
title="previous chapter">add_library</a></p>
|
| 172 |
+
</div>
|
| 173 |
+
<div>
|
| 174 |
+
<h4>Next topic</h4>
|
| 175 |
+
<p class="topless"><a href="add_subdirectory.html"
|
| 176 |
+
title="next chapter">add_subdirectory</a></p>
|
| 177 |
+
</div>
|
| 178 |
+
<div role="note" aria-label="source link">
|
| 179 |
+
<h3>This Page</h3>
|
| 180 |
+
<ul class="this-page-menu">
|
| 181 |
+
<li><a href="../_sources/command/add_link_options.rst.txt"
|
| 182 |
+
rel="nofollow">Show Source</a></li>
|
| 183 |
+
</ul>
|
| 184 |
+
</div>
|
| 185 |
+
<search id="searchbox" style="display: none" role="search">
|
| 186 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 187 |
+
<div class="searchformwrapper">
|
| 188 |
+
<form class="search" action="../search.html" method="get">
|
| 189 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 190 |
+
<input type="submit" value="Go" />
|
| 191 |
+
</form>
|
| 192 |
+
</div>
|
| 193 |
+
</search>
|
| 194 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 195 |
+
</div>
|
| 196 |
+
</div>
|
| 197 |
+
<div class="clearer"></div>
|
| 198 |
+
</div>
|
| 199 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 200 |
+
<h3>Navigation</h3>
|
| 201 |
+
<ul>
|
| 202 |
+
<li class="right" style="margin-right: 10px">
|
| 203 |
+
<a href="../genindex.html" title="General Index"
|
| 204 |
+
>index</a></li>
|
| 205 |
+
<li class="right" >
|
| 206 |
+
<a href="add_subdirectory.html" title="add_subdirectory"
|
| 207 |
+
>next</a> |</li>
|
| 208 |
+
<li class="right" >
|
| 209 |
+
<a href="add_library.html" title="add_library"
|
| 210 |
+
>previous</a> |</li>
|
| 211 |
+
<li>
|
| 212 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 213 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 214 |
+
</li>
|
| 215 |
+
<li>
|
| 216 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 217 |
+
</li>
|
| 218 |
+
<li>
|
| 219 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 220 |
+
</li>
|
| 221 |
+
|
| 222 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 223 |
+
<li class="nav-item nav-item-this"><a href="">add_link_options</a></li>
|
| 224 |
+
</ul>
|
| 225 |
+
</div>
|
| 226 |
+
|
| 227 |
+
<div class="footer" role="contentinfo">
|
| 228 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 229 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 230 |
+
</div>
|
| 231 |
+
</body>
|
| 232 |
+
</html>
|
cmake/doc/cmake/html/command/add_subdirectory.html
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_subdirectory — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="add_test" href="add_test.html" />
|
| 21 |
+
<link rel="prev" title="add_link_options" href="add_link_options.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="add_test.html" title="add_test"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_link_options.html" title="add_link_options"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_subdirectory</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-subdirectory">
|
| 60 |
+
<span id="command:add_subdirectory"></span><h1>add_subdirectory<a class="headerlink" href="#add-subdirectory" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Add a subdirectory to the build.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_subdirectory(</span><span class="nb">source_dir</span><span class="w"> </span><span class="p">[</span><span class="nb">binary_dir</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FROM_ALL</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">SYSTEM</span><span class="p">]</span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Adds a subdirectory to the build. The <code class="docutils literal notranslate"><span class="pre">source_dir</span></code> specifies the
|
| 66 |
+
directory in which the source <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> and code files are
|
| 67 |
+
located. If it is a relative path, it will be evaluated with respect
|
| 68 |
+
to the current directory (the typical usage), but it may also be an
|
| 69 |
+
absolute path. The <code class="docutils literal notranslate"><span class="pre">binary_dir</span></code> specifies the directory in which to
|
| 70 |
+
place the output files. If it is a relative path, it will be evaluated
|
| 71 |
+
with respect to the current output directory, but it may also be an
|
| 72 |
+
absolute path. If <code class="docutils literal notranslate"><span class="pre">binary_dir</span></code> is not specified, the value of
|
| 73 |
+
<code class="docutils literal notranslate"><span class="pre">source_dir</span></code>, before expanding any relative path, will be used (the
|
| 74 |
+
typical usage). The <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file in the specified source
|
| 75 |
+
directory will be processed immediately by CMake before processing in
|
| 76 |
+
the current input file continues beyond this command.</p>
|
| 77 |
+
<p>If the <code class="docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code> argument is provided then the
|
| 78 |
+
<span class="target" id="index-0-prop_dir:EXCLUDE_FROM_ALL"></span><a class="reference internal" href="../prop_dir/EXCLUDE_FROM_ALL.html#prop_dir:EXCLUDE_FROM_ALL" title="EXCLUDE_FROM_ALL"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></a> property will be set on the added directory.
|
| 79 |
+
This will exclude the directory from a default build. See the directory
|
| 80 |
+
property <span class="target" id="index-1-prop_dir:EXCLUDE_FROM_ALL"></span><a class="reference internal" href="../prop_dir/EXCLUDE_FROM_ALL.html#prop_dir:EXCLUDE_FROM_ALL" title="EXCLUDE_FROM_ALL"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">EXCLUDE_FROM_ALL</span></code></a> for full details.</p>
|
| 81 |
+
<div class="versionadded">
|
| 82 |
+
<p><span class="versionmodified added">Added in version 3.25: </span>If the <code class="docutils literal notranslate"><span class="pre">SYSTEM</span></code> argument is provided, the <span class="target" id="index-0-prop_dir:SYSTEM"></span><a class="reference internal" href="../prop_dir/SYSTEM.html#prop_dir:SYSTEM" title="SYSTEM"><code class="xref cmake cmake-prop_dir docutils literal notranslate"><span class="pre">SYSTEM</span></code></a> directory
|
| 83 |
+
property of the subdirectory will be set to true. This property is
|
| 84 |
+
used to initialize the <span class="target" id="index-0-prop_tgt:SYSTEM"></span><a class="reference internal" href="../prop_tgt/SYSTEM.html#prop_tgt:SYSTEM" title="SYSTEM"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">SYSTEM</span></code></a> property of each non-imported
|
| 85 |
+
target created in that subdirectory.</p>
|
| 86 |
+
</div>
|
| 87 |
+
</section>
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
<div class="clearer"></div>
|
| 91 |
+
</div>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 95 |
+
<div class="sphinxsidebarwrapper">
|
| 96 |
+
<div>
|
| 97 |
+
<h4>Previous topic</h4>
|
| 98 |
+
<p class="topless"><a href="add_link_options.html"
|
| 99 |
+
title="previous chapter">add_link_options</a></p>
|
| 100 |
+
</div>
|
| 101 |
+
<div>
|
| 102 |
+
<h4>Next topic</h4>
|
| 103 |
+
<p class="topless"><a href="add_test.html"
|
| 104 |
+
title="next chapter">add_test</a></p>
|
| 105 |
+
</div>
|
| 106 |
+
<div role="note" aria-label="source link">
|
| 107 |
+
<h3>This Page</h3>
|
| 108 |
+
<ul class="this-page-menu">
|
| 109 |
+
<li><a href="../_sources/command/add_subdirectory.rst.txt"
|
| 110 |
+
rel="nofollow">Show Source</a></li>
|
| 111 |
+
</ul>
|
| 112 |
+
</div>
|
| 113 |
+
<search id="searchbox" style="display: none" role="search">
|
| 114 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 115 |
+
<div class="searchformwrapper">
|
| 116 |
+
<form class="search" action="../search.html" method="get">
|
| 117 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 118 |
+
<input type="submit" value="Go" />
|
| 119 |
+
</form>
|
| 120 |
+
</div>
|
| 121 |
+
</search>
|
| 122 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
<div class="clearer"></div>
|
| 126 |
+
</div>
|
| 127 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 128 |
+
<h3>Navigation</h3>
|
| 129 |
+
<ul>
|
| 130 |
+
<li class="right" style="margin-right: 10px">
|
| 131 |
+
<a href="../genindex.html" title="General Index"
|
| 132 |
+
>index</a></li>
|
| 133 |
+
<li class="right" >
|
| 134 |
+
<a href="add_test.html" title="add_test"
|
| 135 |
+
>next</a> |</li>
|
| 136 |
+
<li class="right" >
|
| 137 |
+
<a href="add_link_options.html" title="add_link_options"
|
| 138 |
+
>previous</a> |</li>
|
| 139 |
+
<li>
|
| 140 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 141 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 142 |
+
</li>
|
| 143 |
+
<li>
|
| 144 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 145 |
+
</li>
|
| 146 |
+
<li>
|
| 147 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 148 |
+
</li>
|
| 149 |
+
|
| 150 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 151 |
+
<li class="nav-item nav-item-this"><a href="">add_subdirectory</a></li>
|
| 152 |
+
</ul>
|
| 153 |
+
</div>
|
| 154 |
+
|
| 155 |
+
<div class="footer" role="contentinfo">
|
| 156 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 157 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 158 |
+
</div>
|
| 159 |
+
</body>
|
| 160 |
+
</html>
|
cmake/doc/cmake/html/command/add_test.html
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>add_test — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="aux_source_directory" href="aux_source_directory.html" />
|
| 21 |
+
<link rel="prev" title="add_subdirectory" href="add_subdirectory.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="aux_source_directory.html" title="aux_source_directory"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_subdirectory.html" title="add_subdirectory"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">add_test</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="add-test">
|
| 60 |
+
<span id="command:add_test"></span><h1>add_test<a class="headerlink" href="#add-test" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Add a test to the project to be run by <span class="target" id="index-0-manual:ctest(1)"></span><a class="reference internal" href="../manual/ctest.1.html#manual:ctest(1)" title="ctest(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">ctest(1)</span></code></a>.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_test(</span><span class="no">NAME</span><span class="w"> </span><span class="nv"><name></span><span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nv"><command></span><span class="w"> </span><span class="p">[</span><span class="nv"><arg>...</span><span class="p">]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CONFIGURATIONS</span><span class="w"> </span><span class="nv"><config>...</span><span class="p">]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">WORKING_DIRECTORY</span><span class="w"> </span><span class="nv"><dir></span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COMMAND_EXPAND_LISTS</span><span class="p">]</span><span class="nf">)</span>
|
| 66 |
+
</pre></div>
|
| 67 |
+
</div>
|
| 68 |
+
<p>Adds a test called <code class="docutils literal notranslate"><span class="pre"><name></span></code>. The test name may contain arbitrary
|
| 69 |
+
characters, expressed as a <a class="reference internal" href="../manual/cmake-language.7.html#quoted-argument"><span class="std std-ref">Quoted Argument</span></a> or <a class="reference internal" href="../manual/cmake-language.7.html#bracket-argument"><span class="std std-ref">Bracket Argument</span></a>
|
| 70 |
+
if necessary. See policy <span class="target" id="index-0-policy:CMP0110"></span><a class="reference internal" href="../policy/CMP0110.html#policy:CMP0110" title="CMP0110"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0110</span></code></a>.</p>
|
| 71 |
+
<p>CMake only generates tests if the <span class="target" id="index-0-command:enable_testing"></span><a class="reference internal" href="enable_testing.html#command:enable_testing" title="enable_testing"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">enable_testing()</span></code></a> command has been
|
| 72 |
+
invoked. The <span class="target" id="index-0-module:CTest"></span><a class="reference internal" href="../module/CTest.html#module:CTest" title="CTest"><code class="xref cmake cmake-module docutils literal notranslate"><span class="pre">CTest</span></code></a> module invokes <code class="docutils literal notranslate"><span class="pre">enable_testing</span></code> automatically
|
| 73 |
+
unless <code class="docutils literal notranslate"><span class="pre">BUILD_TESTING</span></code> is set to <code class="docutils literal notranslate"><span class="pre">OFF</span></code>.</p>
|
| 74 |
+
<p>Tests added with the <code class="docutils literal notranslate"><span class="pre">add_test(NAME)</span></code> signature support using
|
| 75 |
+
<span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>
|
| 76 |
+
in test properties set by <span class="target" id="index-0-command:set_property"></span><a class="reference internal" href="set_property.html#command:set_property" title="set_property(test)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set_property(TEST)</span></code></a> or
|
| 77 |
+
<span class="target" id="index-0-command:set_tests_properties"></span><a class="reference internal" href="set_tests_properties.html#command:set_tests_properties" title="set_tests_properties"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set_tests_properties()</span></code></a>. Test properties may only be set in the
|
| 78 |
+
directory the test is created in.</p>
|
| 79 |
+
<p><code class="docutils literal notranslate"><span class="pre">add_test</span></code> options are:</p>
|
| 80 |
+
<dl>
|
| 81 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMAND</span></code></dt><dd><p>Specify the test command-line.</p>
|
| 82 |
+
<p>If <code class="docutils literal notranslate"><span class="pre"><command></span></code> specifies an executable target created by
|
| 83 |
+
<span class="target" id="index-0-command:add_executable"></span><a class="reference internal" href="add_executable.html#command:add_executable" title="add_executable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_executable()</span></code></a>:</p>
|
| 84 |
+
<ul>
|
| 85 |
+
<li><p>It will automatically be replaced by the location of the executable
|
| 86 |
+
created at build time.</p></li>
|
| 87 |
+
<li><div class="versionadded">
|
| 88 |
+
<p><span class="versionmodified added">Added in version 3.3: </span>The target's <span class="target" id="index-0-prop_tgt:CROSSCOMPILING_EMULATOR"></span><a class="reference internal" href="../prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR" title="CROSSCOMPILING_EMULATOR"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CROSSCOMPILING_EMULATOR</span></code></a>, if set, will be
|
| 89 |
+
used to run the command on the host:</p>
|
| 90 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span><emulator> <command>
|
| 91 |
+
</pre></div>
|
| 92 |
+
</div>
|
| 93 |
+
<div class="versionchanged">
|
| 94 |
+
<p><span class="versionmodified changed">Changed in version 3.29: </span>The emulator is used only when
|
| 95 |
+
<span class="target" id="index-0-variable:CMAKE_CROSSCOMPILING"></span><a class="reference internal" href="../variable/CMAKE_CROSSCOMPILING.html#variable:CMAKE_CROSSCOMPILING" title="CMAKE_CROSSCOMPILING"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">cross-compiling</span></code></a>.
|
| 96 |
+
See policy <span class="target" id="index-0-policy:CMP0158"></span><a class="reference internal" href="../policy/CMP0158.html#policy:CMP0158" title="CMP0158"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0158</span></code></a>.</p>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</li>
|
| 100 |
+
<li><div class="versionadded">
|
| 101 |
+
<p><span class="versionmodified added">Added in version 3.29: </span>The target's <span class="target" id="index-0-prop_tgt:TEST_LAUNCHER"></span><a class="reference internal" href="../prop_tgt/TEST_LAUNCHER.html#prop_tgt:TEST_LAUNCHER" title="TEST_LAUNCHER"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">TEST_LAUNCHER</span></code></a>, if set, will be
|
| 102 |
+
used to launch the command:</p>
|
| 103 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span><launcher> <command>
|
| 104 |
+
</pre></div>
|
| 105 |
+
</div>
|
| 106 |
+
<p>If the <span class="target" id="index-1-prop_tgt:CROSSCOMPILING_EMULATOR"></span><a class="reference internal" href="../prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR" title="CROSSCOMPILING_EMULATOR"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">CROSSCOMPILING_EMULATOR</span></code></a> is also set, both are used:</p>
|
| 107 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span><launcher> <emulator> <command>
|
| 108 |
+
</pre></div>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</li>
|
| 112 |
+
</ul>
|
| 113 |
+
<p>The command may be specified using
|
| 114 |
+
<span class="target" id="index-1-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 115 |
+
</dd>
|
| 116 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CONFIGURATIONS</span></code></dt><dd><p>Restrict execution of the test only to the named configurations.</p>
|
| 117 |
+
</dd>
|
| 118 |
+
<dt><code class="docutils literal notranslate"><span class="pre">WORKING_DIRECTORY</span></code></dt><dd><p>Set the test property <span class="target" id="index-0-prop_test:WORKING_DIRECTORY"></span><a class="reference internal" href="../prop_test/WORKING_DIRECTORY.html#prop_test:WORKING_DIRECTORY" title="WORKING_DIRECTORY"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">WORKING_DIRECTORY</span></code></a> in which to execute the
|
| 119 |
+
test. If not specified, the test will be run in
|
| 120 |
+
<span class="target" id="index-0-variable:CMAKE_CURRENT_BINARY_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_BINARY_DIR.html#variable:CMAKE_CURRENT_BINARY_DIR" title="CMAKE_CURRENT_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_BINARY_DIR</span></code></a>. The working directory may be specified
|
| 121 |
+
using <span class="target" id="index-2-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 122 |
+
</dd>
|
| 123 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COMMAND_EXPAND_LISTS</span></code></dt><dd><div class="versionadded">
|
| 124 |
+
<p><span class="versionmodified added">Added in version 3.16.</span></p>
|
| 125 |
+
</div>
|
| 126 |
+
<p>Lists in <code class="docutils literal notranslate"><span class="pre">COMMAND</span></code> arguments will be expanded, including those created with
|
| 127 |
+
<span class="target" id="index-3-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
|
| 128 |
+
</dd>
|
| 129 |
+
</dl>
|
| 130 |
+
<p>If the test command exits with code <code class="docutils literal notranslate"><span class="pre">0</span></code> the test passes. Non-zero exit code
|
| 131 |
+
is a "failed" test. The test property <span class="target" id="index-0-prop_test:WILL_FAIL"></span><a class="reference internal" href="../prop_test/WILL_FAIL.html#prop_test:WILL_FAIL" title="WILL_FAIL"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">WILL_FAIL</span></code></a> inverts this
|
| 132 |
+
logic. Note that system-level test failures such as segmentation faults or
|
| 133 |
+
heap errors will still fail the test even if <code class="docutils literal notranslate"><span class="pre">WILL_FAIL</span></code> is true. Output
|
| 134 |
+
written to stdout or stderr is captured by <span class="target" id="index-1-manual:ctest(1)"></span><a class="reference internal" href="../manual/ctest.1.html#manual:ctest(1)" title="ctest(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">ctest(1)</span></code></a> and only
|
| 135 |
+
affects the pass/fail status via the <span class="target" id="index-0-prop_test:PASS_REGULAR_EXPRESSION"></span><a class="reference internal" href="../prop_test/PASS_REGULAR_EXPRESSION.html#prop_test:PASS_REGULAR_EXPRESSION" title="PASS_REGULAR_EXPRESSION"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">PASS_REGULAR_EXPRESSION</span></code></a>,
|
| 136 |
+
<span class="target" id="index-0-prop_test:FAIL_REGULAR_EXPRESSION"></span><a class="reference internal" href="../prop_test/FAIL_REGULAR_EXPRESSION.html#prop_test:FAIL_REGULAR_EXPRESSION" title="FAIL_REGULAR_EXPRESSION"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">FAIL_REGULAR_EXPRESSION</span></code></a>, or <span class="target" id="index-0-prop_test:SKIP_REGULAR_EXPRESSION"></span><a class="reference internal" href="../prop_test/SKIP_REGULAR_EXPRESSION.html#prop_test:SKIP_REGULAR_EXPRESSION" title="SKIP_REGULAR_EXPRESSION"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">SKIP_REGULAR_EXPRESSION</span></code></a>
|
| 137 |
+
test properties.</p>
|
| 138 |
+
<div class="versionadded">
|
| 139 |
+
<p><span class="versionmodified added">Added in version 3.16: </span>Added <span class="target" id="index-1-prop_test:SKIP_REGULAR_EXPRESSION"></span><a class="reference internal" href="../prop_test/SKIP_REGULAR_EXPRESSION.html#prop_test:SKIP_REGULAR_EXPRESSION" title="SKIP_REGULAR_EXPRESSION"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">SKIP_REGULAR_EXPRESSION</span></code></a> property.</p>
|
| 140 |
+
</div>
|
| 141 |
+
<p>Example usage:</p>
|
| 142 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_test(</span><span class="no">NAME</span><span class="w"> </span><span class="nb">mytest</span>
|
| 143 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">testDriver</span><span class="w"> </span><span class="p">--</span><span class="nb">config</span><span class="w"> </span><span class="o">$<</span><span class="no">CONFIG</span><span class="o">></span>
|
| 144 |
+
<span class="w"> </span><span class="p">--</span><span class="nb">exe</span><span class="w"> </span><span class="o">$<</span><span class="no">TARGET_FILE</span><span class="o">:</span><span class="nb">myexe</span><span class="o">></span><span class="nf">)</span>
|
| 145 |
+
</pre></div>
|
| 146 |
+
</div>
|
| 147 |
+
<p>This creates a test <code class="docutils literal notranslate"><span class="pre">mytest</span></code> whose command runs a <code class="docutils literal notranslate"><span class="pre">testDriver</span></code> tool
|
| 148 |
+
passing the configuration name and the full path to the executable
|
| 149 |
+
file produced by target <code class="docutils literal notranslate"><span class="pre">myexe</span></code>.</p>
|
| 150 |
+
<hr class="docutils" />
|
| 151 |
+
<p>The command syntax above is recommended over the older, less flexible form:</p>
|
| 152 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_test(</span><span class="nv"><name></span><span class="w"> </span><span class="nv"><command></span><span class="w"> </span><span class="p">[</span><span class="nv"><arg>...</span><span class="p">]</span><span class="nf">)</span>
|
| 153 |
+
</pre></div>
|
| 154 |
+
</div>
|
| 155 |
+
<p>Add a test called <code class="docutils literal notranslate"><span class="pre"><name></span></code> with the given command-line.</p>
|
| 156 |
+
<p>Unlike the above <code class="docutils literal notranslate"><span class="pre">NAME</span></code> signature, target names are not supported
|
| 157 |
+
in the command-line. Furthermore, tests added with this signature do not
|
| 158 |
+
support <span class="target" id="index-4-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>
|
| 159 |
+
in the command-line or test properties.</p>
|
| 160 |
+
</section>
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
<div class="clearer"></div>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
</div>
|
| 167 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 168 |
+
<div class="sphinxsidebarwrapper">
|
| 169 |
+
<div>
|
| 170 |
+
<h4>Previous topic</h4>
|
| 171 |
+
<p class="topless"><a href="add_subdirectory.html"
|
| 172 |
+
title="previous chapter">add_subdirectory</a></p>
|
| 173 |
+
</div>
|
| 174 |
+
<div>
|
| 175 |
+
<h4>Next topic</h4>
|
| 176 |
+
<p class="topless"><a href="aux_source_directory.html"
|
| 177 |
+
title="next chapter">aux_source_directory</a></p>
|
| 178 |
+
</div>
|
| 179 |
+
<div role="note" aria-label="source link">
|
| 180 |
+
<h3>This Page</h3>
|
| 181 |
+
<ul class="this-page-menu">
|
| 182 |
+
<li><a href="../_sources/command/add_test.rst.txt"
|
| 183 |
+
rel="nofollow">Show Source</a></li>
|
| 184 |
+
</ul>
|
| 185 |
+
</div>
|
| 186 |
+
<search id="searchbox" style="display: none" role="search">
|
| 187 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 188 |
+
<div class="searchformwrapper">
|
| 189 |
+
<form class="search" action="../search.html" method="get">
|
| 190 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 191 |
+
<input type="submit" value="Go" />
|
| 192 |
+
</form>
|
| 193 |
+
</div>
|
| 194 |
+
</search>
|
| 195 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 196 |
+
</div>
|
| 197 |
+
</div>
|
| 198 |
+
<div class="clearer"></div>
|
| 199 |
+
</div>
|
| 200 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 201 |
+
<h3>Navigation</h3>
|
| 202 |
+
<ul>
|
| 203 |
+
<li class="right" style="margin-right: 10px">
|
| 204 |
+
<a href="../genindex.html" title="General Index"
|
| 205 |
+
>index</a></li>
|
| 206 |
+
<li class="right" >
|
| 207 |
+
<a href="aux_source_directory.html" title="aux_source_directory"
|
| 208 |
+
>next</a> |</li>
|
| 209 |
+
<li class="right" >
|
| 210 |
+
<a href="add_subdirectory.html" title="add_subdirectory"
|
| 211 |
+
>previous</a> |</li>
|
| 212 |
+
<li>
|
| 213 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 214 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 215 |
+
</li>
|
| 216 |
+
<li>
|
| 217 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 218 |
+
</li>
|
| 219 |
+
<li>
|
| 220 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 221 |
+
</li>
|
| 222 |
+
|
| 223 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 224 |
+
<li class="nav-item nav-item-this"><a href="">add_test</a></li>
|
| 225 |
+
</ul>
|
| 226 |
+
</div>
|
| 227 |
+
|
| 228 |
+
<div class="footer" role="contentinfo">
|
| 229 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 230 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 231 |
+
</div>
|
| 232 |
+
</body>
|
| 233 |
+
</html>
|
cmake/doc/cmake/html/command/aux_source_directory.html
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>aux_source_directory — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="build_command" href="build_command.html" />
|
| 21 |
+
<link rel="prev" title="add_test" href="add_test.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="build_command.html" title="build_command"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="add_test.html" title="add_test"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">aux_source_directory</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="aux-source-directory">
|
| 60 |
+
<span id="command:aux_source_directory"></span><h1>aux_source_directory<a class="headerlink" href="#aux-source-directory" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Find all source files in a directory.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">aux_source_directory(</span><span class="nv"><dir></span><span class="w"> </span><span class="nv"><variable></span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Collects the names of all the source files in the specified directory
|
| 66 |
+
and stores the list in the <code class="docutils literal notranslate"><span class="pre"><variable></span></code> provided. This command is
|
| 67 |
+
intended to be used by projects that use explicit template
|
| 68 |
+
instantiation. Template instantiation files can be stored in a
|
| 69 |
+
<code class="docutils literal notranslate"><span class="pre">Templates</span></code> subdirectory and collected automatically using this
|
| 70 |
+
command to avoid manually listing all instantiations.</p>
|
| 71 |
+
<p>It is tempting to use this command to avoid writing the list of source
|
| 72 |
+
files for a library or executable target. While this seems to work,
|
| 73 |
+
there is no way for CMake to generate a build system that knows when a
|
| 74 |
+
new source file has been added. Normally the generated build system
|
| 75 |
+
knows when it needs to rerun CMake because the <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file is
|
| 76 |
+
modified to add a new source. When the source is just added to the
|
| 77 |
+
directory without modifying this file, one would have to manually
|
| 78 |
+
rerun CMake to generate a build system incorporating the new file.</p>
|
| 79 |
+
</section>
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
<div class="clearer"></div>
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 87 |
+
<div class="sphinxsidebarwrapper">
|
| 88 |
+
<div>
|
| 89 |
+
<h4>Previous topic</h4>
|
| 90 |
+
<p class="topless"><a href="add_test.html"
|
| 91 |
+
title="previous chapter">add_test</a></p>
|
| 92 |
+
</div>
|
| 93 |
+
<div>
|
| 94 |
+
<h4>Next topic</h4>
|
| 95 |
+
<p class="topless"><a href="build_command.html"
|
| 96 |
+
title="next chapter">build_command</a></p>
|
| 97 |
+
</div>
|
| 98 |
+
<div role="note" aria-label="source link">
|
| 99 |
+
<h3>This Page</h3>
|
| 100 |
+
<ul class="this-page-menu">
|
| 101 |
+
<li><a href="../_sources/command/aux_source_directory.rst.txt"
|
| 102 |
+
rel="nofollow">Show Source</a></li>
|
| 103 |
+
</ul>
|
| 104 |
+
</div>
|
| 105 |
+
<search id="searchbox" style="display: none" role="search">
|
| 106 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 107 |
+
<div class="searchformwrapper">
|
| 108 |
+
<form class="search" action="../search.html" method="get">
|
| 109 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 110 |
+
<input type="submit" value="Go" />
|
| 111 |
+
</form>
|
| 112 |
+
</div>
|
| 113 |
+
</search>
|
| 114 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="clearer"></div>
|
| 118 |
+
</div>
|
| 119 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 120 |
+
<h3>Navigation</h3>
|
| 121 |
+
<ul>
|
| 122 |
+
<li class="right" style="margin-right: 10px">
|
| 123 |
+
<a href="../genindex.html" title="General Index"
|
| 124 |
+
>index</a></li>
|
| 125 |
+
<li class="right" >
|
| 126 |
+
<a href="build_command.html" title="build_command"
|
| 127 |
+
>next</a> |</li>
|
| 128 |
+
<li class="right" >
|
| 129 |
+
<a href="add_test.html" title="add_test"
|
| 130 |
+
>previous</a> |</li>
|
| 131 |
+
<li>
|
| 132 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 133 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 134 |
+
</li>
|
| 135 |
+
<li>
|
| 136 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 137 |
+
</li>
|
| 138 |
+
<li>
|
| 139 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 140 |
+
</li>
|
| 141 |
+
|
| 142 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 143 |
+
<li class="nav-item nav-item-this"><a href="">aux_source_directory</a></li>
|
| 144 |
+
</ul>
|
| 145 |
+
</div>
|
| 146 |
+
|
| 147 |
+
<div class="footer" role="contentinfo">
|
| 148 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 149 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 150 |
+
</div>
|
| 151 |
+
</body>
|
| 152 |
+
</html>
|
cmake/doc/cmake/html/command/block.html
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>block — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="break" href="break.html" />
|
| 21 |
+
<link rel="prev" title="cmake-commands(7)" href="../manual/cmake-commands.7.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="break.html" title="break"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="../manual/cmake-commands.7.html" title="cmake-commands(7)"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">block</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="block">
|
| 60 |
+
<span id="command:block"></span><h1>block<a class="headerlink" href="#block" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.25.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<p>Evaluate a group of commands with a dedicated variable and/or policy scope.</p>
|
| 65 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">block(</span><span class="p">[</span><span class="no">SCOPE_FOR</span><span class="w"> </span><span class="p">[</span><span class="no">POLICIES</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">VARIABLES</span><span class="p">]</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">PROPAGATE</span><span class="w"> </span><span class="nv"><var-name>...</span><span class="p">]</span><span class="nf">)</span>
|
| 66 |
+
<span class="w"> </span><span class="nv"><commands></span>
|
| 67 |
+
<span class="nf">endblock()</span>
|
| 68 |
+
</pre></div>
|
| 69 |
+
</div>
|
| 70 |
+
<p>All commands between <code class="docutils literal notranslate"><span class="pre">block()</span></code> and the matching <span class="target" id="index-0-command:endblock"></span><a class="reference internal" href="endblock.html#command:endblock" title="endblock"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">endblock()</span></code></a> are
|
| 71 |
+
recorded without being invoked. Once the <span class="target" id="index-1-command:endblock"></span><a class="reference internal" href="endblock.html#command:endblock" title="endblock"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">endblock()</span></code></a> is evaluated, the
|
| 72 |
+
recorded list of commands is invoked inside the requested scopes, then the
|
| 73 |
+
scopes created by the <code class="docutils literal notranslate"><span class="pre">block()</span></code> command are removed.</p>
|
| 74 |
+
<dl>
|
| 75 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SCOPE_FOR</span></code></dt><dd><p>Specify which scopes must be created.</p>
|
| 76 |
+
<dl class="simple">
|
| 77 |
+
<dt><code class="docutils literal notranslate"><span class="pre">POLICIES</span></code></dt><dd><p>Create a new policy scope. This is equivalent to
|
| 78 |
+
<span class="target" id="index-0-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#push" title="cmake_policy(push)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(PUSH)</span></code></a> with an automatic
|
| 79 |
+
<span class="target" id="index-1-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#pop" title="cmake_policy(pop)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(POP)</span></code></a> when leaving the block scope.</p>
|
| 80 |
+
</dd>
|
| 81 |
+
<dt><code class="docutils literal notranslate"><span class="pre">VARIABLES</span></code></dt><dd><p>Create a new variable scope.</p>
|
| 82 |
+
</dd>
|
| 83 |
+
</dl>
|
| 84 |
+
<p>If <code class="docutils literal notranslate"><span class="pre">SCOPE_FOR</span></code> is not specified, this is equivalent to:</p>
|
| 85 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">block(</span><span class="no">SCOPE_FOR</span><span class="w"> </span><span class="no">VARIABLES</span><span class="w"> </span><span class="no">POLICIES</span><span class="nf">)</span>
|
| 86 |
+
</pre></div>
|
| 87 |
+
</div>
|
| 88 |
+
</dd>
|
| 89 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PROPAGATE</span></code></dt><dd><p>When a variable scope is created by the <span class="target" id="index-0-command:block"></span><a class="reference internal" href="#command:block" title="block"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">block()</span></code></a> command, this
|
| 90 |
+
option sets or unsets the specified variables in the parent scope. This is
|
| 91 |
+
equivalent to <span class="target" id="index-0-command:set"></span><a class="reference internal" href="set.html#command:set" title="set(parent_scope)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set(PARENT_SCOPE)</span></code></a> or <span class="target" id="index-0-command:unset"></span><a class="reference internal" href="unset.html#command:unset" title="unset(parent_scope)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">unset(PARENT_SCOPE)</span></code></a>
|
| 92 |
+
commands.</p>
|
| 93 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">var1</span><span class="w"> </span><span class="s">"INIT1"</span><span class="nf">)</span>
|
| 94 |
+
<span class="nf">set(</span><span class="nb">var2</span><span class="w"> </span><span class="s">"INIT2"</span><span class="nf">)</span>
|
| 95 |
+
|
| 96 |
+
<span class="nf">block(</span><span class="no">PROPAGATE</span><span class="w"> </span><span class="nb">var1</span><span class="w"> </span><span class="nb">var2</span><span class="nf">)</span>
|
| 97 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">var1</span><span class="w"> </span><span class="s">"VALUE1"</span><span class="nf">)</span>
|
| 98 |
+
<span class="w"> </span><span class="nf">unset(</span><span class="nb">var2</span><span class="nf">)</span>
|
| 99 |
+
<span class="nf">endblock()</span>
|
| 100 |
+
|
| 101 |
+
<span class="c"># Now var1 holds VALUE1, and var2 is unset</span>
|
| 102 |
+
</pre></div>
|
| 103 |
+
</div>
|
| 104 |
+
<p>This option is only allowed when a variable scope is created. An error will
|
| 105 |
+
be raised in the other cases.</p>
|
| 106 |
+
</dd>
|
| 107 |
+
</dl>
|
| 108 |
+
<p>When the <code class="docutils literal notranslate"><span class="pre">block()</span></code> is inside a <span class="target" id="index-0-command:foreach"></span><a class="reference internal" href="foreach.html#command:foreach" title="foreach"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">foreach()</span></code></a> or <span class="target" id="index-0-command:while"></span><a class="reference internal" href="while.html#command:while" title="while"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">while()</span></code></a>
|
| 109 |
+
command, the <span class="target" id="index-0-command:break"></span><a class="reference internal" href="break.html#command:break" title="break"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">break()</span></code></a> and <span class="target" id="index-0-command:continue"></span><a class="reference internal" href="continue.html#command:continue" title="continue"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">continue()</span></code></a> commands can be used
|
| 110 |
+
inside the block.</p>
|
| 111 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">while(</span><span class="no">TRUE</span><span class="nf">)</span>
|
| 112 |
+
<span class="w"> </span><span class="nf">block()</span>
|
| 113 |
+
<span class="w"> </span><span class="p">...</span>
|
| 114 |
+
<span class="w"> </span><span class="c"># the break() command will terminate the while() command</span>
|
| 115 |
+
<span class="w"> </span><span class="nf">break()</span>
|
| 116 |
+
<span class="w"> </span><span class="nf">endblock()</span>
|
| 117 |
+
<span class="nf">endwhile()</span>
|
| 118 |
+
</pre></div>
|
| 119 |
+
</div>
|
| 120 |
+
<section id="see-also">
|
| 121 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 122 |
+
<ul class="simple">
|
| 123 |
+
<li><p><span class="target" id="index-2-command:endblock"></span><a class="reference internal" href="endblock.html#command:endblock" title="endblock"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">endblock()</span></code></a></p></li>
|
| 124 |
+
<li><p><span class="target" id="index-0-command:return"></span><a class="reference internal" href="return.html#command:return" title="return"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">return()</span></code></a></p></li>
|
| 125 |
+
<li><p><span class="target" id="index-2-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#command:cmake_policy" title="cmake_policy"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy()</span></code></a></p></li>
|
| 126 |
+
</ul>
|
| 127 |
+
</section>
|
| 128 |
+
</section>
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
<div class="clearer"></div>
|
| 132 |
+
</div>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 136 |
+
<div class="sphinxsidebarwrapper">
|
| 137 |
+
<div>
|
| 138 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 139 |
+
<ul>
|
| 140 |
+
<li><a class="reference internal" href="#">block</a><ul>
|
| 141 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 142 |
+
</ul>
|
| 143 |
+
</li>
|
| 144 |
+
</ul>
|
| 145 |
+
|
| 146 |
+
</div>
|
| 147 |
+
<div>
|
| 148 |
+
<h4>Previous topic</h4>
|
| 149 |
+
<p class="topless"><a href="../manual/cmake-commands.7.html"
|
| 150 |
+
title="previous chapter">cmake-commands(7)</a></p>
|
| 151 |
+
</div>
|
| 152 |
+
<div>
|
| 153 |
+
<h4>Next topic</h4>
|
| 154 |
+
<p class="topless"><a href="break.html"
|
| 155 |
+
title="next chapter">break</a></p>
|
| 156 |
+
</div>
|
| 157 |
+
<div role="note" aria-label="source link">
|
| 158 |
+
<h3>This Page</h3>
|
| 159 |
+
<ul class="this-page-menu">
|
| 160 |
+
<li><a href="../_sources/command/block.rst.txt"
|
| 161 |
+
rel="nofollow">Show Source</a></li>
|
| 162 |
+
</ul>
|
| 163 |
+
</div>
|
| 164 |
+
<search id="searchbox" style="display: none" role="search">
|
| 165 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 166 |
+
<div class="searchformwrapper">
|
| 167 |
+
<form class="search" action="../search.html" method="get">
|
| 168 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 169 |
+
<input type="submit" value="Go" />
|
| 170 |
+
</form>
|
| 171 |
+
</div>
|
| 172 |
+
</search>
|
| 173 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
<div class="clearer"></div>
|
| 177 |
+
</div>
|
| 178 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 179 |
+
<h3>Navigation</h3>
|
| 180 |
+
<ul>
|
| 181 |
+
<li class="right" style="margin-right: 10px">
|
| 182 |
+
<a href="../genindex.html" title="General Index"
|
| 183 |
+
>index</a></li>
|
| 184 |
+
<li class="right" >
|
| 185 |
+
<a href="break.html" title="break"
|
| 186 |
+
>next</a> |</li>
|
| 187 |
+
<li class="right" >
|
| 188 |
+
<a href="../manual/cmake-commands.7.html" title="cmake-commands(7)"
|
| 189 |
+
>previous</a> |</li>
|
| 190 |
+
<li>
|
| 191 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 192 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 193 |
+
</li>
|
| 194 |
+
<li>
|
| 195 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 196 |
+
</li>
|
| 197 |
+
<li>
|
| 198 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 199 |
+
</li>
|
| 200 |
+
|
| 201 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 202 |
+
<li class="nav-item nav-item-this"><a href="">block</a></li>
|
| 203 |
+
</ul>
|
| 204 |
+
</div>
|
| 205 |
+
|
| 206 |
+
<div class="footer" role="contentinfo">
|
| 207 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 208 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 209 |
+
</div>
|
| 210 |
+
</body>
|
| 211 |
+
</html>
|
cmake/doc/cmake/html/command/break.html
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>break — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_host_system_information" href="cmake_host_system_information.html" />
|
| 21 |
+
<link rel="prev" title="block" href="block.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_host_system_information.html" title="cmake_host_system_information"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="block.html" title="block"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">break</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="break">
|
| 60 |
+
<span id="command:break"></span><h1>break<a class="headerlink" href="#break" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Break from an enclosing foreach or while loop.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">break()</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Breaks from an enclosing <span class="target" id="index-0-command:foreach"></span><a class="reference internal" href="foreach.html#command:foreach" title="foreach"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">foreach()</span></code></a> or <span class="target" id="index-0-command:while"></span><a class="reference internal" href="while.html#command:while" title="while"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">while()</span></code></a> loop.</p>
|
| 66 |
+
<p>See also the <span class="target" id="index-0-command:continue"></span><a class="reference internal" href="continue.html#command:continue" title="continue"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">continue()</span></code></a> command.</p>
|
| 67 |
+
</section>
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
<div class="clearer"></div>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 75 |
+
<div class="sphinxsidebarwrapper">
|
| 76 |
+
<div>
|
| 77 |
+
<h4>Previous topic</h4>
|
| 78 |
+
<p class="topless"><a href="block.html"
|
| 79 |
+
title="previous chapter">block</a></p>
|
| 80 |
+
</div>
|
| 81 |
+
<div>
|
| 82 |
+
<h4>Next topic</h4>
|
| 83 |
+
<p class="topless"><a href="cmake_host_system_information.html"
|
| 84 |
+
title="next chapter">cmake_host_system_information</a></p>
|
| 85 |
+
</div>
|
| 86 |
+
<div role="note" aria-label="source link">
|
| 87 |
+
<h3>This Page</h3>
|
| 88 |
+
<ul class="this-page-menu">
|
| 89 |
+
<li><a href="../_sources/command/break.rst.txt"
|
| 90 |
+
rel="nofollow">Show Source</a></li>
|
| 91 |
+
</ul>
|
| 92 |
+
</div>
|
| 93 |
+
<search id="searchbox" style="display: none" role="search">
|
| 94 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 95 |
+
<div class="searchformwrapper">
|
| 96 |
+
<form class="search" action="../search.html" method="get">
|
| 97 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 98 |
+
<input type="submit" value="Go" />
|
| 99 |
+
</form>
|
| 100 |
+
</div>
|
| 101 |
+
</search>
|
| 102 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
<div class="clearer"></div>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 108 |
+
<h3>Navigation</h3>
|
| 109 |
+
<ul>
|
| 110 |
+
<li class="right" style="margin-right: 10px">
|
| 111 |
+
<a href="../genindex.html" title="General Index"
|
| 112 |
+
>index</a></li>
|
| 113 |
+
<li class="right" >
|
| 114 |
+
<a href="cmake_host_system_information.html" title="cmake_host_system_information"
|
| 115 |
+
>next</a> |</li>
|
| 116 |
+
<li class="right" >
|
| 117 |
+
<a href="block.html" title="block"
|
| 118 |
+
>previous</a> |</li>
|
| 119 |
+
<li>
|
| 120 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 121 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 122 |
+
</li>
|
| 123 |
+
<li>
|
| 124 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 125 |
+
</li>
|
| 126 |
+
<li>
|
| 127 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 128 |
+
</li>
|
| 129 |
+
|
| 130 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 131 |
+
<li class="nav-item nav-item-this"><a href="">break</a></li>
|
| 132 |
+
</ul>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<div class="footer" role="contentinfo">
|
| 136 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 137 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 138 |
+
</div>
|
| 139 |
+
</body>
|
| 140 |
+
</html>
|
cmake/doc/cmake/html/command/build_command.html
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>build_command — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_file_api" href="cmake_file_api.html" />
|
| 21 |
+
<link rel="prev" title="aux_source_directory" href="aux_source_directory.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_file_api.html" title="cmake_file_api"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="aux_source_directory.html" title="aux_source_directory"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">build_command</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="build-command">
|
| 60 |
+
<span id="command:build_command"></span><h1>build_command<a class="headerlink" href="#build-command" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Get a command line to build the current project.
|
| 62 |
+
This is mainly intended for internal use by the <span class="target" id="index-0-module:CTest"></span><a class="reference internal" href="../module/CTest.html#module:CTest" title="CTest"><code class="xref cmake cmake-module docutils literal notranslate"><span class="pre">CTest</span></code></a> module.</p>
|
| 63 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">build_command(</span><span class="nv"><variable></span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CONFIGURATION</span><span class="w"> </span><span class="nv"><config></span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PARALLEL_LEVEL</span><span class="w"> </span><span class="nv"><parallel></span><span class="p">]</span>
|
| 66 |
+
<span class="w"> </span><span class="p">[</span><span class="no">TARGET</span><span class="w"> </span><span class="nv"><target></span><span class="p">]</span>
|
| 67 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PROJECT_NAME</span><span class="w"> </span><span class="nv"><projname></span><span class="p">]</span><span class="w"> </span><span class="c"># legacy, causes warning</span>
|
| 68 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 69 |
+
</pre></div>
|
| 70 |
+
</div>
|
| 71 |
+
<p>Sets the given <code class="docutils literal notranslate"><span class="pre"><variable></span></code> to a command-line string of the form:</p>
|
| 72 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span><cmake> --build . [--config <config>] [--parallel <parallel>] [--target <target>...] [-- -i]
|
| 73 |
+
</pre></div>
|
| 74 |
+
</div>
|
| 75 |
+
<p>where <code class="docutils literal notranslate"><span class="pre"><cmake></span></code> is the location of the <span class="target" id="index-0-manual:cmake(1)"></span><a class="reference internal" href="../manual/cmake.1.html#manual:cmake(1)" title="cmake(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake(1)</span></code></a> command-line
|
| 76 |
+
tool, and <code class="docutils literal notranslate"><span class="pre"><config></span></code>, <code class="docutils literal notranslate"><span class="pre"><parallel></span></code> and <code class="docutils literal notranslate"><span class="pre"><target></span></code> are the values
|
| 77 |
+
provided to the <code class="docutils literal notranslate"><span class="pre">CONFIGURATION</span></code>, <code class="docutils literal notranslate"><span class="pre">PARALLEL_LEVEL</span></code> and <code class="docutils literal notranslate"><span class="pre">TARGET</span></code>
|
| 78 |
+
options, if any. The trailing <code class="docutils literal notranslate"><span class="pre">--</span> <span class="pre">-i</span></code> option is added for
|
| 79 |
+
<a class="reference internal" href="../manual/cmake-generators.7.html#makefile-generators"><span class="std std-ref">Makefile Generators</span></a> if policy <span class="target" id="index-0-policy:CMP0061"></span><a class="reference internal" href="../policy/CMP0061.html#policy:CMP0061" title="CMP0061"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0061</span></code></a> is not set to
|
| 80 |
+
<code class="docutils literal notranslate"><span class="pre">NEW</span></code>.</p>
|
| 81 |
+
<p>When invoked, this <a class="reference internal" href="../manual/cmake.1.html#cmdoption-cmake-build"><code class="xref std std-option docutils literal notranslate"><span class="pre">cmake</span> <span class="pre">--build</span></code></a> command line will launch the
|
| 82 |
+
underlying build system tool.</p>
|
| 83 |
+
<div class="versionadded">
|
| 84 |
+
<p><span class="versionmodified added">Added in version 3.21: </span>The <code class="docutils literal notranslate"><span class="pre">PARALLEL_LEVEL</span></code> argument can be used to set the
|
| 85 |
+
<a class="reference internal" href="../manual/cmake.1.html#cmdoption-cmake-build-j"><code class="xref std std-option docutils literal notranslate"><span class="pre">--parallel</span></code></a> flag.</p>
|
| 86 |
+
</div>
|
| 87 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">build_command(</span><span class="nv"><cachevariable></span><span class="w"> </span><span class="nv"><makecommand></span><span class="nf">)</span>
|
| 88 |
+
</pre></div>
|
| 89 |
+
</div>
|
| 90 |
+
<p>This second signature is deprecated, but still available for backwards
|
| 91 |
+
compatibility. Use the first signature instead.</p>
|
| 92 |
+
<p>It sets the given <code class="docutils literal notranslate"><span class="pre"><cachevariable></span></code> to a command-line string as
|
| 93 |
+
above but without the <a class="reference internal" href="../manual/cmake.1.html#cmdoption-cmake-build-t"><code class="xref std std-option docutils literal notranslate"><span class="pre">--target</span></code></a> option.
|
| 94 |
+
The <code class="docutils literal notranslate"><span class="pre"><makecommand></span></code> is ignored but should be the full path to
|
| 95 |
+
devenv, nmake, make or one of the end user build tools
|
| 96 |
+
for legacy invocations.</p>
|
| 97 |
+
<div class="admonition note">
|
| 98 |
+
<p class="admonition-title">Note</p>
|
| 99 |
+
<p>In CMake versions prior to 3.0 this command returned a command
|
| 100 |
+
line that directly invokes the native build tool for the current
|
| 101 |
+
generator. Their implementation of the <code class="docutils literal notranslate"><span class="pre">PROJECT_NAME</span></code> option
|
| 102 |
+
had no useful effects, so CMake now warns on use of the option.</p>
|
| 103 |
+
</div>
|
| 104 |
+
</section>
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
<div class="clearer"></div>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 112 |
+
<div class="sphinxsidebarwrapper">
|
| 113 |
+
<div>
|
| 114 |
+
<h4>Previous topic</h4>
|
| 115 |
+
<p class="topless"><a href="aux_source_directory.html"
|
| 116 |
+
title="previous chapter">aux_source_directory</a></p>
|
| 117 |
+
</div>
|
| 118 |
+
<div>
|
| 119 |
+
<h4>Next topic</h4>
|
| 120 |
+
<p class="topless"><a href="cmake_file_api.html"
|
| 121 |
+
title="next chapter">cmake_file_api</a></p>
|
| 122 |
+
</div>
|
| 123 |
+
<div role="note" aria-label="source link">
|
| 124 |
+
<h3>This Page</h3>
|
| 125 |
+
<ul class="this-page-menu">
|
| 126 |
+
<li><a href="../_sources/command/build_command.rst.txt"
|
| 127 |
+
rel="nofollow">Show Source</a></li>
|
| 128 |
+
</ul>
|
| 129 |
+
</div>
|
| 130 |
+
<search id="searchbox" style="display: none" role="search">
|
| 131 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 132 |
+
<div class="searchformwrapper">
|
| 133 |
+
<form class="search" action="../search.html" method="get">
|
| 134 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 135 |
+
<input type="submit" value="Go" />
|
| 136 |
+
</form>
|
| 137 |
+
</div>
|
| 138 |
+
</search>
|
| 139 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
<div class="clearer"></div>
|
| 143 |
+
</div>
|
| 144 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 145 |
+
<h3>Navigation</h3>
|
| 146 |
+
<ul>
|
| 147 |
+
<li class="right" style="margin-right: 10px">
|
| 148 |
+
<a href="../genindex.html" title="General Index"
|
| 149 |
+
>index</a></li>
|
| 150 |
+
<li class="right" >
|
| 151 |
+
<a href="cmake_file_api.html" title="cmake_file_api"
|
| 152 |
+
>next</a> |</li>
|
| 153 |
+
<li class="right" >
|
| 154 |
+
<a href="aux_source_directory.html" title="aux_source_directory"
|
| 155 |
+
>previous</a> |</li>
|
| 156 |
+
<li>
|
| 157 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 158 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 159 |
+
</li>
|
| 160 |
+
<li>
|
| 161 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 162 |
+
</li>
|
| 163 |
+
<li>
|
| 164 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 165 |
+
</li>
|
| 166 |
+
|
| 167 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 168 |
+
<li class="nav-item nav-item-this"><a href="">build_command</a></li>
|
| 169 |
+
</ul>
|
| 170 |
+
</div>
|
| 171 |
+
|
| 172 |
+
<div class="footer" role="contentinfo">
|
| 173 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 174 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 175 |
+
</div>
|
| 176 |
+
</body>
|
| 177 |
+
</html>
|
cmake/doc/cmake/html/command/build_name.html
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>build_name — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="exec_program" href="exec_program.html" />
|
| 21 |
+
<link rel="prev" title="ctest_upload" href="ctest_upload.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="exec_program.html" title="exec_program"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_upload.html" title="ctest_upload"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">build_name</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="build-name">
|
| 60 |
+
<span id="command:build_name"></span><h1>build_name<a class="headerlink" href="#build-name" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Disallowed since version 3.0. See CMake Policy <span class="target" id="index-0-policy:CMP0036"></span><a class="reference internal" href="../policy/CMP0036.html#policy:CMP0036" title="CMP0036"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0036</span></code></a>.</p>
|
| 62 |
+
<p>Use <code class="docutils literal notranslate"><span class="pre">${CMAKE_SYSTEM}</span></code> and <code class="docutils literal notranslate"><span class="pre">${CMAKE_CXX_COMPILER}</span></code> instead.</p>
|
| 63 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">build_name(</span><span class="nb">variable</span><span class="nf">)</span>
|
| 64 |
+
</pre></div>
|
| 65 |
+
</div>
|
| 66 |
+
<p>Sets the specified variable to a string representing the platform and
|
| 67 |
+
compiler settings. These values are now available through the
|
| 68 |
+
<span class="target" id="index-0-variable:CMAKE_SYSTEM"></span><a class="reference internal" href="../variable/CMAKE_SYSTEM.html#variable:CMAKE_SYSTEM" title="CMAKE_SYSTEM"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_SYSTEM</span></code></a> and
|
| 69 |
+
<span class="target" id="index-0-variable:CMAKE_<LANG>_COMPILER"></span><a class="reference internal" href="../variable/CMAKE_LANG_COMPILER.html#variable:CMAKE_<LANG>_COMPILER" title="CMAKE_<LANG>_COMPILER"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CXX_COMPILER</span></code></a> variables.</p>
|
| 70 |
+
</section>
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
<div class="clearer"></div>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 78 |
+
<div class="sphinxsidebarwrapper">
|
| 79 |
+
<div>
|
| 80 |
+
<h4>Previous topic</h4>
|
| 81 |
+
<p class="topless"><a href="ctest_upload.html"
|
| 82 |
+
title="previous chapter">ctest_upload</a></p>
|
| 83 |
+
</div>
|
| 84 |
+
<div>
|
| 85 |
+
<h4>Next topic</h4>
|
| 86 |
+
<p class="topless"><a href="exec_program.html"
|
| 87 |
+
title="next chapter">exec_program</a></p>
|
| 88 |
+
</div>
|
| 89 |
+
<div role="note" aria-label="source link">
|
| 90 |
+
<h3>This Page</h3>
|
| 91 |
+
<ul class="this-page-menu">
|
| 92 |
+
<li><a href="../_sources/command/build_name.rst.txt"
|
| 93 |
+
rel="nofollow">Show Source</a></li>
|
| 94 |
+
</ul>
|
| 95 |
+
</div>
|
| 96 |
+
<search id="searchbox" style="display: none" role="search">
|
| 97 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 98 |
+
<div class="searchformwrapper">
|
| 99 |
+
<form class="search" action="../search.html" method="get">
|
| 100 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 101 |
+
<input type="submit" value="Go" />
|
| 102 |
+
</form>
|
| 103 |
+
</div>
|
| 104 |
+
</search>
|
| 105 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
<div class="clearer"></div>
|
| 109 |
+
</div>
|
| 110 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 111 |
+
<h3>Navigation</h3>
|
| 112 |
+
<ul>
|
| 113 |
+
<li class="right" style="margin-right: 10px">
|
| 114 |
+
<a href="../genindex.html" title="General Index"
|
| 115 |
+
>index</a></li>
|
| 116 |
+
<li class="right" >
|
| 117 |
+
<a href="exec_program.html" title="exec_program"
|
| 118 |
+
>next</a> |</li>
|
| 119 |
+
<li class="right" >
|
| 120 |
+
<a href="ctest_upload.html" title="ctest_upload"
|
| 121 |
+
>previous</a> |</li>
|
| 122 |
+
<li>
|
| 123 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 124 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 125 |
+
</li>
|
| 126 |
+
<li>
|
| 127 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 128 |
+
</li>
|
| 129 |
+
<li>
|
| 130 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 131 |
+
</li>
|
| 132 |
+
|
| 133 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 134 |
+
<li class="nav-item nav-item-this"><a href="">build_name</a></li>
|
| 135 |
+
</ul>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<div class="footer" role="contentinfo">
|
| 139 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 140 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 141 |
+
</div>
|
| 142 |
+
</body>
|
| 143 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_file_api.html
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_file_api — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="create_test_sourcelist" href="create_test_sourcelist.html" />
|
| 21 |
+
<link rel="prev" title="build_command" href="build_command.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="create_test_sourcelist.html" title="create_test_sourcelist"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="build_command.html" title="build_command"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_file_api</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-file-api">
|
| 60 |
+
<span id="command:cmake_file_api"></span><h1>cmake_file_api<a class="headerlink" href="#cmake-file-api" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.27.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<p>Enables interacting with the <span class="target" id="index-0-manual:cmake-file-api(7)"></span><a class="reference internal" href="../manual/cmake-file-api.7.html#manual:cmake-file-api(7)" title="cmake-file-api(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">CMake</span> <span class="pre">file</span> <span class="pre">API</span></code></a>.</p>
|
| 65 |
+
<dl class="cmake signature">
|
| 66 |
+
<dt class="sig sig-object cmake" id="query">
|
| 67 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_file_api(</span></span><span class="no"><span class="pre">QUERY</span></span><span class="w"> </span><span class="p"><span class="pre">...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#query" title="Link to this definition">¶</a></dt>
|
| 68 |
+
<dd><p>The <code class="docutils literal notranslate"><span class="pre">QUERY</span></code> subcommand adds a file API query for the current CMake
|
| 69 |
+
invocation.</p>
|
| 70 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_file_api(</span>
|
| 71 |
+
<span class="w"> </span><span class="no">QUERY</span>
|
| 72 |
+
<span class="w"> </span><span class="no">API_VERSION</span><span class="w"> </span><span class="nv"><version></span>
|
| 73 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CODEMODEL</span><span class="w"> </span><span class="nv"><versions>...</span><span class="p">]</span>
|
| 74 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CACHE</span><span class="w"> </span><span class="nv"><versions>...</span><span class="p">]</span>
|
| 75 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CMAKEFILES</span><span class="w"> </span><span class="nv"><versions>...</span><span class="p">]</span>
|
| 76 |
+
<span class="w"> </span><span class="p">[</span><span class="no">TOOLCHAINS</span><span class="w"> </span><span class="nv"><versions>...</span><span class="p">]</span>
|
| 77 |
+
<span class="nf">)</span>
|
| 78 |
+
</pre></div>
|
| 79 |
+
</div>
|
| 80 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">API_VERSION</span></code> must always be given. Currently, the only supported
|
| 81 |
+
value for <code class="docutils literal notranslate"><span class="pre"><version></span></code> is 1. See <a class="reference internal" href="../manual/cmake-file-api.7.html#file-api-v1"><span class="std std-ref">API v1</span></a> for details of the
|
| 82 |
+
reply content and location.</p>
|
| 83 |
+
<p>Each of the optional keywords <code class="docutils literal notranslate"><span class="pre">CODEMODEL</span></code>, <code class="docutils literal notranslate"><span class="pre">CACHE</span></code>, <code class="docutils literal notranslate"><span class="pre">CMAKEFILES</span></code> and
|
| 84 |
+
<code class="docutils literal notranslate"><span class="pre">TOOLCHAINS</span></code> correspond to one of the object kinds that can be requested
|
| 85 |
+
by the project. The <code class="docutils literal notranslate"><span class="pre">configureLog</span></code> object kind cannot be set with this
|
| 86 |
+
command, since it must be set before CMake starts reading the top level
|
| 87 |
+
<code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file.</p>
|
| 88 |
+
<p>For each of the optional keywords, the <code class="docutils literal notranslate"><span class="pre"><versions></span></code> list must contain one
|
| 89 |
+
or more version values of the form <code class="docutils literal notranslate"><span class="pre">major</span></code> or <code class="docutils literal notranslate"><span class="pre">major.minor</span></code>, where
|
| 90 |
+
<code class="docutils literal notranslate"><span class="pre">major</span></code> and <code class="docutils literal notranslate"><span class="pre">minor</span></code> are integers. Projects should list the versions they
|
| 91 |
+
accept in their preferred order, as only the first supported value from the
|
| 92 |
+
list will be selected. The command will ignore versions with a <code class="docutils literal notranslate"><span class="pre">major</span></code>
|
| 93 |
+
version higher than any major version it supports for that object kind.
|
| 94 |
+
It will raise an error if it encounters an invalid version number, or if none
|
| 95 |
+
of the requested versions is supported.</p>
|
| 96 |
+
<p>For each type of object kind requested, a query equivalent to a shared,
|
| 97 |
+
stateless query will be added internally. No query file will be created in
|
| 98 |
+
the file system. The reply <em>will</em> be written to the file system at
|
| 99 |
+
generation time.</p>
|
| 100 |
+
<p>It is not an error to add a query for the same thing more than once, whether
|
| 101 |
+
from query files or from multiple calls to <code class="docutils literal notranslate"><span class="pre">cmake_file_api(QUERY)</span></code>.
|
| 102 |
+
The final set of queries will be a merged combination of all queries
|
| 103 |
+
specified on disk and queries submitted by the project.</p>
|
| 104 |
+
</dd></dl>
|
| 105 |
+
|
| 106 |
+
<section id="example">
|
| 107 |
+
<h2>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h2>
|
| 108 |
+
<p>A project may want to use replies from the file API at build time to implement
|
| 109 |
+
some form of verification task. Instead of relying on something outside of
|
| 110 |
+
CMake to create a query file, the project can use <code class="docutils literal notranslate"><span class="pre">cmake_file_api(QUERY)</span></code>
|
| 111 |
+
to request the required information for the current run. It can then create
|
| 112 |
+
a custom command to run at build time, knowing that the requested information
|
| 113 |
+
should always be available.</p>
|
| 114 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_file_api(</span>
|
| 115 |
+
<span class="w"> </span><span class="no">QUERY</span>
|
| 116 |
+
<span class="w"> </span><span class="no">API_VERSION</span><span class="w"> </span><span class="m">1</span>
|
| 117 |
+
<span class="w"> </span><span class="no">CODEMODEL</span><span class="w"> </span><span class="m">2.3</span>
|
| 118 |
+
<span class="w"> </span><span class="no">TOOLCHAINS</span><span class="w"> </span><span class="m">1</span>
|
| 119 |
+
<span class="nf">)</span>
|
| 120 |
+
|
| 121 |
+
<span class="nf">add_custom_target(</span><span class="nb">verify_project</span>
|
| 122 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_COMMAND</span><span class="o">}</span>
|
| 123 |
+
<span class="w"> </span><span class="p">-</span><span class="no">D</span><span class="w"> </span><span class="no">BUILD_DIR</span><span class="p">=</span><span class="o">${</span><span class="nt">CMAKE_BINARY_DIR</span><span class="o">}</span>
|
| 124 |
+
<span class="w"> </span><span class="p">-</span><span class="no">D</span><span class="w"> </span><span class="no">CONFIG</span><span class="p">=</span><span class="o">$<</span><span class="no">CONFIG</span><span class="o">></span>
|
| 125 |
+
<span class="w"> </span><span class="p">-</span><span class="no">P</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="na">/verify_project.cmake</span>
|
| 126 |
+
<span class="nf">)</span>
|
| 127 |
+
</pre></div>
|
| 128 |
+
</div>
|
| 129 |
+
</section>
|
| 130 |
+
</section>
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
<div class="clearer"></div>
|
| 134 |
+
</div>
|
| 135 |
+
</div>
|
| 136 |
+
</div>
|
| 137 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 138 |
+
<div class="sphinxsidebarwrapper">
|
| 139 |
+
<div>
|
| 140 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 141 |
+
<ul>
|
| 142 |
+
<li><a class="reference internal" href="#">cmake_file_api</a><ul>
|
| 143 |
+
<li><a class="reference internal" href="#example">Example</a></li>
|
| 144 |
+
</ul>
|
| 145 |
+
</li>
|
| 146 |
+
</ul>
|
| 147 |
+
|
| 148 |
+
</div>
|
| 149 |
+
<div>
|
| 150 |
+
<h4>Previous topic</h4>
|
| 151 |
+
<p class="topless"><a href="build_command.html"
|
| 152 |
+
title="previous chapter">build_command</a></p>
|
| 153 |
+
</div>
|
| 154 |
+
<div>
|
| 155 |
+
<h4>Next topic</h4>
|
| 156 |
+
<p class="topless"><a href="create_test_sourcelist.html"
|
| 157 |
+
title="next chapter">create_test_sourcelist</a></p>
|
| 158 |
+
</div>
|
| 159 |
+
<div role="note" aria-label="source link">
|
| 160 |
+
<h3>This Page</h3>
|
| 161 |
+
<ul class="this-page-menu">
|
| 162 |
+
<li><a href="../_sources/command/cmake_file_api.rst.txt"
|
| 163 |
+
rel="nofollow">Show Source</a></li>
|
| 164 |
+
</ul>
|
| 165 |
+
</div>
|
| 166 |
+
<search id="searchbox" style="display: none" role="search">
|
| 167 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 168 |
+
<div class="searchformwrapper">
|
| 169 |
+
<form class="search" action="../search.html" method="get">
|
| 170 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 171 |
+
<input type="submit" value="Go" />
|
| 172 |
+
</form>
|
| 173 |
+
</div>
|
| 174 |
+
</search>
|
| 175 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 176 |
+
</div>
|
| 177 |
+
</div>
|
| 178 |
+
<div class="clearer"></div>
|
| 179 |
+
</div>
|
| 180 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 181 |
+
<h3>Navigation</h3>
|
| 182 |
+
<ul>
|
| 183 |
+
<li class="right" style="margin-right: 10px">
|
| 184 |
+
<a href="../genindex.html" title="General Index"
|
| 185 |
+
>index</a></li>
|
| 186 |
+
<li class="right" >
|
| 187 |
+
<a href="create_test_sourcelist.html" title="create_test_sourcelist"
|
| 188 |
+
>next</a> |</li>
|
| 189 |
+
<li class="right" >
|
| 190 |
+
<a href="build_command.html" title="build_command"
|
| 191 |
+
>previous</a> |</li>
|
| 192 |
+
<li>
|
| 193 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 194 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 195 |
+
</li>
|
| 196 |
+
<li>
|
| 197 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 198 |
+
</li>
|
| 199 |
+
<li>
|
| 200 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 201 |
+
</li>
|
| 202 |
+
|
| 203 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 204 |
+
<li class="nav-item nav-item-this"><a href="">cmake_file_api</a></li>
|
| 205 |
+
</ul>
|
| 206 |
+
</div>
|
| 207 |
+
|
| 208 |
+
<div class="footer" role="contentinfo">
|
| 209 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 210 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 211 |
+
</div>
|
| 212 |
+
</body>
|
| 213 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_host_system_information.html
ADDED
|
@@ -0,0 +1,522 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_host_system_information — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_language" href="cmake_language.html" />
|
| 21 |
+
<link rel="prev" title="break" href="break.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_language.html" title="cmake_language"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="break.html" title="break"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_host_system_information</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-host-system-information">
|
| 60 |
+
<span id="command:cmake_host_system_information"></span><h1>cmake_host_system_information<a class="headerlink" href="#cmake-host-system-information" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Query various host system information.</p>
|
| 62 |
+
<section id="synopsis">
|
| 63 |
+
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Link to this heading">¶</a></h2>
|
| 64 |
+
<pre class="literal-block"><a class="reference internal" href="#query-host-system-specific-information">Query host system specific information</a>
|
| 65 |
+
cmake_host_system_information(RESULT <variable> QUERY <key> ...)
|
| 66 |
+
|
| 67 |
+
<a class="reference internal" href="#query-windows-registry">Query Windows registry</a>
|
| 68 |
+
cmake_host_system_information(RESULT <variable> QUERY WINDOWS_REGISTRY <key> ...)</pre>
|
| 69 |
+
</section>
|
| 70 |
+
<section id="query-host-system-specific-information">
|
| 71 |
+
<h2>Query host system specific information<a class="headerlink" href="#query-host-system-specific-information" title="Link to this heading">¶</a></h2>
|
| 72 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="nv"><variable></span><span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="nv"><key></span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 73 |
+
</pre></div>
|
| 74 |
+
</div>
|
| 75 |
+
<p>Queries system information of the host system on which cmake runs.
|
| 76 |
+
One or more <code class="docutils literal notranslate"><span class="pre"><key></span></code> can be provided to select the information to be
|
| 77 |
+
queried. The list of queried values is stored in <code class="docutils literal notranslate"><span class="pre"><variable></span></code>.</p>
|
| 78 |
+
<p><code class="docutils literal notranslate"><span class="pre"><key></span></code> can be one of the following values:</p>
|
| 79 |
+
<dl>
|
| 80 |
+
<dt><code class="docutils literal notranslate"><span class="pre">NUMBER_OF_LOGICAL_CORES</span></code></dt><dd><p>Number of logical cores</p>
|
| 81 |
+
</dd>
|
| 82 |
+
<dt><code class="docutils literal notranslate"><span class="pre">NUMBER_OF_PHYSICAL_CORES</span></code></dt><dd><p>Number of physical cores</p>
|
| 83 |
+
</dd>
|
| 84 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HOSTNAME</span></code></dt><dd><p>Hostname</p>
|
| 85 |
+
</dd>
|
| 86 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FQDN</span></code></dt><dd><p>Fully qualified domain name</p>
|
| 87 |
+
</dd>
|
| 88 |
+
<dt><code class="docutils literal notranslate"><span class="pre">TOTAL_VIRTUAL_MEMORY</span></code></dt><dd><p>Total virtual memory in MiB <a class="footnote-reference brackets" href="#mebibytes" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
|
| 89 |
+
</dd>
|
| 90 |
+
<dt><code class="docutils literal notranslate"><span class="pre">AVAILABLE_VIRTUAL_MEMORY</span></code></dt><dd><p>Available virtual memory in MiB <a class="footnote-reference brackets" href="#mebibytes" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
|
| 91 |
+
</dd>
|
| 92 |
+
<dt><code class="docutils literal notranslate"><span class="pre">TOTAL_PHYSICAL_MEMORY</span></code></dt><dd><p>Total physical memory in MiB <a class="footnote-reference brackets" href="#mebibytes" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
|
| 93 |
+
</dd>
|
| 94 |
+
<dt><code class="docutils literal notranslate"><span class="pre">AVAILABLE_PHYSICAL_MEMORY</span></code></dt><dd><p>Available physical memory in MiB <a class="footnote-reference brackets" href="#mebibytes" id="id4" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p>
|
| 95 |
+
</dd>
|
| 96 |
+
<dt><code class="docutils literal notranslate"><span class="pre">IS_64BIT</span></code></dt><dd><div class="versionadded">
|
| 97 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 98 |
+
</div>
|
| 99 |
+
<p>One if processor is 64Bit</p>
|
| 100 |
+
</dd>
|
| 101 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_FPU</span></code></dt><dd><div class="versionadded">
|
| 102 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 103 |
+
</div>
|
| 104 |
+
<p>One if processor has floating point unit</p>
|
| 105 |
+
</dd>
|
| 106 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_MMX</span></code></dt><dd><div class="versionadded">
|
| 107 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 108 |
+
</div>
|
| 109 |
+
<p>One if processor supports MMX instructions</p>
|
| 110 |
+
</dd>
|
| 111 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_MMX_PLUS</span></code></dt><dd><div class="versionadded">
|
| 112 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 113 |
+
</div>
|
| 114 |
+
<p>One if processor supports Ext. MMX instructions</p>
|
| 115 |
+
</dd>
|
| 116 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_SSE</span></code></dt><dd><div class="versionadded">
|
| 117 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 118 |
+
</div>
|
| 119 |
+
<p>One if processor supports SSE instructions</p>
|
| 120 |
+
</dd>
|
| 121 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_SSE2</span></code></dt><dd><div class="versionadded">
|
| 122 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 123 |
+
</div>
|
| 124 |
+
<p>One if processor supports SSE2 instructions</p>
|
| 125 |
+
</dd>
|
| 126 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_SSE_FP</span></code></dt><dd><div class="versionadded">
|
| 127 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 128 |
+
</div>
|
| 129 |
+
<p>One if processor supports SSE FP instructions</p>
|
| 130 |
+
</dd>
|
| 131 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_SSE_MMX</span></code></dt><dd><div class="versionadded">
|
| 132 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 133 |
+
</div>
|
| 134 |
+
<p>One if processor supports SSE MMX instructions</p>
|
| 135 |
+
</dd>
|
| 136 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_AMD_3DNOW</span></code></dt><dd><div class="versionadded">
|
| 137 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 138 |
+
</div>
|
| 139 |
+
<p>One if processor supports 3DNow instructions</p>
|
| 140 |
+
</dd>
|
| 141 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_AMD_3DNOW_PLUS</span></code></dt><dd><div class="versionadded">
|
| 142 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 143 |
+
</div>
|
| 144 |
+
<p>One if processor supports 3DNow+ instructions</p>
|
| 145 |
+
</dd>
|
| 146 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_IA64</span></code></dt><dd><div class="versionadded">
|
| 147 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 148 |
+
</div>
|
| 149 |
+
<p>One if IA64 processor emulating x86</p>
|
| 150 |
+
</dd>
|
| 151 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HAS_SERIAL_NUMBER</span></code></dt><dd><div class="versionadded">
|
| 152 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 153 |
+
</div>
|
| 154 |
+
<p>One if processor has serial number</p>
|
| 155 |
+
</dd>
|
| 156 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PROCESSOR_SERIAL_NUMBER</span></code></dt><dd><div class="versionadded">
|
| 157 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 158 |
+
</div>
|
| 159 |
+
<p>Processor serial number</p>
|
| 160 |
+
</dd>
|
| 161 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PROCESSOR_NAME</span></code></dt><dd><div class="versionadded">
|
| 162 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 163 |
+
</div>
|
| 164 |
+
<p>Human readable processor name</p>
|
| 165 |
+
</dd>
|
| 166 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PROCESSOR_DESCRIPTION</span></code></dt><dd><div class="versionadded">
|
| 167 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 168 |
+
</div>
|
| 169 |
+
<p>Human readable full processor description</p>
|
| 170 |
+
</dd>
|
| 171 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OS_NAME</span></code></dt><dd><div class="versionadded">
|
| 172 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 173 |
+
</div>
|
| 174 |
+
<p>See <span class="target" id="index-0-variable:CMAKE_HOST_SYSTEM_NAME"></span><a class="reference internal" href="../variable/CMAKE_HOST_SYSTEM_NAME.html#variable:CMAKE_HOST_SYSTEM_NAME" title="CMAKE_HOST_SYSTEM_NAME"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_HOST_SYSTEM_NAME</span></code></a></p>
|
| 175 |
+
</dd>
|
| 176 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OS_RELEASE</span></code></dt><dd><div class="versionadded">
|
| 177 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 178 |
+
</div>
|
| 179 |
+
<p>The OS sub-type e.g. on Windows <code class="docutils literal notranslate"><span class="pre">Professional</span></code></p>
|
| 180 |
+
</dd>
|
| 181 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OS_VERSION</span></code></dt><dd><div class="versionadded">
|
| 182 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 183 |
+
</div>
|
| 184 |
+
<p>The OS build ID</p>
|
| 185 |
+
</dd>
|
| 186 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OS_PLATFORM</span></code></dt><dd><div class="versionadded">
|
| 187 |
+
<p><span class="versionmodified added">Added in version 3.10.</span></p>
|
| 188 |
+
</div>
|
| 189 |
+
<p>See <span class="target" id="index-0-variable:CMAKE_HOST_SYSTEM_PROCESSOR"></span><a class="reference internal" href="../variable/CMAKE_HOST_SYSTEM_PROCESSOR.html#variable:CMAKE_HOST_SYSTEM_PROCESSOR" title="CMAKE_HOST_SYSTEM_PROCESSOR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_HOST_SYSTEM_PROCESSOR</span></code></a></p>
|
| 190 |
+
</dd>
|
| 191 |
+
<dt><code class="docutils literal notranslate"><span class="pre">MSYSTEM_PREFIX</span></code></dt><dd><div class="versionadded">
|
| 192 |
+
<p><span class="versionmodified added">Added in version 3.28.</span></p>
|
| 193 |
+
</div>
|
| 194 |
+
<p>Available only on Windows hosts. In a MSYS or MinGW development
|
| 195 |
+
environment that sets the <code class="docutils literal notranslate"><span class="pre">MSYSTEM</span></code> environment variable, this
|
| 196 |
+
is its installation prefix. Otherwise, this is the empty string.</p>
|
| 197 |
+
</dd>
|
| 198 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DISTRIB_INFO</span></code></dt><dd><div class="versionadded">
|
| 199 |
+
<p><span class="versionmodified added">Added in version 3.22.</span></p>
|
| 200 |
+
</div>
|
| 201 |
+
<p>Read <code class="file docutils literal notranslate"><span class="pre">/etc/os-release</span></code> file and define the given <code class="docutils literal notranslate"><span class="pre"><variable></span></code>
|
| 202 |
+
into a list of read variables</p>
|
| 203 |
+
</dd>
|
| 204 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DISTRIB_<name></span></code></dt><dd><div class="versionadded">
|
| 205 |
+
<p><span class="versionmodified added">Added in version 3.22.</span></p>
|
| 206 |
+
</div>
|
| 207 |
+
<p>Get the <code class="docutils literal notranslate"><span class="pre"><name></span></code> variable (see <a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/os-release.html">man 5 os-release</a>) if it exists in the
|
| 208 |
+
<code class="file docutils literal notranslate"><span class="pre">/etc/os-release</span></code> file</p>
|
| 209 |
+
<p>Example:</p>
|
| 210 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="no">PRETTY_NAME</span><span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="no">DISTRIB_PRETTY_NAME</span><span class="nf">)</span>
|
| 211 |
+
<span class="nf">message(</span><span class="no">STATUS</span><span class="w"> </span><span class="s">"${PRETTY_NAME}"</span><span class="nf">)</span>
|
| 212 |
+
|
| 213 |
+
<span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="no">DISTRO</span><span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="no">DISTRIB_INFO</span><span class="nf">)</span>
|
| 214 |
+
|
| 215 |
+
<span class="nf">foreach(</span><span class="no">VAR</span><span class="w"> </span><span class="no">IN</span><span class="w"> </span><span class="no">LISTS</span><span class="w"> </span><span class="no">DISTRO</span><span class="nf">)</span>
|
| 216 |
+
<span class="w"> </span><span class="nf">message(</span><span class="no">STATUS</span><span class="w"> </span><span class="s">"${VAR}=`${${VAR}}`"</span><span class="nf">)</span>
|
| 217 |
+
<span class="nf">endforeach()</span>
|
| 218 |
+
</pre></div>
|
| 219 |
+
</div>
|
| 220 |
+
<p>Output:</p>
|
| 221 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>-- Ubuntu 20.04.2 LTS
|
| 222 |
+
-- DISTRO_BUG_REPORT_URL=`https://bugs.launchpad.net/ubuntu/`
|
| 223 |
+
-- DISTRO_HOME_URL=`https://www.ubuntu.com/`
|
| 224 |
+
-- DISTRO_ID=`ubuntu`
|
| 225 |
+
-- DISTRO_ID_LIKE=`debian`
|
| 226 |
+
-- DISTRO_NAME=`Ubuntu`
|
| 227 |
+
-- DISTRO_PRETTY_NAME=`Ubuntu 20.04.2 LTS`
|
| 228 |
+
-- DISTRO_PRIVACY_POLICY_URL=`https://www.ubuntu.com/legal/terms-and-policies/privacy-policy`
|
| 229 |
+
-- DISTRO_SUPPORT_URL=`https://help.ubuntu.com/`
|
| 230 |
+
-- DISTRO_UBUNTU_CODENAME=`focal`
|
| 231 |
+
-- DISTRO_VERSION=`20.04.2 LTS (Focal Fossa)`
|
| 232 |
+
-- DISTRO_VERSION_CODENAME=`focal`
|
| 233 |
+
-- DISTRO_VERSION_ID=`20.04`
|
| 234 |
+
</pre></div>
|
| 235 |
+
</div>
|
| 236 |
+
</dd>
|
| 237 |
+
</dl>
|
| 238 |
+
<p>If <code class="file docutils literal notranslate"><span class="pre">/etc/os-release</span></code> file is not found, the command tries to gather OS
|
| 239 |
+
identification via fallback scripts. The fallback script can use <a class="reference external" href="http://linuxmafia.com/faq/Admin/release-files.html">various
|
| 240 |
+
distribution-specific files</a> to collect OS identification data and map it
|
| 241 |
+
into <a class="reference external" href="https://www.freedesktop.org/software/systemd/man/latest/os-release.html">man 5 os-release</a> variables.</p>
|
| 242 |
+
<section id="fallback-interface-variables">
|
| 243 |
+
<h3>Fallback Interface Variables<a class="headerlink" href="#fallback-interface-variables" title="Link to this heading">¶</a></h3>
|
| 244 |
+
<dl class="cmake variable">
|
| 245 |
+
<dt class="sig sig-object cmake" id="variable:CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS">
|
| 246 |
+
<span class="sig-name descname"><span class="pre">CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS</span></span><a class="headerlink" href="#variable:CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS" title="Link to this definition">¶</a></dt>
|
| 247 |
+
<dd><p>In addition to the scripts shipped with CMake, a user may append full
|
| 248 |
+
paths to his script(s) to the this list. The script filename has the
|
| 249 |
+
following format: <code class="docutils literal notranslate"><span class="pre">NNN-<name>.cmake</span></code>, where <code class="docutils literal notranslate"><span class="pre">NNN</span></code> is three digits
|
| 250 |
+
used to apply collected scripts in a specific order.</p>
|
| 251 |
+
</dd></dl>
|
| 252 |
+
|
| 253 |
+
<dl class="cmake variable">
|
| 254 |
+
<dt class="sig sig-object cmake" id="variable:CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>">
|
| 255 |
+
<span class="sig-name descname"><span class="pre">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname></span></span><a class="headerlink" href="#variable:CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname>" title="Link to this definition">¶</a></dt>
|
| 256 |
+
<dd><p>Variables collected by the user provided fallback script
|
| 257 |
+
ought to be assigned to CMake variables using this naming
|
| 258 |
+
convention. Example, the <code class="docutils literal notranslate"><span class="pre">ID</span></code> variable from the manual becomes
|
| 259 |
+
<code class="docutils literal notranslate"><span class="pre">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID</span></code>.</p>
|
| 260 |
+
</dd></dl>
|
| 261 |
+
|
| 262 |
+
<dl class="cmake variable">
|
| 263 |
+
<dt class="sig sig-object cmake" id="variable:CMAKE_GET_OS_RELEASE_FALLBACK_RESULT">
|
| 264 |
+
<span class="sig-name descname"><span class="pre">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT</span></span><a class="headerlink" href="#variable:CMAKE_GET_OS_RELEASE_FALLBACK_RESULT" title="Link to this definition">¶</a></dt>
|
| 265 |
+
<dd><p>The fallback script ought to store names of all assigned
|
| 266 |
+
<code class="docutils literal notranslate"><span class="pre">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_<varname></span></code> variables in this list.</p>
|
| 267 |
+
</dd></dl>
|
| 268 |
+
|
| 269 |
+
<p>Example:</p>
|
| 270 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="c"># Try to detect some old distribution</span>
|
| 271 |
+
<span class="c"># See also</span>
|
| 272 |
+
<span class="c"># - http://linuxmafia.com/faq/Admin/release-files.html</span>
|
| 273 |
+
<span class="c">#</span>
|
| 274 |
+
<span class="nf">if(</span><span class="no">NOT</span><span class="w"> </span><span class="no">EXISTS</span><span class="w"> </span><span class="s">"${CMAKE_SYSROOT}/etc/foobar-release"</span><span class="nf">)</span>
|
| 275 |
+
<span class="w"> </span><span class="nf">return()</span>
|
| 276 |
+
<span class="nf">endif()</span>
|
| 277 |
+
<span class="c"># Get the first string only</span>
|
| 278 |
+
<span class="nf">file(</span>
|
| 279 |
+
<span class="w"> </span><span class="no">STRINGS</span><span class="w"> </span><span class="s">"${CMAKE_SYSROOT}/etc/foobar-release"</span><span class="w"> </span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT</span>
|
| 280 |
+
<span class="w"> </span><span class="no">LIMIT_COUNT</span><span class="w"> </span><span class="m">1</span>
|
| 281 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 282 |
+
<span class="c">#</span>
|
| 283 |
+
<span class="c"># Example:</span>
|
| 284 |
+
<span class="c">#</span>
|
| 285 |
+
<span class="c"># Foobar distribution release 1.2.3 (server)</span>
|
| 286 |
+
<span class="c">#</span>
|
| 287 |
+
<span class="nf">if(</span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT</span><span class="w"> </span><span class="no">MATCHES</span><span class="w"> </span><span class="s">"Foobar distribution release ([0-9\.]+) .*"</span><span class="nf">)</span>
|
| 288 |
+
<span class="w"> </span><span class="nf">set(</span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME</span><span class="w"> </span><span class="nb">Foobar</span><span class="nf">)</span>
|
| 289 |
+
<span class="w"> </span><span class="nf">set(</span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME</span><span class="w"> </span><span class="s">"${CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT}"</span><span class="nf">)</span>
|
| 290 |
+
<span class="w"> </span><span class="nf">set(</span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID</span><span class="w"> </span><span class="nb">foobar</span><span class="nf">)</span>
|
| 291 |
+
<span class="w"> </span><span class="nf">set(</span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_MATCH_1</span><span class="o">}</span><span class="nf">)</span>
|
| 292 |
+
<span class="w"> </span><span class="nf">set(</span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_MATCH_1</span><span class="o">}</span><span class="nf">)</span>
|
| 293 |
+
<span class="w"> </span><span class="nf">list(</span>
|
| 294 |
+
<span class="w"> </span><span class="no">APPEND</span><span class="w"> </span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT</span>
|
| 295 |
+
<span class="w"> </span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME</span>
|
| 296 |
+
<span class="w"> </span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME</span>
|
| 297 |
+
<span class="w"> </span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID</span>
|
| 298 |
+
<span class="w"> </span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION</span>
|
| 299 |
+
<span class="w"> </span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID</span>
|
| 300 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 301 |
+
<span class="nf">endif()</span>
|
| 302 |
+
<span class="nf">unset(</span><span class="no">CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT</span><span class="nf">)</span>
|
| 303 |
+
</pre></div>
|
| 304 |
+
</div>
|
| 305 |
+
<p class="rubric">Footnotes</p>
|
| 306 |
+
<aside class="footnote-list brackets">
|
| 307 |
+
<aside class="footnote brackets" id="mebibytes" role="doc-footnote">
|
| 308 |
+
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
|
| 309 |
+
<span class="backrefs">(<a role="doc-backlink" href="#id1">1</a>,<a role="doc-backlink" href="#id2">2</a>,<a role="doc-backlink" href="#id3">3</a>,<a role="doc-backlink" href="#id4">4</a>)</span>
|
| 310 |
+
<p>One MiB (mebibyte) is equal to 1024x1024 bytes.</p>
|
| 311 |
+
</aside>
|
| 312 |
+
</aside>
|
| 313 |
+
</section>
|
| 314 |
+
</section>
|
| 315 |
+
<section id="query-windows-registry">
|
| 316 |
+
<span id="id5"></span><h2>Query Windows registry<a class="headerlink" href="#query-windows-registry" title="Link to this heading">¶</a></h2>
|
| 317 |
+
<div class="versionadded">
|
| 318 |
+
<p><span class="versionmodified added">Added in version 3.24.</span></p>
|
| 319 |
+
</div>
|
| 320 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cmake_host_system_information(RESULT <variable>
|
| 321 |
+
QUERY WINDOWS_REGISTRY <key> [VALUE_NAMES|SUBKEYS|VALUE <name>]
|
| 322 |
+
[VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
|
| 323 |
+
[SEPARATOR <separator>]
|
| 324 |
+
[ERROR_VARIABLE <result>])
|
| 325 |
+
</pre></div>
|
| 326 |
+
</div>
|
| 327 |
+
<p>Performs query operations on local computer registry subkey. Returns a list of
|
| 328 |
+
subkeys or value names that are located under the specified subkey in the
|
| 329 |
+
registry or the data of the specified value name. The result of the queried
|
| 330 |
+
entity is stored in <code class="docutils literal notranslate"><span class="pre"><variable></span></code>.</p>
|
| 331 |
+
<div class="admonition note">
|
| 332 |
+
<p class="admonition-title">Note</p>
|
| 333 |
+
<p>Querying registry for any other platforms than <code class="docutils literal notranslate"><span class="pre">Windows</span></code>, including
|
| 334 |
+
<code class="docutils literal notranslate"><span class="pre">CYGWIN</span></code>, will always returns an empty string and sets an error message in
|
| 335 |
+
the variable specified with sub-option <code class="docutils literal notranslate"><span class="pre">ERROR_VARIABLE</span></code>.</p>
|
| 336 |
+
</div>
|
| 337 |
+
<p><code class="docutils literal notranslate"><span class="pre"><key></span></code> specify the full path of a subkey on the local computer. The
|
| 338 |
+
<code class="docutils literal notranslate"><span class="pre"><key></span></code> must include a valid root key. Valid root keys for the local computer
|
| 339 |
+
are:</p>
|
| 340 |
+
<ul class="simple">
|
| 341 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">HKLM</span></code> or <code class="docutils literal notranslate"><span class="pre">HKEY_LOCAL_MACHINE</span></code></p></li>
|
| 342 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">HKCU</span></code> or <code class="docutils literal notranslate"><span class="pre">HKEY_CURRENT_USER</span></code></p></li>
|
| 343 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">HKCR</span></code> or <code class="docutils literal notranslate"><span class="pre">HKEY_CLASSES_ROOT</span></code></p></li>
|
| 344 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">HKU</span></code> or <code class="docutils literal notranslate"><span class="pre">HKEY_USERS</span></code></p></li>
|
| 345 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">HKCC</span></code> or <code class="docutils literal notranslate"><span class="pre">HKEY_CURRENT_CONFIG</span></code></p></li>
|
| 346 |
+
</ul>
|
| 347 |
+
<p>And, optionally, the path to a subkey under the specified root key. The path
|
| 348 |
+
separator can be the slash or the backslash. <code class="docutils literal notranslate"><span class="pre"><key></span></code> is not case sensitive.
|
| 349 |
+
For example:</p>
|
| 350 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="nb">result</span><span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="no">WINDOWS_REGISTRY</span><span class="w"> </span><span class="s">"HKLM"</span><span class="nf">)</span>
|
| 351 |
+
<span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="nb">result</span><span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="no">WINDOWS_REGISTRY</span><span class="w"> </span><span class="s">"HKLM/SOFTWARE/Kitware"</span><span class="nf">)</span>
|
| 352 |
+
<span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="nb">result</span><span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="no">WINDOWS_REGISTRY</span><span class="w"> </span><span class="s">"HKCU\\SOFTWARE\\Kitware"</span><span class="nf">)</span>
|
| 353 |
+
</pre></div>
|
| 354 |
+
</div>
|
| 355 |
+
<dl>
|
| 356 |
+
<dt><code class="docutils literal notranslate"><span class="pre">VALUE_NAMES</span></code></dt><dd><p>Request the list of value names defined under <code class="docutils literal notranslate"><span class="pre"><key></span></code>. If a default value
|
| 357 |
+
is defined, it will be identified with the special name <code class="docutils literal notranslate"><span class="pre">(default)</span></code>.</p>
|
| 358 |
+
</dd>
|
| 359 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SUBKEYS</span></code></dt><dd><p>Request the list of subkeys defined under <code class="docutils literal notranslate"><span class="pre"><key></span></code>.</p>
|
| 360 |
+
</dd>
|
| 361 |
+
<dt><code class="docutils literal notranslate"><span class="pre">VALUE</span> <span class="pre"><name></span></code></dt><dd><p>Request the data stored in value named <code class="docutils literal notranslate"><span class="pre"><name></span></code>. If <code class="docutils literal notranslate"><span class="pre">VALUE</span></code> is not
|
| 362 |
+
specified or argument is the special name <code class="docutils literal notranslate"><span class="pre">(default)</span></code>, the content of the
|
| 363 |
+
default value, if any, will be returned.</p>
|
| 364 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="c"># query default value for HKLM/SOFTWARE/Kitware key</span>
|
| 365 |
+
<span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="nb">result</span>
|
| 366 |
+
<span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="no">WINDOWS_REGISTRY</span><span class="w"> </span><span class="s">"HKLM/SOFTWARE/Kitware"</span><span class="nf">)</span>
|
| 367 |
+
|
| 368 |
+
<span class="c"># query default value for HKLM/SOFTWARE/Kitware key using special value name</span>
|
| 369 |
+
<span class="nf">cmake_host_system_information(</span><span class="no">RESULT</span><span class="w"> </span><span class="nb">result</span>
|
| 370 |
+
<span class="w"> </span><span class="no">QUERY</span><span class="w"> </span><span class="no">WINDOWS_REGISTRY</span><span class="w"> </span><span class="s">"HKLM/SOFTWARE/Kitware"</span>
|
| 371 |
+
<span class="w"> </span><span class="no">VALUE</span><span class="w"> </span><span class="s">"(default)"</span><span class="nf">)</span>
|
| 372 |
+
</pre></div>
|
| 373 |
+
</div>
|
| 374 |
+
<p>Supported types are:</p>
|
| 375 |
+
<ul class="simple">
|
| 376 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">REG_SZ</span></code>.</p></li>
|
| 377 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">REG_EXPAND_SZ</span></code>. The returned data is expanded.</p></li>
|
| 378 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">REG_MULTI_SZ</span></code>. The returned is expressed as a CMake list. See also
|
| 379 |
+
<code class="docutils literal notranslate"><span class="pre">SEPARATOR</span></code> sub-option.</p></li>
|
| 380 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">REG_DWORD</span></code>.</p></li>
|
| 381 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">REG_QWORD</span></code>.</p></li>
|
| 382 |
+
</ul>
|
| 383 |
+
<p>For all other types, an empty string is returned.</p>
|
| 384 |
+
</dd>
|
| 385 |
+
<dt><code class="docutils literal notranslate"><span class="pre">VIEW</span></code></dt><dd><p>Specify which registry views must be queried. When not specified, <code class="docutils literal notranslate"><span class="pre">BOTH</span></code>
|
| 386 |
+
view is used.</p>
|
| 387 |
+
<dl>
|
| 388 |
+
<dt><code class="docutils literal notranslate"><span class="pre">64</span></code></dt><dd><p>Query the 64bit registry. On <code class="docutils literal notranslate"><span class="pre">32bit</span> <span class="pre">Windows</span></code>, returns always an empty
|
| 389 |
+
string.</p>
|
| 390 |
+
</dd>
|
| 391 |
+
<dt><code class="docutils literal notranslate"><span class="pre">32</span></code></dt><dd><p>Query the 32bit registry.</p>
|
| 392 |
+
</dd>
|
| 393 |
+
<dt><code class="docutils literal notranslate"><span class="pre">64_32</span></code></dt><dd><p>For <code class="docutils literal notranslate"><span class="pre">VALUE</span></code> sub-option or default value, query the registry using view
|
| 394 |
+
<code class="docutils literal notranslate"><span class="pre">64</span></code>, and if the request failed, query the registry using view <code class="docutils literal notranslate"><span class="pre">32</span></code>.
|
| 395 |
+
For <code class="docutils literal notranslate"><span class="pre">VALUE_NAMES</span></code> and <code class="docutils literal notranslate"><span class="pre">SUBKEYS</span></code> sub-options, query both views (<code class="docutils literal notranslate"><span class="pre">64</span></code>
|
| 396 |
+
and <code class="docutils literal notranslate"><span class="pre">32</span></code>) and merge the results (sorted and duplicates removed).</p>
|
| 397 |
+
</dd>
|
| 398 |
+
<dt><code class="docutils literal notranslate"><span class="pre">32_64</span></code></dt><dd><p>For <code class="docutils literal notranslate"><span class="pre">VALUE</span></code> sub-option or default value, query the registry using view
|
| 399 |
+
<code class="docutils literal notranslate"><span class="pre">32</span></code>, and if the request failed, query the registry using view <code class="docutils literal notranslate"><span class="pre">64</span></code>.
|
| 400 |
+
For <code class="docutils literal notranslate"><span class="pre">VALUE_NAMES</span></code> and <code class="docutils literal notranslate"><span class="pre">SUBKEYS</span></code> sub-options, query both views (<code class="docutils literal notranslate"><span class="pre">32</span></code>
|
| 401 |
+
and <code class="docutils literal notranslate"><span class="pre">64</span></code>) and merge the results (sorted and duplicates removed).</p>
|
| 402 |
+
</dd>
|
| 403 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HOST</span></code></dt><dd><p>Query the registry matching the architecture of the host: <code class="docutils literal notranslate"><span class="pre">64</span></code> on <code class="docutils literal notranslate"><span class="pre">64bit</span>
|
| 404 |
+
<span class="pre">Windows</span></code> and <code class="docutils literal notranslate"><span class="pre">32</span></code> on <code class="docutils literal notranslate"><span class="pre">32bit</span> <span class="pre">Windows</span></code>.</p>
|
| 405 |
+
</dd>
|
| 406 |
+
<dt><code class="docutils literal notranslate"><span class="pre">TARGET</span></code></dt><dd><p>Query the registry matching the architecture specified by
|
| 407 |
+
<span class="target" id="index-0-variable:CMAKE_SIZEOF_VOID_P"></span><a class="reference internal" href="../variable/CMAKE_SIZEOF_VOID_P.html#variable:CMAKE_SIZEOF_VOID_P" title="CMAKE_SIZEOF_VOID_P"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_SIZEOF_VOID_P</span></code></a> variable. If not defined, fallback to
|
| 408 |
+
<code class="docutils literal notranslate"><span class="pre">HOST</span></code> view.</p>
|
| 409 |
+
</dd>
|
| 410 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BOTH</span></code></dt><dd><p>Query both views (<code class="docutils literal notranslate"><span class="pre">32</span></code> and <code class="docutils literal notranslate"><span class="pre">64</span></code>). The order depends of the following
|
| 411 |
+
rules: If <span class="target" id="index-1-variable:CMAKE_SIZEOF_VOID_P"></span><a class="reference internal" href="../variable/CMAKE_SIZEOF_VOID_P.html#variable:CMAKE_SIZEOF_VOID_P" title="CMAKE_SIZEOF_VOID_P"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_SIZEOF_VOID_P</span></code></a> variable is defined. Use the
|
| 412 |
+
following view depending of the content of this variable:</p>
|
| 413 |
+
<ul class="simple">
|
| 414 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">8</span></code>: <code class="docutils literal notranslate"><span class="pre">64_32</span></code></p></li>
|
| 415 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">4</span></code>: <code class="docutils literal notranslate"><span class="pre">32_64</span></code></p></li>
|
| 416 |
+
</ul>
|
| 417 |
+
<p>If <span class="target" id="index-2-variable:CMAKE_SIZEOF_VOID_P"></span><a class="reference internal" href="../variable/CMAKE_SIZEOF_VOID_P.html#variable:CMAKE_SIZEOF_VOID_P" title="CMAKE_SIZEOF_VOID_P"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_SIZEOF_VOID_P</span></code></a> variable is not defined, rely on
|
| 418 |
+
architecture of the host:</p>
|
| 419 |
+
<ul class="simple">
|
| 420 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">64bit</span></code>: <code class="docutils literal notranslate"><span class="pre">64_32</span></code></p></li>
|
| 421 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">32bit</span></code>: <code class="docutils literal notranslate"><span class="pre">32</span></code></p></li>
|
| 422 |
+
</ul>
|
| 423 |
+
</dd>
|
| 424 |
+
</dl>
|
| 425 |
+
</dd>
|
| 426 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SEPARATOR</span></code></dt><dd><p>Specify the separator character for <code class="docutils literal notranslate"><span class="pre">REG_MULTI_SZ</span></code> type. When not
|
| 427 |
+
specified, the character <code class="docutils literal notranslate"><span class="pre">\0</span></code> is used.</p>
|
| 428 |
+
</dd>
|
| 429 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ERROR_VARIABLE</span> <span class="pre"><result></span></code></dt><dd><p>Returns any error raised during query operation. In case of success, the
|
| 430 |
+
variable holds an empty string.</p>
|
| 431 |
+
</dd>
|
| 432 |
+
</dl>
|
| 433 |
+
</section>
|
| 434 |
+
</section>
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
<div class="clearer"></div>
|
| 438 |
+
</div>
|
| 439 |
+
</div>
|
| 440 |
+
</div>
|
| 441 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 442 |
+
<div class="sphinxsidebarwrapper">
|
| 443 |
+
<div>
|
| 444 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 445 |
+
<ul>
|
| 446 |
+
<li><a class="reference internal" href="#">cmake_host_system_information</a><ul>
|
| 447 |
+
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
|
| 448 |
+
<li><a class="reference internal" href="#query-host-system-specific-information">Query host system specific information</a><ul>
|
| 449 |
+
<li><a class="reference internal" href="#fallback-interface-variables">Fallback Interface Variables</a></li>
|
| 450 |
+
</ul>
|
| 451 |
+
</li>
|
| 452 |
+
<li><a class="reference internal" href="#query-windows-registry">Query Windows registry</a></li>
|
| 453 |
+
</ul>
|
| 454 |
+
</li>
|
| 455 |
+
</ul>
|
| 456 |
+
|
| 457 |
+
</div>
|
| 458 |
+
<div>
|
| 459 |
+
<h4>Previous topic</h4>
|
| 460 |
+
<p class="topless"><a href="break.html"
|
| 461 |
+
title="previous chapter">break</a></p>
|
| 462 |
+
</div>
|
| 463 |
+
<div>
|
| 464 |
+
<h4>Next topic</h4>
|
| 465 |
+
<p class="topless"><a href="cmake_language.html"
|
| 466 |
+
title="next chapter">cmake_language</a></p>
|
| 467 |
+
</div>
|
| 468 |
+
<div role="note" aria-label="source link">
|
| 469 |
+
<h3>This Page</h3>
|
| 470 |
+
<ul class="this-page-menu">
|
| 471 |
+
<li><a href="../_sources/command/cmake_host_system_information.rst.txt"
|
| 472 |
+
rel="nofollow">Show Source</a></li>
|
| 473 |
+
</ul>
|
| 474 |
+
</div>
|
| 475 |
+
<search id="searchbox" style="display: none" role="search">
|
| 476 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 477 |
+
<div class="searchformwrapper">
|
| 478 |
+
<form class="search" action="../search.html" method="get">
|
| 479 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 480 |
+
<input type="submit" value="Go" />
|
| 481 |
+
</form>
|
| 482 |
+
</div>
|
| 483 |
+
</search>
|
| 484 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 485 |
+
</div>
|
| 486 |
+
</div>
|
| 487 |
+
<div class="clearer"></div>
|
| 488 |
+
</div>
|
| 489 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 490 |
+
<h3>Navigation</h3>
|
| 491 |
+
<ul>
|
| 492 |
+
<li class="right" style="margin-right: 10px">
|
| 493 |
+
<a href="../genindex.html" title="General Index"
|
| 494 |
+
>index</a></li>
|
| 495 |
+
<li class="right" >
|
| 496 |
+
<a href="cmake_language.html" title="cmake_language"
|
| 497 |
+
>next</a> |</li>
|
| 498 |
+
<li class="right" >
|
| 499 |
+
<a href="break.html" title="break"
|
| 500 |
+
>previous</a> |</li>
|
| 501 |
+
<li>
|
| 502 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 503 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 504 |
+
</li>
|
| 505 |
+
<li>
|
| 506 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 507 |
+
</li>
|
| 508 |
+
<li>
|
| 509 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 510 |
+
</li>
|
| 511 |
+
|
| 512 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 513 |
+
<li class="nav-item nav-item-this"><a href="">cmake_host_system_information</a></li>
|
| 514 |
+
</ul>
|
| 515 |
+
</div>
|
| 516 |
+
|
| 517 |
+
<div class="footer" role="contentinfo">
|
| 518 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 519 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 520 |
+
</div>
|
| 521 |
+
</body>
|
| 522 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_language.html
ADDED
|
@@ -0,0 +1,652 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_language — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_minimum_required" href="cmake_minimum_required.html" />
|
| 21 |
+
<link rel="prev" title="cmake_host_system_information" href="cmake_host_system_information.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_minimum_required.html" title="cmake_minimum_required"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_host_system_information.html" title="cmake_host_system_information"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_language</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-language">
|
| 60 |
+
<span id="command:cmake_language"></span><h1>cmake_language<a class="headerlink" href="#cmake-language" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.18.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<p>Call meta-operations on CMake commands.</p>
|
| 65 |
+
<section id="synopsis">
|
| 66 |
+
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Link to this heading">¶</a></h2>
|
| 67 |
+
<pre class="literal-block">cmake_language(<a class="reference internal" href="#call">CALL</a> <command> [<arg>...])
|
| 68 |
+
cmake_language(<a class="reference internal" href="#eval">EVAL</a> CODE <code>...)
|
| 69 |
+
cmake_language(<a class="reference internal" href="#defer">DEFER</a> <options>... CALL <command> [<arg>...])
|
| 70 |
+
cmake_language(<a class="reference internal" href="#set-dependency-provider">SET_DEPENDENCY_PROVIDER</a> <command> SUPPORTED_METHODS <methods>...)
|
| 71 |
+
cmake_language(<a class="reference internal" href="#get-message-log-level">GET_MESSAGE_LOG_LEVEL</a> <out-var>)
|
| 72 |
+
cmake_language(<a class="reference internal" href="#exit">EXIT</a> <exit-code>)</pre>
|
| 73 |
+
</section>
|
| 74 |
+
<section id="introduction">
|
| 75 |
+
<h2>Introduction<a class="headerlink" href="#introduction" title="Link to this heading">¶</a></h2>
|
| 76 |
+
<p>This command will call meta-operations on built-in CMake commands or
|
| 77 |
+
those created via the <span class="target" id="index-0-command:macro"></span><a class="reference internal" href="macro.html#command:macro" title="macro"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">macro()</span></code></a> or <span class="target" id="index-0-command:function"></span><a class="reference internal" href="function.html#command:function" title="function"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">function()</span></code></a> commands.</p>
|
| 78 |
+
<p><code class="docutils literal notranslate"><span class="pre">cmake_language</span></code> does not introduce a new variable or policy scope.</p>
|
| 79 |
+
</section>
|
| 80 |
+
<section id="calling-commands">
|
| 81 |
+
<h2>Calling Commands<a class="headerlink" href="#calling-commands" title="Link to this heading">¶</a></h2>
|
| 82 |
+
<dl class="cmake signature">
|
| 83 |
+
<dt class="sig sig-object cmake" id="call">
|
| 84 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_language(</span></span><span class="no"><span class="pre">CALL</span></span><span class="w"> </span><span class="nv"><span class="pre"><command></span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="nv"><span class="pre"><arg>...</span></span><span class="p"><span class="pre">]</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#call" title="Link to this definition">¶</a></dt>
|
| 85 |
+
<dd><p>Calls the named <code class="docutils literal notranslate"><span class="pre"><command></span></code> with the given arguments (if any).
|
| 86 |
+
For example, the code:</p>
|
| 87 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">message_command</span><span class="w"> </span><span class="s">"message"</span><span class="nf">)</span>
|
| 88 |
+
<span class="nf">cmake_language(</span><span class="no">CALL</span><span class="w"> </span><span class="o">${</span><span class="nt">message_command</span><span class="o">}</span><span class="w"> </span><span class="no">STATUS</span><span class="w"> </span><span class="s">"Hello World!"</span><span class="nf">)</span>
|
| 89 |
+
</pre></div>
|
| 90 |
+
</div>
|
| 91 |
+
<p>is equivalent to</p>
|
| 92 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">message(</span><span class="no">STATUS</span><span class="w"> </span><span class="s">"Hello World!"</span><span class="nf">)</span>
|
| 93 |
+
</pre></div>
|
| 94 |
+
</div>
|
| 95 |
+
<div class="admonition note">
|
| 96 |
+
<p class="admonition-title">Note</p>
|
| 97 |
+
<p>To ensure consistency of the code, the following commands are not allowed:</p>
|
| 98 |
+
<ul class="simple">
|
| 99 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">if</span></code> / <code class="docutils literal notranslate"><span class="pre">elseif</span></code> / <code class="docutils literal notranslate"><span class="pre">else</span></code> / <code class="docutils literal notranslate"><span class="pre">endif</span></code></p></li>
|
| 100 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">block</span></code> / <code class="docutils literal notranslate"><span class="pre">endblock</span></code></p></li>
|
| 101 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">while</span></code> / <code class="docutils literal notranslate"><span class="pre">endwhile</span></code></p></li>
|
| 102 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">foreach</span></code> / <code class="docutils literal notranslate"><span class="pre">endforeach</span></code></p></li>
|
| 103 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">function</span></code> / <code class="docutils literal notranslate"><span class="pre">endfunction</span></code></p></li>
|
| 104 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">macro</span></code> / <code class="docutils literal notranslate"><span class="pre">endmacro</span></code></p></li>
|
| 105 |
+
</ul>
|
| 106 |
+
</div>
|
| 107 |
+
</dd></dl>
|
| 108 |
+
|
| 109 |
+
</section>
|
| 110 |
+
<section id="evaluating-code">
|
| 111 |
+
<h2>Evaluating Code<a class="headerlink" href="#evaluating-code" title="Link to this heading">¶</a></h2>
|
| 112 |
+
<dl class="cmake signature">
|
| 113 |
+
<dt class="sig sig-object cmake" id="eval">
|
| 114 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_language(</span></span><span class="no"><span class="pre">EVAL</span></span><span class="w"> </span><span class="no"><span class="pre">CODE</span></span><span class="w"> </span><span class="nv"><span class="pre"><code>...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#eval" title="Link to this definition">¶</a></dt>
|
| 115 |
+
<dd><p>Evaluates the <code class="docutils literal notranslate"><span class="pre"><code>...</span></code> as CMake code.</p>
|
| 116 |
+
<p>For example, the code:</p>
|
| 117 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="no">A</span><span class="w"> </span><span class="no">TRUE</span><span class="nf">)</span>
|
| 118 |
+
<span class="nf">set(</span><span class="no">B</span><span class="w"> </span><span class="no">TRUE</span><span class="nf">)</span>
|
| 119 |
+
<span class="nf">set(</span><span class="no">C</span><span class="w"> </span><span class="no">TRUE</span><span class="nf">)</span>
|
| 120 |
+
<span class="nf">set(</span><span class="nb">condition</span><span class="w"> </span><span class="s">"(A AND B) OR C"</span><span class="nf">)</span>
|
| 121 |
+
|
| 122 |
+
<span class="nf">cmake_language(</span><span class="no">EVAL</span><span class="w"> </span><span class="no">CODE</span><span class="w"> </span><span class="s">"</span>
|
| 123 |
+
<span class="s"> if (${condition})</span>
|
| 124 |
+
<span class="s"> message(STATUS TRUE)</span>
|
| 125 |
+
<span class="s"> else()</span>
|
| 126 |
+
<span class="s"> message(STATUS FALSE)</span>
|
| 127 |
+
<span class="s"> endif()"</span>
|
| 128 |
+
<span class="nf">)</span>
|
| 129 |
+
</pre></div>
|
| 130 |
+
</div>
|
| 131 |
+
<p>is equivalent to</p>
|
| 132 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="no">A</span><span class="w"> </span><span class="no">TRUE</span><span class="nf">)</span>
|
| 133 |
+
<span class="nf">set(</span><span class="no">B</span><span class="w"> </span><span class="no">TRUE</span><span class="nf">)</span>
|
| 134 |
+
<span class="nf">set(</span><span class="no">C</span><span class="w"> </span><span class="no">TRUE</span><span class="nf">)</span>
|
| 135 |
+
<span class="nf">set(</span><span class="nb">condition</span><span class="w"> </span><span class="s">"(A AND B) OR C"</span><span class="nf">)</span>
|
| 136 |
+
|
| 137 |
+
<span class="nf">file(</span><span class="no">WRITE</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="na">/eval.cmake</span><span class="w"> </span><span class="s">"</span>
|
| 138 |
+
<span class="s"> if (${condition})</span>
|
| 139 |
+
<span class="s"> message(STATUS TRUE)</span>
|
| 140 |
+
<span class="s"> else()</span>
|
| 141 |
+
<span class="s"> message(STATUS FALSE)</span>
|
| 142 |
+
<span class="s"> endif()"</span>
|
| 143 |
+
<span class="nf">)</span>
|
| 144 |
+
|
| 145 |
+
<span class="nf">include(</span><span class="o">${</span><span class="nt">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="na">/eval.cmake</span><span class="nf">)</span>
|
| 146 |
+
</pre></div>
|
| 147 |
+
</div>
|
| 148 |
+
</dd></dl>
|
| 149 |
+
|
| 150 |
+
</section>
|
| 151 |
+
<section id="deferring-calls">
|
| 152 |
+
<h2>Deferring Calls<a class="headerlink" href="#deferring-calls" title="Link to this heading">¶</a></h2>
|
| 153 |
+
<div class="versionadded">
|
| 154 |
+
<p><span class="versionmodified added">Added in version 3.19.</span></p>
|
| 155 |
+
</div>
|
| 156 |
+
<dl class="cmake signature">
|
| 157 |
+
<dt class="sig sig-object cmake" id="defer">
|
| 158 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_language(</span></span><span class="no"><span class="pre">DEFER</span></span><span class="w"> </span><span class="nv"><span class="pre"><options>...</span></span><span class="w"> </span><span class="no"><span class="pre">CALL</span></span><span class="w"> </span><span class="nv"><span class="pre"><command></span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="nv"><span class="pre"><arg>...</span></span><span class="p"><span class="pre">]</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#defer" title="Link to this definition">¶</a></dt>
|
| 159 |
+
<dd><p>Schedules a call to the named <code class="docutils literal notranslate"><span class="pre"><command></span></code> with the given arguments (if any)
|
| 160 |
+
to occur at a later time. By default, deferred calls are executed as if
|
| 161 |
+
written at the end of the current directory's <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file,
|
| 162 |
+
except that they run even after a <span class="target" id="index-0-command:return"></span><a class="reference internal" href="return.html#command:return" title="return"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">return()</span></code></a> call. Variable
|
| 163 |
+
references in arguments are evaluated at the time the deferred call is
|
| 164 |
+
executed.</p>
|
| 165 |
+
<p>The options are:</p>
|
| 166 |
+
<dl>
|
| 167 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DIRECTORY</span> <span class="pre"><dir></span></code></dt><dd><p>Schedule the call for the end of the given directory instead of the
|
| 168 |
+
current directory. The <code class="docutils literal notranslate"><span class="pre"><dir></span></code> may reference either a source
|
| 169 |
+
directory or its corresponding binary directory. Relative paths are
|
| 170 |
+
treated as relative to the current source directory.</p>
|
| 171 |
+
<p>The given directory must be known to CMake, being either the top-level
|
| 172 |
+
directory or one added by <span class="target" id="index-0-command:add_subdirectory"></span><a class="reference internal" href="add_subdirectory.html#command:add_subdirectory" title="add_subdirectory"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_subdirectory()</span></code></a>. Furthermore,
|
| 173 |
+
the given directory must not yet be finished processing. This means
|
| 174 |
+
it can be the current directory or one of its ancestors.</p>
|
| 175 |
+
</dd>
|
| 176 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ID</span> <span class="pre"><id></span></code></dt><dd><p>Specify an identification for the deferred call.
|
| 177 |
+
The <code class="docutils literal notranslate"><span class="pre"><id></span></code> may not be empty and may not begin with a capital letter <code class="docutils literal notranslate"><span class="pre">A-Z</span></code>.
|
| 178 |
+
The <code class="docutils literal notranslate"><span class="pre"><id></span></code> may begin with an underscore (<code class="docutils literal notranslate"><span class="pre">_</span></code>) only if it was generated
|
| 179 |
+
automatically by an earlier call that used <code class="docutils literal notranslate"><span class="pre">ID_VAR</span></code> to get the id.</p>
|
| 180 |
+
</dd>
|
| 181 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ID_VAR</span> <span class="pre"><var></span></code></dt><dd><p>Specify a variable in which to store the identification for the
|
| 182 |
+
deferred call. If <code class="docutils literal notranslate"><span class="pre">ID</span> <span class="pre"><id></span></code> is not given, a new identification
|
| 183 |
+
will be generated and the generated id will start with an underscore (<code class="docutils literal notranslate"><span class="pre">_</span></code>).</p>
|
| 184 |
+
</dd>
|
| 185 |
+
</dl>
|
| 186 |
+
<p>The currently scheduled list of deferred calls may be retrieved:</p>
|
| 187 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_language(</span><span class="no">DEFER</span><span class="w"> </span><span class="p">[</span><span class="no">DIRECTORY</span><span class="w"> </span><span class="nv"><dir></span><span class="p">]</span><span class="w"> </span><span class="no">GET_CALL_IDS</span><span class="w"> </span><span class="nv"><var></span><span class="nf">)</span>
|
| 188 |
+
</pre></div>
|
| 189 |
+
</div>
|
| 190 |
+
<p>This will store in <code class="docutils literal notranslate"><span class="pre"><var></span></code> a <a class="reference internal" href="../manual/cmake-language.7.html#cmake-language-lists"><span class="std std-ref">semicolon-separated list</span></a> of deferred call ids. The ids are for the directory scope in which
|
| 191 |
+
the calls have been deferred to (i.e. where they will be executed), which can
|
| 192 |
+
be different to the scope in which they were created. The <code class="docutils literal notranslate"><span class="pre">DIRECTORY</span></code>
|
| 193 |
+
option can be used to specify the scope for which to retrieve the call ids.
|
| 194 |
+
If that option is not given, the call ids for the current directory scope
|
| 195 |
+
will be returned.</p>
|
| 196 |
+
<p>Details of a specific call may be retrieved from its id:</p>
|
| 197 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_language(</span><span class="no">DEFER</span><span class="w"> </span><span class="p">[</span><span class="no">DIRECTORY</span><span class="w"> </span><span class="nv"><dir></span><span class="p">]</span><span class="w"> </span><span class="no">GET_CALL</span><span class="w"> </span><span class="nv"><id></span><span class="w"> </span><span class="nv"><var></span><span class="nf">)</span>
|
| 198 |
+
</pre></div>
|
| 199 |
+
</div>
|
| 200 |
+
<p>This will store in <code class="docutils literal notranslate"><span class="pre"><var></span></code> a <a class="reference internal" href="../manual/cmake-language.7.html#cmake-language-lists"><span class="std std-ref">semicolon-separated list</span></a> in which the first element is the name of the command to be
|
| 201 |
+
called, and the remaining elements are its unevaluated arguments (any
|
| 202 |
+
contained <code class="docutils literal notranslate"><span class="pre">;</span></code> characters are included literally and cannot be distinguished
|
| 203 |
+
from multiple arguments). If multiple calls are scheduled with the same id,
|
| 204 |
+
this retrieves the first one. If no call is scheduled with the given id in
|
| 205 |
+
the specified <code class="docutils literal notranslate"><span class="pre">DIRECTORY</span></code> scope (or the current directory scope if no
|
| 206 |
+
<code class="docutils literal notranslate"><span class="pre">DIRECTORY</span></code> option is given), this stores an empty string in the variable.</p>
|
| 207 |
+
<p>Deferred calls may be canceled by their id:</p>
|
| 208 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_language(</span><span class="no">DEFER</span><span class="w"> </span><span class="p">[</span><span class="no">DIRECTORY</span><span class="w"> </span><span class="nv"><dir></span><span class="p">]</span><span class="w"> </span><span class="no">CANCEL_CALL</span><span class="w"> </span><span class="nv"><id>...</span><span class="nf">)</span>
|
| 209 |
+
</pre></div>
|
| 210 |
+
</div>
|
| 211 |
+
<p>This cancels all deferred calls matching any of the given ids in the specified
|
| 212 |
+
<code class="docutils literal notranslate"><span class="pre">DIRECTORY</span></code> scope (or the current directory scope if no <code class="docutils literal notranslate"><span class="pre">DIRECTORY</span></code> option
|
| 213 |
+
is given). Unknown ids are silently ignored.</p>
|
| 214 |
+
</dd></dl>
|
| 215 |
+
|
| 216 |
+
<section id="deferred-call-examples">
|
| 217 |
+
<h3>Deferred Call Examples<a class="headerlink" href="#deferred-call-examples" title="Link to this heading">¶</a></h3>
|
| 218 |
+
<p>For example, the code:</p>
|
| 219 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_language(</span><span class="no">DEFER</span><span class="w"> </span><span class="no">CALL</span><span class="w"> </span><span class="nb">message</span><span class="w"> </span><span class="s">"${deferred_message}"</span><span class="nf">)</span>
|
| 220 |
+
<span class="nf">cmake_language(</span><span class="no">DEFER</span><span class="w"> </span><span class="no">ID_VAR</span><span class="w"> </span><span class="nb">id</span><span class="w"> </span><span class="no">CALL</span><span class="w"> </span><span class="nb">message</span><span class="w"> </span><span class="s">"Canceled Message"</span><span class="nf">)</span>
|
| 221 |
+
<span class="nf">cmake_language(</span><span class="no">DEFER</span><span class="w"> </span><span class="no">CANCEL_CALL</span><span class="w"> </span><span class="o">${</span><span class="nt">id</span><span class="o">}</span><span class="nf">)</span>
|
| 222 |
+
<span class="nf">message(</span><span class="s">"Immediate Message"</span><span class="nf">)</span>
|
| 223 |
+
<span class="nf">set(</span><span class="nb">deferred_message</span><span class="w"> </span><span class="s">"Deferred Message"</span><span class="nf">)</span>
|
| 224 |
+
</pre></div>
|
| 225 |
+
</div>
|
| 226 |
+
<p>prints:</p>
|
| 227 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Immediate Message
|
| 228 |
+
Deferred Message
|
| 229 |
+
</pre></div>
|
| 230 |
+
</div>
|
| 231 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">Canceled</span> <span class="pre">Message</span></code> is never printed because its command is
|
| 232 |
+
canceled. The <code class="docutils literal notranslate"><span class="pre">deferred_message</span></code> variable reference is not evaluated
|
| 233 |
+
until the call site, so it can be set after the deferred call is scheduled.</p>
|
| 234 |
+
<p>In order to evaluate variable references immediately when scheduling a
|
| 235 |
+
deferred call, wrap it using <code class="docutils literal notranslate"><span class="pre">cmake_language(EVAL)</span></code>. However, note that
|
| 236 |
+
arguments will be re-evaluated in the deferred call, though that can be
|
| 237 |
+
avoided by using bracket arguments. For example:</p>
|
| 238 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">deferred_message</span><span class="w"> </span><span class="s">"Deferred Message 1"</span><span class="nf">)</span>
|
| 239 |
+
<span class="nf">set(</span><span class="nb">re_evaluated</span><span class="w"> </span><span class="p">[[</span><span class="o">${</span><span class="nt">deferred_message</span><span class="o">}</span><span class="p">]]</span><span class="nf">)</span>
|
| 240 |
+
<span class="nf">cmake_language(</span><span class="no">EVAL</span><span class="w"> </span><span class="no">CODE</span><span class="w"> </span><span class="s">"</span>
|
| 241 |
+
<span class="s"> cmake_language(DEFER CALL message [[${deferred_message}]])</span>
|
| 242 |
+
<span class="s"> cmake_language(DEFER CALL message \"${re_evaluated}\")</span>
|
| 243 |
+
<span class="s">"</span><span class="nf">)</span>
|
| 244 |
+
<span class="nf">message(</span><span class="s">"Immediate Message"</span><span class="nf">)</span>
|
| 245 |
+
<span class="nf">set(</span><span class="nb">deferred_message</span><span class="w"> </span><span class="s">"Deferred Message 2"</span><span class="nf">)</span>
|
| 246 |
+
</pre></div>
|
| 247 |
+
</div>
|
| 248 |
+
<p>also prints:</p>
|
| 249 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Immediate Message
|
| 250 |
+
Deferred Message 1
|
| 251 |
+
Deferred Message 2
|
| 252 |
+
</pre></div>
|
| 253 |
+
</div>
|
| 254 |
+
</section>
|
| 255 |
+
</section>
|
| 256 |
+
<section id="dependency-providers">
|
| 257 |
+
<span id="id1"></span><h2>Dependency Providers<a class="headerlink" href="#dependency-providers" title="Link to this heading">¶</a></h2>
|
| 258 |
+
<div class="versionadded">
|
| 259 |
+
<p><span class="versionmodified added">Added in version 3.24.</span></p>
|
| 260 |
+
</div>
|
| 261 |
+
<div class="admonition note">
|
| 262 |
+
<p class="admonition-title">Note</p>
|
| 263 |
+
<p>A high-level introduction to this feature can be found in the
|
| 264 |
+
<a class="reference internal" href="../guide/using-dependencies/index.html#dependency-providers-overview"><span class="std std-ref">Using Dependencies Guide</span></a>.</p>
|
| 265 |
+
</div>
|
| 266 |
+
<dl class="cmake signature">
|
| 267 |
+
<dt class="sig sig-object cmake" id="set-dependency-provider">
|
| 268 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_language(</span></span><span class="no"><span class="pre">SET_DEPENDENCY_PROVIDER</span></span><span class="w"> </span><span class="nv"><span class="pre"><command></span></span><span class="w"> </span><span class="no"><span class="pre">SUPPORTED_METHODS</span></span><span class="w"> </span><span class="nv"><span class="pre"><methods>...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#set-dependency-provider" title="Link to this definition">¶</a></dt>
|
| 269 |
+
<dd><p>When a call is made to <span class="target" id="index-0-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> or
|
| 270 |
+
<span class="target" id="index-0-command:fetchcontent_makeavailable"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_makeavailable" title="fetchcontent_makeavailable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_MakeAvailable()</span></code></a>, the call may be forwarded to a
|
| 271 |
+
dependency provider which then has the opportunity to fulfill the request.
|
| 272 |
+
If the request is for one of the <code class="docutils literal notranslate"><span class="pre"><methods></span></code> specified when the provider
|
| 273 |
+
was set, CMake calls the provider's <code class="docutils literal notranslate"><span class="pre"><command></span></code> with a set of
|
| 274 |
+
method-specific arguments. If the provider does not fulfill the request,
|
| 275 |
+
or if the provider doesn't support the request's method, or no provider
|
| 276 |
+
is set, the built-in <span class="target" id="index-1-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> or
|
| 277 |
+
<span class="target" id="index-1-command:fetchcontent_makeavailable"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_makeavailable" title="fetchcontent_makeavailable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_MakeAvailable()</span></code></a> implementation is used to fulfill
|
| 278 |
+
the request in the usual way.</p>
|
| 279 |
+
<p>One or more of the following values can be specified for the <code class="docutils literal notranslate"><span class="pre"><methods></span></code>
|
| 280 |
+
when setting the provider:</p>
|
| 281 |
+
<dl class="simple">
|
| 282 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FIND_PACKAGE</span></code></dt><dd><p>The provider command accepts <span class="target" id="index-2-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> requests.</p>
|
| 283 |
+
</dd>
|
| 284 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FETCHCONTENT_MAKEAVAILABLE_SERIAL</span></code></dt><dd><p>The provider command accepts <span class="target" id="index-2-command:fetchcontent_makeavailable"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_makeavailable" title="fetchcontent_makeavailable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_MakeAvailable()</span></code></a>
|
| 285 |
+
requests. It expects each dependency to be fed to the provider command
|
| 286 |
+
one at a time, not the whole list in one go.</p>
|
| 287 |
+
</dd>
|
| 288 |
+
</dl>
|
| 289 |
+
<p>Only one provider can be set at any point in time. If a provider is already
|
| 290 |
+
set when <code class="docutils literal notranslate"><span class="pre">cmake_language(SET_DEPENDENCY_PROVIDER)</span></code> is called, the new
|
| 291 |
+
provider replaces the previously set one. The specified <code class="docutils literal notranslate"><span class="pre"><command></span></code> must
|
| 292 |
+
already exist when <code class="docutils literal notranslate"><span class="pre">cmake_language(SET_DEPENDENCY_PROVIDER)</span></code> is called.
|
| 293 |
+
As a special case, providing an empty string for the <code class="docutils literal notranslate"><span class="pre"><command></span></code> and no
|
| 294 |
+
<code class="docutils literal notranslate"><span class="pre"><methods></span></code> will discard any previously set provider.</p>
|
| 295 |
+
<p>The dependency provider can only be set while processing one of the files
|
| 296 |
+
specified by the <span class="target" id="index-0-variable:CMAKE_PROJECT_TOP_LEVEL_INCLUDES"></span><a class="reference internal" href="../variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.html#variable:CMAKE_PROJECT_TOP_LEVEL_INCLUDES" title="CMAKE_PROJECT_TOP_LEVEL_INCLUDES"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_PROJECT_TOP_LEVEL_INCLUDES</span></code></a> variable.
|
| 297 |
+
Thus, dependency providers can only be set as part of the first call to
|
| 298 |
+
<span class="target" id="index-0-command:project"></span><a class="reference internal" href="project.html#command:project" title="project"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">project()</span></code></a>. Calling <code class="docutils literal notranslate"><span class="pre">cmake_language(SET_DEPENDENCY_PROVIDER)</span></code>
|
| 299 |
+
outside of that context will result in an error.</p>
|
| 300 |
+
<div class="versionadded">
|
| 301 |
+
<p><span class="versionmodified added">Added in version 3.30: </span>The <span class="target" id="index-0-prop_gbl:PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE"></span><a class="reference internal" href="../prop_gbl/PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE.html#prop_gbl:PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE" title="PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE"><code class="xref cmake cmake-prop_gbl docutils literal notranslate"><span class="pre">PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE</span></code></a> global
|
| 302 |
+
property can be set if the dependency provider also wants to be enabled
|
| 303 |
+
in whole-project calls to <span class="target" id="index-0-command:try_compile"></span><a class="reference internal" href="try_compile.html#command:try_compile" title="try_compile"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">try_compile()</span></code></a>.</p>
|
| 304 |
+
</div>
|
| 305 |
+
<div class="admonition note">
|
| 306 |
+
<p class="admonition-title">Note</p>
|
| 307 |
+
<p>The choice of dependency provider should always be under the user's control.
|
| 308 |
+
As a convenience, a project may choose to provide a file that users can
|
| 309 |
+
list in their <span class="target" id="index-1-variable:CMAKE_PROJECT_TOP_LEVEL_INCLUDES"></span><a class="reference internal" href="../variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.html#variable:CMAKE_PROJECT_TOP_LEVEL_INCLUDES" title="CMAKE_PROJECT_TOP_LEVEL_INCLUDES"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_PROJECT_TOP_LEVEL_INCLUDES</span></code></a> variable, but
|
| 310 |
+
the use of such a file should always be the user's choice.</p>
|
| 311 |
+
</div>
|
| 312 |
+
</dd></dl>
|
| 313 |
+
|
| 314 |
+
<section id="provider-commands">
|
| 315 |
+
<h3>Provider commands<a class="headerlink" href="#provider-commands" title="Link to this heading">¶</a></h3>
|
| 316 |
+
<p>Providers define a single <code class="docutils literal notranslate"><span class="pre"><command></span></code> to accept requests. The name of
|
| 317 |
+
the command should be specific to that provider, not something overly
|
| 318 |
+
generic that another provider might also use. This enables users to compose
|
| 319 |
+
different providers in their own custom provider. The recommended form is
|
| 320 |
+
<code class="docutils literal notranslate"><span class="pre">xxx_provide_dependency()</span></code>, where <code class="docutils literal notranslate"><span class="pre">xxx</span></code> is the provider-specific part
|
| 321 |
+
(e.g. <code class="docutils literal notranslate"><span class="pre">vcpkg_provide_dependency()</span></code>, <code class="docutils literal notranslate"><span class="pre">conan_provide_dependency()</span></code>,
|
| 322 |
+
<code class="docutils literal notranslate"><span class="pre">ourcompany_provide_dependency()</span></code>, and so on).</p>
|
| 323 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">xxx_provide_dependency(</span><span class="nv"><method></span><span class="w"> </span><span class="p">[</span><span class="nv"><method-specific-args>...</span><span class="p">]</span><span class="nf">)</span>
|
| 324 |
+
</pre></div>
|
| 325 |
+
</div>
|
| 326 |
+
<p>Because some methods expect certain variables to be set in the calling scope,
|
| 327 |
+
the provider command should typically be implemented as a macro rather than a
|
| 328 |
+
function. This ensures it does not introduce a new variable scope.</p>
|
| 329 |
+
<p>The arguments CMake passes to the dependency provider depend on the type of
|
| 330 |
+
request. The first argument is always the method, and it will only ever
|
| 331 |
+
be one of the <code class="docutils literal notranslate"><span class="pre"><methods></span></code> that was specified when setting the provider.</p>
|
| 332 |
+
<dl>
|
| 333 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FIND_PACKAGE</span></code></dt><dd><p>The <code class="docutils literal notranslate"><span class="pre"><method-specific-args></span></code> will be everything passed to the
|
| 334 |
+
<span class="target" id="index-3-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> call that requested the dependency. The first of
|
| 335 |
+
these <code class="docutils literal notranslate"><span class="pre"><method-specific-args></span></code> will therefore always be the name of the
|
| 336 |
+
dependency. Dependency names are case-sensitive for this method because
|
| 337 |
+
<span class="target" id="index-4-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> treats them case-sensitively too.</p>
|
| 338 |
+
<p>If the provider command fulfills the request, it must set the same variable
|
| 339 |
+
that <span class="target" id="index-5-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> expects to be set. For a dependency named
|
| 340 |
+
<code class="docutils literal notranslate"><span class="pre">depName</span></code>, the provider must set <code class="docutils literal notranslate"><span class="pre">depName_FOUND</span></code> to true if it fulfilled
|
| 341 |
+
the request. If the provider returns without setting this variable, CMake
|
| 342 |
+
will assume the request was not fulfilled and will fall back to the
|
| 343 |
+
built-in implementation.</p>
|
| 344 |
+
<p>If the provider needs to call the built-in <span class="target" id="index-6-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a>
|
| 345 |
+
implementation as part of its processing, it can do so by including the
|
| 346 |
+
<code class="docutils literal notranslate"><span class="pre">BYPASS_PROVIDER</span></code> keyword as one of the arguments.</p>
|
| 347 |
+
</dd>
|
| 348 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FETCHCONTENT_MAKEAVAILABLE_SERIAL</span></code></dt><dd><p>The <code class="docutils literal notranslate"><span class="pre"><method-specific-args></span></code> will be everything passed to the
|
| 349 |
+
<span class="target" id="index-0-command:fetchcontent_declare"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_declare" title="fetchcontent_declare"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_Declare()</span></code></a> call that corresponds to the requested
|
| 350 |
+
dependency, with the following exceptions:</p>
|
| 351 |
+
<ul class="simple">
|
| 352 |
+
<li><p>If <code class="docutils literal notranslate"><span class="pre">SOURCE_DIR</span></code> or <code class="docutils literal notranslate"><span class="pre">BINARY_DIR</span></code> were not part of the original
|
| 353 |
+
declared arguments, they will be added with their default values.</p></li>
|
| 354 |
+
<li><p>If <span class="target" id="index-0-variable:FETCHCONTENT_TRY_FIND_PACKAGE_MODE"></span><a class="reference internal" href="../module/FetchContent.html#variable:FETCHCONTENT_TRY_FIND_PACKAGE_MODE" title="FETCHCONTENT_TRY_FIND_PACKAGE_MODE"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">FETCHCONTENT_TRY_FIND_PACKAGE_MODE</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">NEVER</span></code>,
|
| 355 |
+
any <code class="docutils literal notranslate"><span class="pre">FIND_PACKAGE_ARGS</span></code> will be omitted.</p></li>
|
| 356 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">OVERRIDE_FIND_PACKAGE</span></code> keyword is always omitted.</p></li>
|
| 357 |
+
</ul>
|
| 358 |
+
<p>The first of the <code class="docutils literal notranslate"><span class="pre"><method-specific-args></span></code> will always be the name of the
|
| 359 |
+
dependency. Dependency names are case-insensitive for this method because
|
| 360 |
+
<span class="target" id="index-0-module:FetchContent"></span><a class="reference internal" href="../module/FetchContent.html#module:FetchContent" title="FetchContent"><code class="xref cmake cmake-module docutils literal notranslate"><span class="pre">FetchContent</span></code></a> also treats them case-insensitively.</p>
|
| 361 |
+
<p>If the provider fulfills the request, it should call
|
| 362 |
+
<span class="target" id="index-0-command:fetchcontent_setpopulated"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_setpopulated" title="fetchcontent_setpopulated"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_SetPopulated()</span></code></a>, passing the name of the dependency as
|
| 363 |
+
the first argument. The <code class="docutils literal notranslate"><span class="pre">SOURCE_DIR</span></code> and <code class="docutils literal notranslate"><span class="pre">BINARY_DIR</span></code> arguments to that
|
| 364 |
+
command should only be given if the provider makes the dependency's source
|
| 365 |
+
and build directories available in exactly the same way as the built-in
|
| 366 |
+
<span class="target" id="index-3-command:fetchcontent_makeavailable"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_makeavailable" title="fetchcontent_makeavailable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_MakeAvailable()</span></code></a> command.</p>
|
| 367 |
+
<p>If the provider returns without calling <span class="target" id="index-1-command:fetchcontent_setpopulated"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_setpopulated" title="fetchcontent_setpopulated"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_SetPopulated()</span></code></a>
|
| 368 |
+
for the named dependency, CMake will assume the request was not fulfilled
|
| 369 |
+
and will fall back to the built-in implementation.</p>
|
| 370 |
+
<p>Note that empty arguments may be significant for this method (e.g. an empty
|
| 371 |
+
string following a <code class="docutils literal notranslate"><span class="pre">GIT_SUBMODULES</span></code> keyword). Therefore, if forwarding
|
| 372 |
+
these arguments on to another command, extra care must be taken to avoid such
|
| 373 |
+
arguments being silently dropped.</p>
|
| 374 |
+
<p>If <code class="docutils literal notranslate"><span class="pre">FETCHCONTENT_SOURCE_DIR_<uppercaseDepName></span></code> is set, then the
|
| 375 |
+
dependency provider will never see requests for the <code class="docutils literal notranslate"><span class="pre"><depName></span></code> dependency
|
| 376 |
+
for this method. When the user sets such a variable, they are explicitly
|
| 377 |
+
overriding where to get that dependency from and are taking on the
|
| 378 |
+
responsibility that their overriding version meets any requirements for that
|
| 379 |
+
dependency and is compatible with whatever else in the project uses it.
|
| 380 |
+
Depending on the value of <span class="target" id="index-1-variable:FETCHCONTENT_TRY_FIND_PACKAGE_MODE"></span><a class="reference internal" href="../module/FetchContent.html#variable:FETCHCONTENT_TRY_FIND_PACKAGE_MODE" title="FETCHCONTENT_TRY_FIND_PACKAGE_MODE"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">FETCHCONTENT_TRY_FIND_PACKAGE_MODE</span></code></a>
|
| 381 |
+
and whether the <code class="docutils literal notranslate"><span class="pre">OVERRIDE_FIND_PACKAGE</span></code> option was given to
|
| 382 |
+
<span class="target" id="index-1-command:fetchcontent_declare"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_declare" title="fetchcontent_declare"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_Declare()</span></code></a>, having
|
| 383 |
+
<code class="docutils literal notranslate"><span class="pre">FETCHCONTENT_SOURCE_DIR_<uppercaseDepName></span></code> set may also prevent the
|
| 384 |
+
dependency provider from seeing requests for a <code class="docutils literal notranslate"><span class="pre">find_package(depName)</span></code>
|
| 385 |
+
call too.</p>
|
| 386 |
+
</dd>
|
| 387 |
+
</dl>
|
| 388 |
+
</section>
|
| 389 |
+
<section id="provider-examples">
|
| 390 |
+
<h3>Provider Examples<a class="headerlink" href="#provider-examples" title="Link to this heading">¶</a></h3>
|
| 391 |
+
<p>This first example only intercepts <span class="target" id="index-7-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> calls. The
|
| 392 |
+
provider command runs an external tool which copies the relevant artifacts
|
| 393 |
+
into a provider-specific directory, if that tool knows about the dependency.
|
| 394 |
+
It then relies on the built-in implementation to then find those artifacts.
|
| 395 |
+
<span class="target" id="index-4-command:fetchcontent_makeavailable"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_makeavailable" title="fetchcontent_makeavailable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_MakeAvailable()</span></code></a> calls would not go through the provider.</p>
|
| 396 |
+
<div class="literal-block-wrapper docutils container" id="id2">
|
| 397 |
+
<div class="code-block-caption"><span class="caption-text">mycomp_provider.cmake</span><a class="headerlink" href="#id2" title="Link to this code">¶</a></div>
|
| 398 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="c"># Always ensure we have the policy settings this provider expects</span>
|
| 399 |
+
<span class="nf">cmake_minimum_required(</span><span class="no">VERSION</span><span class="w"> </span><span class="m">3.24</span><span class="nf">)</span>
|
| 400 |
+
|
| 401 |
+
<span class="nf">set(</span><span class="no">MYCOMP_PROVIDER_INSTALL_DIR</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_BINARY_DIR</span><span class="o">}</span><span class="na">/mycomp_packages</span>
|
| 402 |
+
<span class="w"> </span><span class="no">CACHE</span><span class="w"> </span><span class="no">PATH</span><span class="w"> </span><span class="s">"The directory this provider installs packages to"</span>
|
| 403 |
+
<span class="nf">)</span>
|
| 404 |
+
<span class="c"># Tell the built-in implementation to look in our area first, unless</span>
|
| 405 |
+
<span class="c"># the find_package() call uses NO_..._PATH options to exclude it</span>
|
| 406 |
+
<span class="nf">list(</span><span class="no">APPEND</span><span class="w"> </span><span class="no">CMAKE_MODULE_PATH</span><span class="w"> </span><span class="o">${</span><span class="nt">MYCOMP_PROVIDER_INSTALL_DIR</span><span class="o">}</span><span class="na">/cmake</span><span class="nf">)</span>
|
| 407 |
+
<span class="nf">list(</span><span class="no">APPEND</span><span class="w"> </span><span class="no">CMAKE_PREFIX_PATH</span><span class="w"> </span><span class="o">${</span><span class="nt">MYCOMP_PROVIDER_INSTALL_DIR</span><span class="o">}</span><span class="nf">)</span>
|
| 408 |
+
|
| 409 |
+
<span class="nf">macro(</span><span class="nb">mycomp_provide_dependency</span><span class="w"> </span><span class="nb">method</span><span class="w"> </span><span class="nb">package_name</span><span class="nf">)</span>
|
| 410 |
+
<span class="w"> </span><span class="nf">execute_process(</span>
|
| 411 |
+
<span class="w"> </span><span class="no">COMMAND</span><span class="w"> </span><span class="nb">some_tool</span><span class="w"> </span><span class="o">${</span><span class="nt">package_name</span><span class="o">}</span><span class="w"> </span><span class="p">--</span><span class="nb">installdir</span><span class="w"> </span><span class="o">${</span><span class="nt">MYCOMP_PROVIDER_INSTALL_DIR</span><span class="o">}</span>
|
| 412 |
+
<span class="w"> </span><span class="no">COMMAND_ERROR_IS_FATAL</span><span class="w"> </span><span class="no">ANY</span>
|
| 413 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 414 |
+
<span class="nf">endmacro()</span>
|
| 415 |
+
|
| 416 |
+
<span class="nf">cmake_language(</span>
|
| 417 |
+
<span class="w"> </span><span class="no">SET_DEPENDENCY_PROVIDER</span><span class="w"> </span><span class="nb">mycomp_provide_dependency</span>
|
| 418 |
+
<span class="w"> </span><span class="no">SUPPORTED_METHODS</span><span class="w"> </span><span class="no">FIND_PACKAGE</span>
|
| 419 |
+
<span class="nf">)</span>
|
| 420 |
+
</pre></div>
|
| 421 |
+
</div>
|
| 422 |
+
</div>
|
| 423 |
+
<p>The user would then typically use the above file like so:</p>
|
| 424 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cmake -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=/path/to/mycomp_provider.cmake ...
|
| 425 |
+
</pre></div>
|
| 426 |
+
</div>
|
| 427 |
+
<p>The next example demonstrates a provider that accepts both methods, but
|
| 428 |
+
only handles one specific dependency. It enforces providing Google Test
|
| 429 |
+
using <span class="target" id="index-1-module:FetchContent"></span><a class="reference internal" href="../module/FetchContent.html#module:FetchContent" title="FetchContent"><code class="xref cmake cmake-module docutils literal notranslate"><span class="pre">FetchContent</span></code></a>, but leaves all other dependencies to be
|
| 430 |
+
fulfilled by CMake's built-in implementation. It accepts a few different
|
| 431 |
+
names, which demonstrates one way of working around projects that hard-code
|
| 432 |
+
an unusual or undesirable way of adding this particular dependency to the
|
| 433 |
+
build. The example also demonstrates how to use the <span class="target" id="index-0-command:list"></span><a class="reference internal" href="list.html#command:list" title="list"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">list()</span></code></a> command
|
| 434 |
+
to preserve variables that may be overwritten by a call to
|
| 435 |
+
<span class="target" id="index-5-command:fetchcontent_makeavailable"></span><a class="reference internal" href="../module/FetchContent.html#command:fetchcontent_makeavailable" title="fetchcontent_makeavailable"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">FetchContent_MakeAvailable()</span></code></a>.</p>
|
| 436 |
+
<div class="literal-block-wrapper docutils container" id="id3">
|
| 437 |
+
<div class="code-block-caption"><span class="caption-text">mycomp_provider.cmake</span><a class="headerlink" href="#id3" title="Link to this code">¶</a></div>
|
| 438 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_minimum_required(</span><span class="no">VERSION</span><span class="w"> </span><span class="m">3.24</span><span class="nf">)</span>
|
| 439 |
+
|
| 440 |
+
<span class="c"># Because we declare this very early, it will take precedence over any</span>
|
| 441 |
+
<span class="c"># details the project might declare later for the same thing</span>
|
| 442 |
+
<span class="nf">include(</span><span class="nb">FetchContent</span><span class="nf">)</span>
|
| 443 |
+
<span class="nf">FetchContent_Declare(</span>
|
| 444 |
+
<span class="w"> </span><span class="nb">googletest</span>
|
| 445 |
+
<span class="w"> </span><span class="no">GIT_REPOSITORY</span><span class="w"> </span><span class="na">https://github.com/google/googletest.git</span>
|
| 446 |
+
<span class="w"> </span><span class="no">GIT_TAG</span><span class="w"> </span><span class="nb">e2239ee6043f73722e7aa812a459f54a28552929</span><span class="w"> </span><span class="c"># release-1.11.0</span>
|
| 447 |
+
<span class="nf">)</span>
|
| 448 |
+
|
| 449 |
+
<span class="c"># Both FIND_PACKAGE and FETCHCONTENT_MAKEAVAILABLE_SERIAL methods provide</span>
|
| 450 |
+
<span class="c"># the package or dependency name as the first method-specific argument.</span>
|
| 451 |
+
<span class="nf">macro(</span><span class="nb">mycomp_provide_dependency</span><span class="w"> </span><span class="nb">method</span><span class="w"> </span><span class="nb">dep_name</span><span class="nf">)</span>
|
| 452 |
+
<span class="w"> </span><span class="nf">if(</span><span class="s">"${dep_name}"</span><span class="w"> </span><span class="no">MATCHES</span><span class="w"> </span><span class="s">"^(gtest|googletest)$"</span><span class="nf">)</span>
|
| 453 |
+
<span class="w"> </span><span class="c"># Save our current command arguments in case we are called recursively</span>
|
| 454 |
+
<span class="w"> </span><span class="nf">list(</span><span class="no">APPEND</span><span class="w"> </span><span class="nb">mycomp_provider_args</span><span class="w"> </span><span class="o">${</span><span class="nt">method</span><span class="o">}</span><span class="w"> </span><span class="o">${</span><span class="nt">dep_name</span><span class="o">}</span><span class="nf">)</span>
|
| 455 |
+
|
| 456 |
+
<span class="w"> </span><span class="c"># This will forward to the built-in FetchContent implementation,</span>
|
| 457 |
+
<span class="w"> </span><span class="c"># which detects a recursive call for the same thing and avoids calling</span>
|
| 458 |
+
<span class="w"> </span><span class="c"># the provider again if dep_name is the same as the current call.</span>
|
| 459 |
+
<span class="w"> </span><span class="nf">FetchContent_MakeAvailable(</span><span class="nb">googletest</span><span class="nf">)</span>
|
| 460 |
+
|
| 461 |
+
<span class="w"> </span><span class="c"># Restore our command arguments</span>
|
| 462 |
+
<span class="w"> </span><span class="nf">list(</span><span class="no">POP_BACK</span><span class="w"> </span><span class="nb">mycomp_provider_args</span><span class="w"> </span><span class="nb">dep_name</span><span class="w"> </span><span class="nb">method</span><span class="nf">)</span>
|
| 463 |
+
|
| 464 |
+
<span class="w"> </span><span class="c"># Tell the caller we fulfilled the request</span>
|
| 465 |
+
<span class="w"> </span><span class="nf">if(</span><span class="s">"${method}"</span><span class="w"> </span><span class="no">STREQUAL</span><span class="w"> </span><span class="s">"FIND_PACKAGE"</span><span class="nf">)</span>
|
| 466 |
+
<span class="w"> </span><span class="c"># We need to set this if we got here from a find_package() call</span>
|
| 467 |
+
<span class="w"> </span><span class="c"># since we used a different method to fulfill the request.</span>
|
| 468 |
+
<span class="w"> </span><span class="c"># This example assumes projects only use the gtest targets,</span>
|
| 469 |
+
<span class="w"> </span><span class="c"># not any of the variables the FindGTest module may define.</span>
|
| 470 |
+
<span class="w"> </span><span class="nf">set(</span><span class="o">${</span><span class="nt">dep_name</span><span class="o">}</span><span class="nb">_FOUND</span><span class="w"> </span><span class="no">TRUE</span><span class="nf">)</span>
|
| 471 |
+
<span class="w"> </span><span class="nf">elseif(</span><span class="no">NOT</span><span class="w"> </span><span class="s">"${dep_name}"</span><span class="w"> </span><span class="no">STREQUAL</span><span class="w"> </span><span class="s">"googletest"</span><span class="nf">)</span>
|
| 472 |
+
<span class="w"> </span><span class="c"># We used the same method, but were given a different name to the</span>
|
| 473 |
+
<span class="w"> </span><span class="c"># one we populated with. Tell the caller about the name it used.</span>
|
| 474 |
+
<span class="w"> </span><span class="nf">FetchContent_SetPopulated(</span><span class="o">${</span><span class="nt">dep_name</span><span class="o">}</span>
|
| 475 |
+
<span class="w"> </span><span class="no">SOURCE_DIR</span><span class="w"> </span><span class="s">"${googletest_SOURCE_DIR}"</span>
|
| 476 |
+
<span class="w"> </span><span class="no">BINARY_DIR</span><span class="w"> </span><span class="s">"${googletest_BINARY_DIR}"</span>
|
| 477 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 478 |
+
<span class="w"> </span><span class="nf">endif()</span>
|
| 479 |
+
<span class="w"> </span><span class="nf">endif()</span>
|
| 480 |
+
<span class="nf">endmacro()</span>
|
| 481 |
+
|
| 482 |
+
<span class="nf">cmake_language(</span>
|
| 483 |
+
<span class="w"> </span><span class="no">SET_DEPENDENCY_PROVIDER</span><span class="w"> </span><span class="nb">mycomp_provide_dependency</span>
|
| 484 |
+
<span class="w"> </span><span class="no">SUPPORTED_METHODS</span>
|
| 485 |
+
<span class="w"> </span><span class="no">FIND_PACKAGE</span>
|
| 486 |
+
<span class="w"> </span><span class="no">FETCHCONTENT_MAKEAVAILABLE_SERIAL</span>
|
| 487 |
+
<span class="nf">)</span>
|
| 488 |
+
</pre></div>
|
| 489 |
+
</div>
|
| 490 |
+
</div>
|
| 491 |
+
<p>The final example demonstrates how to modify arguments to a
|
| 492 |
+
<span class="target" id="index-8-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> call. It forces all such calls to have the
|
| 493 |
+
<code class="docutils literal notranslate"><span class="pre">QUIET</span></code> keyword. It uses the <code class="docutils literal notranslate"><span class="pre">BYPASS_PROVIDER</span></code> keyword to prevent
|
| 494 |
+
calling the provider command recursively for the same dependency.</p>
|
| 495 |
+
<div class="literal-block-wrapper docutils container" id="id4">
|
| 496 |
+
<div class="code-block-caption"><span class="caption-text">mycomp_provider.cmake</span><a class="headerlink" href="#id4" title="Link to this code">¶</a></div>
|
| 497 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_minimum_required(</span><span class="no">VERSION</span><span class="w"> </span><span class="m">3.24</span><span class="nf">)</span>
|
| 498 |
+
|
| 499 |
+
<span class="nf">macro(</span><span class="nb">mycomp_provide_dependency</span><span class="w"> </span><span class="nb">method</span><span class="nf">)</span>
|
| 500 |
+
<span class="w"> </span><span class="nf">find_package(</span><span class="o">${</span><span class="nt">ARGN</span><span class="o">}</span><span class="w"> </span><span class="no">BYPASS_PROVIDER</span><span class="w"> </span><span class="no">QUIET</span><span class="nf">)</span>
|
| 501 |
+
<span class="nf">endmacro()</span>
|
| 502 |
+
|
| 503 |
+
<span class="nf">cmake_language(</span>
|
| 504 |
+
<span class="w"> </span><span class="no">SET_DEPENDENCY_PROVIDER</span><span class="w"> </span><span class="nb">mycomp_provide_dependency</span>
|
| 505 |
+
<span class="w"> </span><span class="no">SUPPORTED_METHODS</span><span class="w"> </span><span class="no">FIND_PACKAGE</span>
|
| 506 |
+
<span class="nf">)</span>
|
| 507 |
+
</pre></div>
|
| 508 |
+
</div>
|
| 509 |
+
</div>
|
| 510 |
+
</section>
|
| 511 |
+
</section>
|
| 512 |
+
<section id="getting-current-message-log-level">
|
| 513 |
+
<h2>Getting current message log level<a class="headerlink" href="#getting-current-message-log-level" title="Link to this heading">¶</a></h2>
|
| 514 |
+
<div class="versionadded">
|
| 515 |
+
<p><span class="versionmodified added">Added in version 3.25.</span></p>
|
| 516 |
+
</div>
|
| 517 |
+
<dl class="cmake signature" id="query-message-log-level">
|
| 518 |
+
<dt class="sig sig-object cmake" id="get-message-log-level">
|
| 519 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_language(</span></span><span class="no"><span class="pre">GET_MESSAGE_LOG_LEVEL</span></span><span class="w"> </span><span class="nv"><span class="pre"><output_variable></span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#get-message-log-level" title="Link to this definition">¶</a></dt>
|
| 520 |
+
<dd><p>Writes the current <span class="target" id="index-0-command:message"></span><a class="reference internal" href="message.html#command:message" title="message"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">message()</span></code></a> logging level
|
| 521 |
+
into the given <code class="docutils literal notranslate"><span class="pre"><output_variable></span></code>.</p>
|
| 522 |
+
<p>See <span class="target" id="index-1-command:message"></span><a class="reference internal" href="message.html#command:message" title="message"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">message()</span></code></a> for the possible logging levels.</p>
|
| 523 |
+
<p>The current message logging level can be set either using the
|
| 524 |
+
<a class="reference internal" href="../manual/cmake.1.html#cmdoption-cmake-log-level"><code class="xref std std-option docutils literal notranslate"><span class="pre">--log-level</span></code></a>
|
| 525 |
+
command line option of the <span class="target" id="index-0-manual:cmake(1)"></span><a class="reference internal" href="../manual/cmake.1.html#manual:cmake(1)" title="cmake(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake(1)</span></code></a> program or using
|
| 526 |
+
the <span class="target" id="index-0-variable:CMAKE_MESSAGE_LOG_LEVEL"></span><a class="reference internal" href="../variable/CMAKE_MESSAGE_LOG_LEVEL.html#variable:CMAKE_MESSAGE_LOG_LEVEL" title="CMAKE_MESSAGE_LOG_LEVEL"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_MESSAGE_LOG_LEVEL</span></code></a> variable.</p>
|
| 527 |
+
<p>If both the command line option and the variable are set, the command line
|
| 528 |
+
option takes precedence. If neither are set, the default logging level
|
| 529 |
+
is returned.</p>
|
| 530 |
+
</dd></dl>
|
| 531 |
+
|
| 532 |
+
</section>
|
| 533 |
+
<section id="terminating-scripts">
|
| 534 |
+
<h2>Terminating Scripts<a class="headerlink" href="#terminating-scripts" title="Link to this heading">¶</a></h2>
|
| 535 |
+
<div class="versionadded">
|
| 536 |
+
<p><span class="versionmodified added">Added in version 3.29.</span></p>
|
| 537 |
+
</div>
|
| 538 |
+
<dl class="cmake signature">
|
| 539 |
+
<dt class="sig sig-object cmake" id="exit">
|
| 540 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_language(</span></span><span class="no"><span class="pre">EXIT</span></span><span class="w"> </span><span class="nv"><span class="pre"><exit-code></span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#exit" title="Link to this definition">¶</a></dt>
|
| 541 |
+
<dd><p>Terminate the current <a class="reference internal" href="../manual/cmake.1.html#cmdoption-cmake-P"><code class="xref std std-option docutils literal notranslate"><span class="pre">cmake</span> <span class="pre">-P</span></code></a> script and exit with <code class="docutils literal notranslate"><span class="pre"><exit-code></span></code>.</p>
|
| 542 |
+
<p>This command works only in <a class="reference internal" href="../manual/cmake.1.html#script-processing-mode"><span class="std std-ref">script mode</span></a>.
|
| 543 |
+
If used outside of that context, it will cause a fatal error.</p>
|
| 544 |
+
<p>The <code class="docutils literal notranslate"><span class="pre"><exit-code></span></code> should be non-negative.
|
| 545 |
+
If <code class="docutils literal notranslate"><span class="pre"><exit-code></span></code> is negative, then the behavior
|
| 546 |
+
is unspecified (e.g., on Windows the error code -1
|
| 547 |
+
becomes <code class="docutils literal notranslate"><span class="pre">0xffffffff</span></code>, and on Linux it becomes 255).
|
| 548 |
+
Exit codes above 255 may not be supported by the underlying
|
| 549 |
+
shell or platform, and some shells may interpret values
|
| 550 |
+
above 125 specially. Therefore, it is advisable to only
|
| 551 |
+
specify an <code class="docutils literal notranslate"><span class="pre"><exit-code></span></code> in the range 0 to 125.</p>
|
| 552 |
+
</dd></dl>
|
| 553 |
+
|
| 554 |
+
</section>
|
| 555 |
+
</section>
|
| 556 |
+
|
| 557 |
+
|
| 558 |
+
<div class="clearer"></div>
|
| 559 |
+
</div>
|
| 560 |
+
</div>
|
| 561 |
+
</div>
|
| 562 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 563 |
+
<div class="sphinxsidebarwrapper">
|
| 564 |
+
<div>
|
| 565 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 566 |
+
<ul>
|
| 567 |
+
<li><a class="reference internal" href="#">cmake_language</a><ul>
|
| 568 |
+
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
|
| 569 |
+
<li><a class="reference internal" href="#introduction">Introduction</a></li>
|
| 570 |
+
<li><a class="reference internal" href="#calling-commands">Calling Commands</a></li>
|
| 571 |
+
<li><a class="reference internal" href="#evaluating-code">Evaluating Code</a></li>
|
| 572 |
+
<li><a class="reference internal" href="#deferring-calls">Deferring Calls</a><ul>
|
| 573 |
+
<li><a class="reference internal" href="#deferred-call-examples">Deferred Call Examples</a></li>
|
| 574 |
+
</ul>
|
| 575 |
+
</li>
|
| 576 |
+
<li><a class="reference internal" href="#dependency-providers">Dependency Providers</a><ul>
|
| 577 |
+
<li><a class="reference internal" href="#provider-commands">Provider commands</a></li>
|
| 578 |
+
<li><a class="reference internal" href="#provider-examples">Provider Examples</a></li>
|
| 579 |
+
</ul>
|
| 580 |
+
</li>
|
| 581 |
+
<li><a class="reference internal" href="#getting-current-message-log-level">Getting current message log level</a></li>
|
| 582 |
+
<li><a class="reference internal" href="#terminating-scripts">Terminating Scripts</a></li>
|
| 583 |
+
</ul>
|
| 584 |
+
</li>
|
| 585 |
+
</ul>
|
| 586 |
+
|
| 587 |
+
</div>
|
| 588 |
+
<div>
|
| 589 |
+
<h4>Previous topic</h4>
|
| 590 |
+
<p class="topless"><a href="cmake_host_system_information.html"
|
| 591 |
+
title="previous chapter">cmake_host_system_information</a></p>
|
| 592 |
+
</div>
|
| 593 |
+
<div>
|
| 594 |
+
<h4>Next topic</h4>
|
| 595 |
+
<p class="topless"><a href="cmake_minimum_required.html"
|
| 596 |
+
title="next chapter">cmake_minimum_required</a></p>
|
| 597 |
+
</div>
|
| 598 |
+
<div role="note" aria-label="source link">
|
| 599 |
+
<h3>This Page</h3>
|
| 600 |
+
<ul class="this-page-menu">
|
| 601 |
+
<li><a href="../_sources/command/cmake_language.rst.txt"
|
| 602 |
+
rel="nofollow">Show Source</a></li>
|
| 603 |
+
</ul>
|
| 604 |
+
</div>
|
| 605 |
+
<search id="searchbox" style="display: none" role="search">
|
| 606 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 607 |
+
<div class="searchformwrapper">
|
| 608 |
+
<form class="search" action="../search.html" method="get">
|
| 609 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 610 |
+
<input type="submit" value="Go" />
|
| 611 |
+
</form>
|
| 612 |
+
</div>
|
| 613 |
+
</search>
|
| 614 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 615 |
+
</div>
|
| 616 |
+
</div>
|
| 617 |
+
<div class="clearer"></div>
|
| 618 |
+
</div>
|
| 619 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 620 |
+
<h3>Navigation</h3>
|
| 621 |
+
<ul>
|
| 622 |
+
<li class="right" style="margin-right: 10px">
|
| 623 |
+
<a href="../genindex.html" title="General Index"
|
| 624 |
+
>index</a></li>
|
| 625 |
+
<li class="right" >
|
| 626 |
+
<a href="cmake_minimum_required.html" title="cmake_minimum_required"
|
| 627 |
+
>next</a> |</li>
|
| 628 |
+
<li class="right" >
|
| 629 |
+
<a href="cmake_host_system_information.html" title="cmake_host_system_information"
|
| 630 |
+
>previous</a> |</li>
|
| 631 |
+
<li>
|
| 632 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 633 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 634 |
+
</li>
|
| 635 |
+
<li>
|
| 636 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 637 |
+
</li>
|
| 638 |
+
<li>
|
| 639 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 640 |
+
</li>
|
| 641 |
+
|
| 642 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 643 |
+
<li class="nav-item nav-item-this"><a href="">cmake_language</a></li>
|
| 644 |
+
</ul>
|
| 645 |
+
</div>
|
| 646 |
+
|
| 647 |
+
<div class="footer" role="contentinfo">
|
| 648 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 649 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 650 |
+
</div>
|
| 651 |
+
</body>
|
| 652 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_minimum_required.html
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_minimum_required — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_parse_arguments" href="cmake_parse_arguments.html" />
|
| 21 |
+
<link rel="prev" title="cmake_language" href="cmake_language.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_parse_arguments.html" title="cmake_parse_arguments"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_language.html" title="cmake_language"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_minimum_required</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-minimum-required">
|
| 60 |
+
<span id="command:cmake_minimum_required"></span><h1>cmake_minimum_required<a class="headerlink" href="#cmake-minimum-required" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Require a minimum version of cmake.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_minimum_required(</span><span class="no">VERSION</span><span class="w"> </span><span class="nv"><min></span><span class="p">[...</span><span class="nv"><policy_max></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">FATAL_ERROR</span><span class="p">]</span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<div class="versionadded">
|
| 66 |
+
<p><span class="versionmodified added">Added in version 3.12: </span>The optional <code class="docutils literal notranslate"><span class="pre"><policy_max></span></code> version.</p>
|
| 67 |
+
</div>
|
| 68 |
+
<p>Sets the minimum required version of cmake for a project.
|
| 69 |
+
Also updates the policy settings as explained below.</p>
|
| 70 |
+
<p><code class="docutils literal notranslate"><span class="pre"><min></span></code> and the optional <code class="docutils literal notranslate"><span class="pre"><policy_max></span></code> are each CMake versions of the
|
| 71 |
+
form <code class="docutils literal notranslate"><span class="pre">major.minor[.patch[.tweak]]</span></code>, and the <code class="docutils literal notranslate"><span class="pre">...</span></code> is literal.</p>
|
| 72 |
+
<p>If the running version of CMake is lower than the <code class="docutils literal notranslate"><span class="pre"><min></span></code> required
|
| 73 |
+
version it will stop processing the project and report an error.
|
| 74 |
+
The optional <code class="docutils literal notranslate"><span class="pre"><policy_max></span></code> version, if specified, must be at least the
|
| 75 |
+
<code class="docutils literal notranslate"><span class="pre"><min></span></code> version and affects policy settings as described in <a class="reference internal" href="#policy-settings">Policy Settings</a>.
|
| 76 |
+
If the running version of CMake is older than 3.12, the extra <code class="docutils literal notranslate"><span class="pre">...</span></code>
|
| 77 |
+
dots will be seen as version component separators, resulting in the
|
| 78 |
+
<code class="docutils literal notranslate"><span class="pre">...<max></span></code> part being ignored and preserving the pre-3.12 behavior
|
| 79 |
+
of basing policies on <code class="docutils literal notranslate"><span class="pre"><min></span></code>.</p>
|
| 80 |
+
<p>This command will set the value of the
|
| 81 |
+
<span class="target" id="index-0-variable:CMAKE_MINIMUM_REQUIRED_VERSION"></span><a class="reference internal" href="../variable/CMAKE_MINIMUM_REQUIRED_VERSION.html#variable:CMAKE_MINIMUM_REQUIRED_VERSION" title="CMAKE_MINIMUM_REQUIRED_VERSION"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_MINIMUM_REQUIRED_VERSION</span></code></a> variable to <code class="docutils literal notranslate"><span class="pre"><min></span></code>.</p>
|
| 82 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">FATAL_ERROR</span></code> option is accepted but ignored by CMake 2.6 and
|
| 83 |
+
higher. It should be specified so CMake versions 2.4 and lower fail
|
| 84 |
+
with an error instead of just a warning.</p>
|
| 85 |
+
<div class="admonition note">
|
| 86 |
+
<p class="admonition-title">Note</p>
|
| 87 |
+
<p>Call the <code class="docutils literal notranslate"><span class="pre">cmake_minimum_required()</span></code> command at the beginning of
|
| 88 |
+
the top-level <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file even before calling the
|
| 89 |
+
<span class="target" id="index-0-command:project"></span><a class="reference internal" href="project.html#command:project" title="project"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">project()</span></code></a> command. It is important to establish version
|
| 90 |
+
and policy settings before invoking other commands whose behavior
|
| 91 |
+
they may affect. See also policy <span class="target" id="index-0-policy:CMP0000"></span><a class="reference internal" href="../policy/CMP0000.html#policy:CMP0000" title="CMP0000"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0000</span></code></a>.</p>
|
| 92 |
+
<p>Calling <code class="docutils literal notranslate"><span class="pre">cmake_minimum_required()</span></code> inside a <span class="target" id="index-0-command:function"></span><a class="reference internal" href="function.html#command:function" title="function"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">function()</span></code></a>
|
| 93 |
+
limits some effects to the function scope when invoked. For example,
|
| 94 |
+
the <span class="target" id="index-1-variable:CMAKE_MINIMUM_REQUIRED_VERSION"></span><a class="reference internal" href="../variable/CMAKE_MINIMUM_REQUIRED_VERSION.html#variable:CMAKE_MINIMUM_REQUIRED_VERSION" title="CMAKE_MINIMUM_REQUIRED_VERSION"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_MINIMUM_REQUIRED_VERSION</span></code></a> variable won't be set
|
| 95 |
+
in the calling scope. Functions do not introduce their own policy
|
| 96 |
+
scope though, so policy settings of the caller <em>will</em> be affected
|
| 97 |
+
(see below). Due to this mix of things that do and do not affect the
|
| 98 |
+
calling scope, calling <code class="docutils literal notranslate"><span class="pre">cmake_minimum_required()</span></code> inside a function
|
| 99 |
+
is generally discouraged.</p>
|
| 100 |
+
</div>
|
| 101 |
+
<section id="policy-settings">
|
| 102 |
+
<span id="id1"></span><h2>Policy Settings<a class="headerlink" href="#policy-settings" title="Link to this heading">¶</a></h2>
|
| 103 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code> command implicitly invokes the
|
| 104 |
+
<span class="target" id="index-0-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a> command to specify that the current
|
| 105 |
+
project code is written for the given range of CMake versions.
|
| 106 |
+
All policies known to the running version of CMake and introduced
|
| 107 |
+
in the <code class="docutils literal notranslate"><span class="pre"><min></span></code> (or <code class="docutils literal notranslate"><span class="pre"><max></span></code>, if specified) version or earlier will
|
| 108 |
+
be set to use <code class="docutils literal notranslate"><span class="pre">NEW</span></code> behavior. All policies introduced in later
|
| 109 |
+
versions will be unset. This effectively requests behavior preferred
|
| 110 |
+
as of a given CMake version and tells newer CMake versions to warn
|
| 111 |
+
about their new policies.</p>
|
| 112 |
+
<p>When a <code class="docutils literal notranslate"><span class="pre"><min></span></code> version higher than 2.4 is specified the command
|
| 113 |
+
implicitly invokes</p>
|
| 114 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_policy(</span><span class="no">VERSION</span><span class="w"> </span><span class="nv"><min></span><span class="p">[...</span><span class="nv"><max></span><span class="p">]</span><span class="nf">)</span>
|
| 115 |
+
</pre></div>
|
| 116 |
+
</div>
|
| 117 |
+
<p>which sets CMake policies based on the range of versions specified.
|
| 118 |
+
When a <code class="docutils literal notranslate"><span class="pre"><min></span></code> version 2.4 or lower is given the command implicitly
|
| 119 |
+
invokes</p>
|
| 120 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_policy(</span><span class="no">VERSION</span><span class="w"> </span><span class="m">2.4</span><span class="p">[...</span><span class="nv"><max></span><span class="p">]</span><span class="nf">)</span>
|
| 121 |
+
</pre></div>
|
| 122 |
+
</div>
|
| 123 |
+
<p>which enables compatibility features for CMake 2.4 and lower.</p>
|
| 124 |
+
<div class="versionchanged">
|
| 125 |
+
<p><span class="versionmodified changed">Changed in version 3.31: </span>Compatibility with versions of CMake older than 3.10 is deprecated.
|
| 126 |
+
Calls to <span class="target" id="index-0-command:cmake_minimum_required"></span><a class="reference internal" href="#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a> or
|
| 127 |
+
<span class="target" id="index-1-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a> that do not specify at least
|
| 128 |
+
3.10 as their policy version (optionally via <code class="docutils literal notranslate"><span class="pre">...<max></span></code>)
|
| 129 |
+
will produce a deprecation warning in CMake 3.31 and above.</p>
|
| 130 |
+
</div>
|
| 131 |
+
<div class="versionchanged">
|
| 132 |
+
<p><span class="versionmodified changed">Changed in version 3.27: </span>Compatibility with versions of CMake older than 3.5 is deprecated.
|
| 133 |
+
Calls to <span class="target" id="index-1-command:cmake_minimum_required"></span><a class="reference internal" href="#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a> or
|
| 134 |
+
<span class="target" id="index-2-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a> that do not specify at least
|
| 135 |
+
3.5 as their policy version (optionally via <code class="docutils literal notranslate"><span class="pre">...<max></span></code>)
|
| 136 |
+
will produce a deprecation warning in CMake 3.27 and above.</p>
|
| 137 |
+
</div>
|
| 138 |
+
<div class="versionchanged">
|
| 139 |
+
<p><span class="versionmodified changed">Changed in version 3.19: </span>Compatibility with versions of CMake older than 2.8.12 is deprecated.
|
| 140 |
+
Calls to <span class="target" id="index-2-command:cmake_minimum_required"></span><a class="reference internal" href="#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a> or
|
| 141 |
+
<span class="target" id="index-3-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a> that do not specify at least
|
| 142 |
+
2.8.12 as their policy version (optionally via <code class="docutils literal notranslate"><span class="pre">...<max></span></code>)
|
| 143 |
+
will produce a deprecation warning in CMake 3.19 and above.</p>
|
| 144 |
+
</div>
|
| 145 |
+
</section>
|
| 146 |
+
<section id="see-also">
|
| 147 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 148 |
+
<ul class="simple">
|
| 149 |
+
<li><p><span class="target" id="index-4-command:cmake_policy"></span><a class="reference internal" href="cmake_policy.html#command:cmake_policy" title="cmake_policy"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy()</span></code></a></p></li>
|
| 150 |
+
</ul>
|
| 151 |
+
</section>
|
| 152 |
+
</section>
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
<div class="clearer"></div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 160 |
+
<div class="sphinxsidebarwrapper">
|
| 161 |
+
<div>
|
| 162 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 163 |
+
<ul>
|
| 164 |
+
<li><a class="reference internal" href="#">cmake_minimum_required</a><ul>
|
| 165 |
+
<li><a class="reference internal" href="#policy-settings">Policy Settings</a></li>
|
| 166 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 167 |
+
</ul>
|
| 168 |
+
</li>
|
| 169 |
+
</ul>
|
| 170 |
+
|
| 171 |
+
</div>
|
| 172 |
+
<div>
|
| 173 |
+
<h4>Previous topic</h4>
|
| 174 |
+
<p class="topless"><a href="cmake_language.html"
|
| 175 |
+
title="previous chapter">cmake_language</a></p>
|
| 176 |
+
</div>
|
| 177 |
+
<div>
|
| 178 |
+
<h4>Next topic</h4>
|
| 179 |
+
<p class="topless"><a href="cmake_parse_arguments.html"
|
| 180 |
+
title="next chapter">cmake_parse_arguments</a></p>
|
| 181 |
+
</div>
|
| 182 |
+
<div role="note" aria-label="source link">
|
| 183 |
+
<h3>This Page</h3>
|
| 184 |
+
<ul class="this-page-menu">
|
| 185 |
+
<li><a href="../_sources/command/cmake_minimum_required.rst.txt"
|
| 186 |
+
rel="nofollow">Show Source</a></li>
|
| 187 |
+
</ul>
|
| 188 |
+
</div>
|
| 189 |
+
<search id="searchbox" style="display: none" role="search">
|
| 190 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 191 |
+
<div class="searchformwrapper">
|
| 192 |
+
<form class="search" action="../search.html" method="get">
|
| 193 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 194 |
+
<input type="submit" value="Go" />
|
| 195 |
+
</form>
|
| 196 |
+
</div>
|
| 197 |
+
</search>
|
| 198 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
<div class="clearer"></div>
|
| 202 |
+
</div>
|
| 203 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 204 |
+
<h3>Navigation</h3>
|
| 205 |
+
<ul>
|
| 206 |
+
<li class="right" style="margin-right: 10px">
|
| 207 |
+
<a href="../genindex.html" title="General Index"
|
| 208 |
+
>index</a></li>
|
| 209 |
+
<li class="right" >
|
| 210 |
+
<a href="cmake_parse_arguments.html" title="cmake_parse_arguments"
|
| 211 |
+
>next</a> |</li>
|
| 212 |
+
<li class="right" >
|
| 213 |
+
<a href="cmake_language.html" title="cmake_language"
|
| 214 |
+
>previous</a> |</li>
|
| 215 |
+
<li>
|
| 216 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 217 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 218 |
+
</li>
|
| 219 |
+
<li>
|
| 220 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 221 |
+
</li>
|
| 222 |
+
<li>
|
| 223 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 224 |
+
</li>
|
| 225 |
+
|
| 226 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 227 |
+
<li class="nav-item nav-item-this"><a href="">cmake_minimum_required</a></li>
|
| 228 |
+
</ul>
|
| 229 |
+
</div>
|
| 230 |
+
|
| 231 |
+
<div class="footer" role="contentinfo">
|
| 232 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 233 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 234 |
+
</div>
|
| 235 |
+
</body>
|
| 236 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_parse_arguments.html
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_parse_arguments — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_path" href="cmake_path.html" />
|
| 21 |
+
<link rel="prev" title="cmake_minimum_required" href="cmake_minimum_required.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_path.html" title="cmake_path"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_minimum_required.html" title="cmake_minimum_required"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_parse_arguments</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-parse-arguments">
|
| 60 |
+
<span id="command:cmake_parse_arguments"></span><h1>cmake_parse_arguments<a class="headerlink" href="#cmake-parse-arguments" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Parse function or macro arguments.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_parse_arguments(</span><span class="nv"><prefix></span><span class="w"> </span><span class="nv"><options></span><span class="w"> </span><span class="nv"><one_value_keywords></span>
|
| 63 |
+
<span class="w"> </span><span class="nv"><multi_value_keywords></span><span class="w"> </span><span class="nv"><args>...</span><span class="nf">)</span>
|
| 64 |
+
|
| 65 |
+
<span class="nf">cmake_parse_arguments(</span><span class="no">PARSE_ARGV</span><span class="w"> </span><span class="nv"><N></span><span class="w"> </span><span class="nv"><prefix></span><span class="w"> </span><span class="nv"><options></span>
|
| 66 |
+
<span class="w"> </span><span class="nv"><one_value_keywords></span><span class="w"> </span><span class="nv"><multi_value_keywords></span><span class="nf">)</span>
|
| 67 |
+
</pre></div>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="versionadded">
|
| 70 |
+
<p><span class="versionmodified added">Added in version 3.5: </span>This command is implemented natively. Previously, it has been defined in the
|
| 71 |
+
module <span class="target" id="index-0-module:CMakeParseArguments"></span><a class="reference internal" href="../module/CMakeParseArguments.html#module:CMakeParseArguments" title="CMakeParseArguments"><code class="xref cmake cmake-module docutils literal notranslate"><span class="pre">CMakeParseArguments</span></code></a>.</p>
|
| 72 |
+
</div>
|
| 73 |
+
<p>This command is for use in macros or functions.
|
| 74 |
+
It processes the arguments given to that macro or function,
|
| 75 |
+
and defines a set of variables which hold the values of the
|
| 76 |
+
respective options.</p>
|
| 77 |
+
<p>The first signature reads arguments passed in the <code class="docutils literal notranslate"><span class="pre"><args>...</span></code>.
|
| 78 |
+
This may be used in either a <span class="target" id="index-0-command:macro"></span><a class="reference internal" href="macro.html#command:macro" title="macro"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">macro()</span></code></a> or a <span class="target" id="index-0-command:function"></span><a class="reference internal" href="function.html#command:function" title="function"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">function()</span></code></a>.</p>
|
| 79 |
+
<div class="versionadded">
|
| 80 |
+
<p><span class="versionmodified added">Added in version 3.7: </span>The <code class="docutils literal notranslate"><span class="pre">PARSE_ARGV</span></code> signature is only for use in a <span class="target" id="index-1-command:function"></span><a class="reference internal" href="function.html#command:function" title="function"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">function()</span></code></a>
|
| 81 |
+
body. In this case, the arguments that are parsed come from the
|
| 82 |
+
<code class="docutils literal notranslate"><span class="pre">ARGV#</span></code> variables of the calling function. The parsing starts with
|
| 83 |
+
the <code class="docutils literal notranslate"><span class="pre"><N></span></code>-th argument, where <code class="docutils literal notranslate"><span class="pre"><N></span></code> is an unsigned integer.
|
| 84 |
+
This allows for the values to have special characters like <code class="docutils literal notranslate"><span class="pre">;</span></code> in them.</p>
|
| 85 |
+
</div>
|
| 86 |
+
<p>The <code class="docutils literal notranslate"><span class="pre"><options></span></code> argument contains all options for the respective function
|
| 87 |
+
or macro. These are keywords that have no value following them, like the
|
| 88 |
+
<code class="docutils literal notranslate"><span class="pre">OPTIONAL</span></code> keyword of the <span class="target" id="index-0-command:install"></span><a class="reference internal" href="install.html#command:install" title="install"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">install()</span></code></a> command.</p>
|
| 89 |
+
<p>The <code class="docutils literal notranslate"><span class="pre"><one_value_keywords></span></code> argument contains all keywords for this function
|
| 90 |
+
or macro which are followed by one value, like the <code class="docutils literal notranslate"><span class="pre">DESTINATION</span></code> keyword of
|
| 91 |
+
the <span class="target" id="index-1-command:install"></span><a class="reference internal" href="install.html#command:install" title="install"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">install()</span></code></a> command.</p>
|
| 92 |
+
<p>The <code class="docutils literal notranslate"><span class="pre"><multi_value_keywords></span></code> argument contains all keywords for this
|
| 93 |
+
function or macro which can be followed by more than one value, like the
|
| 94 |
+
<code class="docutils literal notranslate"><span class="pre">TARGETS</span></code> or <code class="docutils literal notranslate"><span class="pre">FILES</span></code> keywords of the <span class="target" id="index-2-command:install"></span><a class="reference internal" href="install.html#command:install" title="install"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">install()</span></code></a> command.</p>
|
| 95 |
+
<div class="versionchanged">
|
| 96 |
+
<p><span class="versionmodified changed">Changed in version 3.5: </span>All keywords must be unique. Each keyword can only be specified
|
| 97 |
+
once in any of the <code class="docutils literal notranslate"><span class="pre"><options></span></code>, <code class="docutils literal notranslate"><span class="pre"><one_value_keywords></span></code>, or
|
| 98 |
+
<code class="docutils literal notranslate"><span class="pre"><multi_value_keywords></span></code>. A warning will be emitted if uniqueness is
|
| 99 |
+
violated.</p>
|
| 100 |
+
</div>
|
| 101 |
+
<p>When done, <code class="docutils literal notranslate"><span class="pre">cmake_parse_arguments</span></code> will consider for each of the
|
| 102 |
+
keywords listed in <code class="docutils literal notranslate"><span class="pre"><options></span></code>, <code class="docutils literal notranslate"><span class="pre"><one_value_keywords></span></code>, and
|
| 103 |
+
<code class="docutils literal notranslate"><span class="pre"><multi_value_keywords></span></code>, a variable composed of the given <code class="docutils literal notranslate"><span class="pre"><prefix></span></code>
|
| 104 |
+
followed by <code class="docutils literal notranslate"><span class="pre">"_"</span></code> and the name of the respective keyword. For
|
| 105 |
+
<code class="docutils literal notranslate"><span class="pre"><one_value_keywords></span></code> and <code class="docutils literal notranslate"><span class="pre"><multi_value_keywords></span></code>, these variables
|
| 106 |
+
will then hold the respective value(s) from the argument list, or be undefined
|
| 107 |
+
if the associated keyword was not given (policy <span class="target" id="index-0-policy:CMP0174"></span><a class="reference internal" href="../policy/CMP0174.html#policy:CMP0174" title="CMP0174"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0174</span></code></a> can also
|
| 108 |
+
affect the behavior for <code class="docutils literal notranslate"><span class="pre"><one_value_keywords></span></code>). For the <code class="docutils literal notranslate"><span class="pre"><options></span></code>
|
| 109 |
+
keywords, these variables will always be defined, and they will be set to
|
| 110 |
+
<code class="docutils literal notranslate"><span class="pre">TRUE</span></code> if the keyword is present, or <code class="docutils literal notranslate"><span class="pre">FALSE</span></code> if it is not.</p>
|
| 111 |
+
<p>All remaining arguments are collected in a variable
|
| 112 |
+
<code class="docutils literal notranslate"><span class="pre"><prefix>_UNPARSED_ARGUMENTS</span></code> that will be undefined if all arguments
|
| 113 |
+
were recognized. This can be checked afterwards to see
|
| 114 |
+
whether your macro or function was called with unrecognized parameters.</p>
|
| 115 |
+
<div class="versionadded">
|
| 116 |
+
<p><span class="versionmodified added">Added in version 3.15: </span><code class="docutils literal notranslate"><span class="pre"><one_value_keywords></span></code> and <code class="docutils literal notranslate"><span class="pre"><multi_value_keywords></span></code> that were given no
|
| 117 |
+
values at all are collected in a variable
|
| 118 |
+
<code class="docutils literal notranslate"><span class="pre"><prefix>_KEYWORDS_MISSING_VALUES</span></code> that will be undefined if all keywords
|
| 119 |
+
received values. This can be checked to see if there were keywords without
|
| 120 |
+
any values given.</p>
|
| 121 |
+
</div>
|
| 122 |
+
<div class="versionchanged">
|
| 123 |
+
<p><span class="versionmodified changed">Changed in version 3.31: </span>If a <code class="docutils literal notranslate"><span class="pre"><one_value_keyword></span></code> is followed by an empty string as its value,
|
| 124 |
+
policy <span class="target" id="index-1-policy:CMP0174"></span><a class="reference internal" href="../policy/CMP0174.html#policy:CMP0174" title="CMP0174"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0174</span></code></a> controls whether a corresponding
|
| 125 |
+
<code class="docutils literal notranslate"><span class="pre"><prefix>_<keyword></span></code> variable is defined or not.</p>
|
| 126 |
+
</div>
|
| 127 |
+
<p>Choose a <code class="docutils literal notranslate"><span class="pre"><prefix></span></code> carefully to avoid clashing with existing variable names.
|
| 128 |
+
When used inside a function, it is usually suitable to use the prefix <code class="docutils literal notranslate"><span class="pre">arg</span></code>.
|
| 129 |
+
There is a very strong convention that all keywords are fully uppercase, so
|
| 130 |
+
this prefix results in variables of the form <code class="docutils literal notranslate"><span class="pre">arg_SOME_KEYWORD</span></code>. This makes
|
| 131 |
+
the code more readable, and it minimizes the chance of clashing with cache
|
| 132 |
+
variables, which also have a strong convention of being all uppercase.</p>
|
| 133 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">function(</span><span class="nb">my_install</span><span class="nf">)</span>
|
| 134 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">options</span><span class="w"> </span><span class="no">OPTIONAL</span><span class="w"> </span><span class="no">FAST</span><span class="nf">)</span>
|
| 135 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">oneValueArgs</span><span class="w"> </span><span class="no">DESTINATION</span><span class="w"> </span><span class="no">RENAME</span><span class="nf">)</span>
|
| 136 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">multiValueArgs</span><span class="w"> </span><span class="no">TARGETS</span><span class="w"> </span><span class="no">CONFIGURATIONS</span><span class="nf">)</span>
|
| 137 |
+
<span class="w"> </span><span class="nf">cmake_parse_arguments(</span><span class="no">PARSE_ARGV</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="nb">arg</span>
|
| 138 |
+
<span class="w"> </span><span class="s">"${options}"</span><span class="w"> </span><span class="s">"${oneValueArgs}"</span><span class="w"> </span><span class="s">"${multiValueArgs}"</span>
|
| 139 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 140 |
+
|
| 141 |
+
<span class="w"> </span><span class="c"># The above will set or unset variables with the following names:</span>
|
| 142 |
+
<span class="w"> </span><span class="c"># arg_OPTIONAL</span>
|
| 143 |
+
<span class="w"> </span><span class="c"># arg_FAST</span>
|
| 144 |
+
<span class="w"> </span><span class="c"># arg_DESTINATION</span>
|
| 145 |
+
<span class="w"> </span><span class="c"># arg_RENAME</span>
|
| 146 |
+
<span class="w"> </span><span class="c"># arg_TARGETS</span>
|
| 147 |
+
<span class="w"> </span><span class="c"># arg_CONFIGURATIONS</span>
|
| 148 |
+
<span class="w"> </span><span class="c">#</span>
|
| 149 |
+
<span class="w"> </span><span class="c"># The following will also be set or unset:</span>
|
| 150 |
+
<span class="w"> </span><span class="c"># arg_UNPARSED_ARGUMENTS</span>
|
| 151 |
+
<span class="w"> </span><span class="c"># arg_KEYWORDS_MISSING_VALUES</span>
|
| 152 |
+
</pre></div>
|
| 153 |
+
</div>
|
| 154 |
+
<p>When used inside a macro, <code class="docutils literal notranslate"><span class="pre">arg</span></code> might not be a suitable prefix because the
|
| 155 |
+
code will affect the calling scope. If another macro also called in the same
|
| 156 |
+
scope were to use <code class="docutils literal notranslate"><span class="pre">arg</span></code> in its own call to <code class="docutils literal notranslate"><span class="pre">cmake_parse_arguments()</span></code>,
|
| 157 |
+
and if there are any common keywords between the two macros, the later call's
|
| 158 |
+
variables can overwrite or remove those of the earlier macro's call.
|
| 159 |
+
Therefore, it is advisable to incorporate something unique from the macro name
|
| 160 |
+
in the <code class="docutils literal notranslate"><span class="pre"><prefix></span></code>, such as <code class="docutils literal notranslate"><span class="pre">arg_lowercase_macro_name</span></code>.</p>
|
| 161 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">macro(</span><span class="nb">my_install</span><span class="nf">)</span>
|
| 162 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">options</span><span class="w"> </span><span class="no">OPTIONAL</span><span class="w"> </span><span class="no">FAST</span><span class="nf">)</span>
|
| 163 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">oneValueArgs</span><span class="w"> </span><span class="no">DESTINATION</span><span class="w"> </span><span class="no">RENAME</span><span class="nf">)</span>
|
| 164 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">multiValueArgs</span><span class="w"> </span><span class="no">TARGETS</span><span class="w"> </span><span class="no">CONFIGURATIONS</span><span class="nf">)</span>
|
| 165 |
+
<span class="w"> </span><span class="nf">cmake_parse_arguments(</span><span class="nb">arg_my_install</span>
|
| 166 |
+
<span class="w"> </span><span class="s">"${options}"</span><span class="w"> </span><span class="s">"${oneValueArgs}"</span><span class="w"> </span><span class="s">"${multiValueArgs}"</span>
|
| 167 |
+
<span class="w"> </span><span class="o">${</span><span class="nt">ARGN</span><span class="o">}</span>
|
| 168 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 169 |
+
<span class="w"> </span><span class="c"># ...</span>
|
| 170 |
+
<span class="nf">endmacro()</span>
|
| 171 |
+
|
| 172 |
+
<span class="nf">macro(</span><span class="nb">my_special_install</span><span class="nf">)</span>
|
| 173 |
+
<span class="w"> </span><span class="c"># NOTE: Has the same keywords as my_install()</span>
|
| 174 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">options</span><span class="w"> </span><span class="no">OPTIONAL</span><span class="w"> </span><span class="no">FAST</span><span class="nf">)</span>
|
| 175 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">oneValueArgs</span><span class="w"> </span><span class="no">DESTINATION</span><span class="w"> </span><span class="no">RENAME</span><span class="nf">)</span>
|
| 176 |
+
<span class="w"> </span><span class="nf">set(</span><span class="nb">multiValueArgs</span><span class="w"> </span><span class="no">TARGETS</span><span class="w"> </span><span class="no">CONFIGURATIONS</span><span class="nf">)</span>
|
| 177 |
+
<span class="w"> </span><span class="nf">cmake_parse_arguments(</span><span class="nb">arg_my_special_install</span>
|
| 178 |
+
<span class="w"> </span><span class="s">"${options}"</span><span class="w"> </span><span class="s">"${oneValueArgs}"</span><span class="w"> </span><span class="s">"${multiValueArgs}"</span>
|
| 179 |
+
<span class="w"> </span><span class="o">${</span><span class="nt">ARGN</span><span class="o">}</span>
|
| 180 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 181 |
+
<span class="w"> </span><span class="c"># ...</span>
|
| 182 |
+
<span class="nf">endmacro()</span>
|
| 183 |
+
</pre></div>
|
| 184 |
+
</div>
|
| 185 |
+
<p>Suppose the above macros are called one after the other, like so:</p>
|
| 186 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">my_install(</span><span class="no">TARGETS</span><span class="w"> </span><span class="nb">foo</span><span class="w"> </span><span class="nb">bar</span><span class="w"> </span><span class="no">DESTINATION</span><span class="w"> </span><span class="nb">bin</span><span class="w"> </span><span class="no">OPTIONAL</span><span class="w"> </span><span class="nb">blub</span><span class="w"> </span><span class="no">CONFIGURATIONS</span><span class="nf">)</span>
|
| 187 |
+
<span class="nf">my_special_install(</span><span class="no">TARGETS</span><span class="w"> </span><span class="nb">barry</span><span class="w"> </span><span class="no">DESTINATION</span><span class="w"> </span><span class="nb">sbin</span><span class="w"> </span><span class="no">RENAME</span><span class="w"> </span><span class="no">FAST</span><span class="nf">)</span>
|
| 188 |
+
</pre></div>
|
| 189 |
+
</div>
|
| 190 |
+
<p>After these two calls, the following describes the variables that will be
|
| 191 |
+
set or unset:</p>
|
| 192 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>arg_my_install_OPTIONAL = TRUE
|
| 193 |
+
arg_my_install_FAST = FALSE # was not present in call to my_install
|
| 194 |
+
arg_my_install_DESTINATION = "bin"
|
| 195 |
+
arg_my_install_RENAME <UNSET> # was not present
|
| 196 |
+
arg_my_install_TARGETS = "foo;bar"
|
| 197 |
+
arg_my_install_CONFIGURATIONS <UNSET> # was not present
|
| 198 |
+
arg_my_install_UNPARSED_ARGUMENTS = "blub" # nothing expected after "OPTIONAL"
|
| 199 |
+
arg_my_install_KEYWORDS_MISSING_VALUES = "CONFIGURATIONS" # value was missing
|
| 200 |
+
|
| 201 |
+
arg_my_special_install_OPTIONAL = FALSE # was not present
|
| 202 |
+
arg_my_special_install_FAST = TRUE
|
| 203 |
+
arg_my_special_install_DESTINATION = "sbin"
|
| 204 |
+
arg_my_special_install_RENAME <UNSET> # value was missing
|
| 205 |
+
arg_my_special_install_TARGETS = "barry"
|
| 206 |
+
arg_my_special_install_CONFIGURATIONS <UNSET> # was not present
|
| 207 |
+
arg_my_special_install_UNPARSED_ARGUMENTS <UNSET>
|
| 208 |
+
arg_my_special_install_KEYWORDS_MISSING_VALUES = "RENAME"
|
| 209 |
+
</pre></div>
|
| 210 |
+
</div>
|
| 211 |
+
<p>Keywords terminate lists of values. If a keyword is given directly after a
|
| 212 |
+
<code class="docutils literal notranslate"><span class="pre"><one_value_keyword></span></code>, that preceding <code class="docutils literal notranslate"><span class="pre"><one_value_keyword></span></code> receives no
|
| 213 |
+
value and the keyword is added to the <code class="docutils literal notranslate"><span class="pre"><prefix>_KEYWORDS_MISSING_VALUES</span></code>
|
| 214 |
+
variable. In the above example, the call to <code class="docutils literal notranslate"><span class="pre">my_special_install()</span></code> contains
|
| 215 |
+
the <code class="docutils literal notranslate"><span class="pre">RENAME</span></code> keyword immediately followed by the <code class="docutils literal notranslate"><span class="pre">FAST</span></code> keyword.
|
| 216 |
+
In this case, <code class="docutils literal notranslate"><span class="pre">FAST</span></code> terminates processing of the <code class="docutils literal notranslate"><span class="pre">RENAME</span></code> keyword.
|
| 217 |
+
<code class="docutils literal notranslate"><span class="pre">arg_my_special_install_FAST</span></code> is set to <code class="docutils literal notranslate"><span class="pre">TRUE</span></code>,
|
| 218 |
+
<code class="docutils literal notranslate"><span class="pre">arg_my_special_install_RENAME</span></code> is unset, and
|
| 219 |
+
<code class="docutils literal notranslate"><span class="pre">arg_my_special_install_KEYWORDS_MISSING_VALUES</span></code> contains the value
|
| 220 |
+
<code class="docutils literal notranslate"><span class="pre">RENAME</span></code>.</p>
|
| 221 |
+
<section id="see-also">
|
| 222 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 223 |
+
<ul class="simple">
|
| 224 |
+
<li><p><span class="target" id="index-2-command:function"></span><a class="reference internal" href="function.html#command:function" title="function"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">function()</span></code></a></p></li>
|
| 225 |
+
<li><p><span class="target" id="index-1-command:macro"></span><a class="reference internal" href="macro.html#command:macro" title="macro"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">macro()</span></code></a></p></li>
|
| 226 |
+
</ul>
|
| 227 |
+
</section>
|
| 228 |
+
</section>
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
<div class="clearer"></div>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
</div>
|
| 235 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 236 |
+
<div class="sphinxsidebarwrapper">
|
| 237 |
+
<div>
|
| 238 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 239 |
+
<ul>
|
| 240 |
+
<li><a class="reference internal" href="#">cmake_parse_arguments</a><ul>
|
| 241 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 242 |
+
</ul>
|
| 243 |
+
</li>
|
| 244 |
+
</ul>
|
| 245 |
+
|
| 246 |
+
</div>
|
| 247 |
+
<div>
|
| 248 |
+
<h4>Previous topic</h4>
|
| 249 |
+
<p class="topless"><a href="cmake_minimum_required.html"
|
| 250 |
+
title="previous chapter">cmake_minimum_required</a></p>
|
| 251 |
+
</div>
|
| 252 |
+
<div>
|
| 253 |
+
<h4>Next topic</h4>
|
| 254 |
+
<p class="topless"><a href="cmake_path.html"
|
| 255 |
+
title="next chapter">cmake_path</a></p>
|
| 256 |
+
</div>
|
| 257 |
+
<div role="note" aria-label="source link">
|
| 258 |
+
<h3>This Page</h3>
|
| 259 |
+
<ul class="this-page-menu">
|
| 260 |
+
<li><a href="../_sources/command/cmake_parse_arguments.rst.txt"
|
| 261 |
+
rel="nofollow">Show Source</a></li>
|
| 262 |
+
</ul>
|
| 263 |
+
</div>
|
| 264 |
+
<search id="searchbox" style="display: none" role="search">
|
| 265 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 266 |
+
<div class="searchformwrapper">
|
| 267 |
+
<form class="search" action="../search.html" method="get">
|
| 268 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 269 |
+
<input type="submit" value="Go" />
|
| 270 |
+
</form>
|
| 271 |
+
</div>
|
| 272 |
+
</search>
|
| 273 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 274 |
+
</div>
|
| 275 |
+
</div>
|
| 276 |
+
<div class="clearer"></div>
|
| 277 |
+
</div>
|
| 278 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 279 |
+
<h3>Navigation</h3>
|
| 280 |
+
<ul>
|
| 281 |
+
<li class="right" style="margin-right: 10px">
|
| 282 |
+
<a href="../genindex.html" title="General Index"
|
| 283 |
+
>index</a></li>
|
| 284 |
+
<li class="right" >
|
| 285 |
+
<a href="cmake_path.html" title="cmake_path"
|
| 286 |
+
>next</a> |</li>
|
| 287 |
+
<li class="right" >
|
| 288 |
+
<a href="cmake_minimum_required.html" title="cmake_minimum_required"
|
| 289 |
+
>previous</a> |</li>
|
| 290 |
+
<li>
|
| 291 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 292 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 293 |
+
</li>
|
| 294 |
+
<li>
|
| 295 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 296 |
+
</li>
|
| 297 |
+
<li>
|
| 298 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 299 |
+
</li>
|
| 300 |
+
|
| 301 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 302 |
+
<li class="nav-item nav-item-this"><a href="">cmake_parse_arguments</a></li>
|
| 303 |
+
</ul>
|
| 304 |
+
</div>
|
| 305 |
+
|
| 306 |
+
<div class="footer" role="contentinfo">
|
| 307 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 308 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 309 |
+
</div>
|
| 310 |
+
</body>
|
| 311 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_path.html
ADDED
|
@@ -0,0 +1,784 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_path — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_pkg_config" href="cmake_pkg_config.html" />
|
| 21 |
+
<link rel="prev" title="cmake_parse_arguments" href="cmake_parse_arguments.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_pkg_config.html" title="cmake_pkg_config"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_parse_arguments.html" title="cmake_parse_arguments"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_path</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-path">
|
| 60 |
+
<span id="command:cmake_path"></span><h1>cmake_path<a class="headerlink" href="#cmake-path" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.20.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<p>This command is for the manipulation of paths. Only syntactic aspects of
|
| 65 |
+
paths are handled, there is no interaction of any kind with any underlying
|
| 66 |
+
file system. The path may represent a non-existing path or even one that
|
| 67 |
+
is not allowed to exist on the current file system or platform.
|
| 68 |
+
For operations that do interact with the filesystem, see the <span class="target" id="index-0-command:file"></span><a class="reference internal" href="file.html#command:file" title="file"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">file()</span></code></a>
|
| 69 |
+
command.</p>
|
| 70 |
+
<div class="admonition note">
|
| 71 |
+
<p class="admonition-title">Note</p>
|
| 72 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">cmake_path</span></code> command handles paths in the format of the build system
|
| 73 |
+
(i.e. the host platform), not the target system. When cross-compiling,
|
| 74 |
+
if the path contains elements that are not representable on the host
|
| 75 |
+
platform (e.g. a drive letter when the host is not Windows), the results
|
| 76 |
+
will be unpredictable.</p>
|
| 77 |
+
</div>
|
| 78 |
+
<section id="synopsis">
|
| 79 |
+
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Link to this heading">¶</a></h2>
|
| 80 |
+
<pre class="literal-block"><a class="reference internal" href="#conventions">Conventions</a>
|
| 81 |
+
|
| 82 |
+
<a class="reference internal" href="#path-structure-and-terminology">Path Structure And Terminology</a>
|
| 83 |
+
|
| 84 |
+
<a class="reference internal" href="#normalization">Normalization</a>
|
| 85 |
+
|
| 86 |
+
<a class="reference internal" href="#decomposition">Decomposition</a>
|
| 87 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-root-name"><span class="std std-ref">ROOT_NAME</span></a> <out-var>)
|
| 88 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-root-directory"><span class="std std-ref">ROOT_DIRECTORY</span></a> <out-var>)
|
| 89 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-root-path"><span class="std std-ref">ROOT_PATH</span></a> <out-var>)
|
| 90 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-filename"><span class="std std-ref">FILENAME</span></a> <out-var>)
|
| 91 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-extension"><span class="std std-ref">EXTENSION</span></a> [LAST_ONLY] <out-var>)
|
| 92 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-stem"><span class="std std-ref">STEM</span></a> [LAST_ONLY] <out-var>)
|
| 93 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-relative-part"><span class="std std-ref">RELATIVE_PART</span></a> <out-var>)
|
| 94 |
+
cmake_path(<a class="reference internal" href="#get">GET</a> <path-var> <a class="reference internal" href="#get-parent-path"><span class="std std-ref">PARENT_PATH</span></a> <out-var>)
|
| 95 |
+
|
| 96 |
+
<a class="reference internal" href="#query">Query</a>
|
| 97 |
+
cmake_path(<a class="reference internal" href="#has-root-name">HAS_ROOT_NAME</a> <path-var> <out-var>)
|
| 98 |
+
cmake_path(<a class="reference internal" href="#has-root-directory">HAS_ROOT_DIRECTORY</a> <path-var> <out-var>)
|
| 99 |
+
cmake_path(<a class="reference internal" href="#has-root-path">HAS_ROOT_PATH</a> <path-var> <out-var>)
|
| 100 |
+
cmake_path(<a class="reference internal" href="#has-filename">HAS_FILENAME</a> <path-var> <out-var>)
|
| 101 |
+
cmake_path(<a class="reference internal" href="#has-extension">HAS_EXTENSION</a> <path-var> <out-var>)
|
| 102 |
+
cmake_path(<a class="reference internal" href="#has-stem">HAS_STEM</a> <path-var> <out-var>)
|
| 103 |
+
cmake_path(<a class="reference internal" href="#has-relative-part">HAS_RELATIVE_PART</a> <path-var> <out-var>)
|
| 104 |
+
cmake_path(<a class="reference internal" href="#has-parent-path">HAS_PARENT_PATH</a> <path-var> <out-var>)
|
| 105 |
+
cmake_path(<a class="reference internal" href="#is-absolute">IS_ABSOLUTE</a> <path-var> <out-var>)
|
| 106 |
+
cmake_path(<a class="reference internal" href="#is-relative">IS_RELATIVE</a> <path-var> <out-var>)
|
| 107 |
+
cmake_path(<a class="reference internal" href="#is-prefix">IS_PREFIX</a> <path-var> <input> [NORMALIZE] <out-var>)
|
| 108 |
+
cmake_path(<a class="reference internal" href="#compare">COMPARE</a> <input1> <OP> <input2> <out-var>)
|
| 109 |
+
|
| 110 |
+
<a class="reference internal" href="#modification">Modification</a>
|
| 111 |
+
cmake_path(<a class="reference internal" href="#cmake-path-set"><span class="std std-ref">SET</span></a> <path-var> [NORMALIZE] <input>)
|
| 112 |
+
cmake_path(<a class="reference internal" href="#append">APPEND</a> <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>])
|
| 113 |
+
cmake_path(<a class="reference internal" href="#append-string">APPEND_STRING</a> <path-var> [<input>...] [OUTPUT_VARIABLE <out-var>])
|
| 114 |
+
cmake_path(<a class="reference internal" href="#remove-filename">REMOVE_FILENAME</a> <path-var> [OUTPUT_VARIABLE <out-var>])
|
| 115 |
+
cmake_path(<a class="reference internal" href="#replace-filename">REPLACE_FILENAME</a> <path-var> <input> [OUTPUT_VARIABLE <out-var>])
|
| 116 |
+
cmake_path(<a class="reference internal" href="#remove-extension">REMOVE_EXTENSION</a> <path-var> [LAST_ONLY] [OUTPUT_VARIABLE <out-var>])
|
| 117 |
+
cmake_path(<a class="reference internal" href="#replace-extension">REPLACE_EXTENSION</a> <path-var> [LAST_ONLY] <input> [OUTPUT_VARIABLE <out-var>])
|
| 118 |
+
|
| 119 |
+
<a class="reference internal" href="#generation">Generation</a>
|
| 120 |
+
cmake_path(<a class="reference internal" href="#normal-path">NORMAL_PATH</a> <path-var> [OUTPUT_VARIABLE <out-var>])
|
| 121 |
+
cmake_path(<a class="reference internal" href="#relative-path">RELATIVE_PATH</a> <path-var> [BASE_DIRECTORY <input>] [OUTPUT_VARIABLE <out-var>])
|
| 122 |
+
cmake_path(<a class="reference internal" href="#absolute-path">ABSOLUTE_PATH</a> <path-var> [BASE_DIRECTORY <input>] [NORMALIZE] [OUTPUT_VARIABLE <out-var>])
|
| 123 |
+
|
| 124 |
+
<a class="reference internal" href="#native-conversion">Native Conversion</a>
|
| 125 |
+
cmake_path(<a class="reference internal" href="#native-path">NATIVE_PATH</a> <path-var> [NORMALIZE] <out-var>)
|
| 126 |
+
cmake_path(<a class="reference internal" href="#convert">CONVERT</a> <input> <a class="reference internal" href="#to-cmake-path-list">TO_CMAKE_PATH_LIST</a> <out-var> [NORMALIZE])
|
| 127 |
+
cmake_path(<a class="reference internal" href="#convert">CONVERT</a> <input> <a class="reference internal" href="#to-native-path-list">TO_NATIVE_PATH_LIST</a> <out-var> [NORMALIZE])
|
| 128 |
+
|
| 129 |
+
<a class="reference internal" href="#hashing">Hashing</a>
|
| 130 |
+
cmake_path(<a class="reference internal" href="#hash">HASH</a> <path-var> <out-var>)</pre>
|
| 131 |
+
</section>
|
| 132 |
+
<section id="conventions">
|
| 133 |
+
<h2>Conventions<a class="headerlink" href="#conventions" title="Link to this heading">¶</a></h2>
|
| 134 |
+
<p>The following conventions are used in this command's documentation:</p>
|
| 135 |
+
<dl class="simple">
|
| 136 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><path-var></span></code></dt><dd><p>Always the name of a variable. For commands that expect a <code class="docutils literal notranslate"><span class="pre"><path-var></span></code>
|
| 137 |
+
as input, the variable must exist and it is expected to hold a single path.</p>
|
| 138 |
+
</dd>
|
| 139 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><input></span></code></dt><dd><p>A string literal which may contain a path, path fragment, or multiple paths
|
| 140 |
+
with a special separator depending on the command. See the description of
|
| 141 |
+
each command to see how this is interpreted.</p>
|
| 142 |
+
</dd>
|
| 143 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><input>...</span></code></dt><dd><p>Zero or more string literal arguments.</p>
|
| 144 |
+
</dd>
|
| 145 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><out-var></span></code></dt><dd><p>The name of a variable into which the result of a command will be written.</p>
|
| 146 |
+
</dd>
|
| 147 |
+
</dl>
|
| 148 |
+
</section>
|
| 149 |
+
<section id="path-structure-and-terminology">
|
| 150 |
+
<span id="id1"></span><h2>Path Structure And Terminology<a class="headerlink" href="#path-structure-and-terminology" title="Link to this heading">¶</a></h2>
|
| 151 |
+
<p>A path has the following structure (all components are optional, with some
|
| 152 |
+
constraints):</p>
|
| 153 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>root-name root-directory-separator (item-name directory-separator)* filename
|
| 154 |
+
</pre></div>
|
| 155 |
+
</div>
|
| 156 |
+
<dl>
|
| 157 |
+
<dt><code class="docutils literal notranslate"><span class="pre">root-name</span></code></dt><dd><p>Identifies the root on a filesystem with multiple roots (such as <code class="docutils literal notranslate"><span class="pre">"C:"</span></code>
|
| 158 |
+
or <code class="docutils literal notranslate"><span class="pre">"//myserver"</span></code>). It is optional.</p>
|
| 159 |
+
</dd>
|
| 160 |
+
<dt><code class="docutils literal notranslate"><span class="pre">root-directory-separator</span></code></dt><dd><p>A directory separator that, if present, indicates that this path is
|
| 161 |
+
absolute. If it is missing and the first element other than the
|
| 162 |
+
<code class="docutils literal notranslate"><span class="pre">root-name</span></code> is an <code class="docutils literal notranslate"><span class="pre">item-name</span></code>, then the path is relative.</p>
|
| 163 |
+
</dd>
|
| 164 |
+
<dt><code class="docutils literal notranslate"><span class="pre">item-name</span></code></dt><dd><p>A sequence of characters that aren't directory separators. This name may
|
| 165 |
+
identify a file, a hard link, a symbolic link, or a directory. Two special
|
| 166 |
+
cases are recognized:</p>
|
| 167 |
+
<blockquote>
|
| 168 |
+
<div><ul class="simple">
|
| 169 |
+
<li><p>The item name consisting of a single dot character <code class="docutils literal notranslate"><span class="pre">.</span></code> is a
|
| 170 |
+
directory name that refers to the current directory.</p></li>
|
| 171 |
+
<li><p>The item name consisting of two dot characters <code class="docutils literal notranslate"><span class="pre">..</span></code> is a
|
| 172 |
+
directory name that refers to the parent directory.</p></li>
|
| 173 |
+
</ul>
|
| 174 |
+
</div></blockquote>
|
| 175 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">(...)*</span></code> pattern shown above is to indicate that there can be zero
|
| 176 |
+
or more item names, with multiple items separated by a
|
| 177 |
+
<code class="docutils literal notranslate"><span class="pre">directory-separator</span></code>. The <code class="docutils literal notranslate"><span class="pre">()*</span></code> characters are not part of the path.</p>
|
| 178 |
+
</dd>
|
| 179 |
+
<dt><code class="docutils literal notranslate"><span class="pre">directory-separator</span></code></dt><dd><p>The only recognized directory separator is a forward slash character <code class="docutils literal notranslate"><span class="pre">/</span></code>.
|
| 180 |
+
If this character is repeated, it is treated as a single directory
|
| 181 |
+
separator. In other words, <code class="docutils literal notranslate"><span class="pre">/usr///////lib</span></code> is the same as <code class="docutils literal notranslate"><span class="pre">/usr/lib</span></code>.</p>
|
| 182 |
+
</dd>
|
| 183 |
+
</dl>
|
| 184 |
+
<span id="extension-def"></span><span id="filename-def"></span><dl id="stem-def">
|
| 185 |
+
<dt><code class="docutils literal notranslate"><span class="pre">filename</span></code></dt><dd><p>A path has a <code class="docutils literal notranslate"><span class="pre">filename</span></code> if it does not end with a <code class="docutils literal notranslate"><span class="pre">directory-separator</span></code>.
|
| 186 |
+
The <code class="docutils literal notranslate"><span class="pre">filename</span></code> is effectively the last <code class="docutils literal notranslate"><span class="pre">item-name</span></code> of the path, so it
|
| 187 |
+
can also be a hard link, symbolic link or a directory.</p>
|
| 188 |
+
<p>A <code class="docutils literal notranslate"><span class="pre">filename</span></code> can have an <em>extension</em>. By default, the extension is
|
| 189 |
+
defined as the sub-string beginning at the left-most period (including
|
| 190 |
+
the period) and until the end of the <code class="docutils literal notranslate"><span class="pre">filename</span></code>. In commands that
|
| 191 |
+
accept a <code class="docutils literal notranslate"><span class="pre">LAST_ONLY</span></code> keyword, <code class="docutils literal notranslate"><span class="pre">LAST_ONLY</span></code> changes the interpretation
|
| 192 |
+
to the sub-string beginning at the right-most period.</p>
|
| 193 |
+
<p>The following exceptions apply to the above interpretation:</p>
|
| 194 |
+
<blockquote>
|
| 195 |
+
<div><ul class="simple">
|
| 196 |
+
<li><p>If the first character in the <code class="docutils literal notranslate"><span class="pre">filename</span></code> is a period, that period is
|
| 197 |
+
ignored (i.e. a <code class="docutils literal notranslate"><span class="pre">filename</span></code> like <code class="docutils literal notranslate"><span class="pre">".profile"</span></code> is treated as having
|
| 198 |
+
no extension).</p></li>
|
| 199 |
+
<li><p>If the <code class="docutils literal notranslate"><span class="pre">filename</span></code> is either <code class="docutils literal notranslate"><span class="pre">.</span></code> or <code class="docutils literal notranslate"><span class="pre">..</span></code>, it has no extension.</p></li>
|
| 200 |
+
</ul>
|
| 201 |
+
</div></blockquote>
|
| 202 |
+
<p>The <em>stem</em> is the part of the <code class="docutils literal notranslate"><span class="pre">filename</span></code> before the extension.</p>
|
| 203 |
+
</dd>
|
| 204 |
+
</dl>
|
| 205 |
+
<p>Some commands refer to a <code class="docutils literal notranslate"><span class="pre">root-path</span></code>. This is the concatenation of
|
| 206 |
+
<code class="docutils literal notranslate"><span class="pre">root-name</span></code> and <code class="docutils literal notranslate"><span class="pre">root-directory-separator</span></code>, either or both of which can
|
| 207 |
+
be empty. A <code class="docutils literal notranslate"><span class="pre">relative-part</span></code> refers to the full path with any <code class="docutils literal notranslate"><span class="pre">root-path</span></code>
|
| 208 |
+
removed.</p>
|
| 209 |
+
</section>
|
| 210 |
+
<section id="creating-a-path-variable">
|
| 211 |
+
<h2>Creating A Path Variable<a class="headerlink" href="#creating-a-path-variable" title="Link to this heading">¶</a></h2>
|
| 212 |
+
<p>While a path can be created with care using an ordinary <span class="target" id="index-0-command:set"></span><a class="reference internal" href="set.html#command:set" title="set"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">set()</span></code></a>
|
| 213 |
+
command, it is recommended to use <a class="reference internal" href="#cmake-path-set"><span class="std std-ref">cmake_path(SET)</span></a>
|
| 214 |
+
instead, as it automatically converts the path to the required form where
|
| 215 |
+
required. The <a class="reference internal" href="#append"><span class="std std-ref">cmake_path(APPEND)</span></a> subcommand may
|
| 216 |
+
be another suitable alternative where a path needs to be constructed by
|
| 217 |
+
joining fragments. The following example compares the three methods for
|
| 218 |
+
constructing the same path:</p>
|
| 219 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path1</span><span class="w"> </span><span class="s">"${CMAKE_CURRENT_SOURCE_DIR}/data"</span><span class="nf">)</span>
|
| 220 |
+
|
| 221 |
+
<span class="nf">cmake_path(</span><span class="no">SET</span><span class="w"> </span><span class="nb">path2</span><span class="w"> </span><span class="s">"${CMAKE_CURRENT_SOURCE_DIR}/data"</span><span class="nf">)</span>
|
| 222 |
+
|
| 223 |
+
<span class="nf">cmake_path(</span><span class="no">APPEND</span><span class="w"> </span><span class="nb">path3</span><span class="w"> </span><span class="s">"${CMAKE_CURRENT_SOURCE_DIR}"</span><span class="w"> </span><span class="s">"data"</span><span class="nf">)</span>
|
| 224 |
+
</pre></div>
|
| 225 |
+
</div>
|
| 226 |
+
<p><a class="reference internal" href="#modification">Modification</a> and <a class="reference internal" href="#generation">Generation</a> sub-commands can either store the result
|
| 227 |
+
in-place, or in a separate variable named after an <code class="docutils literal notranslate"><span class="pre">OUTPUT_VARIABLE</span></code>
|
| 228 |
+
keyword. All other sub-commands store the result in a mandatory <code class="docutils literal notranslate"><span class="pre"><out-var></span></code>
|
| 229 |
+
variable.</p>
|
| 230 |
+
</section>
|
| 231 |
+
<section id="normalization">
|
| 232 |
+
<span id="id2"></span><h2>Normalization<a class="headerlink" href="#normalization" title="Link to this heading">¶</a></h2>
|
| 233 |
+
<p>Some sub-commands support <em>normalizing</em> a path. The algorithm used to
|
| 234 |
+
normalize a path is as follows:</p>
|
| 235 |
+
<ol class="arabic simple">
|
| 236 |
+
<li><p>If the path is empty, stop (the normalized form of an empty path is
|
| 237 |
+
also an empty path).</p></li>
|
| 238 |
+
<li><p>Replace each <code class="docutils literal notranslate"><span class="pre">directory-separator</span></code>, which may consist of multiple
|
| 239 |
+
separators, with a single <code class="docutils literal notranslate"><span class="pre">/</span></code> (<code class="docutils literal notranslate"><span class="pre">/a///b</span>  <span class="pre">--></span> <span class="pre">/a/b</span></code>).</p></li>
|
| 240 |
+
<li><p>Remove each solitary period (<code class="docutils literal notranslate"><span class="pre">.</span></code>) and any immediately following
|
| 241 |
+
<code class="docutils literal notranslate"><span class="pre">directory-separator</span></code> (<code class="docutils literal notranslate"><span class="pre">/a/./b/.</span> <span class="pre">--></span> <span class="pre">/a/b</span></code>).</p></li>
|
| 242 |
+
<li><p>Remove each <code class="docutils literal notranslate"><span class="pre">item-name</span></code> (other than <code class="docutils literal notranslate"><span class="pre">..</span></code>) that is immediately
|
| 243 |
+
followed by a <code class="docutils literal notranslate"><span class="pre">directory-separator</span></code> and a <code class="docutils literal notranslate"><span class="pre">..</span></code>, along with any
|
| 244 |
+
immediately following <code class="docutils literal notranslate"><span class="pre">directory-separator</span></code> (<code class="docutils literal notranslate"><span class="pre">/a/b/../c</span> <span class="pre">--></span> <span class="pre">a/c</span></code>).</p></li>
|
| 245 |
+
<li><p>If there is a <code class="docutils literal notranslate"><span class="pre">root-directory</span></code>, remove any <code class="docutils literal notranslate"><span class="pre">..</span></code> and any
|
| 246 |
+
<code class="docutils literal notranslate"><span class="pre">directory-separators</span></code> immediately following them. The parent of the
|
| 247 |
+
root directory is treated as still the root directory (<code class="docutils literal notranslate"><span class="pre">/../a</span> <span class="pre">--></span> <span class="pre">/a</span></code>).</p></li>
|
| 248 |
+
<li><p>If the last <code class="docutils literal notranslate"><span class="pre">item-name</span></code> is <code class="docutils literal notranslate"><span class="pre">..</span></code>, remove any trailing
|
| 249 |
+
<code class="docutils literal notranslate"><span class="pre">directory-separator</span></code> (<code class="docutils literal notranslate"><span class="pre">../</span> <span class="pre">--></span> <span class="pre">..</span></code>).</p></li>
|
| 250 |
+
<li><p>If the path is empty by this stage, add a <code class="docutils literal notranslate"><span class="pre">dot</span></code> (normal form of <code class="docutils literal notranslate"><span class="pre">./</span></code>
|
| 251 |
+
is <code class="docutils literal notranslate"><span class="pre">.</span></code>).</p></li>
|
| 252 |
+
</ol>
|
| 253 |
+
</section>
|
| 254 |
+
<section id="decomposition">
|
| 255 |
+
<span id="path-decomposition"></span><h2>Decomposition<a class="headerlink" href="#decomposition" title="Link to this heading">¶</a></h2>
|
| 256 |
+
<p id="get-parent-path"><span id="get-relative-part"></span><span id="get-stem"></span><span id="get-extension"></span><span id="get-filename"></span><span id="get-root-path"></span><span id="get-root-directory"></span><span id="get-root-name"></span><span id="get"></span>The following forms of the <code class="docutils literal notranslate"><span class="pre">GET</span></code> subcommand each retrieve a different
|
| 257 |
+
component or group of components from a path. See
|
| 258 |
+
<a class="reference internal" href="#path-structure-and-terminology">Path Structure And Terminology</a> for the meaning of each path component.</p>
|
| 259 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">ROOT_NAME</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 260 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">ROOT_DIRECTORY</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 261 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">ROOT_PATH</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 262 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">FILENAME</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 263 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">EXTENSION</span><span class="w"> </span><span class="p">[</span><span class="no">LAST_ONLY</span><span class="p">]</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 264 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">STEM</span><span class="w"> </span><span class="p">[</span><span class="no">LAST_ONLY</span><span class="p">]</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 265 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">RELATIVE_PART</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 266 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="no">PARENT_PATH</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 267 |
+
</pre></div>
|
| 268 |
+
</div>
|
| 269 |
+
<p>If a requested component is not present in the path, an empty string will be
|
| 270 |
+
stored in <code class="docutils literal notranslate"><span class="pre"><out-var></span></code>. For example, only Windows systems have the concept
|
| 271 |
+
of a <code class="docutils literal notranslate"><span class="pre">root-name</span></code>, so when the host machine is non-Windows, the <code class="docutils literal notranslate"><span class="pre">ROOT_NAME</span></code>
|
| 272 |
+
subcommand will always return an empty string.</p>
|
| 273 |
+
<p>For <code class="docutils literal notranslate"><span class="pre">PARENT_PATH</span></code>, if the <a class="reference internal" href="#has-relative-part">HAS_RELATIVE_PART</a> subcommand returns false,
|
| 274 |
+
the result is a copy of <code class="docutils literal notranslate"><span class="pre"><path-var></span></code>. Note that this implies that a root
|
| 275 |
+
directory is considered to have a parent, with that parent being itself.
|
| 276 |
+
Where <a class="reference internal" href="#has-relative-part">HAS_RELATIVE_PART</a> returns true, the result will essentially be
|
| 277 |
+
<code class="docutils literal notranslate"><span class="pre"><path-var></span></code> with one less element.</p>
|
| 278 |
+
<section id="root-examples">
|
| 279 |
+
<h3>Root examples<a class="headerlink" href="#root-examples" title="Link to this heading">¶</a></h3>
|
| 280 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"c:/a"</span><span class="nf">)</span>
|
| 281 |
+
|
| 282 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">ROOT_NAME</span><span class="w"> </span><span class="nb">rootName</span><span class="nf">)</span>
|
| 283 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">ROOT_DIRECTORY</span><span class="w"> </span><span class="nb">rootDir</span><span class="nf">)</span>
|
| 284 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">ROOT_PATH</span><span class="w"> </span><span class="nb">rootPath</span><span class="nf">)</span>
|
| 285 |
+
|
| 286 |
+
<span class="nf">message(</span><span class="s">"Root name is \"${rootName}\""</span><span class="nf">)</span>
|
| 287 |
+
<span class="nf">message(</span><span class="s">"Root directory is \"${rootDir}\""</span><span class="nf">)</span>
|
| 288 |
+
<span class="nf">message(</span><span class="s">"Root path is \"${rootPath}\""</span><span class="nf">)</span>
|
| 289 |
+
</pre></div>
|
| 290 |
+
</div>
|
| 291 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Root name is "c:"
|
| 292 |
+
Root directory is "/"
|
| 293 |
+
Root path is "c:/"
|
| 294 |
+
</pre></div>
|
| 295 |
+
</div>
|
| 296 |
+
</section>
|
| 297 |
+
<section id="filename-examples">
|
| 298 |
+
<h3>Filename examples<a class="headerlink" href="#filename-examples" title="Link to this heading">¶</a></h3>
|
| 299 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/b"</span><span class="nf">)</span>
|
| 300 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">FILENAME</span><span class="w"> </span><span class="nb">filename</span><span class="nf">)</span>
|
| 301 |
+
<span class="nf">message(</span><span class="s">"First filename is \"${filename}\""</span><span class="nf">)</span>
|
| 302 |
+
|
| 303 |
+
<span class="c"># Trailing slash means filename is empty</span>
|
| 304 |
+
<span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/b/"</span><span class="nf">)</span>
|
| 305 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">FILENAME</span><span class="w"> </span><span class="nb">filename</span><span class="nf">)</span>
|
| 306 |
+
<span class="nf">message(</span><span class="s">"Second filename is \"${filename}\""</span><span class="nf">)</span>
|
| 307 |
+
</pre></div>
|
| 308 |
+
</div>
|
| 309 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>First filename is "b"
|
| 310 |
+
Second filename is ""
|
| 311 |
+
</pre></div>
|
| 312 |
+
</div>
|
| 313 |
+
</section>
|
| 314 |
+
<section id="extension-and-stem-examples">
|
| 315 |
+
<h3>Extension and stem examples<a class="headerlink" href="#extension-and-stem-examples" title="Link to this heading">¶</a></h3>
|
| 316 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"name.ext1.ext2"</span><span class="nf">)</span>
|
| 317 |
+
|
| 318 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">EXTENSION</span><span class="w"> </span><span class="nb">fullExt</span><span class="nf">)</span>
|
| 319 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">STEM</span><span class="w"> </span><span class="nb">fullStem</span><span class="nf">)</span>
|
| 320 |
+
<span class="nf">message(</span><span class="s">"Full extension is \"${fullExt}\""</span><span class="nf">)</span>
|
| 321 |
+
<span class="nf">message(</span><span class="s">"Full stem is \"${fullStem}\""</span><span class="nf">)</span>
|
| 322 |
+
|
| 323 |
+
<span class="c"># Effect of LAST_ONLY</span>
|
| 324 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">EXTENSION</span><span class="w"> </span><span class="no">LAST_ONLY</span><span class="w"> </span><span class="nb">lastExt</span><span class="nf">)</span>
|
| 325 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">STEM</span><span class="w"> </span><span class="no">LAST_ONLY</span><span class="w"> </span><span class="nb">lastStem</span><span class="nf">)</span>
|
| 326 |
+
<span class="nf">message(</span><span class="s">"Last extension is \"${lastExt}\""</span><span class="nf">)</span>
|
| 327 |
+
<span class="nf">message(</span><span class="s">"Last stem is \"${lastStem}\""</span><span class="nf">)</span>
|
| 328 |
+
|
| 329 |
+
<span class="c"># Special cases</span>
|
| 330 |
+
<span class="nf">set(</span><span class="nb">dotPath</span><span class="w"> </span><span class="s">"/a/."</span><span class="nf">)</span>
|
| 331 |
+
<span class="nf">set(</span><span class="nb">dotDotPath</span><span class="w"> </span><span class="s">"/a/.."</span><span class="nf">)</span>
|
| 332 |
+
<span class="nf">set(</span><span class="nb">someMorePath</span><span class="w"> </span><span class="s">"/a/.some.more"</span><span class="nf">)</span>
|
| 333 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">dotPath</span><span class="w"> </span><span class="no">EXTENSION</span><span class="w"> </span><span class="nb">dotExt</span><span class="nf">)</span>
|
| 334 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">dotPath</span><span class="w"> </span><span class="no">STEM</span><span class="w"> </span><span class="nb">dotStem</span><span class="nf">)</span>
|
| 335 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">dotDotPath</span><span class="w"> </span><span class="no">EXTENSION</span><span class="w"> </span><span class="nb">dotDotExt</span><span class="nf">)</span>
|
| 336 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">dotDotPath</span><span class="w"> </span><span class="no">STEM</span><span class="w"> </span><span class="nb">dotDotStem</span><span class="nf">)</span>
|
| 337 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">dotMorePath</span><span class="w"> </span><span class="no">EXTENSION</span><span class="w"> </span><span class="nb">someMoreExt</span><span class="nf">)</span>
|
| 338 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">dotMorePath</span><span class="w"> </span><span class="no">STEM</span><span class="w"> </span><span class="nb">someMoreStem</span><span class="nf">)</span>
|
| 339 |
+
<span class="nf">message(</span><span class="s">"Dot extension is \"${dotExt}\""</span><span class="nf">)</span>
|
| 340 |
+
<span class="nf">message(</span><span class="s">"Dot stem is \"${dotStem}\""</span><span class="nf">)</span>
|
| 341 |
+
<span class="nf">message(</span><span class="s">"Dot-dot extension is \"${dotDotExt}\""</span><span class="nf">)</span>
|
| 342 |
+
<span class="nf">message(</span><span class="s">"Dot-dot stem is \"${dotDotStem}\""</span><span class="nf">)</span>
|
| 343 |
+
<span class="nf">message(</span><span class="s">".some.more extension is \"${someMoreExt}\""</span><span class="nf">)</span>
|
| 344 |
+
<span class="nf">message(</span><span class="s">".some.more stem is \"${someMoreStem}\""</span><span class="nf">)</span>
|
| 345 |
+
</pre></div>
|
| 346 |
+
</div>
|
| 347 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Full extension is ".ext1.ext2"
|
| 348 |
+
Full stem is "name"
|
| 349 |
+
Last extension is ".ext2"
|
| 350 |
+
Last stem is "name.ext1"
|
| 351 |
+
Dot extension is ""
|
| 352 |
+
Dot stem is "."
|
| 353 |
+
Dot-dot extension is ""
|
| 354 |
+
Dot-dot stem is ".."
|
| 355 |
+
.some.more extension is ".more"
|
| 356 |
+
.some.more stem is ".some"
|
| 357 |
+
</pre></div>
|
| 358 |
+
</div>
|
| 359 |
+
</section>
|
| 360 |
+
<section id="relative-part-examples">
|
| 361 |
+
<h3>Relative part examples<a class="headerlink" href="#relative-part-examples" title="Link to this heading">¶</a></h3>
|
| 362 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"c:/a/b"</span><span class="nf">)</span>
|
| 363 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">RELATIVE_PART</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span>
|
| 364 |
+
<span class="nf">message(</span><span class="s">"Relative part is \"${result}\""</span><span class="nf">)</span>
|
| 365 |
+
|
| 366 |
+
<span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"c/d"</span><span class="nf">)</span>
|
| 367 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">RELATIVE_PART</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span>
|
| 368 |
+
<span class="nf">message(</span><span class="s">"Relative part is \"${result}\""</span><span class="nf">)</span>
|
| 369 |
+
|
| 370 |
+
<span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"/"</span><span class="nf">)</span>
|
| 371 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">RELATIVE_PART</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span>
|
| 372 |
+
<span class="nf">message(</span><span class="s">"Relative part is \"${result}\""</span><span class="nf">)</span>
|
| 373 |
+
</pre></div>
|
| 374 |
+
</div>
|
| 375 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Relative part is "a/b"
|
| 376 |
+
Relative part is "c/d"
|
| 377 |
+
Relative part is ""
|
| 378 |
+
</pre></div>
|
| 379 |
+
</div>
|
| 380 |
+
</section>
|
| 381 |
+
<section id="path-traversal-examples">
|
| 382 |
+
<h3>Path traversal examples<a class="headerlink" href="#path-traversal-examples" title="Link to this heading">¶</a></h3>
|
| 383 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"c:/a/b"</span><span class="nf">)</span>
|
| 384 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">PARENT_PATH</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span>
|
| 385 |
+
<span class="nf">message(</span><span class="s">"Parent path is \"${result}\""</span><span class="nf">)</span>
|
| 386 |
+
|
| 387 |
+
<span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"c:/"</span><span class="nf">)</span>
|
| 388 |
+
<span class="nf">cmake_path(</span><span class="no">GET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">PARENT_PATH</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span>
|
| 389 |
+
<span class="nf">message(</span><span class="s">"Parent path is \"${result}\""</span><span class="nf">)</span>
|
| 390 |
+
</pre></div>
|
| 391 |
+
</div>
|
| 392 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Parent path is "c:/a"
|
| 393 |
+
Parent path is "c:/"
|
| 394 |
+
</pre></div>
|
| 395 |
+
</div>
|
| 396 |
+
</section>
|
| 397 |
+
</section>
|
| 398 |
+
<section id="query">
|
| 399 |
+
<span id="path-query"></span><h2>Query<a class="headerlink" href="#query" title="Link to this heading">¶</a></h2>
|
| 400 |
+
<p>Each of the <code class="docutils literal notranslate"><span class="pre">GET</span></code> subcommands has a corresponding <code class="docutils literal notranslate"><span class="pre">HAS_...</span></code>
|
| 401 |
+
subcommand which can be used to discover whether a particular path
|
| 402 |
+
component is present. See <a class="reference internal" href="#path-structure-and-terminology">Path Structure And Terminology</a> for the
|
| 403 |
+
meaning of each path component.</p>
|
| 404 |
+
<div class="highlight-cmake notranslate" id="has-parent-path"><span id="has-relative-part"></span><span id="has-stem"></span><span id="has-extension"></span><span id="has-filename"></span><span id="has-root-path"></span><span id="has-root-directory"></span><span id="has-root-name"></span><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">HAS_ROOT_NAME</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 405 |
+
<span class="nf">cmake_path(</span><span class="no">HAS_ROOT_DIRECTORY</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 406 |
+
<span class="nf">cmake_path(</span><span class="no">HAS_ROOT_PATH</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 407 |
+
<span class="nf">cmake_path(</span><span class="no">HAS_FILENAME</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 408 |
+
<span class="nf">cmake_path(</span><span class="no">HAS_EXTENSION</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 409 |
+
<span class="nf">cmake_path(</span><span class="no">HAS_STEM</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 410 |
+
<span class="nf">cmake_path(</span><span class="no">HAS_RELATIVE_PART</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 411 |
+
<span class="nf">cmake_path(</span><span class="no">HAS_PARENT_PATH</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 412 |
+
</pre></div>
|
| 413 |
+
</div>
|
| 414 |
+
<p>Each of the above follows the predictable pattern of setting <code class="docutils literal notranslate"><span class="pre"><out-var></span></code>
|
| 415 |
+
to true if the path has the associated component, or false otherwise.
|
| 416 |
+
Note the following special cases:</p>
|
| 417 |
+
<ul class="simple">
|
| 418 |
+
<li><p>For <code class="docutils literal notranslate"><span class="pre">HAS_ROOT_PATH</span></code>, a true result will only be returned if at least one
|
| 419 |
+
of <code class="docutils literal notranslate"><span class="pre">root-name</span></code> or <code class="docutils literal notranslate"><span class="pre">root-directory</span></code> is non-empty.</p></li>
|
| 420 |
+
<li><p>For <code class="docutils literal notranslate"><span class="pre">HAS_PARENT_PATH</span></code>, the root directory is also considered to have a
|
| 421 |
+
parent, which will be itself. The result is true except if the path
|
| 422 |
+
consists of just a <a class="reference internal" href="#filename-def"><span class="std std-ref">filename</span></a>.</p></li>
|
| 423 |
+
</ul>
|
| 424 |
+
<div class="highlight-cmake notranslate" id="is-absolute"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">IS_ABSOLUTE</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 425 |
+
</pre></div>
|
| 426 |
+
</div>
|
| 427 |
+
<p>Sets <code class="docutils literal notranslate"><span class="pre"><out-var></span></code> to true if <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> is absolute. An absolute path
|
| 428 |
+
is a path that unambiguously identifies the location of a file without
|
| 429 |
+
reference to an additional starting location. On Windows, this means the
|
| 430 |
+
path must have both a <code class="docutils literal notranslate"><span class="pre">root-name</span></code> and a <code class="docutils literal notranslate"><span class="pre">root-directory-separator</span></code> to be
|
| 431 |
+
considered absolute. On other platforms, just a <code class="docutils literal notranslate"><span class="pre">root-directory-separator</span></code>
|
| 432 |
+
is sufficient. Note that this means on Windows, <code class="docutils literal notranslate"><span class="pre">IS_ABSOLUTE</span></code> can be
|
| 433 |
+
false while <code class="docutils literal notranslate"><span class="pre">HAS_ROOT_DIRECTORY</span></code> can be true.</p>
|
| 434 |
+
<div class="highlight-cmake notranslate" id="is-relative"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">IS_RELATIVE</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 435 |
+
</pre></div>
|
| 436 |
+
</div>
|
| 437 |
+
<p>This will store the opposite of <code class="docutils literal notranslate"><span class="pre">IS_ABSOLUTE</span></code> in <code class="docutils literal notranslate"><span class="pre"><out-var></span></code>.</p>
|
| 438 |
+
<div class="highlight-cmake notranslate" id="is-prefix"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">IS_PREFIX</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="p">[</span><span class="no">NORMALIZE</span><span class="p">]</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 439 |
+
</pre></div>
|
| 440 |
+
</div>
|
| 441 |
+
<p>Checks if <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> is the prefix of <code class="docutils literal notranslate"><span class="pre"><input></span></code>.</p>
|
| 442 |
+
<p>When the <code class="docutils literal notranslate"><span class="pre">NORMALIZE</span></code> option is specified, <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> and <code class="docutils literal notranslate"><span class="pre"><input></span></code>
|
| 443 |
+
are <a class="reference internal" href="#normalization"><span class="std std-ref">normalized</span></a> before the check.</p>
|
| 444 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/b/c"</span><span class="nf">)</span>
|
| 445 |
+
<span class="nf">cmake_path(</span><span class="no">IS_PREFIX</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/b/c/d"</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span><span class="w"> </span><span class="c"># result = true</span>
|
| 446 |
+
<span class="nf">cmake_path(</span><span class="no">IS_PREFIX</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/b"</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span><span class="w"> </span><span class="c"># result = false</span>
|
| 447 |
+
<span class="nf">cmake_path(</span><span class="no">IS_PREFIX</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="s">"/x/y/z"</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span><span class="w"> </span><span class="c"># result = false</span>
|
| 448 |
+
|
| 449 |
+
<span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/b"</span><span class="nf">)</span>
|
| 450 |
+
<span class="nf">cmake_path(</span><span class="no">IS_PREFIX</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/c/../b"</span><span class="w"> </span><span class="no">NORMALIZE</span><span class="w"> </span><span class="nb">result</span><span class="nf">)</span><span class="w"> </span><span class="c"># result = true</span>
|
| 451 |
+
</pre></div>
|
| 452 |
+
</div>
|
| 453 |
+
<div class="highlight-cmake notranslate" id="compare"><span id="path-compare"></span><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">COMPARE</span><span class="w"> </span><span class="nv"><input1></span><span class="w"> </span><span class="no">EQUAL</span><span class="w"> </span><span class="nv"><input2></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 454 |
+
<span class="nf">cmake_path(</span><span class="no">COMPARE</span><span class="w"> </span><span class="nv"><input1></span><span class="w"> </span><span class="no">NOT_EQUAL</span><span class="w"> </span><span class="nv"><input2></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 455 |
+
</pre></div>
|
| 456 |
+
</div>
|
| 457 |
+
<p>Compares the lexical representations of two paths provided as string literals.
|
| 458 |
+
No normalization is performed on either path, except multiple consecutive
|
| 459 |
+
directory separators are effectively collapsed into a single separator.
|
| 460 |
+
Equality is determined according to the following pseudo-code logic:</p>
|
| 461 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>if(NOT <input1>.root_name() STREQUAL <input2>.root_name())
|
| 462 |
+
return FALSE
|
| 463 |
+
|
| 464 |
+
if(<input1>.has_root_directory() XOR <input2>.has_root_directory())
|
| 465 |
+
return FALSE
|
| 466 |
+
|
| 467 |
+
Return FALSE if a relative portion of <input1> is not lexicographically
|
| 468 |
+
equal to the relative portion of <input2>. This comparison is performed path
|
| 469 |
+
component-wise. If all of the components compare equal, then return TRUE.
|
| 470 |
+
</pre></div>
|
| 471 |
+
</div>
|
| 472 |
+
<div class="admonition note">
|
| 473 |
+
<p class="admonition-title">Note</p>
|
| 474 |
+
<p>Unlike most other <code class="docutils literal notranslate"><span class="pre">cmake_path()</span></code> subcommands, the <code class="docutils literal notranslate"><span class="pre">COMPARE</span></code> subcommand
|
| 475 |
+
takes literal strings as input, not the names of variables.</p>
|
| 476 |
+
</div>
|
| 477 |
+
</section>
|
| 478 |
+
<section id="modification">
|
| 479 |
+
<span id="path-modification"></span><h2>Modification<a class="headerlink" href="#modification" title="Link to this heading">¶</a></h2>
|
| 480 |
+
<div class="highlight-cmake notranslate" id="cmake-path-set"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">SET</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">NORMALIZE</span><span class="p">]</span><span class="w"> </span><span class="nv"><input></span><span class="nf">)</span>
|
| 481 |
+
</pre></div>
|
| 482 |
+
</div>
|
| 483 |
+
<p>Assign the <code class="docutils literal notranslate"><span class="pre"><input></span></code> path to <code class="docutils literal notranslate"><span class="pre"><path-var></span></code>. If <code class="docutils literal notranslate"><span class="pre"><input></span></code> is a native
|
| 484 |
+
path, it is converted into a cmake-style path with forward-slashes
|
| 485 |
+
(<code class="docutils literal notranslate"><span class="pre">/</span></code>). On Windows, the long filename marker is taken into account.</p>
|
| 486 |
+
<p>When the <code class="docutils literal notranslate"><span class="pre">NORMALIZE</span></code> option is specified, the path is <a class="reference internal" href="#normalization"><span class="std std-ref">normalized</span></a> after the conversion.</p>
|
| 487 |
+
<p>For example:</p>
|
| 488 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">native_path</span><span class="w"> </span><span class="s">"c:\\a\\b/..\\c"</span><span class="nf">)</span>
|
| 489 |
+
<span class="nf">cmake_path(</span><span class="no">SET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="s">"${native_path}"</span><span class="nf">)</span>
|
| 490 |
+
<span class="nf">message(</span><span class="s">"CMake path is \"${path}\""</span><span class="nf">)</span>
|
| 491 |
+
|
| 492 |
+
<span class="nf">cmake_path(</span><span class="no">SET</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="no">NORMALIZE</span><span class="w"> </span><span class="s">"${native_path}"</span><span class="nf">)</span>
|
| 493 |
+
<span class="nf">message(</span><span class="s">"Normalized CMake path is \"${path}\""</span><span class="nf">)</span>
|
| 494 |
+
</pre></div>
|
| 495 |
+
</div>
|
| 496 |
+
<p>Output:</p>
|
| 497 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CMake path is "c:/a/b/../c"
|
| 498 |
+
Normalized CMake path is "c:/a/c"
|
| 499 |
+
</pre></div>
|
| 500 |
+
</div>
|
| 501 |
+
<div class="highlight-cmake notranslate" id="append"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">APPEND</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 502 |
+
</pre></div>
|
| 503 |
+
</div>
|
| 504 |
+
<p>Append all the <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments to the <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> using <code class="docutils literal notranslate"><span class="pre">/</span></code> as
|
| 505 |
+
the <code class="docutils literal notranslate"><span class="pre">directory-separator</span></code>. Depending on the <code class="docutils literal notranslate"><span class="pre"><input></span></code>, the previous
|
| 506 |
+
contents of <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> may be discarded. For each <code class="docutils literal notranslate"><span class="pre"><input></span></code> argument,
|
| 507 |
+
the following algorithm (pseudo-code) applies:</p>
|
| 508 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span># <path> is the contents of <path-var>
|
| 509 |
+
|
| 510 |
+
if(<input>.is_absolute() OR
|
| 511 |
+
(<input>.has_root_name() AND
|
| 512 |
+
NOT <input>.root_name() STREQUAL <path>.root_name()))
|
| 513 |
+
replace <path> with <input>
|
| 514 |
+
return()
|
| 515 |
+
endif()
|
| 516 |
+
|
| 517 |
+
if(<input>.has_root_directory())
|
| 518 |
+
remove any root-directory and the entire relative path from <path>
|
| 519 |
+
elseif(<path>.has_filename() OR
|
| 520 |
+
(NOT <path-var>.has_root_directory() OR <path>.is_absolute()))
|
| 521 |
+
append directory-separator to <path>
|
| 522 |
+
endif()
|
| 523 |
+
|
| 524 |
+
append <input> omitting any root-name to <path>
|
| 525 |
+
</pre></div>
|
| 526 |
+
</div>
|
| 527 |
+
<div class="highlight-cmake notranslate" id="append-string"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">APPEND_STRING</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="nv"><input>...</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 528 |
+
</pre></div>
|
| 529 |
+
</div>
|
| 530 |
+
<p>Append all the <code class="docutils literal notranslate"><span class="pre"><input></span></code> arguments to the <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> without adding any
|
| 531 |
+
<code class="docutils literal notranslate"><span class="pre">directory-separator</span></code>.</p>
|
| 532 |
+
<div class="highlight-cmake notranslate" id="remove-filename"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">REMOVE_FILENAME</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 533 |
+
</pre></div>
|
| 534 |
+
</div>
|
| 535 |
+
<p>Removes the <a class="reference internal" href="#filename-def"><span class="std std-ref">filename</span></a> component (as returned by
|
| 536 |
+
<a class="reference internal" href="#get-filename"><span class="std std-ref">GET ... FILENAME</span></a>) from <code class="docutils literal notranslate"><span class="pre"><path-var></span></code>. After removal,
|
| 537 |
+
any trailing <code class="docutils literal notranslate"><span class="pre">directory-separator</span></code> is left alone, if present.</p>
|
| 538 |
+
<p>If <code class="docutils literal notranslate"><span class="pre">OUTPUT_VARIABLE</span></code> is not given, then after this function returns,
|
| 539 |
+
<a class="reference internal" href="#has-filename">HAS_FILENAME</a> returns false for <code class="docutils literal notranslate"><span class="pre"><path-var></span></code>.</p>
|
| 540 |
+
<p>For example:</p>
|
| 541 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">path</span><span class="w"> </span><span class="s">"/a/b"</span><span class="nf">)</span>
|
| 542 |
+
<span class="nf">cmake_path(</span><span class="no">REMOVE_FILENAME</span><span class="w"> </span><span class="nb">path</span><span class="nf">)</span>
|
| 543 |
+
<span class="nf">message(</span><span class="s">"First path is \"${path}\""</span><span class="nf">)</span>
|
| 544 |
+
|
| 545 |
+
<span class="c"># filename is now already empty, the following removes nothing</span>
|
| 546 |
+
<span class="nf">cmake_path(</span><span class="no">REMOVE_FILENAME</span><span class="w"> </span><span class="nb">path</span><span class="nf">)</span>
|
| 547 |
+
<span class="nf">message(</span><span class="s">"Second path is \"${path}\""</span><span class="nf">)</span>
|
| 548 |
+
</pre></div>
|
| 549 |
+
</div>
|
| 550 |
+
<p>Output:</p>
|
| 551 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>First path is "/a/"
|
| 552 |
+
Second path is "/a/"
|
| 553 |
+
</pre></div>
|
| 554 |
+
</div>
|
| 555 |
+
<div class="highlight-cmake notranslate" id="replace-filename"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">REPLACE_FILENAME</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 556 |
+
</pre></div>
|
| 557 |
+
</div>
|
| 558 |
+
<p>Replaces the <a class="reference internal" href="#filename-def"><span class="std std-ref">filename</span></a> component from <code class="docutils literal notranslate"><span class="pre"><path-var></span></code>
|
| 559 |
+
with <code class="docutils literal notranslate"><span class="pre"><input></span></code>. If <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> has no filename component (i.e.
|
| 560 |
+
<a class="reference internal" href="#has-filename">HAS_FILENAME</a> returns false), the path is unchanged. The operation is
|
| 561 |
+
equivalent to the following:</p>
|
| 562 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">HAS_FILENAME</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="nb">has_filename</span><span class="nf">)</span>
|
| 563 |
+
<span class="nf">if(</span><span class="nb">has_filename</span><span class="nf">)</span>
|
| 564 |
+
<span class="w"> </span><span class="nf">cmake_path(</span><span class="no">REMOVE_FILENAME</span><span class="w"> </span><span class="nb">path</span><span class="nf">)</span>
|
| 565 |
+
<span class="w"> </span><span class="nf">cmake_path(</span><span class="no">APPEND</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="nb">input</span><span class="nf">)</span><span class="p">;</span>
|
| 566 |
+
<span class="nf">endif()</span>
|
| 567 |
+
</pre></div>
|
| 568 |
+
</div>
|
| 569 |
+
<div class="highlight-cmake notranslate" id="remove-extension"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">REMOVE_EXTENSION</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">LAST_ONLY</span><span class="p">]</span>
|
| 570 |
+
<span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 571 |
+
</pre></div>
|
| 572 |
+
</div>
|
| 573 |
+
<p>Removes the <a class="reference internal" href="#extension-def"><span class="std std-ref">extension</span></a>, if any, from <code class="docutils literal notranslate"><span class="pre"><path-var></span></code>.</p>
|
| 574 |
+
<div class="highlight-cmake notranslate" id="replace-extension"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">REPLACE_EXTENSION</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">LAST_ONLY</span><span class="p">]</span><span class="w"> </span><span class="nv"><input></span>
|
| 575 |
+
<span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 576 |
+
</pre></div>
|
| 577 |
+
</div>
|
| 578 |
+
<p>Replaces the <a class="reference internal" href="#extension-def"><span class="std std-ref">extension</span></a> with <code class="docutils literal notranslate"><span class="pre"><input></span></code>. Its effect
|
| 579 |
+
is equivalent to the following:</p>
|
| 580 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">REMOVE_EXTENSION</span><span class="w"> </span><span class="nb">path</span><span class="nf">)</span>
|
| 581 |
+
<span class="nf">if(</span><span class="no">NOT</span><span class="w"> </span><span class="s">"input"</span><span class="w"> </span><span class="no">MATCHES</span><span class="w"> </span><span class="s">"^\\."</span><span class="nf">)</span>
|
| 582 |
+
<span class="w"> </span><span class="nf">cmake_path(</span><span class="no">APPEND_STRING</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="s">"."</span><span class="nf">)</span>
|
| 583 |
+
<span class="nf">endif()</span>
|
| 584 |
+
<span class="nf">cmake_path(</span><span class="no">APPEND_STRING</span><span class="w"> </span><span class="nb">path</span><span class="w"> </span><span class="s">"input"</span><span class="nf">)</span>
|
| 585 |
+
</pre></div>
|
| 586 |
+
</div>
|
| 587 |
+
</section>
|
| 588 |
+
<section id="generation">
|
| 589 |
+
<span id="path-generation"></span><h2>Generation<a class="headerlink" href="#generation" title="Link to this heading">¶</a></h2>
|
| 590 |
+
<div class="highlight-cmake notranslate" id="normal-path"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">NORMAL_PATH</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 591 |
+
</pre></div>
|
| 592 |
+
</div>
|
| 593 |
+
<p>Normalize <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> according the steps described in <a class="reference internal" href="#normalization"><span class="std std-ref">Normalization</span></a>.</p>
|
| 594 |
+
<div class="highlight-cmake notranslate" id="relative-path"><span id="cmake-path-relative-path"></span><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">RELATIVE_PATH</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">BASE_DIRECTORY</span><span class="w"> </span><span class="nv"><input></span><span class="p">]</span>
|
| 595 |
+
<span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 596 |
+
</pre></div>
|
| 597 |
+
</div>
|
| 598 |
+
<p>Modifies <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> to make it relative to the <code class="docutils literal notranslate"><span class="pre">BASE_DIRECTORY</span></code> argument.
|
| 599 |
+
If <code class="docutils literal notranslate"><span class="pre">BASE_DIRECTORY</span></code> is not specified, the default base directory will be
|
| 600 |
+
<span class="target" id="index-0-variable:CMAKE_CURRENT_SOURCE_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_SOURCE_DIR.html#variable:CMAKE_CURRENT_SOURCE_DIR" title="CMAKE_CURRENT_SOURCE_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_SOURCE_DIR</span></code></a>.</p>
|
| 601 |
+
<p>For reference, the algorithm used to compute the relative path is the same
|
| 602 |
+
as that used by C++
|
| 603 |
+
<a class="reference external" href="https://en.cppreference.com/w/cpp/filesystem/path/lexically_normal">std::filesystem::path::lexically_relative</a>.</p>
|
| 604 |
+
<div class="highlight-cmake notranslate" id="absolute-path"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">ABSOLUTE_PATH</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">BASE_DIRECTORY</span><span class="w"> </span><span class="nv"><input></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">NORMALIZE</span><span class="p">]</span>
|
| 605 |
+
<span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_VARIABLE</span><span class="w"> </span><span class="nv"><out-var></span><span class="p">]</span><span class="nf">)</span>
|
| 606 |
+
</pre></div>
|
| 607 |
+
</div>
|
| 608 |
+
<p>If <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> is a relative path (<a class="reference internal" href="#is-relative">IS_RELATIVE</a> is true), it is evaluated
|
| 609 |
+
relative to the given base directory specified by <code class="docutils literal notranslate"><span class="pre">BASE_DIRECTORY</span></code> option.
|
| 610 |
+
If <code class="docutils literal notranslate"><span class="pre">BASE_DIRECTORY</span></code> is not specified, the default base directory will be
|
| 611 |
+
<span class="target" id="index-1-variable:CMAKE_CURRENT_SOURCE_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_SOURCE_DIR.html#variable:CMAKE_CURRENT_SOURCE_DIR" title="CMAKE_CURRENT_SOURCE_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_SOURCE_DIR</span></code></a>.</p>
|
| 612 |
+
<p>When the <code class="docutils literal notranslate"><span class="pre">NORMALIZE</span></code> option is specified, the path is <a class="reference internal" href="#normalization"><span class="std std-ref">normalized</span></a> after the path computation.</p>
|
| 613 |
+
<p>Because <code class="docutils literal notranslate"><span class="pre">cmake_path()</span></code> does not access the filesystem, symbolic links are
|
| 614 |
+
not resolved and any leading tilde is not expanded. To compute a real path
|
| 615 |
+
with symbolic links resolved and leading tildes expanded, use the
|
| 616 |
+
<span class="target" id="index-1-command:file"></span><a class="reference internal" href="file.html#real-path" title="file(real_path)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">file(REAL_PATH)</span></code></a> command instead.</p>
|
| 617 |
+
</section>
|
| 618 |
+
<section id="native-conversion">
|
| 619 |
+
<h2>Native Conversion<a class="headerlink" href="#native-conversion" title="Link to this heading">¶</a></h2>
|
| 620 |
+
<p>For commands in this section, <em>native</em> refers to the host platform, not the
|
| 621 |
+
target platform when cross-compiling.</p>
|
| 622 |
+
<div class="highlight-cmake notranslate" id="native-path"><span id="cmake-path-native-path"></span><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">NATIVE_PATH</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="p">[</span><span class="no">NORMALIZE</span><span class="p">]</span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 623 |
+
</pre></div>
|
| 624 |
+
</div>
|
| 625 |
+
<p>Converts a cmake-style <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> into a native path with
|
| 626 |
+
platform-specific slashes (<code class="docutils literal notranslate"><span class="pre">\</span></code> on Windows hosts and <code class="docutils literal notranslate"><span class="pre">/</span></code> elsewhere).</p>
|
| 627 |
+
<p>When the <code class="docutils literal notranslate"><span class="pre">NORMALIZE</span></code> option is specified, the path is <a class="reference internal" href="#normalization"><span class="std std-ref">normalized</span></a> before the conversion.</p>
|
| 628 |
+
<div class="highlight-cmake notranslate" id="to-cmake-path-list"><span id="cmake-path-to-cmake-path-list"></span><span id="convert"></span><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">CONVERT</span><span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="no">TO_CMAKE_PATH_LIST</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">NORMALIZE</span><span class="p">]</span><span class="nf">)</span>
|
| 629 |
+
</pre></div>
|
| 630 |
+
</div>
|
| 631 |
+
<p>Converts a native <code class="docutils literal notranslate"><span class="pre"><input></span></code> path into a cmake-style path with forward
|
| 632 |
+
slashes (<code class="docutils literal notranslate"><span class="pre">/</span></code>). On Windows hosts, the long filename marker is taken into
|
| 633 |
+
account. The input can be a single path or a system search path like
|
| 634 |
+
<code class="docutils literal notranslate"><span class="pre">$ENV{PATH}</span></code>. A search path will be converted to a cmake-style list
|
| 635 |
+
separated by <code class="docutils literal notranslate"><span class="pre">;</span></code> characters (on non-Windows platforms, this essentially
|
| 636 |
+
means <code class="docutils literal notranslate"><span class="pre">:</span></code> separators are replaced with <code class="docutils literal notranslate"><span class="pre">;</span></code>). The result of the
|
| 637 |
+
conversion is stored in the <code class="docutils literal notranslate"><span class="pre"><out-var></span></code> variable.</p>
|
| 638 |
+
<p>When the <code class="docutils literal notranslate"><span class="pre">NORMALIZE</span></code> option is specified, the path is <a class="reference internal" href="#normalization"><span class="std std-ref">normalized</span></a> before the conversion.</p>
|
| 639 |
+
<div class="admonition note">
|
| 640 |
+
<p class="admonition-title">Note</p>
|
| 641 |
+
<p>Unlike most other <code class="docutils literal notranslate"><span class="pre">cmake_path()</span></code> subcommands, the <code class="docutils literal notranslate"><span class="pre">CONVERT</span></code> subcommand
|
| 642 |
+
takes a literal string as input, not the name of a variable.</p>
|
| 643 |
+
</div>
|
| 644 |
+
<div class="highlight-cmake notranslate" id="to-native-path-list"><span id="cmake-path-to-native-path-list"></span><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">CONVERT</span><span class="w"> </span><span class="nv"><input></span><span class="w"> </span><span class="no">TO_NATIVE_PATH_LIST</span><span class="w"> </span><span class="nv"><out-var></span><span class="w"> </span><span class="p">[</span><span class="no">NORMALIZE</span><span class="p">]</span><span class="nf">)</span>
|
| 645 |
+
</pre></div>
|
| 646 |
+
</div>
|
| 647 |
+
<p>Converts a cmake-style <code class="docutils literal notranslate"><span class="pre"><input></span></code> path into a native path with
|
| 648 |
+
platform-specific slashes (<code class="docutils literal notranslate"><span class="pre">\</span></code> on Windows hosts and <code class="docutils literal notranslate"><span class="pre">/</span></code> elsewhere).
|
| 649 |
+
The input can be a single path or a cmake-style list. A list will be
|
| 650 |
+
converted into a native search path (<code class="docutils literal notranslate"><span class="pre">;</span></code>-separated on Windows,
|
| 651 |
+
<code class="docutils literal notranslate"><span class="pre">:</span></code>-separated on other platforms). The result of the conversion is
|
| 652 |
+
stored in the <code class="docutils literal notranslate"><span class="pre"><out-var></span></code> variable.</p>
|
| 653 |
+
<p>When the <code class="docutils literal notranslate"><span class="pre">NORMALIZE</span></code> option is specified, the path is <a class="reference internal" href="#normalization"><span class="std std-ref">normalized</span></a> before the conversion.</p>
|
| 654 |
+
<div class="admonition note">
|
| 655 |
+
<p class="admonition-title">Note</p>
|
| 656 |
+
<p>Unlike most other <code class="docutils literal notranslate"><span class="pre">cmake_path()</span></code> subcommands, the <code class="docutils literal notranslate"><span class="pre">CONVERT</span></code> subcommand
|
| 657 |
+
takes a literal string as input, not the name of a variable.</p>
|
| 658 |
+
</div>
|
| 659 |
+
<p>For example:</p>
|
| 660 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">set(</span><span class="nb">paths</span><span class="w"> </span><span class="s">"/a/b/c"</span><span class="w"> </span><span class="s">"/x/y/z"</span><span class="nf">)</span>
|
| 661 |
+
<span class="nf">cmake_path(</span><span class="no">CONVERT</span><span class="w"> </span><span class="s">"${paths}"</span><span class="w"> </span><span class="no">TO_NATIVE_PATH_LIST</span><span class="w"> </span><span class="nb">native_paths</span><span class="nf">)</span>
|
| 662 |
+
<span class="nf">message(</span><span class="s">"Native path list is \"${native_paths}\""</span><span class="nf">)</span>
|
| 663 |
+
</pre></div>
|
| 664 |
+
</div>
|
| 665 |
+
<p>Output on Windows:</p>
|
| 666 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Native path list is "\a\b\c;\x\y\z"
|
| 667 |
+
</pre></div>
|
| 668 |
+
</div>
|
| 669 |
+
<p>Output on all other platforms:</p>
|
| 670 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Native path list is "/a/b/c:/x/y/z"
|
| 671 |
+
</pre></div>
|
| 672 |
+
</div>
|
| 673 |
+
</section>
|
| 674 |
+
<section id="hashing">
|
| 675 |
+
<h2>Hashing<a class="headerlink" href="#hashing" title="Link to this heading">¶</a></h2>
|
| 676 |
+
<div class="highlight-cmake notranslate" id="hash"><div class="highlight"><pre><span></span><span class="nf">cmake_path(</span><span class="no">HASH</span><span class="w"> </span><span class="nv"><path-var></span><span class="w"> </span><span class="nv"><out-var></span><span class="nf">)</span>
|
| 677 |
+
</pre></div>
|
| 678 |
+
</div>
|
| 679 |
+
<p>Compute a hash value of <code class="docutils literal notranslate"><span class="pre"><path-var></span></code> such that for two paths <code class="docutils literal notranslate"><span class="pre">p1</span></code> and
|
| 680 |
+
<code class="docutils literal notranslate"><span class="pre">p2</span></code> that compare equal (<a class="reference internal" href="string.html#compare"><span class="std std-ref">COMPARE ... EQUAL</span></a>), the hash
|
| 681 |
+
value of <code class="docutils literal notranslate"><span class="pre">p1</span></code> is equal to the hash value of <code class="docutils literal notranslate"><span class="pre">p2</span></code>. The path is always
|
| 682 |
+
<a class="reference internal" href="#normalization"><span class="std std-ref">normalized</span></a> before the hash is computed.</p>
|
| 683 |
+
</section>
|
| 684 |
+
</section>
|
| 685 |
+
|
| 686 |
+
|
| 687 |
+
<div class="clearer"></div>
|
| 688 |
+
</div>
|
| 689 |
+
</div>
|
| 690 |
+
</div>
|
| 691 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 692 |
+
<div class="sphinxsidebarwrapper">
|
| 693 |
+
<div>
|
| 694 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 695 |
+
<ul>
|
| 696 |
+
<li><a class="reference internal" href="#">cmake_path</a><ul>
|
| 697 |
+
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
|
| 698 |
+
<li><a class="reference internal" href="#conventions">Conventions</a></li>
|
| 699 |
+
<li><a class="reference internal" href="#path-structure-and-terminology">Path Structure And Terminology</a></li>
|
| 700 |
+
<li><a class="reference internal" href="#creating-a-path-variable">Creating A Path Variable</a></li>
|
| 701 |
+
<li><a class="reference internal" href="#normalization">Normalization</a></li>
|
| 702 |
+
<li><a class="reference internal" href="#decomposition">Decomposition</a><ul>
|
| 703 |
+
<li><a class="reference internal" href="#root-examples">Root examples</a></li>
|
| 704 |
+
<li><a class="reference internal" href="#filename-examples">Filename examples</a></li>
|
| 705 |
+
<li><a class="reference internal" href="#extension-and-stem-examples">Extension and stem examples</a></li>
|
| 706 |
+
<li><a class="reference internal" href="#relative-part-examples">Relative part examples</a></li>
|
| 707 |
+
<li><a class="reference internal" href="#path-traversal-examples">Path traversal examples</a></li>
|
| 708 |
+
</ul>
|
| 709 |
+
</li>
|
| 710 |
+
<li><a class="reference internal" href="#query">Query</a></li>
|
| 711 |
+
<li><a class="reference internal" href="#modification">Modification</a></li>
|
| 712 |
+
<li><a class="reference internal" href="#generation">Generation</a></li>
|
| 713 |
+
<li><a class="reference internal" href="#native-conversion">Native Conversion</a></li>
|
| 714 |
+
<li><a class="reference internal" href="#hashing">Hashing</a></li>
|
| 715 |
+
</ul>
|
| 716 |
+
</li>
|
| 717 |
+
</ul>
|
| 718 |
+
|
| 719 |
+
</div>
|
| 720 |
+
<div>
|
| 721 |
+
<h4>Previous topic</h4>
|
| 722 |
+
<p class="topless"><a href="cmake_parse_arguments.html"
|
| 723 |
+
title="previous chapter">cmake_parse_arguments</a></p>
|
| 724 |
+
</div>
|
| 725 |
+
<div>
|
| 726 |
+
<h4>Next topic</h4>
|
| 727 |
+
<p class="topless"><a href="cmake_pkg_config.html"
|
| 728 |
+
title="next chapter">cmake_pkg_config</a></p>
|
| 729 |
+
</div>
|
| 730 |
+
<div role="note" aria-label="source link">
|
| 731 |
+
<h3>This Page</h3>
|
| 732 |
+
<ul class="this-page-menu">
|
| 733 |
+
<li><a href="../_sources/command/cmake_path.rst.txt"
|
| 734 |
+
rel="nofollow">Show Source</a></li>
|
| 735 |
+
</ul>
|
| 736 |
+
</div>
|
| 737 |
+
<search id="searchbox" style="display: none" role="search">
|
| 738 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 739 |
+
<div class="searchformwrapper">
|
| 740 |
+
<form class="search" action="../search.html" method="get">
|
| 741 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 742 |
+
<input type="submit" value="Go" />
|
| 743 |
+
</form>
|
| 744 |
+
</div>
|
| 745 |
+
</search>
|
| 746 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 747 |
+
</div>
|
| 748 |
+
</div>
|
| 749 |
+
<div class="clearer"></div>
|
| 750 |
+
</div>
|
| 751 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 752 |
+
<h3>Navigation</h3>
|
| 753 |
+
<ul>
|
| 754 |
+
<li class="right" style="margin-right: 10px">
|
| 755 |
+
<a href="../genindex.html" title="General Index"
|
| 756 |
+
>index</a></li>
|
| 757 |
+
<li class="right" >
|
| 758 |
+
<a href="cmake_pkg_config.html" title="cmake_pkg_config"
|
| 759 |
+
>next</a> |</li>
|
| 760 |
+
<li class="right" >
|
| 761 |
+
<a href="cmake_parse_arguments.html" title="cmake_parse_arguments"
|
| 762 |
+
>previous</a> |</li>
|
| 763 |
+
<li>
|
| 764 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 765 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 766 |
+
</li>
|
| 767 |
+
<li>
|
| 768 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 769 |
+
</li>
|
| 770 |
+
<li>
|
| 771 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 772 |
+
</li>
|
| 773 |
+
|
| 774 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 775 |
+
<li class="nav-item nav-item-this"><a href="">cmake_path</a></li>
|
| 776 |
+
</ul>
|
| 777 |
+
</div>
|
| 778 |
+
|
| 779 |
+
<div class="footer" role="contentinfo">
|
| 780 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 781 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 782 |
+
</div>
|
| 783 |
+
</body>
|
| 784 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_pkg_config.html
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_pkg_config — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="cmake_policy" href="cmake_policy.html" />
|
| 21 |
+
<link rel="prev" title="cmake_path" href="cmake_path.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="cmake_policy.html" title="cmake_policy"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_path.html" title="cmake_path"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_pkg_config</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-pkg-config">
|
| 60 |
+
<span id="command:cmake_pkg_config"></span><h1><a class="toc-backref" href="#id1" role="doc-backlink">cmake_pkg_config</a><a class="headerlink" href="#cmake-pkg-config" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.31.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<nav class="contents" id="contents">
|
| 65 |
+
<p class="topic-title">Contents</p>
|
| 66 |
+
<ul class="simple">
|
| 67 |
+
<li><p><a class="reference internal" href="#cmake-pkg-config" id="id1">cmake_pkg_config</a></p>
|
| 68 |
+
<ul>
|
| 69 |
+
<li><p><a class="reference internal" href="#synopsis" id="id2">Synopsis</a></p></li>
|
| 70 |
+
<li><p><a class="reference internal" href="#introduction" id="id3">Introduction</a></p></li>
|
| 71 |
+
<li><p><a class="reference internal" href="#signatures" id="id4">Signatures</a></p></li>
|
| 72 |
+
</ul>
|
| 73 |
+
</li>
|
| 74 |
+
</ul>
|
| 75 |
+
</nav>
|
| 76 |
+
<p>Process pkg-config format package files.</p>
|
| 77 |
+
<section id="synopsis">
|
| 78 |
+
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Synopsis</a><a class="headerlink" href="#synopsis" title="Link to this heading">¶</a></h2>
|
| 79 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cmake_pkg_config(EXTRACT <package> [<version>] [...])
|
| 80 |
+
</pre></div>
|
| 81 |
+
</div>
|
| 82 |
+
</section>
|
| 83 |
+
<section id="introduction">
|
| 84 |
+
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Introduction</a><a class="headerlink" href="#introduction" title="Link to this heading">¶</a></h2>
|
| 85 |
+
<p>This command generates CMake variables and targets from pkg-config format
|
| 86 |
+
package files natively, without needing to invoke or even require the presence
|
| 87 |
+
of a pkg-config implementation. A <code class="docutils literal notranslate"><span class="pre"><package></span></code> is either an absolute path to a
|
| 88 |
+
package file, or a package name to be searched for using the typical pkg-config
|
| 89 |
+
search patterns. The optional <code class="docutils literal notranslate"><span class="pre"><version></span></code> string has the same format and
|
| 90 |
+
semantics as a pkg-config style version specifier, with the exception that if
|
| 91 |
+
no comparison operator is specified <code class="docutils literal notranslate"><span class="pre">=</span></code> is assumed.</p>
|
| 92 |
+
<p id="common-options">There are multiple signatures for this command, and some of the options are
|
| 93 |
+
common between them. They are:</p>
|
| 94 |
+
<dl>
|
| 95 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXACT</span></code> / <code class="docutils literal notranslate"><span class="pre">QUIET</span></code> / <code class="docutils literal notranslate"><span class="pre">REQUIRED</span></code></dt><dd><p>The <code class="docutils literal notranslate"><span class="pre">EXACT</span></code> option requests that the version string be matched exactly
|
| 96 |
+
(including empty string, if no version is provided), overriding the typical
|
| 97 |
+
pkg-config version comparison algorithm. This will ignore any comparison
|
| 98 |
+
operator attached to the version string.</p>
|
| 99 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">QUIET</span></code> option disables informational messages, including those
|
| 100 |
+
indicating that the package cannot be found if it is not <code class="docutils literal notranslate"><span class="pre">REQUIRED</span></code>. The
|
| 101 |
+
<code class="docutils literal notranslate"><span class="pre">REQUIRED</span></code> option stops processing with an error message if the package
|
| 102 |
+
cannot be found.</p>
|
| 103 |
+
</dd>
|
| 104 |
+
<dt><code class="docutils literal notranslate"><span class="pre">STRICTNESS</span> <span class="pre"><mode></span></code></dt><dd><p>Specify how strictly the contents of the package files will be verified during
|
| 105 |
+
parsing and resolution. An invalid file, under the provided strictness mode,
|
| 106 |
+
will cause the command to fail. Possible modes are:</p>
|
| 107 |
+
<ul class="simple">
|
| 108 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">STRICT</span></code>: Closely mirrors the behavior of the original FDO pkg-config.
|
| 109 |
+
Variables and keywords must be unique. Variables must be defined before
|
| 110 |
+
they are used. The Name, Description, and Version keywords must be present.
|
| 111 |
+
The overall structure of the file must be valid and parsable.</p></li>
|
| 112 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">PERMISSIVE</span></code>: Closely mirrors the behavior of the pkgconf implementation.
|
| 113 |
+
Duplicate variables are overridden. Duplicate keywords are appended.
|
| 114 |
+
Undefined variables resolve to empty strings. The Name, Description, and
|
| 115 |
+
Version keywords must be present. The overall structure of the file must be
|
| 116 |
+
valid and parsable.</p></li>
|
| 117 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">BEST_EFFORT</span></code>: Same behavior as <code class="docutils literal notranslate"><span class="pre">PERMISSIVE</span></code> with regards to duplicate
|
| 118 |
+
or uninitialized variables and keywords, but will not fail under any
|
| 119 |
+
conditions. Package files which require BEST_EFFORT will fail validation
|
| 120 |
+
under all other major implementations and should be fixed.</p></li>
|
| 121 |
+
</ul>
|
| 122 |
+
<p>The default strictness is <code class="docutils literal notranslate"><span class="pre">PERMISSIVE</span></code>.</p>
|
| 123 |
+
</dd>
|
| 124 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ENV_MODE</span></code></dt><dd><p>Specifies which environment variables will be queried when running a given
|
| 125 |
+
command. Possible modes are:</p>
|
| 126 |
+
<ul>
|
| 127 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">FDO</span></code>: Queries only the original set of <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_*</span></code> environment
|
| 128 |
+
variables used by the freedesktop.org <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code> implementation.</p></li>
|
| 129 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">PKGCONF</span></code>: Queries the more extensive set of environment variables used
|
| 130 |
+
by the <code class="docutils literal notranslate"><span class="pre">pkgconf</span></code> implementation.</p></li>
|
| 131 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">IGNORE</span></code>: Ignores the presence, absence, and value of environment
|
| 132 |
+
variables entirely. In all cases an environment variable would be queried
|
| 133 |
+
its treated as defined, but with a value of empty string for the purpose
|
| 134 |
+
of the operation. This does not modify the current environment. For boolean
|
| 135 |
+
environment variables, such as <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_ALLOW_*</span></code>, this means they are
|
| 136 |
+
evaluated as truthy.</p>
|
| 137 |
+
<p><code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_SYSROOT_PATH</span></code> is a minor exception. When <code class="docutils literal notranslate"><span class="pre">ENV_MODE</span> <span class="pre">IGNORE</span></code>
|
| 138 |
+
is used, no root path prepending will occur by default and <code class="docutils literal notranslate"><span class="pre">pc_sysrootdir</span></code>
|
| 139 |
+
remains defaulted to <code class="docutils literal notranslate"><span class="pre">/</span></code>.</p>
|
| 140 |
+
</li>
|
| 141 |
+
</ul>
|
| 142 |
+
<p>Target-generating subcommands always ignore flag-filtering environment
|
| 143 |
+
variables. The default environment mode is <code class="docutils literal notranslate"><span class="pre">PKGCONF</span></code>.</p>
|
| 144 |
+
</dd>
|
| 145 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PC_LIBDIR</span> <span class="pre"><path>...</span></code></dt><dd><p>Overrides the default search location for package files; also used to derive
|
| 146 |
+
the <code class="docutils literal notranslate"><span class="pre">pc_path</span></code> package variable.</p>
|
| 147 |
+
<p>When this option is not provided, the default library directory is the first
|
| 148 |
+
available of the following values:</p>
|
| 149 |
+
<ol class="arabic simple">
|
| 150 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_PC_LIB_DIRS</span></code></p></li>
|
| 151 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_LIBDIR</span></code> environment variable</p></li>
|
| 152 |
+
<li><p>The output of <code class="docutils literal notranslate"><span class="pre">pkg-config</span> <span class="pre">--variable</span> <span class="pre">pc_path</span> <span class="pre">pkg-config</span></code></p></li>
|
| 153 |
+
<li><p>A platform-dependent default value</p></li>
|
| 154 |
+
</ol>
|
| 155 |
+
</dd>
|
| 156 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PC_PATH</span> <span class="pre"><path>...</span></code></dt><dd><p>Overrides the supplemental package file directories which will be prepended
|
| 157 |
+
to the search path; also used to derive the <code class="docutils literal notranslate"><span class="pre">pc_path</span></code> package variable.</p>
|
| 158 |
+
<p>When this option is not provided, the default paths are the first available of
|
| 159 |
+
the following values:</p>
|
| 160 |
+
<ol class="arabic simple">
|
| 161 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_PC_PATH</span></code></p></li>
|
| 162 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_PATH</span></code> environment variable</p></li>
|
| 163 |
+
<li><p>Empty list</p></li>
|
| 164 |
+
</ol>
|
| 165 |
+
</dd>
|
| 166 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DISABLE_UNINSTALLED</span> <span class="pre"><bool></span></code></dt><dd><p>Overrides the search behavior for "uninstalled" package files. These are
|
| 167 |
+
package files with an "-uninstalled" suffix which describe packages integrated
|
| 168 |
+
directly from a build tree.</p>
|
| 169 |
+
<p>Normally such package files have higher priority than "installed" packages.
|
| 170 |
+
When <code class="docutils literal notranslate"><span class="pre">DISABLE_UNINSTALLED</span></code> is true, searching for "uninstalled" packages
|
| 171 |
+
is disabled.</p>
|
| 172 |
+
<p>When this option is not provided, the default search behavior is determined
|
| 173 |
+
by the first available of the following values:</p>
|
| 174 |
+
<ol class="arabic simple">
|
| 175 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_DISABLE_UNINSTALLED</span></code></p></li>
|
| 176 |
+
<li><p>If the <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_DISABLE_UNINSTALLED</span></code> environment variable is defined
|
| 177 |
+
the search is disabled, otherwise it is enabled.</p></li>
|
| 178 |
+
</ol>
|
| 179 |
+
</dd>
|
| 180 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PC_SYSROOT_DIR</span> <span class="pre"><path></span></code></dt><dd><p>Overrides the root path which will be prepended to paths specified by <code class="docutils literal notranslate"><span class="pre">-I</span></code>
|
| 181 |
+
compile flags and <code class="docutils literal notranslate"><span class="pre">-L</span></code> library search locations; also used to derive the
|
| 182 |
+
<code class="docutils literal notranslate"><span class="pre">pc_sysrootdir</span></code> package variable.</p>
|
| 183 |
+
<p>When this option is not provided, the default root path is provided by the
|
| 184 |
+
first available of the following values:</p>
|
| 185 |
+
<ol class="arabic simple">
|
| 186 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_SYSROOT_DIR</span></code></p></li>
|
| 187 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_SYSROOT_DIR</span></code> environment variable</p></li>
|
| 188 |
+
<li><p>If no root path is available, nothing will be prepended to include or
|
| 189 |
+
library directory paths and <code class="docutils literal notranslate"><span class="pre">pc_sysrootdir</span></code> will be set to <code class="docutils literal notranslate"><span class="pre">/</span></code></p></li>
|
| 190 |
+
</ol>
|
| 191 |
+
</dd>
|
| 192 |
+
<dt><code class="docutils literal notranslate"><span class="pre">TOP_BUILD_DIR</span> <span class="pre"><path></span></code></dt><dd><p>Overrides the top build directory path used to derived the <code class="docutils literal notranslate"><span class="pre">pc_top_builddir</span></code>
|
| 193 |
+
package variable.</p>
|
| 194 |
+
<p>When this option is not provided, the default top build directory path is
|
| 195 |
+
the first available of the following values:</p>
|
| 196 |
+
<ol class="arabic simple">
|
| 197 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_TOP_BUILD_DIR</span></code></p></li>
|
| 198 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_TOP_BUILD_DIR</span></code> environment variable</p></li>
|
| 199 |
+
<li><p>If no top build directory path is available, the <code class="docutils literal notranslate"><span class="pre">pc_top_builddir</span></code>
|
| 200 |
+
package variable is not set</p></li>
|
| 201 |
+
</ol>
|
| 202 |
+
</dd>
|
| 203 |
+
</dl>
|
| 204 |
+
</section>
|
| 205 |
+
<section id="signatures">
|
| 206 |
+
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Signatures</a><a class="headerlink" href="#signatures" title="Link to this heading">¶</a></h2>
|
| 207 |
+
<dl class="cmake signature">
|
| 208 |
+
<dt class="sig sig-object cmake" id="extract">
|
| 209 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_pkg_config(</span></span><span class="no"><span class="pre">EXTRACT</span></span><span class="w"> </span><span class="nv"><span class="pre"><package></span></span><span class="w"> </span><span class="p"><span class="pre">[</span></span><span class="nv"><span class="pre"><version></span></span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">[...]</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#extract" title="Link to this definition">¶</a></dt>
|
| 210 |
+
<dd><p>Extract the contents of the package into variables.</p>
|
| 211 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">cmake_pkg_config(</span><span class="no">EXTRACT</span><span class="w"> </span><span class="nv"><package></span><span class="w"> </span><span class="p">[</span><span class="nv"><version></span><span class="p">]</span>
|
| 212 |
+
<span class="w"> </span><span class="p">[</span><span class="no">REQUIRED</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">EXACT</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span>
|
| 213 |
+
<span class="w"> </span><span class="p">[</span><span class="no">STRICTNESS</span><span class="w"> </span><span class="nv"><mode></span><span class="p">]</span>
|
| 214 |
+
<span class="w"> </span><span class="p">[</span><span class="no">ENV_MODE</span><span class="w"> </span><span class="nv"><mode></span><span class="p">]</span>
|
| 215 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PC_LIBDIR</span><span class="w"> </span><span class="nv"><path>...</span><span class="p">]</span>
|
| 216 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PC_PATH</span><span class="w"> </span><span class="nv"><path>...</span><span class="p">]</span>
|
| 217 |
+
<span class="w"> </span><span class="p">[</span><span class="no">DISABLE_UNINSTALLED</span><span class="w"> </span><span class="nv"><bool></span><span class="p">]</span>
|
| 218 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PC_SYSROOT_DIR</span><span class="w"> </span><span class="nv"><path></span><span class="p">]</span>
|
| 219 |
+
<span class="w"> </span><span class="p">[</span><span class="no">TOP_BUILD_DIR</span><span class="w"> </span><span class="nv"><path></span><span class="p">]</span>
|
| 220 |
+
<span class="w"> </span><span class="p">[</span><span class="no">SYSTEM_INCLUDE_DIRS</span><span class="w"> </span><span class="nv"><path>...</span><span class="p">]</span>
|
| 221 |
+
<span class="w"> </span><span class="p">[</span><span class="no">SYSTEM_LIBRARY_DIRS</span><span class="w"> </span><span class="nv"><path>...</span><span class="p">]</span>
|
| 222 |
+
<span class="w"> </span><span class="p">[</span><span class="no">ALLOW_SYSTEM_INCLUDES</span><span class="w"> </span><span class="nv"><bool></span><span class="p">]</span>
|
| 223 |
+
<span class="w"> </span><span class="p">[</span><span class="no">ALLOW_SYSTEM_LIBS</span><span class="w"> </span><span class="nv"><bool></span><span class="p">]</span><span class="nf">)</span>
|
| 224 |
+
</pre></div>
|
| 225 |
+
</div>
|
| 226 |
+
</dd></dl>
|
| 227 |
+
|
| 228 |
+
<p>The following variables will be populated from the contents of package file:</p>
|
| 229 |
+
<table class="docutils align-default">
|
| 230 |
+
<thead>
|
| 231 |
+
<tr class="row-odd"><th class="head"><p>Variable</p></th>
|
| 232 |
+
<th class="head"><p>Type</p></th>
|
| 233 |
+
<th class="head"><p>Definition</p></th>
|
| 234 |
+
</tr>
|
| 235 |
+
</thead>
|
| 236 |
+
<tbody>
|
| 237 |
+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_NAME</span></code></p></td>
|
| 238 |
+
<td><p>String</p></td>
|
| 239 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">Name</span></code> keyword</p></td>
|
| 240 |
+
</tr>
|
| 241 |
+
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_DESCRIPTION</span></code></p></td>
|
| 242 |
+
<td><p>String</p></td>
|
| 243 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">Description</span></code> keyword</p></td>
|
| 244 |
+
</tr>
|
| 245 |
+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_VERSION</span></code></p></td>
|
| 246 |
+
<td><p>String</p></td>
|
| 247 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">Version</span></code> keyword</p></td>
|
| 248 |
+
</tr>
|
| 249 |
+
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_PROVIDES</span></code></p></td>
|
| 250 |
+
<td><p>List</p></td>
|
| 251 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">Provides</span></code> keyword</p></td>
|
| 252 |
+
</tr>
|
| 253 |
+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_REQUIRES</span></code></p></td>
|
| 254 |
+
<td><p>List</p></td>
|
| 255 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">Requires</span></code> keyword</p></td>
|
| 256 |
+
</tr>
|
| 257 |
+
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_CONFLICTS</span></code></p></td>
|
| 258 |
+
<td><p>List</p></td>
|
| 259 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">Conflicts</span></code> keyword</p></td>
|
| 260 |
+
</tr>
|
| 261 |
+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_CFLAGS</span></code></p></td>
|
| 262 |
+
<td><p>String</p></td>
|
| 263 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">CFlags</span></code> / <code class="docutils literal notranslate"><span class="pre">Cflags</span></code> keyword</p></td>
|
| 264 |
+
</tr>
|
| 265 |
+
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_INCLUDES</span></code></p></td>
|
| 266 |
+
<td><p>List</p></td>
|
| 267 |
+
<td><p>All <code class="docutils literal notranslate"><span class="pre">-I</span></code> prefixed flags from <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_CFLAGS</span></code></p></td>
|
| 268 |
+
</tr>
|
| 269 |
+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_COMPILE_OPTIONS</span></code></p></td>
|
| 270 |
+
<td><p>List</p></td>
|
| 271 |
+
<td><p>All flags not prefixed with <code class="docutils literal notranslate"><span class="pre">-I</span></code> from <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_CFLAGS</span></code></p></td>
|
| 272 |
+
</tr>
|
| 273 |
+
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBS</span></code></p></td>
|
| 274 |
+
<td><p>String</p></td>
|
| 275 |
+
<td><p>Value of the <code class="docutils literal notranslate"><span class="pre">Libs</span></code> keyword</p></td>
|
| 276 |
+
</tr>
|
| 277 |
+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBDIRS</span></code></p></td>
|
| 278 |
+
<td><p>List</p></td>
|
| 279 |
+
<td><p>All <code class="docutils literal notranslate"><span class="pre">-L</span></code> prefixed flags from <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBS</span></code></p></td>
|
| 280 |
+
</tr>
|
| 281 |
+
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBNAMES</span></code></p></td>
|
| 282 |
+
<td><p>List</p></td>
|
| 283 |
+
<td><p>All <code class="docutils literal notranslate"><span class="pre">-l</span></code> prefixed flags from <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBS</span></code></p></td>
|
| 284 |
+
</tr>
|
| 285 |
+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LINK_OPTIONS</span></code></p></td>
|
| 286 |
+
<td><p>List</p></td>
|
| 287 |
+
<td><p>All flags not prefixed with <code class="docutils literal notranslate"><span class="pre">-L</span></code> or <code class="docutils literal notranslate"><span class="pre">-l</span></code> from <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBS</span></code></p></td>
|
| 288 |
+
</tr>
|
| 289 |
+
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_*_PRIVATE</span></code></p></td>
|
| 290 |
+
<td><p>*</p></td>
|
| 291 |
+
<td><p><code class="docutils literal notranslate"><span class="pre">CFLAGS</span></code> / <code class="docutils literal notranslate"><span class="pre">LIBS</span></code> / <code class="docutils literal notranslate"><span class="pre">REQUIRES</span></code> and derived, but in their <code class="docutils literal notranslate"><span class="pre">.private</span></code> suffix forms</p></td>
|
| 292 |
+
</tr>
|
| 293 |
+
</tbody>
|
| 294 |
+
</table>
|
| 295 |
+
<dl>
|
| 296 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SYSTEM_INCLUDE_DIRS</span></code></dt><dd><p>Overrides the "system" directories for the purpose of flag mangling include
|
| 297 |
+
directories in <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_CFLAGS</span></code> and derived variables.</p>
|
| 298 |
+
<p>When this option is not provided, the default directories are provided by the
|
| 299 |
+
first available of the following values:</p>
|
| 300 |
+
<ol class="arabic simple">
|
| 301 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_SYS_INCLUDE_DIRS</span></code></p></li>
|
| 302 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_SYSTEM_INCLUDE_PATH</span></code> environment variable</p></li>
|
| 303 |
+
<li><p>The output of <code class="docutils literal notranslate"><span class="pre">pkgconf</span> <span class="pre">--variable</span> <span class="pre">pc_system_includedirs</span> <span class="pre">pkg-config</span></code></p></li>
|
| 304 |
+
<li><p>A platform-dependent default value</p></li>
|
| 305 |
+
</ol>
|
| 306 |
+
<p>Additionally, when the <code class="docutils literal notranslate"><span class="pre">ENV_MODE</span></code> is <code class="docutils literal notranslate"><span class="pre">PKGCONF</span></code> the
|
| 307 |
+
<code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_PKGCONF_INCLUDES</span></code> variable will be concatenated to the
|
| 308 |
+
list if available. If it is not available, the following environment variables
|
| 309 |
+
will be queried and concatenated:</p>
|
| 310 |
+
<ul class="simple">
|
| 311 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CPATH</span></code></p></li>
|
| 312 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">C_INCLUDE_PATH</span></code></p></li>
|
| 313 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CPLUS_INCLUDE_PATH</span></code></p></li>
|
| 314 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">OBJC_INCLUDE_PATH</span></code></p></li>
|
| 315 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">INCLUDE</span></code> (Windows Only)</p></li>
|
| 316 |
+
</ul>
|
| 317 |
+
</dd>
|
| 318 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SYSTEM_LIBRARY_DIRS</span></code></dt><dd><p>Overrides the "system" directories for the purpose of flag mangling library
|
| 319 |
+
directories in <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBS</span></code> and derived variables.</p>
|
| 320 |
+
<p>When this option is not provided, the default directories are provided by the
|
| 321 |
+
first available of the following values:</p>
|
| 322 |
+
<ol class="arabic simple">
|
| 323 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_SYS_LIB_DIRS</span></code></p></li>
|
| 324 |
+
<li><p>The <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_SYSTEM_LIBRARY_PATH</span></code> environment variable</p></li>
|
| 325 |
+
<li><p>The output of <code class="docutils literal notranslate"><span class="pre">pkgconf</span> <span class="pre">--variable</span> <span class="pre">pc_system_libdirs</span> <span class="pre">pkg-config</span></code></p></li>
|
| 326 |
+
<li><p>A platform-dependent default value</p></li>
|
| 327 |
+
</ol>
|
| 328 |
+
<p>Additionally, when the <code class="docutils literal notranslate"><span class="pre">ENV_MODE</span></code> is <code class="docutils literal notranslate"><span class="pre">PKGCONF</span></code> the
|
| 329 |
+
<code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_PKGCONF_LIB_DIRS</span></code> variable will be concatenated to the
|
| 330 |
+
list if available. If it is not available, the <code class="docutils literal notranslate"><span class="pre">LIBRARY_PATH</span></code> environment
|
| 331 |
+
variable will be queried and concatenated.</p>
|
| 332 |
+
</dd>
|
| 333 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ALLOW_SYSTEM_INCLUDES</span></code></dt><dd><p>Preserves "system" directories during flag mangling of include directories
|
| 334 |
+
in <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_CFLAGS</span></code> and derived variables.</p>
|
| 335 |
+
<p>When this option is not provided, the default value is determined by the first
|
| 336 |
+
available of the following values:</p>
|
| 337 |
+
<ol class="arabic simple">
|
| 338 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_ALLOW_SYS_INCLUDES</span></code></p></li>
|
| 339 |
+
<li><p>If the <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_ALLOW_SYSTEM_CFLAGS</span></code> environment variable is defined
|
| 340 |
+
the flags are preserved, otherwise they are filtered during flag mangling.</p></li>
|
| 341 |
+
</ol>
|
| 342 |
+
</dd>
|
| 343 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ALLOW_SYSTEM_LIBS</span></code></dt><dd><p>Preserves "system" directories during flag mangling of library directories
|
| 344 |
+
in <code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_LIBS</span></code> and derived variables.</p>
|
| 345 |
+
<p>When this option is not provided, the default value is determined by the first
|
| 346 |
+
available of the following values:</p>
|
| 347 |
+
<ol class="arabic simple">
|
| 348 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_PKG_CONFIG_ALLOW_SYS_LIBS</span></code></p></li>
|
| 349 |
+
<li><p>If the <code class="docutils literal notranslate"><span class="pre">PKG_CONFIG_ALLOW_SYSTEM_LIBS</span></code> environment variable is defined
|
| 350 |
+
the flags are preserved, otherwise they are filtered during flag mangling.</p></li>
|
| 351 |
+
</ol>
|
| 352 |
+
</dd>
|
| 353 |
+
</dl>
|
| 354 |
+
</section>
|
| 355 |
+
</section>
|
| 356 |
+
|
| 357 |
+
|
| 358 |
+
<div class="clearer"></div>
|
| 359 |
+
</div>
|
| 360 |
+
</div>
|
| 361 |
+
</div>
|
| 362 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 363 |
+
<div class="sphinxsidebarwrapper">
|
| 364 |
+
<div>
|
| 365 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 366 |
+
<ul>
|
| 367 |
+
<li><a class="reference internal" href="#">cmake_pkg_config</a><ul>
|
| 368 |
+
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
|
| 369 |
+
<li><a class="reference internal" href="#introduction">Introduction</a></li>
|
| 370 |
+
<li><a class="reference internal" href="#signatures">Signatures</a></li>
|
| 371 |
+
</ul>
|
| 372 |
+
</li>
|
| 373 |
+
</ul>
|
| 374 |
+
|
| 375 |
+
</div>
|
| 376 |
+
<div>
|
| 377 |
+
<h4>Previous topic</h4>
|
| 378 |
+
<p class="topless"><a href="cmake_path.html"
|
| 379 |
+
title="previous chapter">cmake_path</a></p>
|
| 380 |
+
</div>
|
| 381 |
+
<div>
|
| 382 |
+
<h4>Next topic</h4>
|
| 383 |
+
<p class="topless"><a href="cmake_policy.html"
|
| 384 |
+
title="next chapter">cmake_policy</a></p>
|
| 385 |
+
</div>
|
| 386 |
+
<div role="note" aria-label="source link">
|
| 387 |
+
<h3>This Page</h3>
|
| 388 |
+
<ul class="this-page-menu">
|
| 389 |
+
<li><a href="../_sources/command/cmake_pkg_config.rst.txt"
|
| 390 |
+
rel="nofollow">Show Source</a></li>
|
| 391 |
+
</ul>
|
| 392 |
+
</div>
|
| 393 |
+
<search id="searchbox" style="display: none" role="search">
|
| 394 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 395 |
+
<div class="searchformwrapper">
|
| 396 |
+
<form class="search" action="../search.html" method="get">
|
| 397 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 398 |
+
<input type="submit" value="Go" />
|
| 399 |
+
</form>
|
| 400 |
+
</div>
|
| 401 |
+
</search>
|
| 402 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 403 |
+
</div>
|
| 404 |
+
</div>
|
| 405 |
+
<div class="clearer"></div>
|
| 406 |
+
</div>
|
| 407 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 408 |
+
<h3>Navigation</h3>
|
| 409 |
+
<ul>
|
| 410 |
+
<li class="right" style="margin-right: 10px">
|
| 411 |
+
<a href="../genindex.html" title="General Index"
|
| 412 |
+
>index</a></li>
|
| 413 |
+
<li class="right" >
|
| 414 |
+
<a href="cmake_policy.html" title="cmake_policy"
|
| 415 |
+
>next</a> |</li>
|
| 416 |
+
<li class="right" >
|
| 417 |
+
<a href="cmake_path.html" title="cmake_path"
|
| 418 |
+
>previous</a> |</li>
|
| 419 |
+
<li>
|
| 420 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 421 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 422 |
+
</li>
|
| 423 |
+
<li>
|
| 424 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 425 |
+
</li>
|
| 426 |
+
<li>
|
| 427 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 428 |
+
</li>
|
| 429 |
+
|
| 430 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 431 |
+
<li class="nav-item nav-item-this"><a href="">cmake_pkg_config</a></li>
|
| 432 |
+
</ul>
|
| 433 |
+
</div>
|
| 434 |
+
|
| 435 |
+
<div class="footer" role="contentinfo">
|
| 436 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 437 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 438 |
+
</div>
|
| 439 |
+
</body>
|
| 440 |
+
</html>
|
cmake/doc/cmake/html/command/cmake_policy.html
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>cmake_policy — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="configure_file" href="configure_file.html" />
|
| 21 |
+
<link rel="prev" title="cmake_pkg_config" href="cmake_pkg_config.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="configure_file.html" title="configure_file"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_pkg_config.html" title="cmake_pkg_config"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">cmake_policy</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="cmake-policy">
|
| 60 |
+
<span id="command:cmake_policy"></span><h1>cmake_policy<a class="headerlink" href="#cmake-policy" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Manage CMake Policy settings. See the <span class="target" id="index-0-manual:cmake-policies(7)"></span><a class="reference internal" href="../manual/cmake-policies.7.html#manual:cmake-policies(7)" title="cmake-policies(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">cmake-policies(7)</span></code></a>
|
| 62 |
+
manual for defined policies.</p>
|
| 63 |
+
<p>As CMake evolves it is sometimes necessary to change existing behavior
|
| 64 |
+
in order to fix bugs or improve implementations of existing features.
|
| 65 |
+
The CMake Policy mechanism is designed to help keep existing projects
|
| 66 |
+
building as new versions of CMake introduce changes in behavior. Each
|
| 67 |
+
new policy (behavioral change) is given an identifier of the form
|
| 68 |
+
<code class="docutils literal notranslate"><span class="pre">CMP<NNNN></span></code> where <code class="docutils literal notranslate"><span class="pre"><NNNN></span></code> is an integer index. Documentation
|
| 69 |
+
associated with each policy describes the <code class="docutils literal notranslate"><span class="pre">OLD</span></code> and <code class="docutils literal notranslate"><span class="pre">NEW</span></code> behavior
|
| 70 |
+
and the reason the policy was introduced. Projects may set each policy
|
| 71 |
+
to select the desired behavior. When CMake needs to know which behavior
|
| 72 |
+
to use it checks for a setting specified by the project. If no
|
| 73 |
+
setting is available the <code class="docutils literal notranslate"><span class="pre">OLD</span></code> behavior is assumed and a warning is
|
| 74 |
+
produced requesting that the policy be set.</p>
|
| 75 |
+
<section id="setting-policies-by-cmake-version">
|
| 76 |
+
<h2>Setting Policies by CMake Version<a class="headerlink" href="#setting-policies-by-cmake-version" title="Link to this heading">¶</a></h2>
|
| 77 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">cmake_policy</span></code> command is used to set policies to <code class="docutils literal notranslate"><span class="pre">OLD</span></code> or <code class="docutils literal notranslate"><span class="pre">NEW</span></code>
|
| 78 |
+
behavior. While setting policies individually is supported, we
|
| 79 |
+
encourage projects to set policies based on CMake versions:</p>
|
| 80 |
+
<dl class="cmake signature">
|
| 81 |
+
<dt class="sig sig-object cmake" id="version">
|
| 82 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_policy(</span></span><span class="no"><span class="pre">VERSION</span></span><span class="w"> </span><span class="nv"><span class="pre"><min></span></span><span class="p"><span class="pre">[...</span></span><span class="nv"><span class="pre"><max></span></span><span class="p"><span class="pre">]</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#version" title="Link to this definition">¶</a></dt>
|
| 83 |
+
<dd></dd></dl>
|
| 84 |
+
|
| 85 |
+
<div class="versionadded">
|
| 86 |
+
<p><span class="versionmodified added">Added in version 3.12: </span>The optional <code class="docutils literal notranslate"><span class="pre"><max></span></code> version.</p>
|
| 87 |
+
</div>
|
| 88 |
+
<p><code class="docutils literal notranslate"><span class="pre"><min></span></code> and the optional <code class="docutils literal notranslate"><span class="pre"><max></span></code> are each CMake versions of the form
|
| 89 |
+
<code class="docutils literal notranslate"><span class="pre">major.minor[.patch[.tweak]]</span></code>, and the <code class="docutils literal notranslate"><span class="pre">...</span></code> is literal. The <code class="docutils literal notranslate"><span class="pre"><min></span></code>
|
| 90 |
+
version must be at least <code class="docutils literal notranslate"><span class="pre">2.4</span></code> and at most the running version of CMake.
|
| 91 |
+
The <code class="docutils literal notranslate"><span class="pre"><max></span></code> version, if specified, must be at least the <code class="docutils literal notranslate"><span class="pre"><min></span></code> version
|
| 92 |
+
but may exceed the running version of CMake. If the running version of
|
| 93 |
+
CMake is older than 3.12, the extra <code class="docutils literal notranslate"><span class="pre">...</span></code> dots will be seen as version
|
| 94 |
+
component separators, resulting in the <code class="docutils literal notranslate"><span class="pre">...<max></span></code> part being ignored and
|
| 95 |
+
preserving the pre-3.12 behavior of basing policies on <code class="docutils literal notranslate"><span class="pre"><min></span></code>.</p>
|
| 96 |
+
<p>This specifies that the current CMake code is written for the given
|
| 97 |
+
range of CMake versions. All policies known to the running version of CMake
|
| 98 |
+
and introduced in the <code class="docutils literal notranslate"><span class="pre"><min></span></code> (or <code class="docutils literal notranslate"><span class="pre"><max></span></code>, if specified) version
|
| 99 |
+
or earlier will be set to use <code class="docutils literal notranslate"><span class="pre">NEW</span></code> behavior. All policies
|
| 100 |
+
introduced in later versions will be unset (unless the
|
| 101 |
+
<span class="target" id="index-0-variable:CMAKE_POLICY_DEFAULT_CMP<NNNN>"></span><a class="reference internal" href="../variable/CMAKE_POLICY_DEFAULT_CMPNNNN.html#variable:CMAKE_POLICY_DEFAULT_CMP<NNNN>" title="CMAKE_POLICY_DEFAULT_CMP<NNNN>"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_POLICY_DEFAULT_CMP<NNNN></span></code></a> variable sets a default).
|
| 102 |
+
This effectively requests behavior preferred as of a given CMake
|
| 103 |
+
version and tells newer CMake versions to warn about their new policies.</p>
|
| 104 |
+
<p>Note that the <span class="target" id="index-0-command:cmake_minimum_required"></span><a class="reference internal" href="cmake_minimum_required.html#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a>
|
| 105 |
+
command implicitly calls <code class="docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code> too.</p>
|
| 106 |
+
<div class="versionchanged">
|
| 107 |
+
<p><span class="versionmodified changed">Changed in version 3.31: </span>Compatibility with versions of CMake older than 3.10 is deprecated.
|
| 108 |
+
Calls to <span class="target" id="index-1-command:cmake_minimum_required"></span><a class="reference internal" href="cmake_minimum_required.html#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a> or
|
| 109 |
+
<span class="target" id="index-0-command:cmake_policy"></span><a class="reference internal" href="#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a> that do not specify at least
|
| 110 |
+
3.10 as their policy version (optionally via <code class="docutils literal notranslate"><span class="pre">...<max></span></code>)
|
| 111 |
+
will produce a deprecation warning in CMake 3.31 and above.</p>
|
| 112 |
+
</div>
|
| 113 |
+
<div class="versionchanged">
|
| 114 |
+
<p><span class="versionmodified changed">Changed in version 3.27: </span>Compatibility with versions of CMake older than 3.5 is deprecated.
|
| 115 |
+
Calls to <span class="target" id="index-2-command:cmake_minimum_required"></span><a class="reference internal" href="cmake_minimum_required.html#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a> or
|
| 116 |
+
<span class="target" id="index-1-command:cmake_policy"></span><a class="reference internal" href="#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a> that do not specify at least
|
| 117 |
+
3.5 as their policy version (optionally via <code class="docutils literal notranslate"><span class="pre">...<max></span></code>)
|
| 118 |
+
will produce a deprecation warning in CMake 3.27 and above.</p>
|
| 119 |
+
</div>
|
| 120 |
+
<div class="versionchanged">
|
| 121 |
+
<p><span class="versionmodified changed">Changed in version 3.19: </span>Compatibility with versions of CMake older than 2.8.12 is deprecated.
|
| 122 |
+
Calls to <span class="target" id="index-3-command:cmake_minimum_required"></span><a class="reference internal" href="cmake_minimum_required.html#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a> or
|
| 123 |
+
<span class="target" id="index-2-command:cmake_policy"></span><a class="reference internal" href="#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a> that do not specify at least
|
| 124 |
+
2.8.12 as their policy version (optionally via <code class="docutils literal notranslate"><span class="pre">...<max></span></code>)
|
| 125 |
+
will produce a deprecation warning in CMake 3.19 and above.</p>
|
| 126 |
+
</div>
|
| 127 |
+
</section>
|
| 128 |
+
<section id="setting-policies-explicitly">
|
| 129 |
+
<h2>Setting Policies Explicitly<a class="headerlink" href="#setting-policies-explicitly" title="Link to this heading">¶</a></h2>
|
| 130 |
+
<dl class="cmake signature">
|
| 131 |
+
<dt class="sig sig-object cmake" id="set">
|
| 132 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_policy(</span></span><span class="no"><span class="pre">SET</span></span><span class="w"> </span><span class="no"><span class="pre">CMP</span></span><span class="nv"><span class="pre"><NNNN></span></span><span class="w"> </span><span class="no"><span class="pre">NEW</span></span><span class="p"><span class="pre">|</span></span><span class="no"><span class="pre">OLD</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#set" title="Link to this definition">¶</a></dt>
|
| 133 |
+
<dd></dd></dl>
|
| 134 |
+
|
| 135 |
+
<p>Tell CMake to use the <code class="docutils literal notranslate"><span class="pre">OLD</span></code> or <code class="docutils literal notranslate"><span class="pre">NEW</span></code> behavior for a given policy.
|
| 136 |
+
Projects depending on the old behavior of a given policy may silence a
|
| 137 |
+
policy warning by setting the policy state to <code class="docutils literal notranslate"><span class="pre">OLD</span></code>. Alternatively
|
| 138 |
+
one may fix the project to work with the new behavior and set the
|
| 139 |
+
policy state to <code class="docutils literal notranslate"><span class="pre">NEW</span></code>.</p>
|
| 140 |
+
<div class="admonition note">
|
| 141 |
+
<p class="admonition-title">Note</p>
|
| 142 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">OLD</span></code> behavior of a policy is
|
| 143 |
+
<span class="target" id="index-1-manual:cmake-policies(7)"></span><a class="reference internal" href="../manual/cmake-policies.7.html#manual:cmake-policies(7)" title="cmake-policies(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">deprecated</span> <span class="pre">by</span> <span class="pre">definition</span></code></a>
|
| 144 |
+
and may be removed in a future version of CMake.</p>
|
| 145 |
+
</div>
|
| 146 |
+
</section>
|
| 147 |
+
<section id="checking-policy-settings">
|
| 148 |
+
<h2>Checking Policy Settings<a class="headerlink" href="#checking-policy-settings" title="Link to this heading">¶</a></h2>
|
| 149 |
+
<dl class="cmake signature">
|
| 150 |
+
<dt class="sig sig-object cmake" id="get">
|
| 151 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_policy(</span></span><span class="no"><span class="pre">GET</span></span><span class="w"> </span><span class="no"><span class="pre">CMP</span></span><span class="nv"><span class="pre"><NNNN></span></span><span class="w"> </span><span class="nv"><span class="pre"><variable></span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#get" title="Link to this definition">¶</a></dt>
|
| 152 |
+
<dd></dd></dl>
|
| 153 |
+
|
| 154 |
+
<p>Check whether a given policy is set to <code class="docutils literal notranslate"><span class="pre">OLD</span></code> or <code class="docutils literal notranslate"><span class="pre">NEW</span></code> behavior.
|
| 155 |
+
The output <code class="docutils literal notranslate"><span class="pre"><variable></span></code> value will be <code class="docutils literal notranslate"><span class="pre">OLD</span></code> or <code class="docutils literal notranslate"><span class="pre">NEW</span></code> if the
|
| 156 |
+
policy is set, and empty otherwise.</p>
|
| 157 |
+
</section>
|
| 158 |
+
<section id="cmake-policy-stack">
|
| 159 |
+
<h2>CMake Policy Stack<a class="headerlink" href="#cmake-policy-stack" title="Link to this heading">¶</a></h2>
|
| 160 |
+
<p>CMake keeps policy settings on a stack, so changes made by the
|
| 161 |
+
<code class="docutils literal notranslate"><span class="pre">cmake_policy</span></code> command affect only the top of the stack. A new entry on
|
| 162 |
+
the policy stack is managed automatically for each subdirectory to
|
| 163 |
+
protect its parents and siblings. CMake also manages a new entry for
|
| 164 |
+
scripts loaded by <span class="target" id="index-0-command:include"></span><a class="reference internal" href="include.html#command:include" title="include"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">include()</span></code></a> and <span class="target" id="index-0-command:find_package"></span><a class="reference internal" href="find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package()</span></code></a> commands
|
| 165 |
+
except when invoked with the <code class="docutils literal notranslate"><span class="pre">NO_POLICY_SCOPE</span></code> option
|
| 166 |
+
(see also policy <span class="target" id="index-0-policy:CMP0011"></span><a class="reference internal" href="../policy/CMP0011.html#policy:CMP0011" title="CMP0011"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0011</span></code></a>).
|
| 167 |
+
The <code class="docutils literal notranslate"><span class="pre">cmake_policy</span></code> command provides an interface to manage custom
|
| 168 |
+
entries on the policy stack:</p>
|
| 169 |
+
<dl class="cmake signature">
|
| 170 |
+
<dt class="sig sig-object cmake" id="push">
|
| 171 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_policy(</span></span><span class="no"><span class="pre">PUSH</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#push" title="Link to this definition">¶</a></dt>
|
| 172 |
+
<dd><p>Create a new entry on the policy stack.</p>
|
| 173 |
+
</dd></dl>
|
| 174 |
+
|
| 175 |
+
<dl class="cmake signature">
|
| 176 |
+
<dt class="sig sig-object cmake" id="pop">
|
| 177 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">cmake_policy(</span></span><span class="no"><span class="pre">POP</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#pop" title="Link to this definition">¶</a></dt>
|
| 178 |
+
<dd><p>Remove the last policy stack entry created with <code class="docutils literal notranslate"><span class="pre">cmake_policy(PUSH)</span></code>.</p>
|
| 179 |
+
</dd></dl>
|
| 180 |
+
|
| 181 |
+
<p>Each <code class="docutils literal notranslate"><span class="pre">PUSH</span></code> must have a matching <code class="docutils literal notranslate"><span class="pre">POP</span></code> to erase any changes.
|
| 182 |
+
This is useful to make temporary changes to policy settings.
|
| 183 |
+
Calls to the <span class="target" id="index-4-command:cmake_minimum_required"></span><a class="reference internal" href="cmake_minimum_required.html#command:cmake_minimum_required" title="cmake_minimum_required(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required(VERSION)</span></code></a>,
|
| 184 |
+
<span class="target" id="index-3-command:cmake_policy"></span><a class="reference internal" href="#version" title="cmake_policy(version)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(VERSION)</span></code></a>, or <span class="target" id="index-4-command:cmake_policy"></span><a class="reference internal" href="#set" title="cmake_policy(set)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(SET)</span></code></a> commands
|
| 185 |
+
influence only the current top of the policy stack.</p>
|
| 186 |
+
<div class="versionadded">
|
| 187 |
+
<p><span class="versionmodified added">Added in version 3.25: </span>The <span class="target" id="index-0-command:block"></span><a class="reference internal" href="block.html#command:block" title="block(scope_for policies)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">block(SCOPE_FOR</span> <span class="pre">POLICIES)</span></code></a> command offers a more flexible
|
| 188 |
+
and more secure way to manage the policy stack. The pop action is done
|
| 189 |
+
automatically when leaving the block scope, so there is no need to
|
| 190 |
+
precede each <span class="target" id="index-0-command:return"></span><a class="reference internal" href="return.html#command:return" title="return"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">return()</span></code></a> with a call to <span class="target" id="index-5-command:cmake_policy"></span><a class="reference internal" href="#pop" title="cmake_policy(pop)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_policy(POP)</span></code></a>.</p>
|
| 191 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="c"># stack management with cmake_policy()</span>
|
| 192 |
+
<span class="nf">function(</span><span class="nb">my_func</span><span class="nf">)</span>
|
| 193 |
+
<span class="w"> </span><span class="nf">cmake_policy(</span><span class="no">PUSH</span><span class="nf">)</span>
|
| 194 |
+
<span class="w"> </span><span class="nf">cmake_policy(</span><span class="no">SET</span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 195 |
+
<span class="w"> </span><span class="nf">if</span> <span class="nf">(</span><span class="nv"><cond1></span><span class="nf">)</span>
|
| 196 |
+
<span class="w"> </span><span class="p">...</span>
|
| 197 |
+
<span class="w"> </span><span class="nf">cmake_policy(</span><span class="no">POP</span><span class="nf">)</span>
|
| 198 |
+
<span class="w"> </span><span class="nf">return()</span>
|
| 199 |
+
<span class="w"> </span><span class="nf">elseif(</span><span class="nv"><cond2></span><span class="nf">)</span>
|
| 200 |
+
<span class="w"> </span><span class="p">...</span>
|
| 201 |
+
<span class="w"> </span><span class="nf">cmake_policy(</span><span class="no">POP</span><span class="nf">)</span>
|
| 202 |
+
<span class="w"> </span><span class="nf">return()</span>
|
| 203 |
+
<span class="w"> </span><span class="nf">endif()</span>
|
| 204 |
+
<span class="w"> </span><span class="p">...</span>
|
| 205 |
+
<span class="w"> </span><span class="nf">cmake_policy(</span><span class="no">POP</span><span class="nf">)</span>
|
| 206 |
+
<span class="nf">endfunction()</span>
|
| 207 |
+
|
| 208 |
+
<span class="c"># stack management with block()/endblock()</span>
|
| 209 |
+
<span class="nf">function(</span><span class="nb">my_func</span><span class="nf">)</span>
|
| 210 |
+
<span class="w"> </span><span class="nf">block(</span><span class="no">SCOPE_FOR</span><span class="w"> </span><span class="no">POLICIES</span><span class="nf">)</span>
|
| 211 |
+
<span class="w"> </span><span class="nf">cmake_policy(</span><span class="no">SET</span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
|
| 212 |
+
<span class="w"> </span><span class="nf">if</span> <span class="nf">(</span><span class="nv"><cond1></span><span class="nf">)</span>
|
| 213 |
+
<span class="w"> </span><span class="p">...</span>
|
| 214 |
+
<span class="w"> </span><span class="nf">return()</span>
|
| 215 |
+
<span class="w"> </span><span class="nf">elseif(</span><span class="nv"><cond2></span><span class="nf">)</span>
|
| 216 |
+
<span class="w"> </span><span class="p">...</span>
|
| 217 |
+
<span class="w"> </span><span class="nf">return()</span>
|
| 218 |
+
<span class="w"> </span><span class="nf">endif()</span>
|
| 219 |
+
<span class="w"> </span><span class="p">...</span>
|
| 220 |
+
<span class="w"> </span><span class="nf">endblock()</span>
|
| 221 |
+
<span class="nf">endfunction()</span>
|
| 222 |
+
</pre></div>
|
| 223 |
+
</div>
|
| 224 |
+
</div>
|
| 225 |
+
<p>Commands created by the <span class="target" id="index-0-command:function"></span><a class="reference internal" href="function.html#command:function" title="function"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">function()</span></code></a> and <span class="target" id="index-0-command:macro"></span><a class="reference internal" href="macro.html#command:macro" title="macro"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">macro()</span></code></a>
|
| 226 |
+
commands record policy settings when they are created and
|
| 227 |
+
use the pre-record policies when they are invoked. If the function or
|
| 228 |
+
macro implementation sets policies, the changes automatically
|
| 229 |
+
propagate up through callers until they reach the closest nested
|
| 230 |
+
policy stack entry.</p>
|
| 231 |
+
</section>
|
| 232 |
+
<section id="see-also">
|
| 233 |
+
<h2>See Also<a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 234 |
+
<ul class="simple">
|
| 235 |
+
<li><p><span class="target" id="index-5-command:cmake_minimum_required"></span><a class="reference internal" href="cmake_minimum_required.html#command:cmake_minimum_required" title="cmake_minimum_required"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">cmake_minimum_required()</span></code></a></p></li>
|
| 236 |
+
</ul>
|
| 237 |
+
</section>
|
| 238 |
+
</section>
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
<div class="clearer"></div>
|
| 242 |
+
</div>
|
| 243 |
+
</div>
|
| 244 |
+
</div>
|
| 245 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 246 |
+
<div class="sphinxsidebarwrapper">
|
| 247 |
+
<div>
|
| 248 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 249 |
+
<ul>
|
| 250 |
+
<li><a class="reference internal" href="#">cmake_policy</a><ul>
|
| 251 |
+
<li><a class="reference internal" href="#setting-policies-by-cmake-version">Setting Policies by CMake Version</a></li>
|
| 252 |
+
<li><a class="reference internal" href="#setting-policies-explicitly">Setting Policies Explicitly</a></li>
|
| 253 |
+
<li><a class="reference internal" href="#checking-policy-settings">Checking Policy Settings</a></li>
|
| 254 |
+
<li><a class="reference internal" href="#cmake-policy-stack">CMake Policy Stack</a></li>
|
| 255 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 256 |
+
</ul>
|
| 257 |
+
</li>
|
| 258 |
+
</ul>
|
| 259 |
+
|
| 260 |
+
</div>
|
| 261 |
+
<div>
|
| 262 |
+
<h4>Previous topic</h4>
|
| 263 |
+
<p class="topless"><a href="cmake_pkg_config.html"
|
| 264 |
+
title="previous chapter">cmake_pkg_config</a></p>
|
| 265 |
+
</div>
|
| 266 |
+
<div>
|
| 267 |
+
<h4>Next topic</h4>
|
| 268 |
+
<p class="topless"><a href="configure_file.html"
|
| 269 |
+
title="next chapter">configure_file</a></p>
|
| 270 |
+
</div>
|
| 271 |
+
<div role="note" aria-label="source link">
|
| 272 |
+
<h3>This Page</h3>
|
| 273 |
+
<ul class="this-page-menu">
|
| 274 |
+
<li><a href="../_sources/command/cmake_policy.rst.txt"
|
| 275 |
+
rel="nofollow">Show Source</a></li>
|
| 276 |
+
</ul>
|
| 277 |
+
</div>
|
| 278 |
+
<search id="searchbox" style="display: none" role="search">
|
| 279 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 280 |
+
<div class="searchformwrapper">
|
| 281 |
+
<form class="search" action="../search.html" method="get">
|
| 282 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 283 |
+
<input type="submit" value="Go" />
|
| 284 |
+
</form>
|
| 285 |
+
</div>
|
| 286 |
+
</search>
|
| 287 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 288 |
+
</div>
|
| 289 |
+
</div>
|
| 290 |
+
<div class="clearer"></div>
|
| 291 |
+
</div>
|
| 292 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 293 |
+
<h3>Navigation</h3>
|
| 294 |
+
<ul>
|
| 295 |
+
<li class="right" style="margin-right: 10px">
|
| 296 |
+
<a href="../genindex.html" title="General Index"
|
| 297 |
+
>index</a></li>
|
| 298 |
+
<li class="right" >
|
| 299 |
+
<a href="configure_file.html" title="configure_file"
|
| 300 |
+
>next</a> |</li>
|
| 301 |
+
<li class="right" >
|
| 302 |
+
<a href="cmake_pkg_config.html" title="cmake_pkg_config"
|
| 303 |
+
>previous</a> |</li>
|
| 304 |
+
<li>
|
| 305 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 306 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 307 |
+
</li>
|
| 308 |
+
<li>
|
| 309 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 310 |
+
</li>
|
| 311 |
+
<li>
|
| 312 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 313 |
+
</li>
|
| 314 |
+
|
| 315 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 316 |
+
<li class="nav-item nav-item-this"><a href="">cmake_policy</a></li>
|
| 317 |
+
</ul>
|
| 318 |
+
</div>
|
| 319 |
+
|
| 320 |
+
<div class="footer" role="contentinfo">
|
| 321 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 322 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 323 |
+
</div>
|
| 324 |
+
</body>
|
| 325 |
+
</html>
|
cmake/doc/cmake/html/command/configure_file.html
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>configure_file — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="continue" href="continue.html" />
|
| 21 |
+
<link rel="prev" title="cmake_policy" href="cmake_policy.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="continue.html" title="continue"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_policy.html" title="cmake_policy"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">configure_file</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="configure-file">
|
| 60 |
+
<span id="command:configure_file"></span><h1><a class="toc-backref" href="#id1" role="doc-backlink">configure_file</a><a class="headerlink" href="#configure-file" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<nav class="contents" id="contents">
|
| 62 |
+
<p class="topic-title">Contents</p>
|
| 63 |
+
<ul class="simple">
|
| 64 |
+
<li><p><a class="reference internal" href="#configure-file" id="id1">configure_file</a></p>
|
| 65 |
+
<ul>
|
| 66 |
+
<li><p><a class="reference internal" href="#options" id="id2">Options</a></p></li>
|
| 67 |
+
<li><p><a class="reference internal" href="#transformations" id="id3">Transformations</a></p></li>
|
| 68 |
+
<li><p><a class="reference internal" href="#example" id="id4">Example</a></p></li>
|
| 69 |
+
<li><p><a class="reference internal" href="#see-also" id="id5">See Also</a></p></li>
|
| 70 |
+
</ul>
|
| 71 |
+
</li>
|
| 72 |
+
</ul>
|
| 73 |
+
</nav>
|
| 74 |
+
<p>Copy a file to another location and modify its contents.</p>
|
| 75 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">configure_file(</span><span class="nv"><input></span><span class="w"> </span><span class="nv"><output></span>
|
| 76 |
+
<span class="w"> </span><span class="p">[</span><span class="no">NO_SOURCE_PERMISSIONS</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="no">USE_SOURCE_PERMISSIONS</span><span class="w"> </span><span class="p">|</span>
|
| 77 |
+
<span class="w"> </span><span class="no">FILE_PERMISSIONS</span><span class="w"> </span><span class="nv"><permissions>...</span><span class="p">]</span>
|
| 78 |
+
<span class="w"> </span><span class="p">[</span><span class="no">COPYONLY</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">ESCAPE_QUOTES</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">@ONLY</span><span class="p">]</span>
|
| 79 |
+
<span class="w"> </span><span class="p">[</span><span class="no">NEWLINE_STYLE</span><span class="w"> </span><span class="p">[</span><span class="no">UNIX</span><span class="p">|</span><span class="no">DOS</span><span class="p">|</span><span class="no">WIN32</span><span class="p">|</span><span class="no">LF</span><span class="p">|</span><span class="no">CRLF</span><span class="p">]</span><span class="w"> </span><span class="p">]</span><span class="nf">)</span>
|
| 80 |
+
</pre></div>
|
| 81 |
+
</div>
|
| 82 |
+
<p>Copies an <code class="docutils literal notranslate"><span class="pre"><input></span></code> file to an <code class="docutils literal notranslate"><span class="pre"><output></span></code> file while performing
|
| 83 |
+
<a class="reference internal" href="#transformations">transformations</a> of the input file content.</p>
|
| 84 |
+
<p>If the input file is modified the build system will re-run CMake to
|
| 85 |
+
re-configure the file and generate the build system again.
|
| 86 |
+
The generated file is modified and its timestamp updated on subsequent
|
| 87 |
+
cmake runs only if its content is changed.</p>
|
| 88 |
+
<section id="options">
|
| 89 |
+
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Options</a><a class="headerlink" href="#options" title="Link to this heading">¶</a></h2>
|
| 90 |
+
<p>The options are:</p>
|
| 91 |
+
<dl>
|
| 92 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><input></span></code></dt><dd><p>Path to the input file. A relative path is treated with respect to
|
| 93 |
+
the value of <span class="target" id="index-0-variable:CMAKE_CURRENT_SOURCE_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_SOURCE_DIR.html#variable:CMAKE_CURRENT_SOURCE_DIR" title="CMAKE_CURRENT_SOURCE_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_SOURCE_DIR</span></code></a>. The input path
|
| 94 |
+
must be a file, not a directory.</p>
|
| 95 |
+
</dd>
|
| 96 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><output></span></code></dt><dd><p>Path to the output file or directory. A relative path is treated
|
| 97 |
+
with respect to the value of <span class="target" id="index-0-variable:CMAKE_CURRENT_BINARY_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_BINARY_DIR.html#variable:CMAKE_CURRENT_BINARY_DIR" title="CMAKE_CURRENT_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_BINARY_DIR</span></code></a>.
|
| 98 |
+
If the path names an existing directory the output file is placed
|
| 99 |
+
in that directory with the same file name as the input file.
|
| 100 |
+
If the path contains non-existent directories, they are created.</p>
|
| 101 |
+
</dd>
|
| 102 |
+
<dt><code class="docutils literal notranslate"><span class="pre">NO_SOURCE_PERMISSIONS</span></code></dt><dd><div class="versionadded">
|
| 103 |
+
<p><span class="versionmodified added">Added in version 3.19.</span></p>
|
| 104 |
+
</div>
|
| 105 |
+
<p>Do not transfer the permissions of the input file to the output file.
|
| 106 |
+
The copied file permissions default to the standard 644 value
|
| 107 |
+
(-rw-r--r--).</p>
|
| 108 |
+
</dd>
|
| 109 |
+
<dt><code class="docutils literal notranslate"><span class="pre">USE_SOURCE_PERMISSIONS</span></code></dt><dd><div class="versionadded">
|
| 110 |
+
<p><span class="versionmodified added">Added in version 3.20.</span></p>
|
| 111 |
+
</div>
|
| 112 |
+
<p>Transfer the permissions of the input file to the output file.
|
| 113 |
+
This is already the default behavior if none of the three permissions-related
|
| 114 |
+
keywords are given (<code class="docutils literal notranslate"><span class="pre">NO_SOURCE_PERMISSIONS</span></code>, <code class="docutils literal notranslate"><span class="pre">USE_SOURCE_PERMISSIONS</span></code>
|
| 115 |
+
or <code class="docutils literal notranslate"><span class="pre">FILE_PERMISSIONS</span></code>). The <code class="docutils literal notranslate"><span class="pre">USE_SOURCE_PERMISSIONS</span></code> keyword mostly
|
| 116 |
+
serves as a way of making the intended behavior clearer at the call site.</p>
|
| 117 |
+
</dd>
|
| 118 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FILE_PERMISSIONS</span> <span class="pre"><permissions>...</span></code></dt><dd><div class="versionadded">
|
| 119 |
+
<p><span class="versionmodified added">Added in version 3.20.</span></p>
|
| 120 |
+
</div>
|
| 121 |
+
<p>Ignore the input file's permissions and use the specified <code class="docutils literal notranslate"><span class="pre"><permissions></span></code>
|
| 122 |
+
for the output file instead.</p>
|
| 123 |
+
</dd>
|
| 124 |
+
<dt><code class="docutils literal notranslate"><span class="pre">COPYONLY</span></code></dt><dd><p>Copy the file without replacing any variable references or other
|
| 125 |
+
content. This option may not be used with <code class="docutils literal notranslate"><span class="pre">NEWLINE_STYLE</span></code>.</p>
|
| 126 |
+
</dd>
|
| 127 |
+
<dt><code class="docutils literal notranslate"><span class="pre">ESCAPE_QUOTES</span></code></dt><dd><p>Escape any substituted quotes with backslashes (C-style).</p>
|
| 128 |
+
</dd>
|
| 129 |
+
<dt><code class="docutils literal notranslate"><span class="pre">@ONLY</span></code></dt><dd><p>Restrict variable replacement to references of the form <code class="docutils literal notranslate"><span class="pre">@VAR@</span></code>.
|
| 130 |
+
This is useful for configuring scripts that use <code class="docutils literal notranslate"><span class="pre">${VAR}</span></code> syntax.</p>
|
| 131 |
+
</dd>
|
| 132 |
+
<dt><code class="docutils literal notranslate"><span class="pre">NEWLINE_STYLE</span> <span class="pre"><style></span></code></dt><dd><p>Specify the newline style for the output file. Specify
|
| 133 |
+
<code class="docutils literal notranslate"><span class="pre">UNIX</span></code> or <code class="docutils literal notranslate"><span class="pre">LF</span></code> for <code class="docutils literal notranslate"><span class="pre">\n</span></code> newlines, or specify
|
| 134 |
+
<code class="docutils literal notranslate"><span class="pre">DOS</span></code>, <code class="docutils literal notranslate"><span class="pre">WIN32</span></code>, or <code class="docutils literal notranslate"><span class="pre">CRLF</span></code> for <code class="docutils literal notranslate"><span class="pre">\r\n</span></code> newlines.
|
| 135 |
+
This option may not be used with <code class="docutils literal notranslate"><span class="pre">COPYONLY</span></code>.</p>
|
| 136 |
+
</dd>
|
| 137 |
+
</dl>
|
| 138 |
+
</section>
|
| 139 |
+
<section id="transformations">
|
| 140 |
+
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Transformations</a><a class="headerlink" href="#transformations" title="Link to this heading">¶</a></h2>
|
| 141 |
+
<p><a class="reference internal" href="../manual/cmake-language.7.html#cmake-language-variables"><span class="std std-ref">Variables</span></a> referenced in the input
|
| 142 |
+
file content as <code class="docutils literal notranslate"><span class="pre">@VAR@</span></code>, <code class="docutils literal notranslate"><span class="pre">${VAR}</span></code>, <code class="docutils literal notranslate"><span class="pre">$CACHE{VAR}</span></code>, and
|
| 143 |
+
<a class="reference internal" href="../manual/cmake-language.7.html#cmake-language-environment-variables"><span class="std std-ref">environment variables</span></a>
|
| 144 |
+
referenced as <code class="docutils literal notranslate"><span class="pre">$ENV{VAR}</span></code>, will each be replaced with the current value
|
| 145 |
+
of the variable, or the empty string if the variable is not defined.
|
| 146 |
+
Furthermore, input lines of the form</p>
|
| 147 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#cmakedefine VAR ...</span>
|
| 148 |
+
</pre></div>
|
| 149 |
+
</div>
|
| 150 |
+
<p>will be replaced with either</p>
|
| 151 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define VAR ...</span>
|
| 152 |
+
</pre></div>
|
| 153 |
+
</div>
|
| 154 |
+
<p>or</p>
|
| 155 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cm">/* #undef VAR */</span>
|
| 156 |
+
</pre></div>
|
| 157 |
+
</div>
|
| 158 |
+
<p>depending on whether <code class="docutils literal notranslate"><span class="pre">VAR</span></code> is set in CMake to any value not considered
|
| 159 |
+
a false constant by the <span class="target" id="index-0-command:if"></span><a class="reference internal" href="if.html#command:if" title="if"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">if()</span></code></a> command. The "..." content on the
|
| 160 |
+
line after the variable name, if any, is processed as above.</p>
|
| 161 |
+
<p>Unlike lines of the form <code class="docutils literal notranslate"><span class="pre">#cmakedefine</span> <span class="pre">VAR</span> <span class="pre">...</span></code>, in lines of the form
|
| 162 |
+
<code class="docutils literal notranslate"><span class="pre">#cmakedefine01</span> <span class="pre">VAR</span></code>, <code class="docutils literal notranslate"><span class="pre">VAR</span></code> itself will expand to <code class="docutils literal notranslate"><span class="pre">VAR</span> <span class="pre">0</span></code> or <code class="docutils literal notranslate"><span class="pre">VAR</span> <span class="pre">1</span></code>
|
| 163 |
+
rather than being assigned the value <code class="docutils literal notranslate"><span class="pre">...</span></code>. Therefore, input lines of the form</p>
|
| 164 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#cmakedefine01 VAR</span>
|
| 165 |
+
</pre></div>
|
| 166 |
+
</div>
|
| 167 |
+
<p>will be replaced with either</p>
|
| 168 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define VAR 0</span>
|
| 169 |
+
</pre></div>
|
| 170 |
+
</div>
|
| 171 |
+
<p>or</p>
|
| 172 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define VAR 1</span>
|
| 173 |
+
</pre></div>
|
| 174 |
+
</div>
|
| 175 |
+
<p>Input lines of the form <code class="docutils literal notranslate"><span class="pre">#cmakedefine01</span> <span class="pre">VAR</span> <span class="pre">...</span></code> will expand
|
| 176 |
+
as <code class="docutils literal notranslate"><span class="pre">#cmakedefine01</span> <span class="pre">VAR</span> <span class="pre">...</span> <span class="pre">0</span></code> or <code class="docutils literal notranslate"><span class="pre">#cmakedefine01</span> <span class="pre">VAR</span> <span class="pre">...</span> <span class="pre">1</span></code>,
|
| 177 |
+
which may lead to undefined behavior.</p>
|
| 178 |
+
<div class="versionadded">
|
| 179 |
+
<p><span class="versionmodified added">Added in version 3.10: </span>The result lines (with the exception of the <code class="docutils literal notranslate"><span class="pre">#undef</span></code> comments) can be
|
| 180 |
+
indented using spaces and/or tabs between the <code class="docutils literal notranslate"><span class="pre">#</span></code> character
|
| 181 |
+
and the <code class="docutils literal notranslate"><span class="pre">cmakedefine</span></code> or <code class="docutils literal notranslate"><span class="pre">cmakedefine01</span></code> words. This whitespace
|
| 182 |
+
indentation will be preserved in the output lines:</p>
|
| 183 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp"># cmakedefine VAR</span>
|
| 184 |
+
<span class="cp"># cmakedefine01 VAR</span>
|
| 185 |
+
</pre></div>
|
| 186 |
+
</div>
|
| 187 |
+
<p>will be replaced, if <code class="docutils literal notranslate"><span class="pre">VAR</span></code> is defined, with</p>
|
| 188 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp"># define VAR</span>
|
| 189 |
+
<span class="cp"># define VAR 1</span>
|
| 190 |
+
</pre></div>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
</section>
|
| 194 |
+
<section id="example">
|
| 195 |
+
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Example</a><a class="headerlink" href="#example" title="Link to this heading">¶</a></h2>
|
| 196 |
+
<p>Consider a source tree containing a <code class="docutils literal notranslate"><span class="pre">foo.h.in</span></code> file:</p>
|
| 197 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#cmakedefine FOO_ENABLE</span>
|
| 198 |
+
<span class="cp">#cmakedefine FOO_STRING "@FOO_STRING@"</span>
|
| 199 |
+
</pre></div>
|
| 200 |
+
</div>
|
| 201 |
+
<p>An adjacent <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> may use <code class="docutils literal notranslate"><span class="pre">configure_file</span></code> to
|
| 202 |
+
configure the header:</p>
|
| 203 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">option(</span><span class="no">FOO_ENABLE</span><span class="w"> </span><span class="s">"Enable Foo"</span><span class="w"> </span><span class="no">ON</span><span class="nf">)</span>
|
| 204 |
+
<span class="nf">if(</span><span class="no">FOO_ENABLE</span><span class="nf">)</span>
|
| 205 |
+
<span class="w"> </span><span class="nf">set(</span><span class="no">FOO_STRING</span><span class="w"> </span><span class="s">"foo"</span><span class="nf">)</span>
|
| 206 |
+
<span class="nf">endif()</span>
|
| 207 |
+
<span class="nf">configure_file(</span><span class="nb">foo.h.in</span><span class="w"> </span><span class="nb">foo.h</span><span class="w"> </span><span class="no">@ONLY</span><span class="nf">)</span>
|
| 208 |
+
</pre></div>
|
| 209 |
+
</div>
|
| 210 |
+
<p>This creates a <code class="docutils literal notranslate"><span class="pre">foo.h</span></code> in the build directory corresponding to
|
| 211 |
+
this source directory. If the <code class="docutils literal notranslate"><span class="pre">FOO_ENABLE</span></code> option is on, the
|
| 212 |
+
configured file will contain:</p>
|
| 213 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cp">#define FOO_ENABLE</span>
|
| 214 |
+
<span class="cp">#define FOO_STRING "foo"</span>
|
| 215 |
+
</pre></div>
|
| 216 |
+
</div>
|
| 217 |
+
<p>Otherwise it will contain:</p>
|
| 218 |
+
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="cm">/* #undef FOO_ENABLE */</span>
|
| 219 |
+
<span class="cm">/* #undef FOO_STRING */</span>
|
| 220 |
+
</pre></div>
|
| 221 |
+
</div>
|
| 222 |
+
<p>One may then use the <span class="target" id="index-0-command:target_include_directories"></span><a class="reference internal" href="target_include_directories.html#command:target_include_directories" title="target_include_directories"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">target_include_directories()</span></code></a> command to
|
| 223 |
+
specify the output directory as an include directory:</p>
|
| 224 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">target_include_directories(</span><span class="nv"><target></span><span class="w"> </span><span class="p">[</span><span class="no">SYSTEM</span><span class="p">]</span><span class="w"> </span><span class="o"><</span><span class="no">INTERFACE</span><span class="p">|</span><span class="no">PUBLIC</span><span class="p">|</span><span class="no">PRIVATE</span><span class="o">></span><span class="w"> </span><span class="s">"${CMAKE_CURRENT_BINARY_DIR}"</span><span class="nf">)</span>
|
| 225 |
+
</pre></div>
|
| 226 |
+
</div>
|
| 227 |
+
<p>so that sources may include the header as <code class="docutils literal notranslate"><span class="pre">#include</span> <span class="pre"><foo.h></span></code>.</p>
|
| 228 |
+
</section>
|
| 229 |
+
<section id="see-also">
|
| 230 |
+
<h2><a class="toc-backref" href="#id5" role="doc-backlink">See Also</a><a class="headerlink" href="#see-also" title="Link to this heading">¶</a></h2>
|
| 231 |
+
<ul class="simple">
|
| 232 |
+
<li><p><span class="target" id="index-0-command:file"></span><a class="reference internal" href="file.html#generate" title="file(generate)"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">file(GENERATE)</span></code></a></p></li>
|
| 233 |
+
</ul>
|
| 234 |
+
</section>
|
| 235 |
+
</section>
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
<div class="clearer"></div>
|
| 239 |
+
</div>
|
| 240 |
+
</div>
|
| 241 |
+
</div>
|
| 242 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 243 |
+
<div class="sphinxsidebarwrapper">
|
| 244 |
+
<div>
|
| 245 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 246 |
+
<ul>
|
| 247 |
+
<li><a class="reference internal" href="#">configure_file</a><ul>
|
| 248 |
+
<li><a class="reference internal" href="#options">Options</a></li>
|
| 249 |
+
<li><a class="reference internal" href="#transformations">Transformations</a></li>
|
| 250 |
+
<li><a class="reference internal" href="#example">Example</a></li>
|
| 251 |
+
<li><a class="reference internal" href="#see-also">See Also</a></li>
|
| 252 |
+
</ul>
|
| 253 |
+
</li>
|
| 254 |
+
</ul>
|
| 255 |
+
|
| 256 |
+
</div>
|
| 257 |
+
<div>
|
| 258 |
+
<h4>Previous topic</h4>
|
| 259 |
+
<p class="topless"><a href="cmake_policy.html"
|
| 260 |
+
title="previous chapter">cmake_policy</a></p>
|
| 261 |
+
</div>
|
| 262 |
+
<div>
|
| 263 |
+
<h4>Next topic</h4>
|
| 264 |
+
<p class="topless"><a href="continue.html"
|
| 265 |
+
title="next chapter">continue</a></p>
|
| 266 |
+
</div>
|
| 267 |
+
<div role="note" aria-label="source link">
|
| 268 |
+
<h3>This Page</h3>
|
| 269 |
+
<ul class="this-page-menu">
|
| 270 |
+
<li><a href="../_sources/command/configure_file.rst.txt"
|
| 271 |
+
rel="nofollow">Show Source</a></li>
|
| 272 |
+
</ul>
|
| 273 |
+
</div>
|
| 274 |
+
<search id="searchbox" style="display: none" role="search">
|
| 275 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 276 |
+
<div class="searchformwrapper">
|
| 277 |
+
<form class="search" action="../search.html" method="get">
|
| 278 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 279 |
+
<input type="submit" value="Go" />
|
| 280 |
+
</form>
|
| 281 |
+
</div>
|
| 282 |
+
</search>
|
| 283 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 284 |
+
</div>
|
| 285 |
+
</div>
|
| 286 |
+
<div class="clearer"></div>
|
| 287 |
+
</div>
|
| 288 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 289 |
+
<h3>Navigation</h3>
|
| 290 |
+
<ul>
|
| 291 |
+
<li class="right" style="margin-right: 10px">
|
| 292 |
+
<a href="../genindex.html" title="General Index"
|
| 293 |
+
>index</a></li>
|
| 294 |
+
<li class="right" >
|
| 295 |
+
<a href="continue.html" title="continue"
|
| 296 |
+
>next</a> |</li>
|
| 297 |
+
<li class="right" >
|
| 298 |
+
<a href="cmake_policy.html" title="cmake_policy"
|
| 299 |
+
>previous</a> |</li>
|
| 300 |
+
<li>
|
| 301 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 302 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 303 |
+
</li>
|
| 304 |
+
<li>
|
| 305 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 306 |
+
</li>
|
| 307 |
+
<li>
|
| 308 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 309 |
+
</li>
|
| 310 |
+
|
| 311 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 312 |
+
<li class="nav-item nav-item-this"><a href="">configure_file</a></li>
|
| 313 |
+
</ul>
|
| 314 |
+
</div>
|
| 315 |
+
|
| 316 |
+
<div class="footer" role="contentinfo">
|
| 317 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 318 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 319 |
+
</div>
|
| 320 |
+
</body>
|
| 321 |
+
</html>
|
cmake/doc/cmake/html/command/continue.html
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>continue — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="else" href="else.html" />
|
| 21 |
+
<link rel="prev" title="configure_file" href="configure_file.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="else.html" title="else"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="configure_file.html" title="configure_file"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">continue</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="continue">
|
| 60 |
+
<span id="command:continue"></span><h1>continue<a class="headerlink" href="#continue" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<div class="versionadded">
|
| 62 |
+
<p><span class="versionmodified added">Added in version 3.2.</span></p>
|
| 63 |
+
</div>
|
| 64 |
+
<p>Continue to the top of enclosing foreach or while loop.</p>
|
| 65 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">continue()</span>
|
| 66 |
+
</pre></div>
|
| 67 |
+
</div>
|
| 68 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">continue()</span></code> command allows a cmake script to abort the rest of the
|
| 69 |
+
current iteration of a <span class="target" id="index-0-command:foreach"></span><a class="reference internal" href="foreach.html#command:foreach" title="foreach"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">foreach()</span></code></a> or <span class="target" id="index-0-command:while"></span><a class="reference internal" href="while.html#command:while" title="while"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">while()</span></code></a> loop, and start
|
| 70 |
+
at the top of the next iteration.</p>
|
| 71 |
+
<p>See also the <span class="target" id="index-0-command:break"></span><a class="reference internal" href="break.html#command:break" title="break"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">break()</span></code></a> command.</p>
|
| 72 |
+
</section>
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
<div class="clearer"></div>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 80 |
+
<div class="sphinxsidebarwrapper">
|
| 81 |
+
<div>
|
| 82 |
+
<h4>Previous topic</h4>
|
| 83 |
+
<p class="topless"><a href="configure_file.html"
|
| 84 |
+
title="previous chapter">configure_file</a></p>
|
| 85 |
+
</div>
|
| 86 |
+
<div>
|
| 87 |
+
<h4>Next topic</h4>
|
| 88 |
+
<p class="topless"><a href="else.html"
|
| 89 |
+
title="next chapter">else</a></p>
|
| 90 |
+
</div>
|
| 91 |
+
<div role="note" aria-label="source link">
|
| 92 |
+
<h3>This Page</h3>
|
| 93 |
+
<ul class="this-page-menu">
|
| 94 |
+
<li><a href="../_sources/command/continue.rst.txt"
|
| 95 |
+
rel="nofollow">Show Source</a></li>
|
| 96 |
+
</ul>
|
| 97 |
+
</div>
|
| 98 |
+
<search id="searchbox" style="display: none" role="search">
|
| 99 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 100 |
+
<div class="searchformwrapper">
|
| 101 |
+
<form class="search" action="../search.html" method="get">
|
| 102 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 103 |
+
<input type="submit" value="Go" />
|
| 104 |
+
</form>
|
| 105 |
+
</div>
|
| 106 |
+
</search>
|
| 107 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
<div class="clearer"></div>
|
| 111 |
+
</div>
|
| 112 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 113 |
+
<h3>Navigation</h3>
|
| 114 |
+
<ul>
|
| 115 |
+
<li class="right" style="margin-right: 10px">
|
| 116 |
+
<a href="../genindex.html" title="General Index"
|
| 117 |
+
>index</a></li>
|
| 118 |
+
<li class="right" >
|
| 119 |
+
<a href="else.html" title="else"
|
| 120 |
+
>next</a> |</li>
|
| 121 |
+
<li class="right" >
|
| 122 |
+
<a href="configure_file.html" title="configure_file"
|
| 123 |
+
>previous</a> |</li>
|
| 124 |
+
<li>
|
| 125 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 126 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 127 |
+
</li>
|
| 128 |
+
<li>
|
| 129 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 130 |
+
</li>
|
| 131 |
+
<li>
|
| 132 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 133 |
+
</li>
|
| 134 |
+
|
| 135 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 136 |
+
<li class="nav-item nav-item-this"><a href="">continue</a></li>
|
| 137 |
+
</ul>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<div class="footer" role="contentinfo">
|
| 141 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 142 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 143 |
+
</div>
|
| 144 |
+
</body>
|
| 145 |
+
</html>
|
cmake/doc/cmake/html/command/create_test_sourcelist.html
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>create_test_sourcelist — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="define_property" href="define_property.html" />
|
| 21 |
+
<link rel="prev" title="cmake_file_api" href="cmake_file_api.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="define_property.html" title="define_property"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="cmake_file_api.html" title="cmake_file_api"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">create_test_sourcelist</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="create-test-sourcelist">
|
| 60 |
+
<span id="command:create_test_sourcelist"></span><h1>create_test_sourcelist<a class="headerlink" href="#create-test-sourcelist" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Create a test driver program that links together many small tests into a
|
| 62 |
+
single executable. This is useful when building static executables with
|
| 63 |
+
large libraries to shrink the total required size.</p>
|
| 64 |
+
<dl class="cmake signature">
|
| 65 |
+
<dt class="sig sig-object cmake" id="original">
|
| 66 |
+
<span class="code cmake highlight sig-name descname"><span class="nf"><span class="pre">create_test_sourcelist(</span></span><span class="nv"><span class="pre"><sourceListName></span></span><span class="w"> </span><span class="nv"><span class="pre"><driverName></span></span><span class="w"> </span><span class="nv"><span class="pre"><test>...</span></span><span class="w"> </span><span class="nv"><span class="pre"><options>...</span></span><span class="nf"><span class="pre">)</span></span></span><a class="headerlink" href="#original" title="Link to this definition">¶</a></dt>
|
| 67 |
+
<dd><p>Generate a test driver source file from a list of individual test sources
|
| 68 |
+
and provide a combined list of sources that can be built as an executable.</p>
|
| 69 |
+
<p>The options are:</p>
|
| 70 |
+
<dl>
|
| 71 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><sourceListName></span></code></dt><dd><p>The name of a variable in which to store the list of source files needed
|
| 72 |
+
to build the test driver. The list will contain the <code class="docutils literal notranslate"><span class="pre"><test>...</span></code> sources
|
| 73 |
+
and the generated <code class="docutils literal notranslate"><span class="pre"><driverName></span></code> source.</p>
|
| 74 |
+
<div class="versionchanged">
|
| 75 |
+
<p><span class="versionmodified changed">Changed in version 3.29: </span>The test driver source is listed by absolute path in the build tree.
|
| 76 |
+
Previously it was listed only as <code class="docutils literal notranslate"><span class="pre"><driverName></span></code>.</p>
|
| 77 |
+
</div>
|
| 78 |
+
</dd>
|
| 79 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><driverName></span></code></dt><dd><p>Name of the test driver source file to be generated into the build tree.
|
| 80 |
+
The source file will contain a <code class="docutils literal notranslate"><span class="pre">main()</span></code> program entry point that
|
| 81 |
+
dispatches to whatever test is named on the command line.</p>
|
| 82 |
+
</dd>
|
| 83 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><test>...</span></code></dt><dd><p>Test source files to be added to the driver binary. Each test source
|
| 84 |
+
file must have a function in it that is the same name as the file with the
|
| 85 |
+
extension removed. For example, a <code class="docutils literal notranslate"><span class="pre">foo.cxx</span></code> test source might contain:</p>
|
| 86 |
+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">foo</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">argc</span><span class="p">,</span><span class="w"> </span><span class="kt">char</span><span class="o">**</span><span class="w"> </span><span class="n">argv</span><span class="p">)</span>
|
| 87 |
+
</pre></div>
|
| 88 |
+
</div>
|
| 89 |
+
</dd>
|
| 90 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXTRA_INCLUDE</span> <span class="pre"><header></span></code></dt><dd><p>Specify a header file to <code class="docutils literal notranslate"><span class="pre">#include</span></code> in the generated test driver source.</p>
|
| 91 |
+
</dd>
|
| 92 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FUNCTION</span> <span class="pre"><function></span></code></dt><dd><p>Specify a function to be called with pointers to <code class="docutils literal notranslate"><span class="pre">argc</span></code> and <code class="docutils literal notranslate"><span class="pre">argv</span></code>.
|
| 93 |
+
The function may be provided in the <code class="docutils literal notranslate"><span class="pre">EXTRA_INCLUDE</span></code> header:</p>
|
| 94 |
+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="n">function</span><span class="p">(</span><span class="kt">int</span><span class="o">*</span><span class="w"> </span><span class="n">pargc</span><span class="p">,</span><span class="w"> </span><span class="kt">char</span><span class="o">***</span><span class="w"> </span><span class="n">pargv</span><span class="p">)</span>
|
| 95 |
+
</pre></div>
|
| 96 |
+
</div>
|
| 97 |
+
<p>This can be used to add extra command line processing to each test.</p>
|
| 98 |
+
</dd>
|
| 99 |
+
</dl>
|
| 100 |
+
</dd></dl>
|
| 101 |
+
|
| 102 |
+
<p>Additionally, some CMake variables affect test driver generation:</p>
|
| 103 |
+
<dl class="cmake variable">
|
| 104 |
+
<dt class="sig sig-object cmake" id="variable:CMAKE_TESTDRIVER_BEFORE_TESTMAIN">
|
| 105 |
+
<span class="sig-name descname"><span class="pre">CMAKE_TESTDRIVER_BEFORE_TESTMAIN</span></span><a class="headerlink" href="#variable:CMAKE_TESTDRIVER_BEFORE_TESTMAIN" title="Link to this definition">¶</a></dt>
|
| 106 |
+
<dd><p>Code to be placed directly before calling each test's function.</p>
|
| 107 |
+
</dd></dl>
|
| 108 |
+
|
| 109 |
+
<dl class="cmake variable">
|
| 110 |
+
<dt class="sig sig-object cmake" id="variable:CMAKE_TESTDRIVER_AFTER_TESTMAIN">
|
| 111 |
+
<span class="sig-name descname"><span class="pre">CMAKE_TESTDRIVER_AFTER_TESTMAIN</span></span><a class="headerlink" href="#variable:CMAKE_TESTDRIVER_AFTER_TESTMAIN" title="Link to this definition">¶</a></dt>
|
| 112 |
+
<dd><p>Code to be placed directly after the call to each test's function.</p>
|
| 113 |
+
</dd></dl>
|
| 114 |
+
|
| 115 |
+
</section>
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
<div class="clearer"></div>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 123 |
+
<div class="sphinxsidebarwrapper">
|
| 124 |
+
<div>
|
| 125 |
+
<h4>Previous topic</h4>
|
| 126 |
+
<p class="topless"><a href="cmake_file_api.html"
|
| 127 |
+
title="previous chapter">cmake_file_api</a></p>
|
| 128 |
+
</div>
|
| 129 |
+
<div>
|
| 130 |
+
<h4>Next topic</h4>
|
| 131 |
+
<p class="topless"><a href="define_property.html"
|
| 132 |
+
title="next chapter">define_property</a></p>
|
| 133 |
+
</div>
|
| 134 |
+
<div role="note" aria-label="source link">
|
| 135 |
+
<h3>This Page</h3>
|
| 136 |
+
<ul class="this-page-menu">
|
| 137 |
+
<li><a href="../_sources/command/create_test_sourcelist.rst.txt"
|
| 138 |
+
rel="nofollow">Show Source</a></li>
|
| 139 |
+
</ul>
|
| 140 |
+
</div>
|
| 141 |
+
<search id="searchbox" style="display: none" role="search">
|
| 142 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 143 |
+
<div class="searchformwrapper">
|
| 144 |
+
<form class="search" action="../search.html" method="get">
|
| 145 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 146 |
+
<input type="submit" value="Go" />
|
| 147 |
+
</form>
|
| 148 |
+
</div>
|
| 149 |
+
</search>
|
| 150 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
<div class="clearer"></div>
|
| 154 |
+
</div>
|
| 155 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 156 |
+
<h3>Navigation</h3>
|
| 157 |
+
<ul>
|
| 158 |
+
<li class="right" style="margin-right: 10px">
|
| 159 |
+
<a href="../genindex.html" title="General Index"
|
| 160 |
+
>index</a></li>
|
| 161 |
+
<li class="right" >
|
| 162 |
+
<a href="define_property.html" title="define_property"
|
| 163 |
+
>next</a> |</li>
|
| 164 |
+
<li class="right" >
|
| 165 |
+
<a href="cmake_file_api.html" title="cmake_file_api"
|
| 166 |
+
>previous</a> |</li>
|
| 167 |
+
<li>
|
| 168 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 169 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 170 |
+
</li>
|
| 171 |
+
<li>
|
| 172 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 173 |
+
</li>
|
| 174 |
+
<li>
|
| 175 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 176 |
+
</li>
|
| 177 |
+
|
| 178 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 179 |
+
<li class="nav-item nav-item-this"><a href="">create_test_sourcelist</a></li>
|
| 180 |
+
</ul>
|
| 181 |
+
</div>
|
| 182 |
+
|
| 183 |
+
<div class="footer" role="contentinfo">
|
| 184 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 185 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 186 |
+
</div>
|
| 187 |
+
</body>
|
| 188 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_build.html
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_build — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_configure" href="ctest_configure.html" />
|
| 21 |
+
<link rel="prev" title="try_run" href="try_run.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_configure.html" title="ctest_configure"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="try_run.html" title="try_run"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_build</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-build">
|
| 60 |
+
<span id="command:ctest_build"></span><h1>ctest_build<a class="headerlink" href="#ctest-build" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Perform the <a class="reference internal" href="../manual/ctest.1.html#ctest-build-step"><span class="std std-ref">CTest Build Step</span></a> as a <a class="reference internal" href="../manual/ctest.1.html#dashboard-client"><span class="std std-ref">Dashboard Client</span></a>.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_build(</span><span class="p">[</span><span class="no">BUILD</span><span class="w"> </span><span class="nv"><build-dir></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">APPEND</span><span class="p">]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CONFIGURATION</span><span class="w"> </span><span class="nv"><config></span><span class="p">]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PARALLEL_LEVEL</span><span class="w"> </span><span class="nv"><parallel></span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">FLAGS</span><span class="w"> </span><span class="nv"><flags></span><span class="p">]</span>
|
| 66 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PROJECT_NAME</span><span class="w"> </span><span class="nv"><project-name></span><span class="p">]</span>
|
| 67 |
+
<span class="w"> </span><span class="p">[</span><span class="no">TARGET</span><span class="w"> </span><span class="nv"><target-name></span><span class="p">]</span>
|
| 68 |
+
<span class="w"> </span><span class="p">[</span><span class="no">NUMBER_ERRORS</span><span class="w"> </span><span class="nv"><num-err-var></span><span class="p">]</span>
|
| 69 |
+
<span class="w"> </span><span class="p">[</span><span class="no">NUMBER_WARNINGS</span><span class="w"> </span><span class="nv"><num-warn-var></span><span class="p">]</span>
|
| 70 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 71 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CAPTURE_CMAKE_ERROR</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 72 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 73 |
+
</pre></div>
|
| 74 |
+
</div>
|
| 75 |
+
<p>Build the project and store results in <code class="docutils literal notranslate"><span class="pre">Build.xml</span></code>
|
| 76 |
+
for submission with the <span class="target" id="index-0-command:ctest_submit"></span><a class="reference internal" href="ctest_submit.html#command:ctest_submit" title="ctest_submit"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_submit()</span></code></a> command.</p>
|
| 77 |
+
<p>The <span class="target" id="index-0-variable:CTEST_BUILD_COMMAND"></span><a class="reference internal" href="../variable/CTEST_BUILD_COMMAND.html#variable:CTEST_BUILD_COMMAND" title="CTEST_BUILD_COMMAND"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_BUILD_COMMAND</span></code></a> variable may be set to explicitly
|
| 78 |
+
specify the build command line. Otherwise the build command line is
|
| 79 |
+
computed automatically based on the options given.</p>
|
| 80 |
+
<p>The options are:</p>
|
| 81 |
+
<dl>
|
| 82 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BUILD</span> <span class="pre"><build-dir></span></code></dt><dd><p>Specify the top-level build directory. If not given, the
|
| 83 |
+
<span class="target" id="index-0-variable:CTEST_BINARY_DIRECTORY"></span><a class="reference internal" href="../variable/CTEST_BINARY_DIRECTORY.html#variable:CTEST_BINARY_DIRECTORY" title="CTEST_BINARY_DIRECTORY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_BINARY_DIRECTORY</span></code></a> variable is used.</p>
|
| 84 |
+
</dd>
|
| 85 |
+
<dt><code class="docutils literal notranslate"><span class="pre">APPEND</span></code></dt><dd><p>Mark <code class="docutils literal notranslate"><span class="pre">Build.xml</span></code> for append to results previously submitted to a
|
| 86 |
+
dashboard server since the last <span class="target" id="index-0-command:ctest_start"></span><a class="reference internal" href="ctest_start.html#command:ctest_start" title="ctest_start"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_start()</span></code></a> call.
|
| 87 |
+
Append semantics are defined by the dashboard server in use.
|
| 88 |
+
This does <em>not</em> cause results to be appended to a <code class="docutils literal notranslate"><span class="pre">.xml</span></code> file
|
| 89 |
+
produced by a previous call to this command.</p>
|
| 90 |
+
</dd>
|
| 91 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CONFIGURATION</span> <span class="pre"><config></span></code></dt><dd><p>Specify the build configuration (e.g. <code class="docutils literal notranslate"><span class="pre">Debug</span></code>). If not
|
| 92 |
+
specified the <code class="docutils literal notranslate"><span class="pre">CTEST_BUILD_CONFIGURATION</span></code> variable will be checked.
|
| 93 |
+
Otherwise the <a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-C"><code class="xref std std-option docutils literal notranslate"><span class="pre">-C</span> <span class="pre"><cfg></span></code></a> option given to the
|
| 94 |
+
<span class="target" id="index-0-manual:ctest(1)"></span><a class="reference internal" href="../manual/ctest.1.html#manual:ctest(1)" title="ctest(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">ctest(1)</span></code></a> command will be used, if any.</p>
|
| 95 |
+
</dd>
|
| 96 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PARALLEL_LEVEL</span> <span class="pre"><parallel></span></code></dt><dd><div class="versionadded">
|
| 97 |
+
<p><span class="versionmodified added">Added in version 3.21.</span></p>
|
| 98 |
+
</div>
|
| 99 |
+
<p>Specify the parallel level of the underlying build system. If not
|
| 100 |
+
specified, the <span class="target" id="index-0-envvar:CMAKE_BUILD_PARALLEL_LEVEL"></span><a class="reference internal" href="../envvar/CMAKE_BUILD_PARALLEL_LEVEL.html#envvar:CMAKE_BUILD_PARALLEL_LEVEL" title="CMAKE_BUILD_PARALLEL_LEVEL"><code class="xref cmake cmake-envvar docutils literal notranslate"><span class="pre">CMAKE_BUILD_PARALLEL_LEVEL</span></code></a> environment
|
| 101 |
+
variable will be checked.</p>
|
| 102 |
+
</dd>
|
| 103 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FLAGS</span> <span class="pre"><flags></span></code></dt><dd><p>Pass additional arguments to the underlying build command.
|
| 104 |
+
If not specified the <code class="docutils literal notranslate"><span class="pre">CTEST_BUILD_FLAGS</span></code> variable will be checked.
|
| 105 |
+
This can, e.g., be used to trigger a parallel build using the
|
| 106 |
+
<code class="docutils literal notranslate"><span class="pre">-j</span></code> option of <code class="docutils literal notranslate"><span class="pre">make</span></code>. See the <span class="target" id="index-0-module:ProcessorCount"></span><a class="reference internal" href="../module/ProcessorCount.html#module:ProcessorCount" title="ProcessorCount"><code class="xref cmake cmake-module docutils literal notranslate"><span class="pre">ProcessorCount</span></code></a> module
|
| 107 |
+
for an example.</p>
|
| 108 |
+
</dd>
|
| 109 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PROJECT_NAME</span> <span class="pre"><project-name></span></code></dt><dd><p>Ignored since CMake 3.0.</p>
|
| 110 |
+
<div class="versionchanged">
|
| 111 |
+
<p><span class="versionmodified changed">Changed in version 3.14: </span>This value is no longer required.</p>
|
| 112 |
+
</div>
|
| 113 |
+
</dd>
|
| 114 |
+
<dt><code class="docutils literal notranslate"><span class="pre">TARGET</span> <span class="pre"><target-name></span></code></dt><dd><p>Specify the name of a target to build. If not specified the
|
| 115 |
+
<code class="docutils literal notranslate"><span class="pre">CTEST_BUILD_TARGET</span></code> variable will be checked. Otherwise the
|
| 116 |
+
default target will be built. This is the "all" target
|
| 117 |
+
(called <code class="docutils literal notranslate"><span class="pre">ALL_BUILD</span></code> in <a class="reference internal" href="../manual/cmake-generators.7.html#visual-studio-generators"><span class="std std-ref">Visual Studio Generators</span></a>).</p>
|
| 118 |
+
</dd>
|
| 119 |
+
<dt><code class="docutils literal notranslate"><span class="pre">NUMBER_ERRORS</span> <span class="pre"><num-err-var></span></code></dt><dd><p>Store the number of build errors detected in the given variable.</p>
|
| 120 |
+
</dd>
|
| 121 |
+
<dt><code class="docutils literal notranslate"><span class="pre">NUMBER_WARNINGS</span> <span class="pre"><num-warn-var></span></code></dt><dd><p>Store the number of build warnings detected in the given variable.</p>
|
| 122 |
+
</dd>
|
| 123 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RETURN_VALUE</span> <span class="pre"><result-var></span></code></dt><dd><p>Store the return value of the native build tool in the given variable.</p>
|
| 124 |
+
</dd>
|
| 125 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CAPTURE_CMAKE_ERROR</span> <span class="pre"><result-var></span></code></dt><dd><div class="versionadded">
|
| 126 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 127 |
+
</div>
|
| 128 |
+
<p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable -1 if there are any errors running
|
| 129 |
+
the command and prevent ctest from returning non-zero if an error occurs.</p>
|
| 130 |
+
</dd>
|
| 131 |
+
<dt><code class="docutils literal notranslate"><span class="pre">QUIET</span></code></dt><dd><div class="versionadded">
|
| 132 |
+
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
| 133 |
+
</div>
|
| 134 |
+
<p>Suppress any CTest-specific non-error output that would have been
|
| 135 |
+
printed to the console otherwise. The summary of warnings / errors,
|
| 136 |
+
as well as the output from the native build tool is unaffected by
|
| 137 |
+
this option.</p>
|
| 138 |
+
</dd>
|
| 139 |
+
</dl>
|
| 140 |
+
</section>
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
<div class="clearer"></div>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 148 |
+
<div class="sphinxsidebarwrapper">
|
| 149 |
+
<div>
|
| 150 |
+
<h4>Previous topic</h4>
|
| 151 |
+
<p class="topless"><a href="try_run.html"
|
| 152 |
+
title="previous chapter">try_run</a></p>
|
| 153 |
+
</div>
|
| 154 |
+
<div>
|
| 155 |
+
<h4>Next topic</h4>
|
| 156 |
+
<p class="topless"><a href="ctest_configure.html"
|
| 157 |
+
title="next chapter">ctest_configure</a></p>
|
| 158 |
+
</div>
|
| 159 |
+
<div role="note" aria-label="source link">
|
| 160 |
+
<h3>This Page</h3>
|
| 161 |
+
<ul class="this-page-menu">
|
| 162 |
+
<li><a href="../_sources/command/ctest_build.rst.txt"
|
| 163 |
+
rel="nofollow">Show Source</a></li>
|
| 164 |
+
</ul>
|
| 165 |
+
</div>
|
| 166 |
+
<search id="searchbox" style="display: none" role="search">
|
| 167 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 168 |
+
<div class="searchformwrapper">
|
| 169 |
+
<form class="search" action="../search.html" method="get">
|
| 170 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 171 |
+
<input type="submit" value="Go" />
|
| 172 |
+
</form>
|
| 173 |
+
</div>
|
| 174 |
+
</search>
|
| 175 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 176 |
+
</div>
|
| 177 |
+
</div>
|
| 178 |
+
<div class="clearer"></div>
|
| 179 |
+
</div>
|
| 180 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 181 |
+
<h3>Navigation</h3>
|
| 182 |
+
<ul>
|
| 183 |
+
<li class="right" style="margin-right: 10px">
|
| 184 |
+
<a href="../genindex.html" title="General Index"
|
| 185 |
+
>index</a></li>
|
| 186 |
+
<li class="right" >
|
| 187 |
+
<a href="ctest_configure.html" title="ctest_configure"
|
| 188 |
+
>next</a> |</li>
|
| 189 |
+
<li class="right" >
|
| 190 |
+
<a href="try_run.html" title="try_run"
|
| 191 |
+
>previous</a> |</li>
|
| 192 |
+
<li>
|
| 193 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 194 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 195 |
+
</li>
|
| 196 |
+
<li>
|
| 197 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 198 |
+
</li>
|
| 199 |
+
<li>
|
| 200 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 201 |
+
</li>
|
| 202 |
+
|
| 203 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 204 |
+
<li class="nav-item nav-item-this"><a href="">ctest_build</a></li>
|
| 205 |
+
</ul>
|
| 206 |
+
</div>
|
| 207 |
+
|
| 208 |
+
<div class="footer" role="contentinfo">
|
| 209 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 210 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 211 |
+
</div>
|
| 212 |
+
</body>
|
| 213 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_configure.html
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_configure — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_coverage" href="ctest_coverage.html" />
|
| 21 |
+
<link rel="prev" title="ctest_build" href="ctest_build.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_coverage.html" title="ctest_coverage"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_build.html" title="ctest_build"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_configure</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-configure">
|
| 60 |
+
<span id="command:ctest_configure"></span><h1>ctest_configure<a class="headerlink" href="#ctest-configure" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Perform the <a class="reference internal" href="../manual/ctest.1.html#ctest-configure-step"><span class="std std-ref">CTest Configure Step</span></a> as a <a class="reference internal" href="../manual/ctest.1.html#dashboard-client"><span class="std std-ref">Dashboard Client</span></a>.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_configure(</span><span class="p">[</span><span class="no">BUILD</span><span class="w"> </span><span class="nv"><build-dir></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">SOURCE</span><span class="w"> </span><span class="nv"><source-dir></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">APPEND</span><span class="p">]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">OPTIONS</span><span class="w"> </span><span class="nv"><options></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CAPTURE_CMAKE_ERROR</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span><span class="nf">)</span>
|
| 65 |
+
</pre></div>
|
| 66 |
+
</div>
|
| 67 |
+
<p>Configure the project build tree and record results in <code class="docutils literal notranslate"><span class="pre">Configure.xml</span></code>
|
| 68 |
+
for submission with the <span class="target" id="index-0-command:ctest_submit"></span><a class="reference internal" href="ctest_submit.html#command:ctest_submit" title="ctest_submit"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_submit()</span></code></a> command.</p>
|
| 69 |
+
<p>The options are:</p>
|
| 70 |
+
<dl>
|
| 71 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BUILD</span> <span class="pre"><build-dir></span></code></dt><dd><p>Specify the top-level build directory. If not given, the
|
| 72 |
+
<span class="target" id="index-0-variable:CTEST_BINARY_DIRECTORY"></span><a class="reference internal" href="../variable/CTEST_BINARY_DIRECTORY.html#variable:CTEST_BINARY_DIRECTORY" title="CTEST_BINARY_DIRECTORY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_BINARY_DIRECTORY</span></code></a> variable is used.</p>
|
| 73 |
+
</dd>
|
| 74 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SOURCE</span> <span class="pre"><source-dir></span></code></dt><dd><p>Specify the source directory. If not given, the
|
| 75 |
+
<span class="target" id="index-0-variable:CTEST_SOURCE_DIRECTORY"></span><a class="reference internal" href="../variable/CTEST_SOURCE_DIRECTORY.html#variable:CTEST_SOURCE_DIRECTORY" title="CTEST_SOURCE_DIRECTORY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_SOURCE_DIRECTORY</span></code></a> variable is used.</p>
|
| 76 |
+
</dd>
|
| 77 |
+
<dt><code class="docutils literal notranslate"><span class="pre">APPEND</span></code></dt><dd><p>Mark <code class="docutils literal notranslate"><span class="pre">Configure.xml</span></code> for append to results previously submitted to a
|
| 78 |
+
dashboard server since the last <span class="target" id="index-0-command:ctest_start"></span><a class="reference internal" href="ctest_start.html#command:ctest_start" title="ctest_start"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_start()</span></code></a> call.
|
| 79 |
+
Append semantics are defined by the dashboard server in use.
|
| 80 |
+
This does <em>not</em> cause results to be appended to a <code class="docutils literal notranslate"><span class="pre">.xml</span></code> file
|
| 81 |
+
produced by a previous call to this command.</p>
|
| 82 |
+
</dd>
|
| 83 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OPTIONS</span> <span class="pre"><options></span></code></dt><dd><p>Specify command-line arguments to pass to the configuration tool.</p>
|
| 84 |
+
</dd>
|
| 85 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RETURN_VALUE</span> <span class="pre"><result-var></span></code></dt><dd><p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable the return value of the native
|
| 86 |
+
configuration tool.</p>
|
| 87 |
+
</dd>
|
| 88 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CAPTURE_CMAKE_ERROR</span> <span class="pre"><result-var></span></code></dt><dd><div class="versionadded">
|
| 89 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 90 |
+
</div>
|
| 91 |
+
<p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable -1 if there are any errors running
|
| 92 |
+
the command and prevent ctest from returning non-zero if an error occurs.</p>
|
| 93 |
+
</dd>
|
| 94 |
+
<dt><code class="docutils literal notranslate"><span class="pre">QUIET</span></code></dt><dd><div class="versionadded">
|
| 95 |
+
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
| 96 |
+
</div>
|
| 97 |
+
<p>Suppress any CTest-specific non-error messages that would have
|
| 98 |
+
otherwise been printed to the console. Output from the underlying
|
| 99 |
+
configure command is not affected.</p>
|
| 100 |
+
</dd>
|
| 101 |
+
</dl>
|
| 102 |
+
</section>
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
<div class="clearer"></div>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 110 |
+
<div class="sphinxsidebarwrapper">
|
| 111 |
+
<div>
|
| 112 |
+
<h4>Previous topic</h4>
|
| 113 |
+
<p class="topless"><a href="ctest_build.html"
|
| 114 |
+
title="previous chapter">ctest_build</a></p>
|
| 115 |
+
</div>
|
| 116 |
+
<div>
|
| 117 |
+
<h4>Next topic</h4>
|
| 118 |
+
<p class="topless"><a href="ctest_coverage.html"
|
| 119 |
+
title="next chapter">ctest_coverage</a></p>
|
| 120 |
+
</div>
|
| 121 |
+
<div role="note" aria-label="source link">
|
| 122 |
+
<h3>This Page</h3>
|
| 123 |
+
<ul class="this-page-menu">
|
| 124 |
+
<li><a href="../_sources/command/ctest_configure.rst.txt"
|
| 125 |
+
rel="nofollow">Show Source</a></li>
|
| 126 |
+
</ul>
|
| 127 |
+
</div>
|
| 128 |
+
<search id="searchbox" style="display: none" role="search">
|
| 129 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 130 |
+
<div class="searchformwrapper">
|
| 131 |
+
<form class="search" action="../search.html" method="get">
|
| 132 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 133 |
+
<input type="submit" value="Go" />
|
| 134 |
+
</form>
|
| 135 |
+
</div>
|
| 136 |
+
</search>
|
| 137 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
<div class="clearer"></div>
|
| 141 |
+
</div>
|
| 142 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 143 |
+
<h3>Navigation</h3>
|
| 144 |
+
<ul>
|
| 145 |
+
<li class="right" style="margin-right: 10px">
|
| 146 |
+
<a href="../genindex.html" title="General Index"
|
| 147 |
+
>index</a></li>
|
| 148 |
+
<li class="right" >
|
| 149 |
+
<a href="ctest_coverage.html" title="ctest_coverage"
|
| 150 |
+
>next</a> |</li>
|
| 151 |
+
<li class="right" >
|
| 152 |
+
<a href="ctest_build.html" title="ctest_build"
|
| 153 |
+
>previous</a> |</li>
|
| 154 |
+
<li>
|
| 155 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 156 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 157 |
+
</li>
|
| 158 |
+
<li>
|
| 159 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 160 |
+
</li>
|
| 161 |
+
<li>
|
| 162 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 163 |
+
</li>
|
| 164 |
+
|
| 165 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 166 |
+
<li class="nav-item nav-item-this"><a href="">ctest_configure</a></li>
|
| 167 |
+
</ul>
|
| 168 |
+
</div>
|
| 169 |
+
|
| 170 |
+
<div class="footer" role="contentinfo">
|
| 171 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 172 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 173 |
+
</div>
|
| 174 |
+
</body>
|
| 175 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_coverage.html
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_coverage — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_empty_binary_directory" href="ctest_empty_binary_directory.html" />
|
| 21 |
+
<link rel="prev" title="ctest_configure" href="ctest_configure.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_empty_binary_directory.html" title="ctest_empty_binary_directory"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_configure.html" title="ctest_configure"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_coverage</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-coverage">
|
| 60 |
+
<span id="command:ctest_coverage"></span><h1>ctest_coverage<a class="headerlink" href="#ctest-coverage" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Perform the <a class="reference internal" href="../manual/ctest.1.html#ctest-coverage-step"><span class="std std-ref">CTest Coverage Step</span></a> as a <a class="reference internal" href="../manual/ctest.1.html#dashboard-client"><span class="std std-ref">Dashboard Client</span></a>.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_coverage(</span><span class="p">[</span><span class="no">BUILD</span><span class="w"> </span><span class="nv"><build-dir></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">APPEND</span><span class="p">]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">LABELS</span><span class="w"> </span><span class="nv"><label>...</span><span class="p">]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CAPTURE_CMAKE_ERROR</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 66 |
+
<span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span>
|
| 67 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 68 |
+
</pre></div>
|
| 69 |
+
</div>
|
| 70 |
+
<p>Collect coverage tool results and stores them in <code class="docutils literal notranslate"><span class="pre">Coverage.xml</span></code>
|
| 71 |
+
for submission with the <span class="target" id="index-0-command:ctest_submit"></span><a class="reference internal" href="ctest_submit.html#command:ctest_submit" title="ctest_submit"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_submit()</span></code></a> command.</p>
|
| 72 |
+
<p>The options are:</p>
|
| 73 |
+
<dl>
|
| 74 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BUILD</span> <span class="pre"><build-dir></span></code></dt><dd><p>Specify the top-level build directory. If not given, the
|
| 75 |
+
<span class="target" id="index-0-variable:CTEST_BINARY_DIRECTORY"></span><a class="reference internal" href="../variable/CTEST_BINARY_DIRECTORY.html#variable:CTEST_BINARY_DIRECTORY" title="CTEST_BINARY_DIRECTORY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_BINARY_DIRECTORY</span></code></a> variable is used.</p>
|
| 76 |
+
</dd>
|
| 77 |
+
<dt><code class="docutils literal notranslate"><span class="pre">APPEND</span></code></dt><dd><p>Mark <code class="docutils literal notranslate"><span class="pre">Coverage.xml</span></code> for append to results previously submitted to a
|
| 78 |
+
dashboard server since the last <span class="target" id="index-0-command:ctest_start"></span><a class="reference internal" href="ctest_start.html#command:ctest_start" title="ctest_start"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_start()</span></code></a> call.
|
| 79 |
+
Append semantics are defined by the dashboard server in use.
|
| 80 |
+
This does <em>not</em> cause results to be appended to a <code class="docutils literal notranslate"><span class="pre">.xml</span></code> file
|
| 81 |
+
produced by a previous call to this command.</p>
|
| 82 |
+
</dd>
|
| 83 |
+
<dt><code class="docutils literal notranslate"><span class="pre">LABELS</span></code></dt><dd><p>Filter the coverage report to include only source files labeled
|
| 84 |
+
with at least one of the labels specified.</p>
|
| 85 |
+
</dd>
|
| 86 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RETURN_VALUE</span> <span class="pre"><result-var></span></code></dt><dd><p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable <code class="docutils literal notranslate"><span class="pre">0</span></code> if coverage tools
|
| 87 |
+
ran without error and non-zero otherwise.</p>
|
| 88 |
+
</dd>
|
| 89 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CAPTURE_CMAKE_ERROR</span> <span class="pre"><result-var></span></code></dt><dd><div class="versionadded">
|
| 90 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 91 |
+
</div>
|
| 92 |
+
<p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable -1 if there are any errors running
|
| 93 |
+
the command and prevent ctest from returning non-zero if an error occurs.</p>
|
| 94 |
+
</dd>
|
| 95 |
+
<dt><code class="docutils literal notranslate"><span class="pre">QUIET</span></code></dt><dd><div class="versionadded">
|
| 96 |
+
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
| 97 |
+
</div>
|
| 98 |
+
<p>Suppress any CTest-specific non-error output that would have been
|
| 99 |
+
printed to the console otherwise. The summary indicating how many
|
| 100 |
+
lines of code were covered is unaffected by this option.</p>
|
| 101 |
+
</dd>
|
| 102 |
+
</dl>
|
| 103 |
+
</section>
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
<div class="clearer"></div>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 111 |
+
<div class="sphinxsidebarwrapper">
|
| 112 |
+
<div>
|
| 113 |
+
<h4>Previous topic</h4>
|
| 114 |
+
<p class="topless"><a href="ctest_configure.html"
|
| 115 |
+
title="previous chapter">ctest_configure</a></p>
|
| 116 |
+
</div>
|
| 117 |
+
<div>
|
| 118 |
+
<h4>Next topic</h4>
|
| 119 |
+
<p class="topless"><a href="ctest_empty_binary_directory.html"
|
| 120 |
+
title="next chapter">ctest_empty_binary_directory</a></p>
|
| 121 |
+
</div>
|
| 122 |
+
<div role="note" aria-label="source link">
|
| 123 |
+
<h3>This Page</h3>
|
| 124 |
+
<ul class="this-page-menu">
|
| 125 |
+
<li><a href="../_sources/command/ctest_coverage.rst.txt"
|
| 126 |
+
rel="nofollow">Show Source</a></li>
|
| 127 |
+
</ul>
|
| 128 |
+
</div>
|
| 129 |
+
<search id="searchbox" style="display: none" role="search">
|
| 130 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 131 |
+
<div class="searchformwrapper">
|
| 132 |
+
<form class="search" action="../search.html" method="get">
|
| 133 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 134 |
+
<input type="submit" value="Go" />
|
| 135 |
+
</form>
|
| 136 |
+
</div>
|
| 137 |
+
</search>
|
| 138 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
<div class="clearer"></div>
|
| 142 |
+
</div>
|
| 143 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 144 |
+
<h3>Navigation</h3>
|
| 145 |
+
<ul>
|
| 146 |
+
<li class="right" style="margin-right: 10px">
|
| 147 |
+
<a href="../genindex.html" title="General Index"
|
| 148 |
+
>index</a></li>
|
| 149 |
+
<li class="right" >
|
| 150 |
+
<a href="ctest_empty_binary_directory.html" title="ctest_empty_binary_directory"
|
| 151 |
+
>next</a> |</li>
|
| 152 |
+
<li class="right" >
|
| 153 |
+
<a href="ctest_configure.html" title="ctest_configure"
|
| 154 |
+
>previous</a> |</li>
|
| 155 |
+
<li>
|
| 156 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 157 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 158 |
+
</li>
|
| 159 |
+
<li>
|
| 160 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 161 |
+
</li>
|
| 162 |
+
<li>
|
| 163 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 164 |
+
</li>
|
| 165 |
+
|
| 166 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 167 |
+
<li class="nav-item nav-item-this"><a href="">ctest_coverage</a></li>
|
| 168 |
+
</ul>
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
<div class="footer" role="contentinfo">
|
| 172 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 173 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 174 |
+
</div>
|
| 175 |
+
</body>
|
| 176 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_empty_binary_directory.html
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_empty_binary_directory — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_memcheck" href="ctest_memcheck.html" />
|
| 21 |
+
<link rel="prev" title="ctest_coverage" href="ctest_coverage.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_memcheck.html" title="ctest_memcheck"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_coverage.html" title="ctest_coverage"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_empty_binary_directory</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-empty-binary-directory">
|
| 60 |
+
<span id="command:ctest_empty_binary_directory"></span><h1>ctest_empty_binary_directory<a class="headerlink" href="#ctest-empty-binary-directory" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>empties the binary directory</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_empty_binary_directory(</span><span class="nv"><directory></span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Removes a binary directory. This command will perform some checks
|
| 66 |
+
prior to deleting the directory in an attempt to avoid malicious or
|
| 67 |
+
accidental directory deletion.</p>
|
| 68 |
+
</section>
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
<div class="clearer"></div>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 76 |
+
<div class="sphinxsidebarwrapper">
|
| 77 |
+
<div>
|
| 78 |
+
<h4>Previous topic</h4>
|
| 79 |
+
<p class="topless"><a href="ctest_coverage.html"
|
| 80 |
+
title="previous chapter">ctest_coverage</a></p>
|
| 81 |
+
</div>
|
| 82 |
+
<div>
|
| 83 |
+
<h4>Next topic</h4>
|
| 84 |
+
<p class="topless"><a href="ctest_memcheck.html"
|
| 85 |
+
title="next chapter">ctest_memcheck</a></p>
|
| 86 |
+
</div>
|
| 87 |
+
<div role="note" aria-label="source link">
|
| 88 |
+
<h3>This Page</h3>
|
| 89 |
+
<ul class="this-page-menu">
|
| 90 |
+
<li><a href="../_sources/command/ctest_empty_binary_directory.rst.txt"
|
| 91 |
+
rel="nofollow">Show Source</a></li>
|
| 92 |
+
</ul>
|
| 93 |
+
</div>
|
| 94 |
+
<search id="searchbox" style="display: none" role="search">
|
| 95 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 96 |
+
<div class="searchformwrapper">
|
| 97 |
+
<form class="search" action="../search.html" method="get">
|
| 98 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 99 |
+
<input type="submit" value="Go" />
|
| 100 |
+
</form>
|
| 101 |
+
</div>
|
| 102 |
+
</search>
|
| 103 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
<div class="clearer"></div>
|
| 107 |
+
</div>
|
| 108 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 109 |
+
<h3>Navigation</h3>
|
| 110 |
+
<ul>
|
| 111 |
+
<li class="right" style="margin-right: 10px">
|
| 112 |
+
<a href="../genindex.html" title="General Index"
|
| 113 |
+
>index</a></li>
|
| 114 |
+
<li class="right" >
|
| 115 |
+
<a href="ctest_memcheck.html" title="ctest_memcheck"
|
| 116 |
+
>next</a> |</li>
|
| 117 |
+
<li class="right" >
|
| 118 |
+
<a href="ctest_coverage.html" title="ctest_coverage"
|
| 119 |
+
>previous</a> |</li>
|
| 120 |
+
<li>
|
| 121 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 122 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 123 |
+
</li>
|
| 124 |
+
<li>
|
| 125 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 126 |
+
</li>
|
| 127 |
+
<li>
|
| 128 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 129 |
+
</li>
|
| 130 |
+
|
| 131 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 132 |
+
<li class="nav-item nav-item-this"><a href="">ctest_empty_binary_directory</a></li>
|
| 133 |
+
</ul>
|
| 134 |
+
</div>
|
| 135 |
+
|
| 136 |
+
<div class="footer" role="contentinfo">
|
| 137 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 138 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 139 |
+
</div>
|
| 140 |
+
</body>
|
| 141 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_memcheck.html
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_memcheck — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_read_custom_files" href="ctest_read_custom_files.html" />
|
| 21 |
+
<link rel="prev" title="ctest_empty_binary_directory" href="ctest_empty_binary_directory.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_read_custom_files.html" title="ctest_read_custom_files"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_empty_binary_directory.html" title="ctest_empty_binary_directory"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_memcheck</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-memcheck">
|
| 60 |
+
<span id="command:ctest_memcheck"></span><h1>ctest_memcheck<a class="headerlink" href="#ctest-memcheck" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Perform the <a class="reference internal" href="../manual/ctest.1.html#ctest-memcheck-step"><span class="std std-ref">CTest MemCheck Step</span></a> as a <a class="reference internal" href="../manual/ctest.1.html#dashboard-client"><span class="std std-ref">Dashboard Client</span></a>.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_memcheck(</span><span class="p">[</span><span class="no">BUILD</span><span class="w"> </span><span class="nv"><build-dir></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">APPEND</span><span class="p">]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">START</span><span class="w"> </span><span class="nv"><start-number></span><span class="p">]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">END</span><span class="w"> </span><span class="nv"><end-number></span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">STRIDE</span><span class="w"> </span><span class="nv"><stride-number></span><span class="p">]</span>
|
| 66 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE</span><span class="w"> </span><span class="nv"><exclude-regex></span><span class="p">]</span>
|
| 67 |
+
<span class="w"> </span><span class="p">[</span><span class="no">INCLUDE</span><span class="w"> </span><span class="nv"><include-regex></span><span class="p">]</span>
|
| 68 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_LABEL</span><span class="w"> </span><span class="nv"><label-exclude-regex></span><span class="p">]</span>
|
| 69 |
+
<span class="w"> </span><span class="p">[</span><span class="no">INCLUDE_LABEL</span><span class="w"> </span><span class="nv"><label-include-regex></span><span class="p">]</span>
|
| 70 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FIXTURE</span><span class="w"> </span><span class="nv"><regex></span><span class="p">]</span>
|
| 71 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FIXTURE_SETUP</span><span class="w"> </span><span class="nv"><regex></span><span class="p">]</span>
|
| 72 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FIXTURE_CLEANUP</span><span class="w"> </span><span class="nv"><regex></span><span class="p">]</span>
|
| 73 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PARALLEL_LEVEL</span><span class="w"> </span><span class="nv"><level></span><span class="p">]</span>
|
| 74 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RESOURCE_SPEC_FILE</span><span class="w"> </span><span class="nv"><file></span><span class="p">]</span>
|
| 75 |
+
<span class="w"> </span><span class="p">[</span><span class="no">TEST_LOAD</span><span class="w"> </span><span class="nv"><threshold></span><span class="p">]</span>
|
| 76 |
+
<span class="w"> </span><span class="p">[</span><span class="no">SCHEDULE_RANDOM</span><span class="w"> </span><span class="o"><</span><span class="no">ON</span><span class="p">|</span><span class="no">OFF</span><span class="o">></span><span class="p">]</span>
|
| 77 |
+
<span class="w"> </span><span class="p">[</span><span class="no">STOP_ON_FAILURE</span><span class="p">]</span>
|
| 78 |
+
<span class="w"> </span><span class="p">[</span><span class="no">STOP_TIME</span><span class="w"> </span><span class="nv"><time-of-day></span><span class="p">]</span>
|
| 79 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 80 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CAPTURE_CMAKE_ERROR</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 81 |
+
<span class="w"> </span><span class="p">[</span><span class="no">REPEAT</span><span class="w"> </span><span class="nv"><mode></span><span class="o">:</span><span class="nv"><n></span><span class="p">]</span>
|
| 82 |
+
<span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_JUNIT</span><span class="w"> </span><span class="nv"><file></span><span class="p">]</span>
|
| 83 |
+
<span class="w"> </span><span class="p">[</span><span class="no">DEFECT_COUNT</span><span class="w"> </span><span class="nv"><defect-count-var></span><span class="p">]</span>
|
| 84 |
+
<span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span>
|
| 85 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 86 |
+
</pre></div>
|
| 87 |
+
</div>
|
| 88 |
+
<p>Run tests with a dynamic analysis tool and store results in
|
| 89 |
+
<code class="docutils literal notranslate"><span class="pre">MemCheck.xml</span></code> for submission with the <span class="target" id="index-0-command:ctest_submit"></span><a class="reference internal" href="ctest_submit.html#command:ctest_submit" title="ctest_submit"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_submit()</span></code></a>
|
| 90 |
+
command.</p>
|
| 91 |
+
<p>Most options are the same as those for the <span class="target" id="index-0-command:ctest_test"></span><a class="reference internal" href="ctest_test.html#command:ctest_test" title="ctest_test"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_test()</span></code></a> command.</p>
|
| 92 |
+
<p>The options unique to this command are:</p>
|
| 93 |
+
<dl>
|
| 94 |
+
<dt><code class="docutils literal notranslate"><span class="pre">DEFECT_COUNT</span> <span class="pre"><defect-count-var></span></code></dt><dd><div class="versionadded">
|
| 95 |
+
<p><span class="versionmodified added">Added in version 3.8.</span></p>
|
| 96 |
+
</div>
|
| 97 |
+
<p>Store in the <code class="docutils literal notranslate"><span class="pre"><defect-count-var></span></code> the number of defects found.</p>
|
| 98 |
+
</dd>
|
| 99 |
+
</dl>
|
| 100 |
+
</section>
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
<div class="clearer"></div>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 108 |
+
<div class="sphinxsidebarwrapper">
|
| 109 |
+
<div>
|
| 110 |
+
<h4>Previous topic</h4>
|
| 111 |
+
<p class="topless"><a href="ctest_empty_binary_directory.html"
|
| 112 |
+
title="previous chapter">ctest_empty_binary_directory</a></p>
|
| 113 |
+
</div>
|
| 114 |
+
<div>
|
| 115 |
+
<h4>Next topic</h4>
|
| 116 |
+
<p class="topless"><a href="ctest_read_custom_files.html"
|
| 117 |
+
title="next chapter">ctest_read_custom_files</a></p>
|
| 118 |
+
</div>
|
| 119 |
+
<div role="note" aria-label="source link">
|
| 120 |
+
<h3>This Page</h3>
|
| 121 |
+
<ul class="this-page-menu">
|
| 122 |
+
<li><a href="../_sources/command/ctest_memcheck.rst.txt"
|
| 123 |
+
rel="nofollow">Show Source</a></li>
|
| 124 |
+
</ul>
|
| 125 |
+
</div>
|
| 126 |
+
<search id="searchbox" style="display: none" role="search">
|
| 127 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 128 |
+
<div class="searchformwrapper">
|
| 129 |
+
<form class="search" action="../search.html" method="get">
|
| 130 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 131 |
+
<input type="submit" value="Go" />
|
| 132 |
+
</form>
|
| 133 |
+
</div>
|
| 134 |
+
</search>
|
| 135 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
<div class="clearer"></div>
|
| 139 |
+
</div>
|
| 140 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 141 |
+
<h3>Navigation</h3>
|
| 142 |
+
<ul>
|
| 143 |
+
<li class="right" style="margin-right: 10px">
|
| 144 |
+
<a href="../genindex.html" title="General Index"
|
| 145 |
+
>index</a></li>
|
| 146 |
+
<li class="right" >
|
| 147 |
+
<a href="ctest_read_custom_files.html" title="ctest_read_custom_files"
|
| 148 |
+
>next</a> |</li>
|
| 149 |
+
<li class="right" >
|
| 150 |
+
<a href="ctest_empty_binary_directory.html" title="ctest_empty_binary_directory"
|
| 151 |
+
>previous</a> |</li>
|
| 152 |
+
<li>
|
| 153 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 154 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 155 |
+
</li>
|
| 156 |
+
<li>
|
| 157 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 158 |
+
</li>
|
| 159 |
+
<li>
|
| 160 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 161 |
+
</li>
|
| 162 |
+
|
| 163 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 164 |
+
<li class="nav-item nav-item-this"><a href="">ctest_memcheck</a></li>
|
| 165 |
+
</ul>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div class="footer" role="contentinfo">
|
| 169 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 170 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 171 |
+
</div>
|
| 172 |
+
</body>
|
| 173 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_read_custom_files.html
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_read_custom_files — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_run_script" href="ctest_run_script.html" />
|
| 21 |
+
<link rel="prev" title="ctest_memcheck" href="ctest_memcheck.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_run_script.html" title="ctest_run_script"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_memcheck.html" title="ctest_memcheck"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_read_custom_files</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-read-custom-files">
|
| 60 |
+
<span id="command:ctest_read_custom_files"></span><h1>ctest_read_custom_files<a class="headerlink" href="#ctest-read-custom-files" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>read CTestCustom files.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_read_custom_files(</span><span class="nv"><directory>...</span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Read all the CTestCustom.ctest or CTestCustom.cmake files from the
|
| 66 |
+
given directory.</p>
|
| 67 |
+
<p>By default, invoking <span class="target" id="index-0-manual:ctest(1)"></span><a class="reference internal" href="../manual/ctest.1.html#manual:ctest(1)" title="ctest(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">ctest(1)</span></code></a> without a script will read custom
|
| 68 |
+
files from the binary directory.</p>
|
| 69 |
+
</section>
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
<div class="clearer"></div>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 77 |
+
<div class="sphinxsidebarwrapper">
|
| 78 |
+
<div>
|
| 79 |
+
<h4>Previous topic</h4>
|
| 80 |
+
<p class="topless"><a href="ctest_memcheck.html"
|
| 81 |
+
title="previous chapter">ctest_memcheck</a></p>
|
| 82 |
+
</div>
|
| 83 |
+
<div>
|
| 84 |
+
<h4>Next topic</h4>
|
| 85 |
+
<p class="topless"><a href="ctest_run_script.html"
|
| 86 |
+
title="next chapter">ctest_run_script</a></p>
|
| 87 |
+
</div>
|
| 88 |
+
<div role="note" aria-label="source link">
|
| 89 |
+
<h3>This Page</h3>
|
| 90 |
+
<ul class="this-page-menu">
|
| 91 |
+
<li><a href="../_sources/command/ctest_read_custom_files.rst.txt"
|
| 92 |
+
rel="nofollow">Show Source</a></li>
|
| 93 |
+
</ul>
|
| 94 |
+
</div>
|
| 95 |
+
<search id="searchbox" style="display: none" role="search">
|
| 96 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 97 |
+
<div class="searchformwrapper">
|
| 98 |
+
<form class="search" action="../search.html" method="get">
|
| 99 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 100 |
+
<input type="submit" value="Go" />
|
| 101 |
+
</form>
|
| 102 |
+
</div>
|
| 103 |
+
</search>
|
| 104 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="clearer"></div>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 110 |
+
<h3>Navigation</h3>
|
| 111 |
+
<ul>
|
| 112 |
+
<li class="right" style="margin-right: 10px">
|
| 113 |
+
<a href="../genindex.html" title="General Index"
|
| 114 |
+
>index</a></li>
|
| 115 |
+
<li class="right" >
|
| 116 |
+
<a href="ctest_run_script.html" title="ctest_run_script"
|
| 117 |
+
>next</a> |</li>
|
| 118 |
+
<li class="right" >
|
| 119 |
+
<a href="ctest_memcheck.html" title="ctest_memcheck"
|
| 120 |
+
>previous</a> |</li>
|
| 121 |
+
<li>
|
| 122 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 123 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 124 |
+
</li>
|
| 125 |
+
<li>
|
| 126 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 127 |
+
</li>
|
| 128 |
+
<li>
|
| 129 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 130 |
+
</li>
|
| 131 |
+
|
| 132 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 133 |
+
<li class="nav-item nav-item-this"><a href="">ctest_read_custom_files</a></li>
|
| 134 |
+
</ul>
|
| 135 |
+
</div>
|
| 136 |
+
|
| 137 |
+
<div class="footer" role="contentinfo">
|
| 138 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 139 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 140 |
+
</div>
|
| 141 |
+
</body>
|
| 142 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_run_script.html
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_run_script — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_sleep" href="ctest_sleep.html" />
|
| 21 |
+
<link rel="prev" title="ctest_read_custom_files" href="ctest_read_custom_files.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_sleep.html" title="ctest_sleep"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_read_custom_files.html" title="ctest_read_custom_files"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_run_script</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-run-script">
|
| 60 |
+
<span id="command:ctest_run_script"></span><h1>ctest_run_script<a class="headerlink" href="#ctest-run-script" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>runs a <a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-S"><code class="xref std std-option docutils literal notranslate"><span class="pre">ctest</span> <span class="pre">-S</span></code></a> script</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_run_script(</span><span class="p">[</span><span class="no">NEW_PROCESS</span><span class="p">]</span><span class="w"> </span><span class="nb">script_file_name</span><span class="w"> </span><span class="nb">script_file_name1</span>
|
| 63 |
+
<span class="w"> </span><span class="nb">script_file_name2</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nb">var</span><span class="p">]</span><span class="nf">)</span>
|
| 64 |
+
</pre></div>
|
| 65 |
+
</div>
|
| 66 |
+
<p>Runs a script or scripts much like if it was run from <a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-S"><code class="xref std std-option docutils literal notranslate"><span class="pre">ctest</span> <span class="pre">-S</span></code></a>.
|
| 67 |
+
If no argument is provided then the current script is run using the current
|
| 68 |
+
settings of the variables. If <code class="docutils literal notranslate"><span class="pre">NEW_PROCESS</span></code> is specified then each
|
| 69 |
+
script will be run in a separate process.If <code class="docutils literal notranslate"><span class="pre">RETURN_VALUE</span></code> is specified
|
| 70 |
+
the return value of the last script run will be put into <code class="docutils literal notranslate"><span class="pre">var</span></code>.</p>
|
| 71 |
+
</section>
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
<div class="clearer"></div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 79 |
+
<div class="sphinxsidebarwrapper">
|
| 80 |
+
<div>
|
| 81 |
+
<h4>Previous topic</h4>
|
| 82 |
+
<p class="topless"><a href="ctest_read_custom_files.html"
|
| 83 |
+
title="previous chapter">ctest_read_custom_files</a></p>
|
| 84 |
+
</div>
|
| 85 |
+
<div>
|
| 86 |
+
<h4>Next topic</h4>
|
| 87 |
+
<p class="topless"><a href="ctest_sleep.html"
|
| 88 |
+
title="next chapter">ctest_sleep</a></p>
|
| 89 |
+
</div>
|
| 90 |
+
<div role="note" aria-label="source link">
|
| 91 |
+
<h3>This Page</h3>
|
| 92 |
+
<ul class="this-page-menu">
|
| 93 |
+
<li><a href="../_sources/command/ctest_run_script.rst.txt"
|
| 94 |
+
rel="nofollow">Show Source</a></li>
|
| 95 |
+
</ul>
|
| 96 |
+
</div>
|
| 97 |
+
<search id="searchbox" style="display: none" role="search">
|
| 98 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 99 |
+
<div class="searchformwrapper">
|
| 100 |
+
<form class="search" action="../search.html" method="get">
|
| 101 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 102 |
+
<input type="submit" value="Go" />
|
| 103 |
+
</form>
|
| 104 |
+
</div>
|
| 105 |
+
</search>
|
| 106 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="clearer"></div>
|
| 110 |
+
</div>
|
| 111 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 112 |
+
<h3>Navigation</h3>
|
| 113 |
+
<ul>
|
| 114 |
+
<li class="right" style="margin-right: 10px">
|
| 115 |
+
<a href="../genindex.html" title="General Index"
|
| 116 |
+
>index</a></li>
|
| 117 |
+
<li class="right" >
|
| 118 |
+
<a href="ctest_sleep.html" title="ctest_sleep"
|
| 119 |
+
>next</a> |</li>
|
| 120 |
+
<li class="right" >
|
| 121 |
+
<a href="ctest_read_custom_files.html" title="ctest_read_custom_files"
|
| 122 |
+
>previous</a> |</li>
|
| 123 |
+
<li>
|
| 124 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 125 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 126 |
+
</li>
|
| 127 |
+
<li>
|
| 128 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 129 |
+
</li>
|
| 130 |
+
<li>
|
| 131 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 132 |
+
</li>
|
| 133 |
+
|
| 134 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 135 |
+
<li class="nav-item nav-item-this"><a href="">ctest_run_script</a></li>
|
| 136 |
+
</ul>
|
| 137 |
+
</div>
|
| 138 |
+
|
| 139 |
+
<div class="footer" role="contentinfo">
|
| 140 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 141 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 142 |
+
</div>
|
| 143 |
+
</body>
|
| 144 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_sleep.html
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_sleep — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_start" href="ctest_start.html" />
|
| 21 |
+
<link rel="prev" title="ctest_run_script" href="ctest_run_script.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_start.html" title="ctest_start"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_run_script.html" title="ctest_run_script"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_sleep</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-sleep">
|
| 60 |
+
<span id="command:ctest_sleep"></span><h1>ctest_sleep<a class="headerlink" href="#ctest-sleep" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>sleeps for some amount of time</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_sleep(</span><span class="nv"><seconds></span><span class="nf">)</span>
|
| 63 |
+
</pre></div>
|
| 64 |
+
</div>
|
| 65 |
+
<p>Sleep for given number of seconds.</p>
|
| 66 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_sleep(</span><span class="nv"><time1></span><span class="w"> </span><span class="nv"><duration></span><span class="w"> </span><span class="nv"><time2></span><span class="nf">)</span>
|
| 67 |
+
</pre></div>
|
| 68 |
+
</div>
|
| 69 |
+
<p>Sleep for t=(time1 + duration - time2) seconds if t > 0.</p>
|
| 70 |
+
</section>
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
<div class="clearer"></div>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 78 |
+
<div class="sphinxsidebarwrapper">
|
| 79 |
+
<div>
|
| 80 |
+
<h4>Previous topic</h4>
|
| 81 |
+
<p class="topless"><a href="ctest_run_script.html"
|
| 82 |
+
title="previous chapter">ctest_run_script</a></p>
|
| 83 |
+
</div>
|
| 84 |
+
<div>
|
| 85 |
+
<h4>Next topic</h4>
|
| 86 |
+
<p class="topless"><a href="ctest_start.html"
|
| 87 |
+
title="next chapter">ctest_start</a></p>
|
| 88 |
+
</div>
|
| 89 |
+
<div role="note" aria-label="source link">
|
| 90 |
+
<h3>This Page</h3>
|
| 91 |
+
<ul class="this-page-menu">
|
| 92 |
+
<li><a href="../_sources/command/ctest_sleep.rst.txt"
|
| 93 |
+
rel="nofollow">Show Source</a></li>
|
| 94 |
+
</ul>
|
| 95 |
+
</div>
|
| 96 |
+
<search id="searchbox" style="display: none" role="search">
|
| 97 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 98 |
+
<div class="searchformwrapper">
|
| 99 |
+
<form class="search" action="../search.html" method="get">
|
| 100 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 101 |
+
<input type="submit" value="Go" />
|
| 102 |
+
</form>
|
| 103 |
+
</div>
|
| 104 |
+
</search>
|
| 105 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
<div class="clearer"></div>
|
| 109 |
+
</div>
|
| 110 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 111 |
+
<h3>Navigation</h3>
|
| 112 |
+
<ul>
|
| 113 |
+
<li class="right" style="margin-right: 10px">
|
| 114 |
+
<a href="../genindex.html" title="General Index"
|
| 115 |
+
>index</a></li>
|
| 116 |
+
<li class="right" >
|
| 117 |
+
<a href="ctest_start.html" title="ctest_start"
|
| 118 |
+
>next</a> |</li>
|
| 119 |
+
<li class="right" >
|
| 120 |
+
<a href="ctest_run_script.html" title="ctest_run_script"
|
| 121 |
+
>previous</a> |</li>
|
| 122 |
+
<li>
|
| 123 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 124 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 125 |
+
</li>
|
| 126 |
+
<li>
|
| 127 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 128 |
+
</li>
|
| 129 |
+
<li>
|
| 130 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 131 |
+
</li>
|
| 132 |
+
|
| 133 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 134 |
+
<li class="nav-item nav-item-this"><a href="">ctest_sleep</a></li>
|
| 135 |
+
</ul>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<div class="footer" role="contentinfo">
|
| 139 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 140 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 141 |
+
</div>
|
| 142 |
+
</body>
|
| 143 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_start.html
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_start — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_submit" href="ctest_submit.html" />
|
| 21 |
+
<link rel="prev" title="ctest_sleep" href="ctest_sleep.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_submit.html" title="ctest_submit"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_sleep.html" title="ctest_sleep"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_start</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-start">
|
| 60 |
+
<span id="command:ctest_start"></span><h1>ctest_start<a class="headerlink" href="#ctest-start" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Starts the testing for a given model</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_start(</span><span class="nv"><model></span><span class="w"> </span><span class="p">[</span><span class="nv"><source></span><span class="w"> </span><span class="p">[</span><span class="nv"><binary></span><span class="p">]]</span><span class="w"> </span><span class="p">[</span><span class="no">GROUP</span><span class="w"> </span><span class="nv"><group></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span><span class="nf">)</span>
|
| 63 |
+
|
| 64 |
+
<span class="nf">ctest_start(</span><span class="p">[</span><span class="nv"><model></span><span class="w"> </span><span class="p">[</span><span class="nv"><source></span><span class="w"> </span><span class="p">[</span><span class="nv"><binary></span><span class="p">]]]</span><span class="w"> </span><span class="p">[</span><span class="no">GROUP</span><span class="w"> </span><span class="nv"><group></span><span class="p">]</span><span class="w"> </span><span class="no">APPEND</span><span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span><span class="nf">)</span>
|
| 65 |
+
</pre></div>
|
| 66 |
+
</div>
|
| 67 |
+
<p>Starts the testing for a given model. The command should be called
|
| 68 |
+
after the binary directory is initialized.</p>
|
| 69 |
+
<p>The parameters are as follows:</p>
|
| 70 |
+
<dl>
|
| 71 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><model></span></code></dt><dd><p>Set the dashboard model. Must be one of <code class="docutils literal notranslate"><span class="pre">Experimental</span></code>, <code class="docutils literal notranslate"><span class="pre">Continuous</span></code>, or
|
| 72 |
+
<code class="docutils literal notranslate"><span class="pre">Nightly</span></code>. This parameter is required unless <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> is specified.</p>
|
| 73 |
+
</dd>
|
| 74 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><source></span></code></dt><dd><p>Set the source directory. If not specified, the value of
|
| 75 |
+
<span class="target" id="index-0-variable:CTEST_SOURCE_DIRECTORY"></span><a class="reference internal" href="../variable/CTEST_SOURCE_DIRECTORY.html#variable:CTEST_SOURCE_DIRECTORY" title="CTEST_SOURCE_DIRECTORY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_SOURCE_DIRECTORY</span></code></a> is used instead.</p>
|
| 76 |
+
</dd>
|
| 77 |
+
<dt><code class="docutils literal notranslate"><span class="pre"><binary></span></code></dt><dd><p>Set the binary directory. If not specified, the value of
|
| 78 |
+
<span class="target" id="index-0-variable:CTEST_BINARY_DIRECTORY"></span><a class="reference internal" href="../variable/CTEST_BINARY_DIRECTORY.html#variable:CTEST_BINARY_DIRECTORY" title="CTEST_BINARY_DIRECTORY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_BINARY_DIRECTORY</span></code></a> is used instead.</p>
|
| 79 |
+
</dd>
|
| 80 |
+
<dt><code class="docutils literal notranslate"><span class="pre">GROUP</span> <span class="pre"><group></span></code></dt><dd><p>If <code class="docutils literal notranslate"><span class="pre">GROUP</span></code> is used, the submissions will go to the specified group on the
|
| 81 |
+
CDash server. If no <code class="docutils literal notranslate"><span class="pre">GROUP</span></code> is specified, the name of the model is used by
|
| 82 |
+
default.</p>
|
| 83 |
+
<div class="versionchanged">
|
| 84 |
+
<p><span class="versionmodified changed">Changed in version 3.16: </span>This replaces the deprecated option <code class="docutils literal notranslate"><span class="pre">TRACK</span></code>. Despite the name
|
| 85 |
+
change its behavior is unchanged.</p>
|
| 86 |
+
</div>
|
| 87 |
+
</dd>
|
| 88 |
+
<dt><code class="docutils literal notranslate"><span class="pre">APPEND</span></code></dt><dd><p>If <code class="docutils literal notranslate"><span class="pre">APPEND</span></code> is used, the existing <code class="docutils literal notranslate"><span class="pre">TAG</span></code> is used rather than creating a new
|
| 89 |
+
one based on the current time stamp. If you use <code class="docutils literal notranslate"><span class="pre">APPEND</span></code>, you can omit the
|
| 90 |
+
<code class="docutils literal notranslate"><span class="pre"><model></span></code> and <code class="docutils literal notranslate"><span class="pre">GROUP</span> <span class="pre"><group></span></code> parameters, because they will be read from
|
| 91 |
+
the generated <code class="docutils literal notranslate"><span class="pre">TAG</span></code> file. For example:</p>
|
| 92 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_start(</span><span class="nb">Experimental</span><span class="w"> </span><span class="no">GROUP</span><span class="w"> </span><span class="nb">GroupExperimental</span><span class="nf">)</span>
|
| 93 |
+
</pre></div>
|
| 94 |
+
</div>
|
| 95 |
+
<p>Later, in another <a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-S"><code class="xref std std-option docutils literal notranslate"><span class="pre">ctest</span> <span class="pre">-S</span></code></a> script:</p>
|
| 96 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_start(</span><span class="no">APPEND</span><span class="nf">)</span>
|
| 97 |
+
</pre></div>
|
| 98 |
+
</div>
|
| 99 |
+
<p>When the second script runs <code class="docutils literal notranslate"><span class="pre">ctest_start(APPEND)</span></code>, it will read the
|
| 100 |
+
<code class="docutils literal notranslate"><span class="pre">Experimental</span></code> model and <code class="docutils literal notranslate"><span class="pre">GroupExperimental</span></code> group from the <code class="docutils literal notranslate"><span class="pre">TAG</span></code> file
|
| 101 |
+
generated by the first <code class="docutils literal notranslate"><span class="pre">ctest_start()</span></code> command. Please note that if you
|
| 102 |
+
call <code class="docutils literal notranslate"><span class="pre">ctest_start(APPEND)</span></code> and specify a different model or group than
|
| 103 |
+
in the first <code class="docutils literal notranslate"><span class="pre">ctest_start()</span></code> command, a warning will be issued, and the
|
| 104 |
+
new model and group will be used.</p>
|
| 105 |
+
</dd>
|
| 106 |
+
<dt><code class="docutils literal notranslate"><span class="pre">QUIET</span></code></dt><dd><div class="versionadded">
|
| 107 |
+
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
| 108 |
+
</div>
|
| 109 |
+
<p>If <code class="docutils literal notranslate"><span class="pre">QUIET</span></code> is used, CTest will suppress any non-error messages that it
|
| 110 |
+
otherwise would have printed to the console.</p>
|
| 111 |
+
</dd>
|
| 112 |
+
</dl>
|
| 113 |
+
<p>The parameters for <code class="docutils literal notranslate"><span class="pre">ctest_start()</span></code> can be issued in any order, with the
|
| 114 |
+
exception that <code class="docutils literal notranslate"><span class="pre"><model></span></code>, <code class="docutils literal notranslate"><span class="pre"><source></span></code>, and <code class="docutils literal notranslate"><span class="pre"><binary></span></code> have to appear
|
| 115 |
+
in that order with respect to each other. The following are all valid and
|
| 116 |
+
equivalent:</p>
|
| 117 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_start(</span><span class="nb">Experimental</span><span class="w"> </span><span class="na">path/to/source</span><span class="w"> </span><span class="na">path/to/binary</span><span class="w"> </span><span class="no">GROUP</span><span class="w"> </span><span class="nb">SomeGroup</span><span class="w"> </span><span class="no">QUIET</span><span class="w"> </span><span class="no">APPEND</span><span class="nf">)</span>
|
| 118 |
+
|
| 119 |
+
<span class="nf">ctest_start(</span><span class="no">GROUP</span><span class="w"> </span><span class="nb">SomeGroup</span><span class="w"> </span><span class="nb">Experimental</span><span class="w"> </span><span class="no">QUIET</span><span class="w"> </span><span class="na">path/to/source</span><span class="w"> </span><span class="no">APPEND</span><span class="w"> </span><span class="na">path/to/binary</span><span class="nf">)</span>
|
| 120 |
+
|
| 121 |
+
<span class="nf">ctest_start(</span><span class="no">APPEND</span><span class="w"> </span><span class="no">QUIET</span><span class="w"> </span><span class="nb">Experimental</span><span class="w"> </span><span class="na">path/to/source</span><span class="w"> </span><span class="no">GROUP</span><span class="w"> </span><span class="nb">SomeGroup</span><span class="w"> </span><span class="na">path/to/binary</span><span class="nf">)</span>
|
| 122 |
+
</pre></div>
|
| 123 |
+
</div>
|
| 124 |
+
<p>However, for the sake of readability, it is recommended that you order your
|
| 125 |
+
parameters in the order listed at the top of this page.</p>
|
| 126 |
+
<p>If the <span class="target" id="index-0-variable:CTEST_CHECKOUT_COMMAND"></span><a class="reference internal" href="../variable/CTEST_CHECKOUT_COMMAND.html#variable:CTEST_CHECKOUT_COMMAND" title="CTEST_CHECKOUT_COMMAND"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_CHECKOUT_COMMAND</span></code></a> variable (or the
|
| 127 |
+
<span class="target" id="index-0-variable:CTEST_CVS_CHECKOUT"></span><a class="reference internal" href="../variable/CTEST_CVS_CHECKOUT.html#variable:CTEST_CVS_CHECKOUT" title="CTEST_CVS_CHECKOUT"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_CVS_CHECKOUT</span></code></a> variable) is set, its content is treated as
|
| 128 |
+
command-line. The command is invoked with the current working directory set
|
| 129 |
+
to the parent of the source directory, even if the source directory already
|
| 130 |
+
exists. This can be used to create the source tree from a version control
|
| 131 |
+
repository.</p>
|
| 132 |
+
</section>
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
<div class="clearer"></div>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 140 |
+
<div class="sphinxsidebarwrapper">
|
| 141 |
+
<div>
|
| 142 |
+
<h4>Previous topic</h4>
|
| 143 |
+
<p class="topless"><a href="ctest_sleep.html"
|
| 144 |
+
title="previous chapter">ctest_sleep</a></p>
|
| 145 |
+
</div>
|
| 146 |
+
<div>
|
| 147 |
+
<h4>Next topic</h4>
|
| 148 |
+
<p class="topless"><a href="ctest_submit.html"
|
| 149 |
+
title="next chapter">ctest_submit</a></p>
|
| 150 |
+
</div>
|
| 151 |
+
<div role="note" aria-label="source link">
|
| 152 |
+
<h3>This Page</h3>
|
| 153 |
+
<ul class="this-page-menu">
|
| 154 |
+
<li><a href="../_sources/command/ctest_start.rst.txt"
|
| 155 |
+
rel="nofollow">Show Source</a></li>
|
| 156 |
+
</ul>
|
| 157 |
+
</div>
|
| 158 |
+
<search id="searchbox" style="display: none" role="search">
|
| 159 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 160 |
+
<div class="searchformwrapper">
|
| 161 |
+
<form class="search" action="../search.html" method="get">
|
| 162 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 163 |
+
<input type="submit" value="Go" />
|
| 164 |
+
</form>
|
| 165 |
+
</div>
|
| 166 |
+
</search>
|
| 167 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 168 |
+
</div>
|
| 169 |
+
</div>
|
| 170 |
+
<div class="clearer"></div>
|
| 171 |
+
</div>
|
| 172 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 173 |
+
<h3>Navigation</h3>
|
| 174 |
+
<ul>
|
| 175 |
+
<li class="right" style="margin-right: 10px">
|
| 176 |
+
<a href="../genindex.html" title="General Index"
|
| 177 |
+
>index</a></li>
|
| 178 |
+
<li class="right" >
|
| 179 |
+
<a href="ctest_submit.html" title="ctest_submit"
|
| 180 |
+
>next</a> |</li>
|
| 181 |
+
<li class="right" >
|
| 182 |
+
<a href="ctest_sleep.html" title="ctest_sleep"
|
| 183 |
+
>previous</a> |</li>
|
| 184 |
+
<li>
|
| 185 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 186 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 187 |
+
</li>
|
| 188 |
+
<li>
|
| 189 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 190 |
+
</li>
|
| 191 |
+
<li>
|
| 192 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 193 |
+
</li>
|
| 194 |
+
|
| 195 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 196 |
+
<li class="nav-item nav-item-this"><a href="">ctest_start</a></li>
|
| 197 |
+
</ul>
|
| 198 |
+
</div>
|
| 199 |
+
|
| 200 |
+
<div class="footer" role="contentinfo">
|
| 201 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 202 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 203 |
+
</div>
|
| 204 |
+
</body>
|
| 205 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_submit.html
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_submit — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_test" href="ctest_test.html" />
|
| 21 |
+
<link rel="prev" title="ctest_start" href="ctest_start.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_test.html" title="ctest_test"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_start.html" title="ctest_start"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_submit</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-submit">
|
| 60 |
+
<span id="command:ctest_submit"></span><h1>ctest_submit<a class="headerlink" href="#ctest-submit" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Perform the <a class="reference internal" href="../manual/ctest.1.html#ctest-submit-step"><span class="std std-ref">CTest Submit Step</span></a> as a <a class="reference internal" href="../manual/ctest.1.html#dashboard-client"><span class="std std-ref">Dashboard Client</span></a>.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_submit(</span><span class="p">[</span><span class="no">PARTS</span><span class="w"> </span><span class="nv"><part>...</span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">FILES</span><span class="w"> </span><span class="nv"><file>...</span><span class="p">]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">SUBMIT_URL</span><span class="w"> </span><span class="nv"><url></span><span class="p">]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">BUILD_ID</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">HTTPHEADER</span><span class="w"> </span><span class="nv"><header></span><span class="p">]</span>
|
| 66 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETRY_COUNT</span><span class="w"> </span><span class="nv"><count></span><span class="p">]</span>
|
| 67 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETRY_DELAY</span><span class="w"> </span><span class="nv"><delay></span><span class="p">]</span>
|
| 68 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 69 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CAPTURE_CMAKE_ERROR</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 70 |
+
<span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span>
|
| 71 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 72 |
+
</pre></div>
|
| 73 |
+
</div>
|
| 74 |
+
<p>Submit results to a dashboard server.
|
| 75 |
+
By default all available parts are submitted.</p>
|
| 76 |
+
<p>The options are:</p>
|
| 77 |
+
<dl>
|
| 78 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PARTS</span> <span class="pre"><part>...</span></code></dt><dd><p>Specify a subset of parts to submit. Valid part names are:</p>
|
| 79 |
+
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Start = nothing
|
| 80 |
+
Update = ctest_update results, in Update.xml
|
| 81 |
+
Configure = ctest_configure results, in Configure.xml
|
| 82 |
+
Build = ctest_build results, in Build.xml
|
| 83 |
+
Test = ctest_test results, in Test.xml
|
| 84 |
+
Coverage = ctest_coverage results, in Coverage.xml
|
| 85 |
+
MemCheck = ctest_memcheck results, in DynamicAnalysis.xml and
|
| 86 |
+
DynamicAnalysis-Test.xml
|
| 87 |
+
Notes = Files listed by CTEST_NOTES_FILES, in Notes.xml
|
| 88 |
+
ExtraFiles = Files listed by CTEST_EXTRA_SUBMIT_FILES
|
| 89 |
+
Upload = Files prepared for upload by ctest_upload(), in Upload.xml
|
| 90 |
+
Submit = nothing
|
| 91 |
+
Done = Build is complete, in Done.xml
|
| 92 |
+
</pre></div>
|
| 93 |
+
</div>
|
| 94 |
+
</dd>
|
| 95 |
+
<dt><code class="docutils literal notranslate"><span class="pre">FILES</span> <span class="pre"><file>...</span></code></dt><dd><p>Specify an explicit list of specific files to be submitted.
|
| 96 |
+
Each individual file must exist at the time of the call.</p>
|
| 97 |
+
</dd>
|
| 98 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SUBMIT_URL</span> <span class="pre"><url></span></code></dt><dd><div class="versionadded">
|
| 99 |
+
<p><span class="versionmodified added">Added in version 3.14.</span></p>
|
| 100 |
+
</div>
|
| 101 |
+
<p>The <code class="docutils literal notranslate"><span class="pre">http</span></code> or <code class="docutils literal notranslate"><span class="pre">https</span></code> URL of the dashboard server to send the submission
|
| 102 |
+
to. If not given, the <span class="target" id="index-0-variable:CTEST_SUBMIT_URL"></span><a class="reference internal" href="../variable/CTEST_SUBMIT_URL.html#variable:CTEST_SUBMIT_URL" title="CTEST_SUBMIT_URL"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_SUBMIT_URL</span></code></a> variable is used.</p>
|
| 103 |
+
</dd>
|
| 104 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BUILD_ID</span> <span class="pre"><result-var></span></code></dt><dd><div class="versionadded">
|
| 105 |
+
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
| 106 |
+
</div>
|
| 107 |
+
<p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable the ID assigned to this build by
|
| 108 |
+
CDash.</p>
|
| 109 |
+
</dd>
|
| 110 |
+
<dt><code class="docutils literal notranslate"><span class="pre">HTTPHEADER</span> <span class="pre"><HTTP-header></span></code></dt><dd><div class="versionadded">
|
| 111 |
+
<p><span class="versionmodified added">Added in version 3.9.</span></p>
|
| 112 |
+
</div>
|
| 113 |
+
<p>Specify HTTP header to be included in the request to CDash during submission.
|
| 114 |
+
For example, CDash can be configured to only accept submissions from
|
| 115 |
+
authenticated clients. In this case, you should provide a bearer token in your
|
| 116 |
+
header:</p>
|
| 117 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_submit(</span><span class="no">HTTPHEADER</span><span class="w"> </span><span class="s">"Authorization: Bearer <auth-token>"</span><span class="nf">)</span>
|
| 118 |
+
</pre></div>
|
| 119 |
+
</div>
|
| 120 |
+
<p>This suboption can be repeated several times for multiple headers.</p>
|
| 121 |
+
</dd>
|
| 122 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RETRY_COUNT</span> <span class="pre"><count></span></code></dt><dd><p>Specify how many times to retry a timed-out submission.</p>
|
| 123 |
+
</dd>
|
| 124 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RETRY_DELAY</span> <span class="pre"><delay></span></code></dt><dd><p>Specify how long (in seconds) to wait after a timed-out submission
|
| 125 |
+
before attempting to re-submit.</p>
|
| 126 |
+
</dd>
|
| 127 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RETURN_VALUE</span> <span class="pre"><result-var></span></code></dt><dd><p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable <code class="docutils literal notranslate"><span class="pre">0</span></code> for success and
|
| 128 |
+
non-zero on failure.</p>
|
| 129 |
+
</dd>
|
| 130 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CAPTURE_CMAKE_ERROR</span> <span class="pre"><result-var></span></code></dt><dd><div class="versionadded">
|
| 131 |
+
<p><span class="versionmodified added">Added in version 3.13.</span></p>
|
| 132 |
+
</div>
|
| 133 |
+
<p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable -1 if there are any errors running
|
| 134 |
+
the command and prevent ctest from returning non-zero if an error occurs.</p>
|
| 135 |
+
</dd>
|
| 136 |
+
<dt><code class="docutils literal notranslate"><span class="pre">QUIET</span></code></dt><dd><div class="versionadded">
|
| 137 |
+
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
| 138 |
+
</div>
|
| 139 |
+
<p>Suppress all non-error messages that would have otherwise been
|
| 140 |
+
printed to the console.</p>
|
| 141 |
+
</dd>
|
| 142 |
+
</dl>
|
| 143 |
+
<section id="submit-to-cdash-upload-api">
|
| 144 |
+
<h2>Submit to CDash Upload API<a class="headerlink" href="#submit-to-cdash-upload-api" title="Link to this heading">¶</a></h2>
|
| 145 |
+
<div class="versionadded">
|
| 146 |
+
<p><span class="versionmodified added">Added in version 3.2.</span></p>
|
| 147 |
+
</div>
|
| 148 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_submit(</span><span class="no">CDASH_UPLOAD</span><span class="w"> </span><span class="nv"><file></span><span class="w"> </span><span class="p">[</span><span class="no">CDASH_UPLOAD_TYPE</span><span class="w"> </span><span class="nv"><type></span><span class="p">]</span>
|
| 149 |
+
<span class="w"> </span><span class="p">[</span><span class="no">SUBMIT_URL</span><span class="w"> </span><span class="nv"><url></span><span class="p">]</span>
|
| 150 |
+
<span class="w"> </span><span class="p">[</span><span class="no">BUILD_ID</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 151 |
+
<span class="w"> </span><span class="p">[</span><span class="no">HTTPHEADER</span><span class="w"> </span><span class="nv"><header></span><span class="p">]</span>
|
| 152 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETRY_COUNT</span><span class="w"> </span><span class="nv"><count></span><span class="p">]</span>
|
| 153 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETRY_DELAY</span><span class="w"> </span><span class="nv"><delay></span><span class="p">]</span>
|
| 154 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 155 |
+
<span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span><span class="nf">)</span>
|
| 156 |
+
</pre></div>
|
| 157 |
+
</div>
|
| 158 |
+
<p>This second signature is used to upload files to CDash via the CDash
|
| 159 |
+
file upload API. The API first sends a request to upload to CDash along
|
| 160 |
+
with a content hash of the file. If CDash does not already have the file,
|
| 161 |
+
then it is uploaded. Along with the file, a CDash type string is specified
|
| 162 |
+
to tell CDash which handler to use to process the data.</p>
|
| 163 |
+
<p>This signature interprets options in the same way as the first one.</p>
|
| 164 |
+
<div class="versionadded">
|
| 165 |
+
<p><span class="versionmodified added">Added in version 3.8: </span>Added the <code class="docutils literal notranslate"><span class="pre">RETRY_COUNT</span></code>, <code class="docutils literal notranslate"><span class="pre">RETRY_DELAY</span></code>, <code class="docutils literal notranslate"><span class="pre">QUIET</span></code> options.</p>
|
| 166 |
+
</div>
|
| 167 |
+
<div class="versionadded">
|
| 168 |
+
<p><span class="versionmodified added">Added in version 3.9: </span>Added the <code class="docutils literal notranslate"><span class="pre">HTTPHEADER</span></code> option.</p>
|
| 169 |
+
</div>
|
| 170 |
+
<div class="versionadded">
|
| 171 |
+
<p><span class="versionmodified added">Added in version 3.13: </span>Added the <code class="docutils literal notranslate"><span class="pre">RETURN_VALUE</span></code> option.</p>
|
| 172 |
+
</div>
|
| 173 |
+
<div class="versionadded">
|
| 174 |
+
<p><span class="versionmodified added">Added in version 3.14: </span>Added the <code class="docutils literal notranslate"><span class="pre">SUBMIT_URL</span></code> option.</p>
|
| 175 |
+
</div>
|
| 176 |
+
<div class="versionadded">
|
| 177 |
+
<p><span class="versionmodified added">Added in version 3.15: </span>Added the <code class="docutils literal notranslate"><span class="pre">BUILD_ID</span></code> option.</p>
|
| 178 |
+
</div>
|
| 179 |
+
</section>
|
| 180 |
+
</section>
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
<div class="clearer"></div>
|
| 184 |
+
</div>
|
| 185 |
+
</div>
|
| 186 |
+
</div>
|
| 187 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 188 |
+
<div class="sphinxsidebarwrapper">
|
| 189 |
+
<div>
|
| 190 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 191 |
+
<ul>
|
| 192 |
+
<li><a class="reference internal" href="#">ctest_submit</a><ul>
|
| 193 |
+
<li><a class="reference internal" href="#submit-to-cdash-upload-api">Submit to CDash Upload API</a></li>
|
| 194 |
+
</ul>
|
| 195 |
+
</li>
|
| 196 |
+
</ul>
|
| 197 |
+
|
| 198 |
+
</div>
|
| 199 |
+
<div>
|
| 200 |
+
<h4>Previous topic</h4>
|
| 201 |
+
<p class="topless"><a href="ctest_start.html"
|
| 202 |
+
title="previous chapter">ctest_start</a></p>
|
| 203 |
+
</div>
|
| 204 |
+
<div>
|
| 205 |
+
<h4>Next topic</h4>
|
| 206 |
+
<p class="topless"><a href="ctest_test.html"
|
| 207 |
+
title="next chapter">ctest_test</a></p>
|
| 208 |
+
</div>
|
| 209 |
+
<div role="note" aria-label="source link">
|
| 210 |
+
<h3>This Page</h3>
|
| 211 |
+
<ul class="this-page-menu">
|
| 212 |
+
<li><a href="../_sources/command/ctest_submit.rst.txt"
|
| 213 |
+
rel="nofollow">Show Source</a></li>
|
| 214 |
+
</ul>
|
| 215 |
+
</div>
|
| 216 |
+
<search id="searchbox" style="display: none" role="search">
|
| 217 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 218 |
+
<div class="searchformwrapper">
|
| 219 |
+
<form class="search" action="../search.html" method="get">
|
| 220 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 221 |
+
<input type="submit" value="Go" />
|
| 222 |
+
</form>
|
| 223 |
+
</div>
|
| 224 |
+
</search>
|
| 225 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
<div class="clearer"></div>
|
| 229 |
+
</div>
|
| 230 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 231 |
+
<h3>Navigation</h3>
|
| 232 |
+
<ul>
|
| 233 |
+
<li class="right" style="margin-right: 10px">
|
| 234 |
+
<a href="../genindex.html" title="General Index"
|
| 235 |
+
>index</a></li>
|
| 236 |
+
<li class="right" >
|
| 237 |
+
<a href="ctest_test.html" title="ctest_test"
|
| 238 |
+
>next</a> |</li>
|
| 239 |
+
<li class="right" >
|
| 240 |
+
<a href="ctest_start.html" title="ctest_start"
|
| 241 |
+
>previous</a> |</li>
|
| 242 |
+
<li>
|
| 243 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 244 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 245 |
+
</li>
|
| 246 |
+
<li>
|
| 247 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 248 |
+
</li>
|
| 249 |
+
<li>
|
| 250 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 251 |
+
</li>
|
| 252 |
+
|
| 253 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 254 |
+
<li class="nav-item nav-item-this"><a href="">ctest_submit</a></li>
|
| 255 |
+
</ul>
|
| 256 |
+
</div>
|
| 257 |
+
|
| 258 |
+
<div class="footer" role="contentinfo">
|
| 259 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 260 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 261 |
+
</div>
|
| 262 |
+
</body>
|
| 263 |
+
</html>
|
cmake/doc/cmake/html/command/ctest_test.html
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
|
| 3 |
+
<html lang="en" data-content_root="../">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="utf-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
+
|
| 8 |
+
<title>ctest_test — CMake 3.31.5 Documentation</title>
|
| 9 |
+
|
| 10 |
+
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
|
| 11 |
+
<link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=3e562cf9" />
|
| 12 |
+
|
| 13 |
+
<script src="../_static/documentation_options.js?v=f480327f"></script>
|
| 14 |
+
<script src="../_static/doctools.js?v=9a2dae69"></script>
|
| 15 |
+
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="../_static/cmake-favicon.ico"/>
|
| 18 |
+
<link rel="index" title="Index" href="../genindex.html" />
|
| 19 |
+
<link rel="search" title="Search" href="../search.html" />
|
| 20 |
+
<link rel="next" title="ctest_update" href="ctest_update.html" />
|
| 21 |
+
<link rel="prev" title="ctest_submit" href="ctest_submit.html" />
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
</head><body>
|
| 25 |
+
|
| 26 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 27 |
+
<h3>Navigation</h3>
|
| 28 |
+
<ul>
|
| 29 |
+
<li class="right" style="margin-right: 10px">
|
| 30 |
+
<a href="../genindex.html" title="General Index"
|
| 31 |
+
accesskey="I">index</a></li>
|
| 32 |
+
<li class="right" >
|
| 33 |
+
<a href="ctest_update.html" title="ctest_update"
|
| 34 |
+
accesskey="N">next</a> |</li>
|
| 35 |
+
<li class="right" >
|
| 36 |
+
<a href="ctest_submit.html" title="ctest_submit"
|
| 37 |
+
accesskey="P">previous</a> |</li>
|
| 38 |
+
<li>
|
| 39 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 40 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 41 |
+
</li>
|
| 42 |
+
<li>
|
| 43 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 44 |
+
</li>
|
| 45 |
+
<li>
|
| 46 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 47 |
+
</li>
|
| 48 |
+
|
| 49 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li>
|
| 50 |
+
<li class="nav-item nav-item-this"><a href="">ctest_test</a></li>
|
| 51 |
+
</ul>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="document">
|
| 55 |
+
<div class="documentwrapper">
|
| 56 |
+
<div class="bodywrapper">
|
| 57 |
+
<div class="body" role="main">
|
| 58 |
+
|
| 59 |
+
<section id="ctest-test">
|
| 60 |
+
<span id="command:ctest_test"></span><h1>ctest_test<a class="headerlink" href="#ctest-test" title="Link to this heading">¶</a></h1>
|
| 61 |
+
<p>Perform the <a class="reference internal" href="../manual/ctest.1.html#ctest-test-step"><span class="std std-ref">CTest Test Step</span></a> as a <a class="reference internal" href="../manual/ctest.1.html#dashboard-client"><span class="std std-ref">Dashboard Client</span></a>.</p>
|
| 62 |
+
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ctest_test(</span><span class="p">[</span><span class="no">BUILD</span><span class="w"> </span><span class="nv"><build-dir></span><span class="p">]</span><span class="w"> </span><span class="p">[</span><span class="no">APPEND</span><span class="p">]</span>
|
| 63 |
+
<span class="w"> </span><span class="p">[</span><span class="no">START</span><span class="w"> </span><span class="nv"><start-number></span><span class="p">]</span>
|
| 64 |
+
<span class="w"> </span><span class="p">[</span><span class="no">END</span><span class="w"> </span><span class="nv"><end-number></span><span class="p">]</span>
|
| 65 |
+
<span class="w"> </span><span class="p">[</span><span class="no">STRIDE</span><span class="w"> </span><span class="nv"><stride-number></span><span class="p">]</span>
|
| 66 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE</span><span class="w"> </span><span class="nv"><exclude-regex></span><span class="p">]</span>
|
| 67 |
+
<span class="w"> </span><span class="p">[</span><span class="no">INCLUDE</span><span class="w"> </span><span class="nv"><include-regex></span><span class="p">]</span>
|
| 68 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_LABEL</span><span class="w"> </span><span class="nv"><label-exclude-regex></span><span class="p">]</span>
|
| 69 |
+
<span class="w"> </span><span class="p">[</span><span class="no">INCLUDE_LABEL</span><span class="w"> </span><span class="nv"><label-include-regex></span><span class="p">]</span>
|
| 70 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FROM_FILE</span><span class="w"> </span><span class="nv"><filename></span><span class="p">]</span>
|
| 71 |
+
<span class="w"> </span><span class="p">[</span><span class="no">INCLUDE_FROM_FILE</span><span class="w"> </span><span class="nv"><filename></span><span class="p">]</span>
|
| 72 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FIXTURE</span><span class="w"> </span><span class="nv"><regex></span><span class="p">]</span>
|
| 73 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FIXTURE_SETUP</span><span class="w"> </span><span class="nv"><regex></span><span class="p">]</span>
|
| 74 |
+
<span class="w"> </span><span class="p">[</span><span class="no">EXCLUDE_FIXTURE_CLEANUP</span><span class="w"> </span><span class="nv"><regex></span><span class="p">]</span>
|
| 75 |
+
<span class="w"> </span><span class="p">[</span><span class="no">PARALLEL_LEVEL</span><span class="w"> </span><span class="p">[</span><span class="nv"><level></span><span class="p">]]</span>
|
| 76 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RESOURCE_SPEC_FILE</span><span class="w"> </span><span class="nv"><file></span><span class="p">]</span>
|
| 77 |
+
<span class="w"> </span><span class="p">[</span><span class="no">TEST_LOAD</span><span class="w"> </span><span class="nv"><threshold></span><span class="p">]</span>
|
| 78 |
+
<span class="w"> </span><span class="p">[</span><span class="no">SCHEDULE_RANDOM</span><span class="w"> </span><span class="o"><</span><span class="no">ON</span><span class="p">|</span><span class="no">OFF</span><span class="o">></span><span class="p">]</span>
|
| 79 |
+
<span class="w"> </span><span class="p">[</span><span class="no">STOP_ON_FAILURE</span><span class="p">]</span>
|
| 80 |
+
<span class="w"> </span><span class="p">[</span><span class="no">STOP_TIME</span><span class="w"> </span><span class="nv"><time-of-day></span><span class="p">]</span>
|
| 81 |
+
<span class="w"> </span><span class="p">[</span><span class="no">RETURN_VALUE</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 82 |
+
<span class="w"> </span><span class="p">[</span><span class="no">CAPTURE_CMAKE_ERROR</span><span class="w"> </span><span class="nv"><result-var></span><span class="p">]</span>
|
| 83 |
+
<span class="w"> </span><span class="p">[</span><span class="no">REPEAT</span><span class="w"> </span><span class="nv"><mode></span><span class="o">:</span><span class="nv"><n></span><span class="p">]</span>
|
| 84 |
+
<span class="w"> </span><span class="p">[</span><span class="no">OUTPUT_JUNIT</span><span class="w"> </span><span class="nv"><file></span><span class="p">]</span>
|
| 85 |
+
<span class="w"> </span><span class="p">[</span><span class="no">QUIET</span><span class="p">]</span>
|
| 86 |
+
<span class="w"> </span><span class="nf">)</span>
|
| 87 |
+
</pre></div>
|
| 88 |
+
</div>
|
| 89 |
+
<p>Run tests in the project build tree and store results in
|
| 90 |
+
<code class="docutils literal notranslate"><span class="pre">Test.xml</span></code> for submission with the <span class="target" id="index-0-command:ctest_submit"></span><a class="reference internal" href="ctest_submit.html#command:ctest_submit" title="ctest_submit"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_submit()</span></code></a> command.</p>
|
| 91 |
+
<p>The options are:</p>
|
| 92 |
+
<dl>
|
| 93 |
+
<dt><code class="docutils literal notranslate"><span class="pre">BUILD</span> <span class="pre"><build-dir></span></code></dt><dd><p>Specify the top-level build directory. If not given, the
|
| 94 |
+
<span class="target" id="index-0-variable:CTEST_BINARY_DIRECTORY"></span><a class="reference internal" href="../variable/CTEST_BINARY_DIRECTORY.html#variable:CTEST_BINARY_DIRECTORY" title="CTEST_BINARY_DIRECTORY"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_BINARY_DIRECTORY</span></code></a> variable is used.</p>
|
| 95 |
+
</dd>
|
| 96 |
+
<dt><code class="docutils literal notranslate"><span class="pre">APPEND</span></code></dt><dd><p>Mark <code class="docutils literal notranslate"><span class="pre">Test.xml</span></code> for append to results previously submitted to a
|
| 97 |
+
dashboard server since the last <span class="target" id="index-0-command:ctest_start"></span><a class="reference internal" href="ctest_start.html#command:ctest_start" title="ctest_start"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">ctest_start()</span></code></a> call.
|
| 98 |
+
Append semantics are defined by the dashboard server in use.
|
| 99 |
+
This does <em>not</em> cause results to be appended to a <code class="docutils literal notranslate"><span class="pre">.xml</span></code> file
|
| 100 |
+
produced by a previous call to this command.</p>
|
| 101 |
+
</dd>
|
| 102 |
+
<dt><code class="docutils literal notranslate"><span class="pre">START</span> <span class="pre"><start-number></span></code></dt><dd><p>Specify the beginning of a range of test numbers.</p>
|
| 103 |
+
</dd>
|
| 104 |
+
<dt><code class="docutils literal notranslate"><span class="pre">END</span> <span class="pre"><end-number></span></code></dt><dd><p>Specify the end of a range of test numbers.</p>
|
| 105 |
+
</dd>
|
| 106 |
+
<dt><code class="docutils literal notranslate"><span class="pre">STRIDE</span> <span class="pre"><stride-number></span></code></dt><dd><p>Specify the stride by which to step across a range of test numbers.</p>
|
| 107 |
+
</dd>
|
| 108 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE</span> <span class="pre"><exclude-regex></span></code></dt><dd><p>Specify a regular expression matching test names to exclude.</p>
|
| 109 |
+
</dd>
|
| 110 |
+
<dt><code class="docutils literal notranslate"><span class="pre">INCLUDE</span> <span class="pre"><include-regex></span></code></dt><dd><p>Specify a regular expression matching test names to include.
|
| 111 |
+
Tests not matching this expression are excluded.</p>
|
| 112 |
+
</dd>
|
| 113 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_LABEL</span> <span class="pre"><label-exclude-regex></span></code></dt><dd><p>Specify a regular expression matching test labels to exclude.</p>
|
| 114 |
+
</dd>
|
| 115 |
+
<dt><code class="docutils literal notranslate"><span class="pre">INCLUDE_LABEL</span> <span class="pre"><label-include-regex></span></code></dt><dd><p>Specify a regular expression matching test labels to include.
|
| 116 |
+
Tests not matching this expression are excluded.</p>
|
| 117 |
+
</dd>
|
| 118 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_FROM_FILE</span> <span class="pre"><filename></span></code></dt><dd><div class="versionadded">
|
| 119 |
+
<p><span class="versionmodified added">Added in version 3.29.</span></p>
|
| 120 |
+
</div>
|
| 121 |
+
<p>Do NOT run tests listed with their exact name in the given file.</p>
|
| 122 |
+
</dd>
|
| 123 |
+
<dt><code class="docutils literal notranslate"><span class="pre">INCLUDE_FROM_FILE</span> <span class="pre"><filename></span></code></dt><dd><div class="versionadded">
|
| 124 |
+
<p><span class="versionmodified added">Added in version 3.29.</span></p>
|
| 125 |
+
</div>
|
| 126 |
+
<p>Only run the tests listed with their exact name in the given file.</p>
|
| 127 |
+
</dd>
|
| 128 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_FIXTURE</span> <span class="pre"><regex></span></code></dt><dd><div class="versionadded">
|
| 129 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 130 |
+
</div>
|
| 131 |
+
<p>If a test in the set of tests to be executed requires a particular fixture,
|
| 132 |
+
that fixture's setup and cleanup tests would normally be added to the test
|
| 133 |
+
set automatically. This option prevents adding setup or cleanup tests for
|
| 134 |
+
fixtures matching the <code class="docutils literal notranslate"><span class="pre"><regex></span></code>. Note that all other fixture behavior is
|
| 135 |
+
retained, including test dependencies and skipping tests that have fixture
|
| 136 |
+
setup tests that fail.</p>
|
| 137 |
+
</dd>
|
| 138 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_FIXTURE_SETUP</span> <span class="pre"><regex></span></code></dt><dd><div class="versionadded">
|
| 139 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 140 |
+
</div>
|
| 141 |
+
<p>Same as <code class="docutils literal notranslate"><span class="pre">EXCLUDE_FIXTURE</span></code> except only matching setup tests are excluded.</p>
|
| 142 |
+
</dd>
|
| 143 |
+
<dt><code class="docutils literal notranslate"><span class="pre">EXCLUDE_FIXTURE_CLEANUP</span> <span class="pre"><regex></span></code></dt><dd><div class="versionadded">
|
| 144 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 145 |
+
</div>
|
| 146 |
+
<p>Same as <code class="docutils literal notranslate"><span class="pre">EXCLUDE_FIXTURE</span></code> except only matching cleanup tests are excluded.</p>
|
| 147 |
+
</dd>
|
| 148 |
+
<dt><code class="docutils literal notranslate"><span class="pre">PARALLEL_LEVEL</span> <span class="pre">[<level>]</span></code></dt><dd><p>Run tests in parallel, limited to a given level of parallelism.</p>
|
| 149 |
+
<div class="versionadded">
|
| 150 |
+
<p><span class="versionmodified added">Added in version 3.29: </span>The <code class="docutils literal notranslate"><span class="pre"><level></span></code> may be omitted, or <code class="docutils literal notranslate"><span class="pre">0</span></code>, to let ctest use a default
|
| 151 |
+
level of parallelism, or unbounded parallelism, respectively, as
|
| 152 |
+
documented by the <a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-j"><code class="xref std std-option docutils literal notranslate"><span class="pre">ctest</span> <span class="pre">--parallel</span></code></a> option.</p>
|
| 153 |
+
</div>
|
| 154 |
+
</dd>
|
| 155 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RESOURCE_SPEC_FILE</span> <span class="pre"><file></span></code></dt><dd><div class="versionadded">
|
| 156 |
+
<p><span class="versionmodified added">Added in version 3.16.</span></p>
|
| 157 |
+
</div>
|
| 158 |
+
<p>Specify a
|
| 159 |
+
<a class="reference internal" href="../manual/ctest.1.html#ctest-resource-specification-file"><span class="std std-ref">resource specification file</span></a>. See
|
| 160 |
+
<a class="reference internal" href="../manual/ctest.1.html#ctest-resource-allocation"><span class="std std-ref">Resource Allocation</span></a> for more information.</p>
|
| 161 |
+
</dd>
|
| 162 |
+
<dt><code class="docutils literal notranslate"><span class="pre">TEST_LOAD</span> <span class="pre"><threshold></span></code></dt><dd><div class="versionadded">
|
| 163 |
+
<p><span class="versionmodified added">Added in version 3.4.</span></p>
|
| 164 |
+
</div>
|
| 165 |
+
<p>While running tests in parallel, try not to start tests when they
|
| 166 |
+
may cause the CPU load to pass above a given threshold. If not
|
| 167 |
+
specified the <span class="target" id="index-0-variable:CTEST_TEST_LOAD"></span><a class="reference internal" href="../variable/CTEST_TEST_LOAD.html#variable:CTEST_TEST_LOAD" title="CTEST_TEST_LOAD"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_TEST_LOAD</span></code></a> variable will be checked,
|
| 168 |
+
and then the <a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-test-load"><code class="xref std std-option docutils literal notranslate"><span class="pre">--test-load</span></code></a> command-line
|
| 169 |
+
argument to <span class="target" id="index-0-manual:ctest(1)"></span><a class="reference internal" href="../manual/ctest.1.html#manual:ctest(1)" title="ctest(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">ctest(1)</span></code></a>. See also the <code class="docutils literal notranslate"><span class="pre">TestLoad</span></code> setting
|
| 170 |
+
in the <a class="reference internal" href="../manual/ctest.1.html#ctest-test-step"><span class="std std-ref">CTest Test Step</span></a>.</p>
|
| 171 |
+
</dd>
|
| 172 |
+
<dt><code class="docutils literal notranslate"><span class="pre">REPEAT</span> <span class="pre"><mode>:<n></span></code></dt><dd><div class="versionadded">
|
| 173 |
+
<p><span class="versionmodified added">Added in version 3.17.</span></p>
|
| 174 |
+
</div>
|
| 175 |
+
<p>Run tests repeatedly based on the given <code class="docutils literal notranslate"><span class="pre"><mode></span></code> up to <code class="docutils literal notranslate"><span class="pre"><n></span></code> times.
|
| 176 |
+
The modes are:</p>
|
| 177 |
+
<dl class="simple">
|
| 178 |
+
<dt><code class="docutils literal notranslate"><span class="pre">UNTIL_FAIL</span></code></dt><dd><p>Require each test to run <code class="docutils literal notranslate"><span class="pre"><n></span></code> times without failing in order to pass.
|
| 179 |
+
This is useful in finding sporadic failures in test cases.</p>
|
| 180 |
+
</dd>
|
| 181 |
+
<dt><code class="docutils literal notranslate"><span class="pre">UNTIL_PASS</span></code></dt><dd><p>Allow each test to run up to <code class="docutils literal notranslate"><span class="pre"><n></span></code> times in order to pass.
|
| 182 |
+
Repeats tests if they fail for any reason.
|
| 183 |
+
This is useful in tolerating sporadic failures in test cases.</p>
|
| 184 |
+
</dd>
|
| 185 |
+
<dt><code class="docutils literal notranslate"><span class="pre">AFTER_TIMEOUT</span></code></dt><dd><p>Allow each test to run up to <code class="docutils literal notranslate"><span class="pre"><n></span></code> times in order to pass.
|
| 186 |
+
Repeats tests only if they timeout.
|
| 187 |
+
This is useful in tolerating sporadic timeouts in test cases
|
| 188 |
+
on busy machines.</p>
|
| 189 |
+
</dd>
|
| 190 |
+
</dl>
|
| 191 |
+
</dd>
|
| 192 |
+
<dt><code class="docutils literal notranslate"><span class="pre">SCHEDULE_RANDOM</span> <span class="pre"><ON|OFF></span></code></dt><dd><p>Launch tests in a random order. This may be useful for detecting
|
| 193 |
+
implicit test dependencies.</p>
|
| 194 |
+
</dd>
|
| 195 |
+
<dt><code class="docutils literal notranslate"><span class="pre">STOP_ON_FAILURE</span></code></dt><dd><div class="versionadded">
|
| 196 |
+
<p><span class="versionmodified added">Added in version 3.18.</span></p>
|
| 197 |
+
</div>
|
| 198 |
+
<p>Stop the execution of the tests once one has failed.</p>
|
| 199 |
+
</dd>
|
| 200 |
+
<dt><code class="docutils literal notranslate"><span class="pre">STOP_TIME</span> <span class="pre"><time-of-day></span></code></dt><dd><p>Specify a time of day at which the tests should all stop running.</p>
|
| 201 |
+
</dd>
|
| 202 |
+
<dt><code class="docutils literal notranslate"><span class="pre">RETURN_VALUE</span> <span class="pre"><result-var></span></code></dt><dd><p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable <code class="docutils literal notranslate"><span class="pre">0</span></code> if all tests passed.
|
| 203 |
+
Store non-zero if anything went wrong.</p>
|
| 204 |
+
</dd>
|
| 205 |
+
<dt><code class="docutils literal notranslate"><span class="pre">CAPTURE_CMAKE_ERROR</span> <span class="pre"><result-var></span></code></dt><dd><div class="versionadded">
|
| 206 |
+
<p><span class="versionmodified added">Added in version 3.7.</span></p>
|
| 207 |
+
</div>
|
| 208 |
+
<p>Store in the <code class="docutils literal notranslate"><span class="pre"><result-var></span></code> variable -1 if there are any errors running
|
| 209 |
+
the command and prevent ctest from returning non-zero if an error occurs.</p>
|
| 210 |
+
</dd>
|
| 211 |
+
<dt><code class="docutils literal notranslate"><span class="pre">OUTPUT_JUNIT</span> <span class="pre"><file></span></code></dt><dd><div class="versionadded">
|
| 212 |
+
<p><span class="versionmodified added">Added in version 3.21.</span></p>
|
| 213 |
+
</div>
|
| 214 |
+
<p>Write test results to <code class="docutils literal notranslate"><span class="pre"><file></span></code> in JUnit XML format. If <code class="docutils literal notranslate"><span class="pre"><file></span></code> is a
|
| 215 |
+
relative path, it will be placed in the build directory. If <code class="docutils literal notranslate"><span class="pre"><file></span></code>
|
| 216 |
+
already exists, it will be overwritten. Note that the resulting JUnit XML
|
| 217 |
+
file is <strong>not</strong> uploaded to CDash because it would be redundant with
|
| 218 |
+
CTest's <code class="docutils literal notranslate"><span class="pre">Test.xml</span></code> file.</p>
|
| 219 |
+
</dd>
|
| 220 |
+
<dt><code class="docutils literal notranslate"><span class="pre">QUIET</span></code></dt><dd><div class="versionadded">
|
| 221 |
+
<p><span class="versionmodified added">Added in version 3.3.</span></p>
|
| 222 |
+
</div>
|
| 223 |
+
<p>Suppress any CTest-specific non-error messages that would have otherwise
|
| 224 |
+
been printed to the console. Output from the underlying test command is not
|
| 225 |
+
affected. Summary info detailing the percentage of passing tests is also
|
| 226 |
+
unaffected by the <code class="docutils literal notranslate"><span class="pre">QUIET</span></code> option.</p>
|
| 227 |
+
</dd>
|
| 228 |
+
</dl>
|
| 229 |
+
<p>See also the <span class="target" id="index-0-variable:CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE"></span><a class="reference internal" href="../variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.html#variable:CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE" title="CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE</span></code></a>,
|
| 230 |
+
<span class="target" id="index-0-variable:CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE"></span><a class="reference internal" href="../variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.html#variable:CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE" title="CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE</span></code></a> and
|
| 231 |
+
<span class="target" id="index-0-variable:CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION"></span><a class="reference internal" href="../variable/CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION.html#variable:CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION" title="CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION</span></code></a> variables, along with their
|
| 232 |
+
corresponding <span class="target" id="index-1-manual:ctest(1)"></span><a class="reference internal" href="../manual/ctest.1.html#manual:ctest(1)" title="ctest(1)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">ctest(1)</span></code></a> command line options
|
| 233 |
+
<a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-test-output-size-passed"><code class="xref std std-option docutils literal notranslate"><span class="pre">--test-output-size-passed</span></code></a>,
|
| 234 |
+
<a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-test-output-size-failed"><code class="xref std std-option docutils literal notranslate"><span class="pre">--test-output-size-failed</span></code></a>, and
|
| 235 |
+
<a class="reference internal" href="../manual/ctest.1.html#cmdoption-ctest-test-output-truncation"><code class="xref std std-option docutils literal notranslate"><span class="pre">--test-output-truncation</span></code></a>.</p>
|
| 236 |
+
<section id="additional-test-measurements">
|
| 237 |
+
<span id="id1"></span><h2>Additional Test Measurements<a class="headerlink" href="#additional-test-measurements" title="Link to this heading">¶</a></h2>
|
| 238 |
+
<p>CTest can parse the output of your tests for extra measurements to report
|
| 239 |
+
to CDash.</p>
|
| 240 |
+
<p>When run as a <a class="reference internal" href="../manual/ctest.1.html#dashboard-client"><span class="std std-ref">Dashboard Client</span></a>, CTest will include these custom
|
| 241 |
+
measurements in the <code class="docutils literal notranslate"><span class="pre">Test.xml</span></code> file that gets uploaded to CDash.</p>
|
| 242 |
+
<p>Check the <a class="reference external" href="https://github.com/Kitware/CDash/blob/master/docs/test_measurements.md">CDash test measurement documentation</a>
|
| 243 |
+
for more information on the types of test measurements that CDash recognizes.</p>
|
| 244 |
+
<p>The following example demonstrates how to output a variety of custom test
|
| 245 |
+
measurements.</p>
|
| 246 |
+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 247 |
+
<span class="w"> </span><span class="s">"<CTestMeasurement type=</span><span class="se">\"</span><span class="s">numeric/double</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">score</span><span class="se">\"</span><span class="s">>28.3</CTestMeasurement>"</span>
|
| 248 |
+
<span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 249 |
+
|
| 250 |
+
<span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 251 |
+
<span class="w"> </span><span class="s">"<CTestMeasurement type=</span><span class="se">\"</span><span class="s">text/string</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">color</span><span class="se">\"</span><span class="s">>red</CTestMeasurement>"</span>
|
| 252 |
+
<span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 253 |
+
|
| 254 |
+
<span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 255 |
+
<span class="w"> </span><span class="s">"<CTestMeasurement type=</span><span class="se">\"</span><span class="s">text/link</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">CMake URL</span><span class="se">\"</span><span class="s">>https://cmake.org</CTestMeasurement>"</span>
|
| 256 |
+
<span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 257 |
+
|
| 258 |
+
<span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 259 |
+
<span class="w"> </span><span class="s">"<CTestMeasurement type=</span><span class="se">\"</span><span class="s">text/preformatted</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">Console Output</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><<</span>
|
| 260 |
+
<span class="w"> </span><span class="s">"line 1.</span><span class="se">\n</span><span class="s">"</span><span class="w"> </span><span class="o"><<</span>
|
| 261 |
+
<span class="w"> </span><span class="s">" </span><span class="se">\033</span><span class="s">[31;1m line 2. Bold red, and indented!</span><span class="se">\033</span><span class="s">[0;0ml</span><span class="se">\n</span><span class="s">"</span><span class="w"> </span><span class="o"><<</span>
|
| 262 |
+
<span class="w"> </span><span class="s">"line 3. Not bold or indented...</span><span class="se">\n</span><span class="s">"</span><span class="w"> </span><span class="o"><<</span>
|
| 263 |
+
<span class="w"> </span><span class="s">"</CTestMeasurement>"</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 264 |
+
</pre></div>
|
| 265 |
+
</div>
|
| 266 |
+
<section id="image-measurements">
|
| 267 |
+
<h3>Image Measurements<a class="headerlink" href="#image-measurements" title="Link to this heading">¶</a></h3>
|
| 268 |
+
<p>The following example demonstrates how to upload test images to CDash.</p>
|
| 269 |
+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 270 |
+
<span class="w"> </span><span class="s">"<CTestMeasurementFile type=</span><span class="se">\"</span><span class="s">image/jpg</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">TestImage</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><<</span>
|
| 271 |
+
<span class="w"> </span><span class="s">"/dir/to/test_img.jpg</CTestMeasurementFile>"</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 272 |
+
|
| 273 |
+
<span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 274 |
+
<span class="w"> </span><span class="s">"<CTestMeasurementFile type=</span><span class="se">\"</span><span class="s">image/gif</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">ValidImage</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><<</span>
|
| 275 |
+
<span class="w"> </span><span class="s">"/dir/to/valid_img.gif</CTestMeasurementFile>"</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 276 |
+
|
| 277 |
+
<span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 278 |
+
<span class="w"> </span><span class="s">"<CTestMeasurementFile type=</span><span class="se">\"</span><span class="s">image/png</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">AlgoResult</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><<</span>
|
| 279 |
+
<span class="w"> </span><span class="s">"/dir/to/img.png</CTestMeasurementFile>"</span>
|
| 280 |
+
<span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 281 |
+
</pre></div>
|
| 282 |
+
</div>
|
| 283 |
+
<p>Images will be displayed together in an interactive comparison mode on CDash
|
| 284 |
+
if they are provided with two or more of the following names.</p>
|
| 285 |
+
<ul class="simple">
|
| 286 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">TestImage</span></code></p></li>
|
| 287 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">ValidImage</span></code></p></li>
|
| 288 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">BaselineImage</span></code></p></li>
|
| 289 |
+
<li><p><code class="docutils literal notranslate"><span class="pre">DifferenceImage2</span></code></p></li>
|
| 290 |
+
</ul>
|
| 291 |
+
<p>By convention, <code class="docutils literal notranslate"><span class="pre">TestImage</span></code> is the image generated by your test, and
|
| 292 |
+
<code class="docutils literal notranslate"><span class="pre">ValidImage</span></code> (or <code class="docutils literal notranslate"><span class="pre">BaselineImage</span></code>) is basis of comparison used to determine
|
| 293 |
+
if the test passed or failed.</p>
|
| 294 |
+
<p>If another image name is used it will be displayed by CDash as a static image
|
| 295 |
+
separate from the interactive comparison UI.</p>
|
| 296 |
+
</section>
|
| 297 |
+
<section id="attached-files">
|
| 298 |
+
<h3>Attached Files<a class="headerlink" href="#attached-files" title="Link to this heading">¶</a></h3>
|
| 299 |
+
<div class="versionadded">
|
| 300 |
+
<p><span class="versionmodified added">Added in version 3.21.</span></p>
|
| 301 |
+
</div>
|
| 302 |
+
<p>The following example demonstrates how to upload non-image files to CDash.</p>
|
| 303 |
+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 304 |
+
<span class="w"> </span><span class="s">"<CTestMeasurementFile type=</span><span class="se">\"</span><span class="s">file</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">TestInputData1</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><<</span>
|
| 305 |
+
<span class="w"> </span><span class="s">"/dir/to/data1.csv</CTestMeasurementFile></span><span class="se">\n</span><span class="s">"</span><span class="w"> </span><span class="o"><<</span>
|
| 306 |
+
<span class="w"> </span><span class="s">"<CTestMeasurementFile type=</span><span class="se">\"</span><span class="s">file</span><span class="se">\"</span><span class="s"> name=</span><span class="se">\"</span><span class="s">TestInputData2</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><<</span>
|
| 307 |
+
<span class="w"> </span><span class="s">"/dir/to/data2.csv</CTestMeasurementFile>"</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 308 |
+
</pre></div>
|
| 309 |
+
</div>
|
| 310 |
+
<p>If the name of the file to upload is known at configure time, you can use the
|
| 311 |
+
<span class="target" id="index-0-prop_test:ATTACHED_FILES"></span><a class="reference internal" href="../prop_test/ATTACHED_FILES.html#prop_test:ATTACHED_FILES" title="ATTACHED_FILES"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">ATTACHED_FILES</span></code></a> or <span class="target" id="index-0-prop_test:ATTACHED_FILES_ON_FAIL"></span><a class="reference internal" href="../prop_test/ATTACHED_FILES_ON_FAIL.html#prop_test:ATTACHED_FILES_ON_FAIL" title="ATTACHED_FILES_ON_FAIL"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">ATTACHED_FILES_ON_FAIL</span></code></a> test
|
| 312 |
+
properties instead.</p>
|
| 313 |
+
</section>
|
| 314 |
+
<section id="custom-details">
|
| 315 |
+
<h3>Custom Details<a class="headerlink" href="#custom-details" title="Link to this heading">¶</a></h3>
|
| 316 |
+
<div class="versionadded">
|
| 317 |
+
<p><span class="versionmodified added">Added in version 3.21.</span></p>
|
| 318 |
+
</div>
|
| 319 |
+
<p>The following example demonstrates how to specify a custom value for the
|
| 320 |
+
<code class="docutils literal notranslate"><span class="pre">Test</span> <span class="pre">Details</span></code> field displayed on CDash.</p>
|
| 321 |
+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 322 |
+
<span class="w"> </span><span class="s">"<CTestDetails>My Custom Details Value</CTestDetails>"</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 323 |
+
</pre></div>
|
| 324 |
+
</div>
|
| 325 |
+
</section>
|
| 326 |
+
<section id="additional-labels">
|
| 327 |
+
<span id="id2"></span><h3>Additional Labels<a class="headerlink" href="#additional-labels" title="Link to this heading">¶</a></h3>
|
| 328 |
+
<div class="versionadded">
|
| 329 |
+
<p><span class="versionmodified added">Added in version 3.22.</span></p>
|
| 330 |
+
</div>
|
| 331 |
+
<p>The following example demonstrates how to add additional labels to a test
|
| 332 |
+
at runtime.</p>
|
| 333 |
+
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="n">std</span><span class="o">::</span><span class="n">cout</span><span class="w"> </span><span class="o"><<</span>
|
| 334 |
+
<span class="w"> </span><span class="s">"<CTestLabel>Custom Label 1</CTestLabel></span><span class="se">\n</span><span class="s">"</span><span class="w"> </span><span class="o"><<</span>
|
| 335 |
+
<span class="w"> </span><span class="s">"<CTestLabel>Custom Label 2</CTestLabel>"</span><span class="w"> </span><span class="o"><<</span><span class="w"> </span><span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
|
| 336 |
+
</pre></div>
|
| 337 |
+
</div>
|
| 338 |
+
<p>Use the <span class="target" id="index-0-prop_test:LABELS"></span><a class="reference internal" href="../prop_test/LABELS.html#prop_test:LABELS" title="LABELS"><code class="xref cmake cmake-prop_test docutils literal notranslate"><span class="pre">LABELS</span></code></a> test property instead for labels that can be
|
| 339 |
+
determined at configure time.</p>
|
| 340 |
+
</section>
|
| 341 |
+
</section>
|
| 342 |
+
</section>
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
<div class="clearer"></div>
|
| 346 |
+
</div>
|
| 347 |
+
</div>
|
| 348 |
+
</div>
|
| 349 |
+
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
| 350 |
+
<div class="sphinxsidebarwrapper">
|
| 351 |
+
<div>
|
| 352 |
+
<h3><a href="../index.html">Table of Contents</a></h3>
|
| 353 |
+
<ul>
|
| 354 |
+
<li><a class="reference internal" href="#">ctest_test</a><ul>
|
| 355 |
+
<li><a class="reference internal" href="#additional-test-measurements">Additional Test Measurements</a><ul>
|
| 356 |
+
<li><a class="reference internal" href="#image-measurements">Image Measurements</a></li>
|
| 357 |
+
<li><a class="reference internal" href="#attached-files">Attached Files</a></li>
|
| 358 |
+
<li><a class="reference internal" href="#custom-details">Custom Details</a></li>
|
| 359 |
+
<li><a class="reference internal" href="#additional-labels">Additional Labels</a></li>
|
| 360 |
+
</ul>
|
| 361 |
+
</li>
|
| 362 |
+
</ul>
|
| 363 |
+
</li>
|
| 364 |
+
</ul>
|
| 365 |
+
|
| 366 |
+
</div>
|
| 367 |
+
<div>
|
| 368 |
+
<h4>Previous topic</h4>
|
| 369 |
+
<p class="topless"><a href="ctest_submit.html"
|
| 370 |
+
title="previous chapter">ctest_submit</a></p>
|
| 371 |
+
</div>
|
| 372 |
+
<div>
|
| 373 |
+
<h4>Next topic</h4>
|
| 374 |
+
<p class="topless"><a href="ctest_update.html"
|
| 375 |
+
title="next chapter">ctest_update</a></p>
|
| 376 |
+
</div>
|
| 377 |
+
<div role="note" aria-label="source link">
|
| 378 |
+
<h3>This Page</h3>
|
| 379 |
+
<ul class="this-page-menu">
|
| 380 |
+
<li><a href="../_sources/command/ctest_test.rst.txt"
|
| 381 |
+
rel="nofollow">Show Source</a></li>
|
| 382 |
+
</ul>
|
| 383 |
+
</div>
|
| 384 |
+
<search id="searchbox" style="display: none" role="search">
|
| 385 |
+
<h3 id="searchlabel">Quick search</h3>
|
| 386 |
+
<div class="searchformwrapper">
|
| 387 |
+
<form class="search" action="../search.html" method="get">
|
| 388 |
+
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
| 389 |
+
<input type="submit" value="Go" />
|
| 390 |
+
</form>
|
| 391 |
+
</div>
|
| 392 |
+
</search>
|
| 393 |
+
<script>document.getElementById('searchbox').style.display = "block"</script>
|
| 394 |
+
</div>
|
| 395 |
+
</div>
|
| 396 |
+
<div class="clearer"></div>
|
| 397 |
+
</div>
|
| 398 |
+
<div class="related" role="navigation" aria-label="related navigation">
|
| 399 |
+
<h3>Navigation</h3>
|
| 400 |
+
<ul>
|
| 401 |
+
<li class="right" style="margin-right: 10px">
|
| 402 |
+
<a href="../genindex.html" title="General Index"
|
| 403 |
+
>index</a></li>
|
| 404 |
+
<li class="right" >
|
| 405 |
+
<a href="ctest_update.html" title="ctest_update"
|
| 406 |
+
>next</a> |</li>
|
| 407 |
+
<li class="right" >
|
| 408 |
+
<a href="ctest_submit.html" title="ctest_submit"
|
| 409 |
+
>previous</a> |</li>
|
| 410 |
+
<li>
|
| 411 |
+
<img src="../_static/cmake-logo-16.png" alt=""
|
| 412 |
+
style="vertical-align: middle; margin-top: -2px" />
|
| 413 |
+
</li>
|
| 414 |
+
<li>
|
| 415 |
+
<a href="https://cmake.org/">CMake</a> »
|
| 416 |
+
</li>
|
| 417 |
+
<li>
|
| 418 |
+
<a href="../index.html">3.31.5 Documentation</a> »
|
| 419 |
+
</li>
|
| 420 |
+
|
| 421 |
+
<li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li>
|
| 422 |
+
<li class="nav-item nav-item-this"><a href="">ctest_test</a></li>
|
| 423 |
+
</ul>
|
| 424 |
+
</div>
|
| 425 |
+
|
| 426 |
+
<div class="footer" role="contentinfo">
|
| 427 |
+
© Copyright 2000-2024 Kitware, Inc. and Contributors.
|
| 428 |
+
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
|
| 429 |
+
</div>
|
| 430 |
+
</body>
|
| 431 |
+
</html>
|