mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
Ninja, Makefile: Add compile and link wrapper usage requirements
Introduce new properties which allow target-specific wrapping of compile and link commands with arbitrary command lines. This is similar to the existing compiler and linker launchers, except the new `INTERFACE` compile and link wrappers allows expression as usage requirements. Wrappers are more flexible than launchers with regard to having multiple belonging to a given target, either from the target itself or dependent(s). In such cases, wrappers precede launchers on the resulting command line (so as to not interfere with tools like `ccache`), and are sorted lexicographically by the name of the corresponding CMake global property containing their value. Co-authored-by: Joseph Snyder <joseph.snyder@kitware.com> Issue: #27402, #28110 Fixes: #27598
This commit is contained in:
1 parent
46e63b5025
commit
c355bd02e4
122 files changed
+1467
-64
No files matched your search
@@ -143,6 +143,7 @@ syn keyword cmakeProperty contained
|
||||
\ COMPILE_PDB_NAME
|
||||
\ COMPILE_PDB_OUTPUT_DIRECTORY
|
||||
\ COMPILE_WARNING_AS_ERROR
|
||||
\ COMPILE_WRAPPERS
|
||||
\ COST
|
||||
\ CPACK_DESKTOP_SHORTCUTS
|
||||
\ CPACK_NEVER_OVERWRITE
|
||||
@@ -279,6 +280,7 @@ syn keyword cmakeProperty contained
|
||||
\ INTERFACE_COMPILE_DEFINITIONS
|
||||
\ INTERFACE_COMPILE_FEATURES
|
||||
\ INTERFACE_COMPILE_OPTIONS
|
||||
\ INTERFACE_COMPILE_WRAPPERS
|
||||
\ INTERFACE_CXX_MODULE_SETS
|
||||
\ INTERFACE_HEADER_SETS
|
||||
\ INTERFACE_HEADER_SETS_TO_VERIFY
|
||||
@@ -289,6 +291,7 @@ syn keyword cmakeProperty contained
|
||||
\ INTERFACE_LINK_LIBRARIES_DIRECT
|
||||
\ INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE
|
||||
\ INTERFACE_LINK_OPTIONS
|
||||
\ INTERFACE_LINK_WRAPPERS
|
||||
\ INTERFACE_POSITION_INDEPENDENT_CODE
|
||||
\ INTERFACE_PRECOMPILE_HEADERS
|
||||
\ INTERFACE_SOURCES
|
||||
@@ -325,6 +328,7 @@ syn keyword cmakeProperty contained
|
||||
\ LINK_SEARCH_START_STATIC
|
||||
\ LINK_WARNING_AS_ERROR
|
||||
\ LINK_WHAT_YOU_USE
|
||||
\ LINK_WRAPPERS
|
||||
\ LISTFILE_STACK
|
||||
\ LOCATION
|
||||
\ MACHO_COMPATIBILITY_VERSION
|
||||
|
||||
@@ -570,6 +570,12 @@ for compiling a target.
|
||||
List of header files to precompile and include when compiling
|
||||
sources in the target.
|
||||
|
||||
:prop_tgt:`COMPILE_WRAPPERS`
|
||||
.. versionadded:: 4.5
|
||||
|
||||
List of wrapper names to be prepended to the compile commands for a target's
|
||||
sources. See also :prop_gbl:`CMAKE_COMPILE_WRAPPER_<NAME>`.
|
||||
|
||||
:prop_tgt:`AUTOMOC_MACRO_NAMES`
|
||||
.. versionadded:: 3.10
|
||||
|
||||
@@ -627,6 +633,13 @@ for linking a target.
|
||||
via :prop_tgt:`LINK_OPTIONS` may be listed here such that changing them
|
||||
causes binaries to be linked again.
|
||||
|
||||
:prop_tgt:`LINK_WRAPPERS`
|
||||
.. versionadded:: 4.5
|
||||
|
||||
List of wrapper names to be prepended to the link command for a target's
|
||||
output artifact, if it is an executable, shared library, or module library.
|
||||
See also :prop_gbl:`CMAKE_LINK_WRAPPER_<NAME>`.
|
||||
|
||||
.. _`Target Usage Requirements`:
|
||||
|
||||
Target Usage Requirements
|
||||
@@ -760,6 +773,13 @@ compiling consumers.
|
||||
List of header files to precompile and include when compiling
|
||||
sources in the target's consumers.
|
||||
|
||||
:prop_tgt:`INTERFACE_COMPILE_WRAPPERS`
|
||||
.. versionadded:: 4.5
|
||||
|
||||
List of wrapper names to be prepended to the compile commands when compiling
|
||||
sources in the target's consumers. See also
|
||||
:prop_gbl:`CMAKE_COMPILE_WRAPPER_<NAME>`.
|
||||
|
||||
:prop_tgt:`INTERFACE_AUTOMOC_MACRO_NAMES`
|
||||
.. versionadded:: 3.27
|
||||
|
||||
@@ -809,6 +829,13 @@ linking consumers.
|
||||
List of files on which linking the target's consumers depends, for
|
||||
those that are executables, shared libraries, or module libraries.
|
||||
|
||||
:prop_tgt:`INTERFACE_LINK_WRAPPERS`
|
||||
.. versionadded:: 4.5
|
||||
|
||||
List of wrapper names to be prepended to the link commands for a target's
|
||||
consumers' output artifact, for those that are executables, shared libraries,
|
||||
and module libraries. See also :prop_gbl:`CMAKE_LINK_WRAPPER_<NAME>`.
|
||||
|
||||
.. _`Custom Transitive Properties`:
|
||||
|
||||
Custom Transitive Properties
|
||||
|
||||
@@ -23,9 +23,11 @@ Properties of Global Scope
|
||||
/prop_gbl/AUTORCC_SOURCE_GROUP
|
||||
/prop_gbl/AUTOUIC_SOURCE_GROUP
|
||||
/prop_gbl/CMAKE_C_KNOWN_FEATURES
|
||||
/prop_gbl/CMAKE_COMPILE_WRAPPER_NAME
|
||||
/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES
|
||||
/prop_gbl/CMAKE_CXX_KNOWN_FEATURES
|
||||
/prop_gbl/CMAKE_HIP_KNOWN_FEATURES
|
||||
/prop_gbl/CMAKE_LINK_WRAPPER_NAME
|
||||
/prop_gbl/CMAKE_ROLE
|
||||
/prop_gbl/DEBUG_CONFIGURATIONS
|
||||
/prop_gbl/DISABLED_FEATURES
|
||||
@@ -213,6 +215,7 @@ Properties on Targets
|
||||
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY
|
||||
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
|
||||
/prop_tgt/COMPILE_WARNING_AS_ERROR
|
||||
/prop_tgt/COMPILE_WRAPPERS
|
||||
/prop_tgt/CONFIG_OUTPUT_NAME
|
||||
/prop_tgt/CONFIG_POSTFIX
|
||||
/prop_tgt/CROSSCOMPILING_EMULATOR
|
||||
@@ -329,6 +332,7 @@ Properties on Targets
|
||||
/prop_tgt/INTERFACE_COMPILE_DEFINITIONS
|
||||
/prop_tgt/INTERFACE_COMPILE_FEATURES
|
||||
/prop_tgt/INTERFACE_COMPILE_OPTIONS
|
||||
/prop_tgt/INTERFACE_COMPILE_WRAPPERS
|
||||
/prop_tgt/INTERFACE_CXX_MODULE_SETS
|
||||
/prop_tgt/INTERFACE_FILE_SETS_TYPE
|
||||
/prop_tgt/INTERFACE_HEADER_SETS
|
||||
@@ -340,6 +344,7 @@ Properties on Targets
|
||||
/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT
|
||||
/prop_tgt/INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE
|
||||
/prop_tgt/INTERFACE_LINK_OPTIONS
|
||||
/prop_tgt/INTERFACE_LINK_WRAPPERS
|
||||
/prop_tgt/INTERFACE_POSITION_INDEPENDENT_CODE
|
||||
/prop_tgt/INTERFACE_PRECOMPILE_HEADERS
|
||||
/prop_tgt/INTERFACE_SOURCE_SETS
|
||||
@@ -390,6 +395,7 @@ Properties on Targets
|
||||
/prop_tgt/LINK_SEARCH_START_STATIC
|
||||
/prop_tgt/LINK_WARNING_AS_ERROR
|
||||
/prop_tgt/LINK_WHAT_YOU_USE
|
||||
/prop_tgt/LINK_WRAPPERS
|
||||
/prop_tgt/LINKER_LANGUAGE
|
||||
/prop_tgt/LINKER_TYPE
|
||||
/prop_tgt/LOCATION
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
CMAKE_COMPILE_WRAPPER_<NAME>
|
||||
----------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
Command line to be prepended to compile commands.
|
||||
|
||||
This property holds a command line to be used with the
|
||||
:prop_tgt:`COMPILE_WRAPPERS` and/or :prop_tgt:`INTERFACE_COMPILE_WRAPPERS`
|
||||
target properties. Named values in those target properties (which are
|
||||
:ref:`semicolon-separated lists <CMake Language Lists>`) will reference the
|
||||
correspondingly-named ``CMAKE_COMPILE_WRAPPER_<NAME>`` and prepend the compile
|
||||
command(s) for source(s) of the given target or its consumer(s) with the value
|
||||
of this property.
|
||||
|
||||
This property is supported only by :ref:`Makefile Generators` and
|
||||
:ref:`Ninja Generators`, and is ignored by other generators.
|
||||
|
||||
The value is a :ref:`semicolon-separated list <CMake Language Lists>` of
|
||||
command line arguments. Empty arguments are preserved, and a literal
|
||||
semicolon within an argument may be written as ``\;``.
|
||||
|
||||
Contents of ``CMAKE_COMPILE_WRAPPER_<NAME>`` may use "generator expressions"
|
||||
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
||||
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
|
||||
manual for more on defining buildsystem properties.
|
||||
|
||||
Example
|
||||
^^^^^^^
|
||||
|
||||
Consider the following example:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
add_library(iface INTERFACE)
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE iface)
|
||||
|
||||
set_property(GLOBAL
|
||||
PROPERTY CMAKE_COMPILE_WRAPPER_2_PYTHON_WRAPPER
|
||||
"${Python_EXECUTABLE}" my_wrapper.py
|
||||
)
|
||||
set_property(GLOBAL
|
||||
PROPERTY CMAKE_COMPILE_WRAPPER_1_TIME
|
||||
"${CMAKE_COMMAND}" -E time
|
||||
)
|
||||
|
||||
set_target_properties(iface PROPERTIES
|
||||
INTERFACE_COMPILE_WRAPPERS 1_TIME
|
||||
)
|
||||
set_target_properties(main PROPERTIES
|
||||
COMPILE_WRAPPERS 2_PYTHON_WRAPPER
|
||||
)
|
||||
|
||||
Here, all compile commands for the sources of ``main`` will look like:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
/path/to/cmake -E time /path/to/python my_wrapper.py ...
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
* :prop_gbl:`CMAKE_LINK_WRAPPER_<NAME>`
|
||||
* :prop_tgt:`COMPILE_WRAPPERS`
|
||||
* :prop_tgt:`INTERFACE_COMPILE_WRAPPERS`
|
||||
* :prop_tgt:`<LANG>_COMPILER_LAUNCHER`
|
||||
@@ -0,0 +1,65 @@
|
||||
CMAKE_LINK_WRAPPER_<NAME>
|
||||
-------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
Command line to be prepended to link commands.
|
||||
|
||||
This property holds a command line to be used with the
|
||||
:prop_tgt:`LINK_WRAPPERS` and/or :prop_tgt:`INTERFACE_LINK_WRAPPERS`
|
||||
target properties. Named values in those properties (which are
|
||||
:ref:`semicolon-separated lists <CMake Language Lists>`) will reference the
|
||||
correspondingly-named ``CMAKE_LINK_WRAPPER_<NAME>`` and prepend the link
|
||||
command for the output artifact of the given target or its consumer(s) with the
|
||||
value of this property.
|
||||
|
||||
This property is supported only by :ref:`Makefile Generators` and
|
||||
:ref:`Ninja Generators`, and is ignored by other generators.
|
||||
|
||||
The value is a :ref:`semicolon-separated list <CMake Language Lists>` of
|
||||
command line arguments. Empty arguments are preserved, and a literal
|
||||
semicolon within an argument may be written as ``\;``.
|
||||
|
||||
Contents of ``CMAKE_LINK_WRAPPER_<NAME>`` may use "generator expressions"
|
||||
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
|
||||
manual for available expressions. See the :manual:`cmake-buildsystem(7)`
|
||||
manual for more on defining buildsystem properties.
|
||||
|
||||
Example
|
||||
^^^^^^^
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
add_library(iface INTERFACE)
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE iface)
|
||||
|
||||
set_property(GLOBAL
|
||||
PROPERTY CMAKE_LINK_WRAPPER_2_PYTHON_WRAPPER
|
||||
"${Python_EXECUTABLE}" my_wrapper.py
|
||||
)
|
||||
set_property(GLOBAL
|
||||
PROPERTY CMAKE_LINK_WRAPPER_1_TIME
|
||||
"${CMAKE_COMMAND}" -E time
|
||||
)
|
||||
|
||||
set_target_properties(iface PROPERTIES
|
||||
INTERFACE_LINK_WRAPPERS 1_TIME
|
||||
)
|
||||
set_target_properties(main PROPERTIES
|
||||
LINK_WRAPPERS 2_PYTHON_WRAPPER
|
||||
)
|
||||
|
||||
Here, the link command for ``main`` will look like:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
/path/to/cmake -E time /path/to/python my_wrapper.py ...
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
* :prop_gbl:`CMAKE_COMPILE_WRAPPER_<NAME>`
|
||||
* :prop_tgt:`INTERFACE_LINK_WRAPPERS`
|
||||
* :prop_tgt:`LINK_WRAPPERS`
|
||||
* :prop_tgt:`<LANG>_LINKER_LAUNCHER`
|
||||
@@ -0,0 +1,59 @@
|
||||
COMPILE_WRAPPERS
|
||||
----------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
List of wrapper names to be prepended to the compile commands for a target's
|
||||
sources.
|
||||
|
||||
This property holds a :ref:`semicolon-separated list <CMake Language Lists>`
|
||||
of names, where each item is a ``<NAME>`` keyed to the
|
||||
:prop_gbl:`CMAKE_COMPILE_WRAPPER_<NAME>` global property.
|
||||
|
||||
.. note::
|
||||
|
||||
If a target has multiple wrappers, either via its ``COMPILE_WRAPPERS`` and/or
|
||||
the :prop_tgt:`INTERFACE_COMPILE_WRAPPERS` inherited from its dependents, the
|
||||
wrappers will be deduplicated and ordered lexicographically based on their
|
||||
name in the resulting compile command(s).
|
||||
|
||||
This property is supported only by :ref:`Makefile Generators` and
|
||||
:ref:`Ninja Generators`, and is ignored by other generators. Further, it is
|
||||
supported only when the target's language is one of: ``C``, ``CXX``, ``CUDA``,
|
||||
``Fortran``, ``HIP``, ``ISPC``, ``OBJC``, ``OBJCXX``.
|
||||
|
||||
Contents of ``COMPILE_WRAPPERS`` may use "generator expressions" with the
|
||||
syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for
|
||||
available expressions. See the :manual:`cmake-buildsystem(7)` manual for more
|
||||
on defining buildsystem properties.
|
||||
|
||||
Interaction With Launchers
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Wrappers are placed *outside* of any :prop_tgt:`<LANG>_COMPILER_LAUNCHER`.
|
||||
The resulting compile command is:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
<wrappers...> <launcher...> <compiler> <arguments...>
|
||||
|
||||
A tool that expects to be given the compiler as its first argument, such as
|
||||
``ccache`` or ``distcc``, should be used as a launcher rather than a wrapper.
|
||||
|
||||
When a static analysis tool is enabled for a source via
|
||||
:prop_tgt:`<LANG>_CLANG_TIDY`, :prop_tgt:`<LANG>_CPPCHECK`,
|
||||
:prop_tgt:`<LANG>_CPPLINT`, :prop_tgt:`<LANG>_INCLUDE_WHAT_YOU_USE`, or a
|
||||
similar property, the wrappers and the launcher apply only to the compiler
|
||||
invocation and *not* to the analysis tool.
|
||||
|
||||
The launcher used by :manual:`ctest(1)` (see :variable:`CTEST_USE_LAUNCHERS`)
|
||||
remains outermost and runs the wrappers as part of the command it launches.
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
Related properties:
|
||||
|
||||
* :prop_tgt:`INTERFACE_COMPILE_WRAPPERS`
|
||||
* :prop_tgt:`<LANG>_COMPILER_LAUNCHER`
|
||||
* :prop_tgt:`LINK_WRAPPERS`
|
||||
@@ -0,0 +1,17 @@
|
||||
INTERFACE_COMPILE_WRAPPERS
|
||||
--------------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. |property_name| replace:: compile wrappers
|
||||
.. |command_name| replace:: :command:`target_link_libraries`
|
||||
.. |PROPERTY_INTERFACE_NAME| replace:: ``INTERFACE_COMPILE_WRAPPERS``
|
||||
.. |PROPERTY_LINK| replace:: :prop_tgt:`COMPILE_WRAPPERS`
|
||||
.. include:: include/INTERFACE_BUILD_PROPERTY.rst
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
Related properties:
|
||||
|
||||
* :prop_tgt:`COMPILE_WRAPPERS`
|
||||
@@ -0,0 +1,17 @@
|
||||
INTERFACE_LINK_WRAPPERS
|
||||
-----------------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
.. |property_name| replace:: link wrappers
|
||||
.. |command_name| replace:: :command:`target_link_libraries`
|
||||
.. |PROPERTY_INTERFACE_NAME| replace:: ``INTERFACE_LINK_WRAPPERS``
|
||||
.. |PROPERTY_LINK| replace:: :prop_tgt:`LINK_WRAPPERS`
|
||||
.. include:: include/INTERFACE_BUILD_PROPERTY.rst
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
Related properties:
|
||||
|
||||
* :prop_tgt:`LINK_WRAPPERS`
|
||||
@@ -19,3 +19,9 @@ when a target is created.
|
||||
|
||||
The property value may use
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
Any wrappers specified by :prop_tgt:`COMPILE_WRAPPERS` and
|
||||
:prop_tgt:`INTERFACE_COMPILE_WRAPPERS` are placed before the launcher
|
||||
command line. See :prop_tgt:`COMPILE_WRAPPERS` for details.
|
||||
@@ -38,3 +38,12 @@ created.
|
||||
|
||||
The property value may use
|
||||
:manual:`generator expressions <cmake-generator-expressions(7)>`.
|
||||
|
||||
The launcher is used only for linking executables, shared libraries, and
|
||||
module libraries. It is not used when creating static libraries.
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
Any wrappers specified by :prop_tgt:`LINK_WRAPPERS` and
|
||||
:prop_tgt:`INTERFACE_LINK_WRAPPERS` are placed before the launcher command
|
||||
line. See :prop_tgt:`LINK_WRAPPERS` for details.
|
||||
@@ -0,0 +1,55 @@
|
||||
LINK_WRAPPERS
|
||||
-------------
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
List of wrapper names to be prepended to the link commands for a target's
|
||||
output artifact.
|
||||
|
||||
This property holds a :ref:`semicolon-separated list <CMake Language Lists>`
|
||||
of names, where each item is a ``<NAME>`` keyed to the
|
||||
:prop_gbl:`CMAKE_LINK_WRAPPER_<NAME>` global property.
|
||||
|
||||
.. note::
|
||||
|
||||
If a target has multiple wrappers, either via its ``LINK_WRAPPERS`` and/or
|
||||
the :prop_tgt:`INTERFACE_LINK_WRAPPERS` inherited from its dependents, the
|
||||
wrappers will be deduplicated and ordered lexicographically based on their
|
||||
name in the resulting link command(s).
|
||||
|
||||
This property is supported only by :ref:`Makefile Generators` and
|
||||
:ref:`Ninja Generators`, and is ignored by other generators. Further, it is
|
||||
supported only when the target's language is one of: ``C``, ``CXX``, ``CUDA``,
|
||||
``OBJC``, ``OBJCXX``, ``Fortran``, ``HIP``.
|
||||
|
||||
Contents of ``LINK_WRAPPERS`` may use "generator expressions" with the syntax
|
||||
``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for
|
||||
available expressions. See the :manual:`cmake-buildsystem(7)` manual for more
|
||||
on defining buildsystem properties.
|
||||
|
||||
Wrappers apply to the link command of executables, shared libraries, and
|
||||
module libraries. As with :prop_tgt:`<LANG>_LINKER_LAUNCHER`, they do not
|
||||
apply to ``STATIC`` libraries, which are created by the archiver rather than
|
||||
the linker.
|
||||
|
||||
Interaction With Launchers
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Wrappers are placed *outside* of any :prop_tgt:`<LANG>_LINKER_LAUNCHER`.
|
||||
The resulting link command is:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
<wrappers...> <launcher...> <linker> <arguments...>
|
||||
|
||||
The launcher used by :manual:`ctest(1)` (see :variable:`CTEST_USE_LAUNCHERS`)
|
||||
remains outermost and runs the wrappers as part of the command it launches.
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
Related properties:
|
||||
|
||||
* :prop_tgt:`COMPILE_WRAPPERS`
|
||||
* :prop_tgt:`INTERFACE_LINK_WRAPPERS`
|
||||
* :prop_tgt:`<LANG>_LINKER_LAUNCHER`
|
||||
@@ -0,0 +1,11 @@
|
||||
interface-compile-link-wrappers
|
||||
-------------------------------
|
||||
|
||||
* The :prop_gbl:`CMAKE_COMPILE_WRAPPER_<NAME>` and
|
||||
:prop_gbl:`CMAKE_LINK_WRAPPER_<NAME>` global properties were added alongside
|
||||
the :prop_tgt:`COMPILE_WRAPPERS`, :prop_tgt:`LINK_WRAPPERS`,
|
||||
:prop_tgt:`INTERFACE_COMPILE_WRAPPERS`, and
|
||||
:prop_tgt:`INTERFACE_LINK_WRAPPERS` target properties. Together, for the
|
||||
:ref:`Makefile Generators` and :ref:`Ninja Generators`, they support wrapping
|
||||
compile and link commands for a given target or its consumers with arbitrary
|
||||
command lines.
|
||||
@@ -8,13 +8,29 @@ debug output for when evaluating target properties. Currently it can
|
||||
only be used when evaluating:
|
||||
|
||||
* :prop_tgt:`AUTOUIC_OPTIONS`
|
||||
|
||||
* :prop_tgt:`COMPILE_DEFINITIONS`
|
||||
|
||||
* :prop_tgt:`COMPILE_FEATURES`
|
||||
|
||||
* :prop_tgt:`COMPILE_OPTIONS`
|
||||
|
||||
* :prop_tgt:`COMPILE_WRAPPERS`
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
* :prop_tgt:`INCLUDE_DIRECTORIES`
|
||||
|
||||
* :prop_tgt:`LINK_DIRECTORIES`
|
||||
|
||||
* :prop_tgt:`LINK_OPTIONS`
|
||||
|
||||
* :prop_tgt:`LINK_WRAPPERS`
|
||||
|
||||
.. versionadded:: 4.5
|
||||
|
||||
* :prop_tgt:`POSITION_INDEPENDENT_CODE`
|
||||
|
||||
* :prop_tgt:`SOURCES`
|
||||
|
||||
target properties and any other property listed in
|
||||
|
||||
@@ -336,6 +336,7 @@ add_library(
|
||||
cmGeneratorTarget_Options.cxx
|
||||
cmGeneratorTarget_Sources.cxx
|
||||
cmGeneratorTarget_TransitiveProperty.cxx
|
||||
cmGeneratorTarget_Wrappers.cxx
|
||||
cmLinkItemGraphVisitor.cxx
|
||||
cmLinkItemGraphVisitor.h
|
||||
cmGetPipes.cxx
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "cmGlobalCommonGenerator.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmLocalCommonGenerator.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
@@ -427,6 +428,21 @@ std::vector<std::string> cmCommonTargetGenerator::GetCompilerLauncher(
|
||||
std::vector<std::string> compilerLauncher;
|
||||
if (lang == "C" || lang == "CXX" || lang == "Fortran" || lang == "CUDA" ||
|
||||
lang == "HIP" || lang == "ISPC" || lang == "OBJC" || lang == "OBJCXX") {
|
||||
// FIXME(#27402,#28110): The FASTBuild generator's limitations w.r.t.
|
||||
// shell escaping and command line ordering means we can't support
|
||||
// wrappers for now.
|
||||
std::string const generatorName =
|
||||
this->GeneratorTarget->GetLocalGenerator()
|
||||
->GetGlobalGenerator()
|
||||
->GetName();
|
||||
if (generatorName.find("FASTBuild") == std::string::npos) {
|
||||
// Wrappers go outside of the launcher.
|
||||
compilerLauncher = this->ParseWrappers(
|
||||
this->GeneratorTarget->GetCompileWrappers(config, lang),
|
||||
"CMAKE_COMPILE_WRAPPER_"_s, "COMPILE_WRAPPERS"_s,
|
||||
this->GeneratorTarget->GetName(), config, lang);
|
||||
}
|
||||
|
||||
std::string const propName = cmStrCat(lang, "_COMPILER_LAUNCHER");
|
||||
cmValue cLauncherValue = this->GeneratorTarget->GetProperty(propName);
|
||||
std::string const evaluatedCLauncher = cmGeneratorExpression::Evaluate(
|
||||
@@ -647,6 +663,21 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkerLauncher(
|
||||
{
|
||||
std::vector<std::string> linkLauncher;
|
||||
std::string const lang = this->GeneratorTarget->GetLinkerLanguage(config);
|
||||
|
||||
// FIXME(#27402,#28110): The FASTBuild generator's limitations w.r.t.
|
||||
// shell escaping and command line ordering means we can't support
|
||||
// wrappers for now.
|
||||
std::string const generatorName = this->GeneratorTarget->GetLocalGenerator()
|
||||
->GetGlobalGenerator()
|
||||
->GetName();
|
||||
if (generatorName.find("FASTBuild") == std::string::npos) {
|
||||
// Wrappers go outside of the launcher.
|
||||
linkLauncher =
|
||||
this->ParseWrappers(this->GeneratorTarget->GetLinkWrappers(config, lang),
|
||||
"CMAKE_LINK_WRAPPER_"_s, "LINK_WRAPPERS"_s,
|
||||
this->GeneratorTarget->GetName(), config, lang);
|
||||
}
|
||||
|
||||
std::string const propName = cmStrCat(lang, "_LINKER_LAUNCHER");
|
||||
cmValue launcherProp = this->GeneratorTarget->GetProperty(propName);
|
||||
if (cmNonempty(launcherProp)) {
|
||||
@@ -735,3 +766,46 @@ void cmCommonTargetGenerator::ComputeRustFlagsForObjects(
|
||||
processObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> cmCommonTargetGenerator::ParseWrappers(
|
||||
std::vector<BT<std::string>> const& wrappers, cm::string_view prefix,
|
||||
cm::string_view targetPropName, std::string const& targetName,
|
||||
std::string const& config, std::string const& lang) const
|
||||
{
|
||||
std::vector<std::string> wrapperCommandLine;
|
||||
if (wrappers.empty()) {
|
||||
return wrapperCommandLine;
|
||||
}
|
||||
|
||||
cm::GenEx::Context context(this->LocalCommonGenerator, config, lang);
|
||||
|
||||
for (BT<std::string> const& wrapper : wrappers) {
|
||||
std::string const wrapperPropName = cmStrCat(prefix, wrapper.Value);
|
||||
cmValue globalPropValue =
|
||||
this->Makefile->GetState()->GetGlobalProperty(wrapperPropName);
|
||||
if (!globalPropValue.IsSet()) {
|
||||
this->Makefile->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat("Specified wrapper \'", wrapper.Value, "\' for target \'",
|
||||
targetName, "\' does not exist. Set the GLOBAL property \'",
|
||||
wrapperPropName, "\'."),
|
||||
wrapper.Backtrace);
|
||||
return {};
|
||||
}
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker{ this->GeneratorTarget,
|
||||
std::string(targetPropName),
|
||||
nullptr, nullptr, context };
|
||||
std::string const evaluatedWrapper = cmGeneratorExpression::Evaluate(
|
||||
*globalPropValue, context.LG, context.Config, this->GeneratorTarget,
|
||||
&dagChecker, this->GeneratorTarget, context.Language);
|
||||
// An empty definition is a no-op wrapper, but empty arguments within a
|
||||
// non-empty definition must reach the command line.
|
||||
if (!evaluatedWrapper.empty()) {
|
||||
cm::append(wrapperCommandLine,
|
||||
cmList{ evaluatedWrapper, cmList::EmptyElements::Yes });
|
||||
}
|
||||
}
|
||||
|
||||
return wrapperCommandLine;
|
||||
}
|
||||
@@ -10,8 +10,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <cm/string_view>
|
||||
|
||||
#include "cmValue.h"
|
||||
|
||||
template <typename T>
|
||||
class BT;
|
||||
class cmGeneratorTarget;
|
||||
class cmGlobalCommonGenerator;
|
||||
class cmLocalCommonGenerator;
|
||||
@@ -97,6 +101,11 @@ protected:
|
||||
std::string& nativeObjects,
|
||||
std::vector<std::string> const& objects);
|
||||
|
||||
std::vector<std::string> ParseWrappers(
|
||||
std::vector<BT<std::string>> const& wrappers, cm::string_view prefix,
|
||||
cm::string_view targetPropName, std::string const& targetName,
|
||||
std::string const& config, std::string const& lang) const;
|
||||
|
||||
private:
|
||||
using ByLanguageMap = std::map<std::string, std::string>;
|
||||
struct ByConfig
|
||||
|
||||
@@ -159,7 +159,8 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingCompileExpression() const
|
||||
cm::string_view property(this->Top->Property);
|
||||
|
||||
return property == "INCLUDE_DIRECTORIES"_s ||
|
||||
property == "COMPILE_DEFINITIONS"_s || property == "COMPILE_OPTIONS"_s;
|
||||
property == "COMPILE_DEFINITIONS"_s || property == "COMPILE_OPTIONS"_s ||
|
||||
property == "COMPILE_WRAPPERS"_s;
|
||||
}
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingSources() const
|
||||
@@ -174,7 +175,7 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const
|
||||
|
||||
return property == "LINK_DIRECTORIES"_s || property == "LINK_OPTIONS"_s ||
|
||||
property == "LINK_DEPENDS"_s || property == "LINK_LIBRARY_OVERRIDE"_s ||
|
||||
property == "LINKER_TYPE"_s;
|
||||
property == "LINKER_TYPE"_s || property == "LINK_WRAPPERS"_s;
|
||||
}
|
||||
|
||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkOptionsExpression() const
|
||||
|
||||
@@ -3499,8 +3499,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
|
||||
reportError(
|
||||
eval, content->GetOriginalExpression(),
|
||||
"$<COMPILE_LANGUAGE:...> may only be used to specify include "
|
||||
"directories, compile definitions, compile options, and to evaluate "
|
||||
"components of the file(GENERATE) command.");
|
||||
"directories, compile definitions, compile options, compile wrappers, "
|
||||
"and to evaluate components of the file(GENERATE) command.");
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -3549,9 +3549,9 @@ static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode
|
||||
eval, content->GetOriginalExpression(),
|
||||
"$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary "
|
||||
"targets "
|
||||
"to specify include directories, compile definitions, and compile "
|
||||
"options. It may not be used with the add_custom_command, "
|
||||
"add_custom_target, or file(GENERATE) commands.");
|
||||
"to specify include directories, compile definitions, compile "
|
||||
"options, and compile wrappers. It may not be used with the "
|
||||
"add_custom_command, add_custom_target, or file(GENERATE) commands.");
|
||||
return std::string();
|
||||
}
|
||||
cmGlobalGenerator const* gg = eval->Context.LG->GetGlobalGenerator();
|
||||
@@ -3597,8 +3597,8 @@ static const struct LinkLanguageNode : public cmGeneratorExpressionNode
|
||||
dagChecker->EvaluatingLinkerLauncher())) {
|
||||
reportError(eval, content->GetOriginalExpression(),
|
||||
"$<LINK_LANGUAGE:...> may only be used with binary targets "
|
||||
"to specify link libraries, link directories, link options "
|
||||
"and link depends.");
|
||||
"to specify link libraries, link directories, link options, "
|
||||
"link depends, and link wrappers.");
|
||||
return std::string();
|
||||
}
|
||||
if (dagChecker->EvaluatingLinkLibraries() && parameters.empty()) {
|
||||
@@ -3693,9 +3693,8 @@ static const struct LinkLanguageAndIdNode : public cmGeneratorExpressionNode
|
||||
reportError(
|
||||
eval, content->GetOriginalExpression(),
|
||||
"$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets "
|
||||
"to specify link libraries, link directories, link options, and "
|
||||
"link "
|
||||
"depends.");
|
||||
"to specify link libraries, link directories, link options, link "
|
||||
"depends, and link wrappers.");
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,10 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||
t->GetCompileDefinitionsEntries(),
|
||||
this->CompileDefinitionsEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(*lg->GetCMakeInstance(),
|
||||
t->GetCompileWrappersEntries(),
|
||||
this->CompileWrappersEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(*lg->GetCMakeInstance(),
|
||||
t->GetLinkOptionsEntries(),
|
||||
this->LinkOptionsEntries);
|
||||
@@ -122,6 +126,10 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||
t->GetLinkDirectoriesEntries(),
|
||||
this->LinkDirectoriesEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(*lg->GetCMakeInstance(),
|
||||
t->GetLinkWrappersEntries(),
|
||||
this->LinkWrappersEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(*lg->GetCMakeInstance(),
|
||||
t->GetPrecompileHeadersEntries(),
|
||||
this->PrecompileHeadersEntries);
|
||||
@@ -544,9 +552,11 @@ void cmGeneratorTarget::ClearSourcesCache()
|
||||
this->LinkImplClosureForUsageMap.clear();
|
||||
this->LinkImplMap.clear();
|
||||
this->LinkImplUsageRequirementsOnlyMap.clear();
|
||||
this->LinkWrappersCache.clear();
|
||||
this->IncludeDirectoriesCache.clear();
|
||||
this->CompileOptionsCache.clear();
|
||||
this->CompileDefinitionsCache.clear();
|
||||
this->CompileWrappersCache.clear();
|
||||
this->CustomTransitiveBuildPropertiesMap.clear();
|
||||
this->CustomTransitiveInterfacePropertiesMap.clear();
|
||||
this->PrecompileHeadersCache.clear();
|
||||
|
||||
@@ -673,11 +673,19 @@ private:
|
||||
mutable ConfigAndLanguageToBTStrings IncludeDirectoriesCache;
|
||||
mutable ConfigAndLanguageToBTStrings CompileOptionsCache;
|
||||
mutable ConfigAndLanguageToBTStrings CompileDefinitionsCache;
|
||||
mutable ConfigAndLanguageToBTStrings CompileWrappersCache;
|
||||
mutable ConfigAndLanguageToBTStrings PrecompileHeadersCache;
|
||||
mutable ConfigAndLanguageToBTStrings LinkOptionsCache;
|
||||
mutable ConfigAndLanguageToBTStrings LinkDirectoriesCache;
|
||||
mutable ConfigAndLanguageToBTStrings LinkWrappersCache;
|
||||
|
||||
public:
|
||||
/** Get the wrapper entries for this target. */
|
||||
std::vector<BT<std::string>> GetCompileWrappers(
|
||||
std::string const& config, std::string const& lang) const;
|
||||
std::vector<BT<std::string>> GetLinkWrappers(std::string const& config,
|
||||
std::string const& lang) const;
|
||||
|
||||
/** Get the include directories for this target. */
|
||||
std::vector<BT<std::string>> GetIncludeDirectories(
|
||||
std::string const& config, std::string const& lang) const;
|
||||
@@ -1383,8 +1391,10 @@ private:
|
||||
TargetPropertyEntryVector CompileOptionsEntries;
|
||||
TargetPropertyEntryVector CompileFeaturesEntries;
|
||||
TargetPropertyEntryVector CompileDefinitionsEntries;
|
||||
TargetPropertyEntryVector CompileWrappersEntries;
|
||||
TargetPropertyEntryVector LinkOptionsEntries;
|
||||
TargetPropertyEntryVector LinkDirectoriesEntries;
|
||||
TargetPropertyEntryVector LinkWrappersEntries;
|
||||
TargetPropertyEntryVector PrecompileHeadersEntries;
|
||||
TargetPropertyEntryVector SourceEntries;
|
||||
mutable std::set<std::string> LinkImplicitNullProperties;
|
||||
@@ -1470,11 +1480,13 @@ private:
|
||||
mutable bool DebugCompileOptionsDone = false;
|
||||
mutable bool DebugCompileFeaturesDone = false;
|
||||
mutable bool DebugCompileDefinitionsDone = false;
|
||||
mutable bool DebugCompileWrappersDone = false;
|
||||
mutable bool DebugLinkOptionsDone = false;
|
||||
mutable bool DebugLinkDirectoriesDone = false;
|
||||
mutable bool DebugPrecompileHeadersDone = false;
|
||||
mutable bool DebugSourcesDone = false;
|
||||
mutable bool UtilityItemsDone = false;
|
||||
mutable bool DebugLinkWrappersDone = false;
|
||||
enum class Tribool
|
||||
{
|
||||
False = 0x0,
|
||||
|
||||
@@ -48,12 +48,15 @@ std::map<cm::string_view, TransitiveProperty> const
|
||||
{ "COMPILE_FEATURES"_s,
|
||||
{ "INTERFACE_COMPILE_FEATURES"_s, UseTo::Compile } },
|
||||
{ "COMPILE_OPTIONS"_s, { "INTERFACE_COMPILE_OPTIONS"_s, UseTo::Compile } },
|
||||
{ "COMPILE_WRAPPERS"_s,
|
||||
{ "INTERFACE_COMPILE_WRAPPERS"_s, UseTo::Compile } },
|
||||
{ "INCLUDE_DIRECTORIES"_s,
|
||||
{ "INTERFACE_INCLUDE_DIRECTORIES"_s, UseTo::Compile } },
|
||||
{ "LINK_DEPENDS"_s, { "INTERFACE_LINK_DEPENDS"_s, UseTo::Link } },
|
||||
{ "LINK_DIRECTORIES"_s, { "INTERFACE_LINK_DIRECTORIES"_s, UseTo::Link } },
|
||||
{ "LINK_LIBRARIES"_s, { "INTERFACE_LINK_LIBRARIES"_s, UseTo::Link } },
|
||||
{ "LINK_OPTIONS"_s, { "INTERFACE_LINK_OPTIONS"_s, UseTo::Link } },
|
||||
{ "LINK_WRAPPERS"_s, { "INTERFACE_LINK_WRAPPERS"_s, UseTo::Link } },
|
||||
{ "PRECOMPILE_HEADERS"_s,
|
||||
{ "INTERFACE_PRECOMPILE_HEADERS"_s, UseTo::Compile } },
|
||||
{ "SOURCES"_s, { "INTERFACE_SOURCES"_s, UseTo::Compile } },
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file LICENSE.rst or https://cmake.org/licensing for details. */
|
||||
/* clang-format off */
|
||||
#include "cmGeneratorTarget.h"
|
||||
/* clang-format on */
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <cmext/algorithm>
|
||||
|
||||
#include "cmEvaluatedTargetProperty.h"
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpressionDAGChecker.h"
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmUnreachable.h"
|
||||
#include "cmValue.h"
|
||||
#include "cmake.h"
|
||||
|
||||
namespace {
|
||||
|
||||
enum class WrapperType
|
||||
{
|
||||
Compile,
|
||||
Link,
|
||||
};
|
||||
|
||||
std::string WrapperTypeToString(WrapperType type)
|
||||
{
|
||||
switch (type) {
|
||||
case WrapperType::Compile:
|
||||
return "compile";
|
||||
case WrapperType::Link:
|
||||
return "link";
|
||||
}
|
||||
CM_UNREACHABLE;
|
||||
}
|
||||
|
||||
void ProcessWrappers(cmGeneratorTarget const* tgt,
|
||||
cm::EvaluatedTargetPropertyEntries const& entries,
|
||||
std::vector<BT<std::string>>& wrappers,
|
||||
std::unordered_set<std::string>& uniqueWrappers,
|
||||
WrapperType wrapperType, bool debugWrapper)
|
||||
{
|
||||
for (cm::EvaluatedTargetPropertyEntry const& entry : entries.Entries) {
|
||||
std::string usedOptions;
|
||||
for (std::string const& entryOption : entry.Values) {
|
||||
if (uniqueWrappers.insert(entryOption).second) {
|
||||
wrappers.emplace_back(entryOption, entry.Backtrace);
|
||||
if (debugWrapper) {
|
||||
usedOptions =
|
||||
cmStrCat(std::move(usedOptions), " * ", entryOption, '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!usedOptions.empty()) {
|
||||
tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::LOG,
|
||||
cmStrCat("Used ", WrapperTypeToString(wrapperType),
|
||||
" wrappers for target ", tgt->GetName(), ":\n", usedOptions),
|
||||
entry.Backtrace);
|
||||
}
|
||||
}
|
||||
|
||||
// Order wrappers lexicographically based on their name.
|
||||
std::sort(wrappers.begin(), wrappers.end(),
|
||||
[](BT<std::string> const& a, BT<std::string> const& b) {
|
||||
return a.Value < b.Value;
|
||||
});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::vector<BT<std::string>> cmGeneratorTarget::GetLinkWrappers(
|
||||
std::string const& config, std::string const& lang) const
|
||||
{
|
||||
ConfigAndLanguage cacheKey(config, lang);
|
||||
{
|
||||
auto it = this->LinkWrappersCache.find(cacheKey);
|
||||
if (it != this->LinkWrappersCache.end()) {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<BT<std::string>> wrappers;
|
||||
std::unordered_set<std::string> uniqueWrappers;
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, lang);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "LINK_WRAPPERS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
"CMAKE_DEBUG_TARGET_PROPERTIES") };
|
||||
bool debugWrappers = !this->DebugLinkWrappersDone &&
|
||||
cm::contains(debugProperties, "LINK_WRAPPERS");
|
||||
this->DebugLinkWrappersDone = true;
|
||||
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->LinkWrappersEntries);
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_WRAPPERS", context, &dagChecker,
|
||||
entries, cm::IncludeRuntimeInterface::Yes, UseTo::Link);
|
||||
|
||||
ProcessWrappers(this, entries, wrappers, uniqueWrappers, WrapperType::Link,
|
||||
debugWrappers);
|
||||
|
||||
this->LinkWrappersCache.emplace(cacheKey, wrappers);
|
||||
return wrappers;
|
||||
}
|
||||
|
||||
std::vector<BT<std::string>> cmGeneratorTarget::GetCompileWrappers(
|
||||
std::string const& config, std::string const& lang) const
|
||||
{
|
||||
ConfigAndLanguage cacheKey(config, lang);
|
||||
{
|
||||
auto it = this->CompileWrappersCache.find(cacheKey);
|
||||
if (it != this->CompileWrappersCache.end()) {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<BT<std::string>> wrappers;
|
||||
std::unordered_set<std::string> uniqueWrappers;
|
||||
cm::GenEx::Context context(this->LocalGenerator, config, lang);
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this, "COMPILE_WRAPPERS", nullptr, nullptr, context,
|
||||
};
|
||||
|
||||
cmList debugProperties{ this->Makefile->GetDefinition(
|
||||
"CMAKE_DEBUG_TARGET_PROPERTIES") };
|
||||
bool debugWrappers = !this->DebugCompileWrappersDone &&
|
||||
cm::contains(debugProperties, "COMPILE_WRAPPERS");
|
||||
this->DebugCompileWrappersDone = true;
|
||||
|
||||
cm::EvaluatedTargetPropertyEntries entries =
|
||||
cm::EvaluateTargetPropertyEntries(this, context, &dagChecker,
|
||||
this->CompileWrappersEntries);
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_WRAPPERS", context, &dagChecker,
|
||||
entries, cm::IncludeRuntimeInterface::Yes,
|
||||
UseTo::Compile);
|
||||
|
||||
ProcessWrappers(this, entries, wrappers, uniqueWrappers,
|
||||
WrapperType::Compile, debugWrappers);
|
||||
|
||||
this->CompileWrappersCache.emplace(cacheKey, wrappers);
|
||||
return wrappers;
|
||||
}
|
||||
@@ -672,14 +672,18 @@ public:
|
||||
UsageRequirementProperty CompileOptions;
|
||||
UsageRequirementProperty CompileFeatures;
|
||||
UsageRequirementProperty CompileDefinitions;
|
||||
UsageRequirementProperty CompileWrappers;
|
||||
UsageRequirementProperty PrecompileHeaders;
|
||||
UsageRequirementProperty Sources;
|
||||
UsageRequirementProperty LinkOptions;
|
||||
UsageRequirementProperty LinkDirectories;
|
||||
UsageRequirementProperty LinkLibraries;
|
||||
UsageRequirementProperty LinkWrappers;
|
||||
UsageRequirementProperty InterfaceCompileWrappers;
|
||||
UsageRequirementProperty InterfaceLinkLibraries;
|
||||
UsageRequirementProperty InterfaceLinkLibrariesDirect;
|
||||
UsageRequirementProperty InterfaceLinkLibrariesDirectExclude;
|
||||
UsageRequirementProperty InterfaceLinkWrappers;
|
||||
UsageRequirementProperty ImportedCxxModulesIncludeDirectories;
|
||||
UsageRequirementProperty ImportedCxxModulesCompileDefinitions;
|
||||
UsageRequirementProperty ImportedCxxModulesCompileFeatures;
|
||||
@@ -734,15 +738,19 @@ cmTargetInternals::cmTargetInternals(std::string name, cm::TargetType type,
|
||||
, CompileOptions("COMPILE_OPTIONS"_s)
|
||||
, CompileFeatures("COMPILE_FEATURES"_s)
|
||||
, CompileDefinitions("COMPILE_DEFINITIONS"_s)
|
||||
, CompileWrappers("COMPILE_WRAPPERS"_s)
|
||||
, PrecompileHeaders("PRECOMPILE_HEADERS"_s)
|
||||
, Sources("SOURCES"_s, UsageRequirementProperty::AppendEmpty::Yes)
|
||||
, LinkOptions("LINK_OPTIONS"_s)
|
||||
, LinkDirectories("LINK_DIRECTORIES"_s)
|
||||
, LinkLibraries("LINK_LIBRARIES"_s)
|
||||
, LinkWrappers("LINK_WRAPPERS"_s)
|
||||
, InterfaceCompileWrappers("INTERFACE_COMPILE_WRAPPERS"_s)
|
||||
, InterfaceLinkLibraries("INTERFACE_LINK_LIBRARIES"_s)
|
||||
, InterfaceLinkLibrariesDirect("INTERFACE_LINK_LIBRARIES_DIRECT"_s)
|
||||
, InterfaceLinkLibrariesDirectExclude(
|
||||
"INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE"_s)
|
||||
, InterfaceLinkWrappers("INTERFACE_LINK_WRAPPERS"_s)
|
||||
, ImportedCxxModulesIncludeDirectories(
|
||||
"IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES"_s)
|
||||
, ImportedCxxModulesCompileDefinitions(
|
||||
@@ -1784,6 +1792,11 @@ cmBTStringRange cmTarget::GetCompileDefinitionsEntries() const
|
||||
return cmMakeRange(this->impl->CompileDefinitions.Entries);
|
||||
}
|
||||
|
||||
cmBTStringRange cmTarget::GetCompileWrappersEntries() const
|
||||
{
|
||||
return cmMakeRange(this->impl->CompileWrappers.Entries);
|
||||
}
|
||||
|
||||
cmBTStringRange cmTarget::GetPrecompileHeadersEntries() const
|
||||
{
|
||||
return cmMakeRange(this->impl->PrecompileHeaders.Entries);
|
||||
@@ -1799,6 +1812,11 @@ cmBTStringRange cmTarget::GetLinkOptionsEntries() const
|
||||
return cmMakeRange(this->impl->LinkOptions.Entries);
|
||||
}
|
||||
|
||||
cmBTStringRange cmTarget::GetLinkWrappersEntries() const
|
||||
{
|
||||
return cmMakeRange(this->impl->LinkWrappers.Entries);
|
||||
}
|
||||
|
||||
cmBTStringRange cmTarget::GetLinkDirectoriesEntries() const
|
||||
{
|
||||
return cmMakeRange(this->impl->LinkDirectories.Entries);
|
||||
@@ -2082,6 +2100,7 @@ MAKE_PROP(OBJCXX_STANDARD);
|
||||
MAKE_PROP(COMPILE_DEFINITIONS);
|
||||
MAKE_PROP(COMPILE_FEATURES);
|
||||
MAKE_PROP(COMPILE_OPTIONS);
|
||||
MAKE_PROP(COMPILE_WRAPPERS);
|
||||
MAKE_PROP(PRECOMPILE_HEADERS);
|
||||
MAKE_PROP(CUDA_CUBIN_COMPILATION);
|
||||
MAKE_PROP(CUDA_FATBIN_COMPILATION);
|
||||
@@ -2098,6 +2117,7 @@ MAKE_PROP(IMPORTED_CXX_MODULES_COMPILE_OPTIONS);
|
||||
MAKE_PROP(IMPORTED_CXX_MODULES_LINK_LIBRARIES);
|
||||
MAKE_PROP(LINK_DIRECTORIES);
|
||||
MAKE_PROP(LINK_LIBRARIES);
|
||||
MAKE_PROP(LINK_WRAPPERS);
|
||||
MAKE_PROP(MANUALLY_ADDED_DEPENDENCIES);
|
||||
MAKE_PROP(NAME);
|
||||
MAKE_PROP(SOURCES);
|
||||
@@ -2107,9 +2127,11 @@ MAKE_PROP(BINARY_DIR);
|
||||
MAKE_PROP(SOURCE_DIR);
|
||||
MAKE_PROP(FALSE);
|
||||
MAKE_PROP(TRUE);
|
||||
MAKE_PROP(INTERFACE_COMPILE_WRAPPERS);
|
||||
MAKE_PROP(INTERFACE_LINK_LIBRARIES);
|
||||
MAKE_PROP(INTERFACE_LINK_LIBRARIES_DIRECT);
|
||||
MAKE_PROP(INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE);
|
||||
MAKE_PROP(INTERFACE_LINK_WRAPPERS);
|
||||
#undef MAKE_PROP
|
||||
}
|
||||
|
||||
@@ -2248,14 +2270,18 @@ void cmTarget::SetProperty(std::string const& prop, cmValue value)
|
||||
&this->impl->CompileOptions,
|
||||
&this->impl->CompileFeatures,
|
||||
&this->impl->CompileDefinitions,
|
||||
&this->impl->CompileWrappers,
|
||||
&this->impl->PrecompileHeaders,
|
||||
&this->impl->Sources,
|
||||
&this->impl->LinkOptions,
|
||||
&this->impl->LinkDirectories,
|
||||
&this->impl->LinkLibraries,
|
||||
&this->impl->LinkWrappers,
|
||||
&this->impl->InterfaceCompileWrappers,
|
||||
&this->impl->InterfaceLinkLibraries,
|
||||
&this->impl->InterfaceLinkLibrariesDirect,
|
||||
&this->impl->InterfaceLinkLibrariesDirectExclude,
|
||||
&this->impl->InterfaceLinkWrappers,
|
||||
&this->impl->ImportedCxxModulesIncludeDirectories,
|
||||
&this->impl->ImportedCxxModulesCompileDefinitions,
|
||||
&this->impl->ImportedCxxModulesCompileFeatures,
|
||||
@@ -2368,14 +2394,18 @@ void cmTarget::AppendProperty(std::string const& prop,
|
||||
&this->impl->CompileOptions,
|
||||
&this->impl->CompileFeatures,
|
||||
&this->impl->CompileDefinitions,
|
||||
&this->impl->CompileWrappers,
|
||||
&this->impl->PrecompileHeaders,
|
||||
&this->impl->Sources,
|
||||
&this->impl->LinkOptions,
|
||||
&this->impl->LinkDirectories,
|
||||
&this->impl->LinkLibraries,
|
||||
&this->impl->LinkWrappers,
|
||||
&this->impl->InterfaceCompileWrappers,
|
||||
&this->impl->InterfaceLinkLibraries,
|
||||
&this->impl->InterfaceLinkLibrariesDirect,
|
||||
&this->impl->InterfaceLinkLibrariesDirectExclude,
|
||||
&this->impl->InterfaceLinkWrappers,
|
||||
&this->impl->ImportedCxxModulesIncludeDirectories,
|
||||
&this->impl->ImportedCxxModulesCompileDefinitions,
|
||||
&this->impl->ImportedCxxModulesCompileFeatures,
|
||||
@@ -2755,9 +2785,11 @@ std::unordered_set<std::string> const& cmTarget::GetSpecialPropertyNames()
|
||||
propCOMPILE_FEATURES,
|
||||
propCOMPILE_OPTIONS,
|
||||
propCOMPILE_DEFINITIONS,
|
||||
propCOMPILE_WRAPPERS,
|
||||
propPRECOMPILE_HEADERS,
|
||||
propLINK_OPTIONS,
|
||||
propLINK_DIRECTORIES,
|
||||
propLINK_WRAPPERS,
|
||||
propIMPORTED,
|
||||
propIMPORTED_GLOBAL,
|
||||
propMANUALLY_ADDED_DEPENDENCIES,
|
||||
@@ -2766,9 +2798,11 @@ std::unordered_set<std::string> const& cmTarget::GetSpecialPropertyNames()
|
||||
propSOURCE_DIR,
|
||||
propSOURCES,
|
||||
propSYMBOLIC,
|
||||
propINTERFACE_COMPILE_WRAPPERS,
|
||||
propINTERFACE_LINK_LIBRARIES,
|
||||
propINTERFACE_LINK_LIBRARIES_DIRECT,
|
||||
propINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
|
||||
propINTERFACE_LINK_WRAPPERS,
|
||||
propIMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES,
|
||||
propIMPORTED_CXX_MODULES_COMPILE_DEFINITIONS,
|
||||
propIMPORTED_CXX_MODULES_COMPILE_FEATURES,
|
||||
@@ -2807,14 +2841,18 @@ cmValue cmTarget::GetProperty(std::string const& prop) const
|
||||
&this->impl->CompileOptions,
|
||||
&this->impl->CompileFeatures,
|
||||
&this->impl->CompileDefinitions,
|
||||
&this->impl->CompileWrappers,
|
||||
&this->impl->PrecompileHeaders,
|
||||
&this->impl->Sources,
|
||||
&this->impl->LinkOptions,
|
||||
&this->impl->LinkDirectories,
|
||||
&this->impl->LinkLibraries,
|
||||
&this->impl->LinkWrappers,
|
||||
&this->impl->InterfaceCompileWrappers,
|
||||
&this->impl->InterfaceLinkLibraries,
|
||||
&this->impl->InterfaceLinkLibrariesDirect,
|
||||
&this->impl->InterfaceLinkLibrariesDirectExclude,
|
||||
&this->impl->InterfaceLinkWrappers,
|
||||
&this->impl->ImportedCxxModulesIncludeDirectories,
|
||||
&this->impl->ImportedCxxModulesCompileDefinitions,
|
||||
&this->impl->ImportedCxxModulesCompileFeatures,
|
||||
|
||||
@@ -338,6 +338,9 @@ public:
|
||||
cmBTStringRange GetImportedCxxModulesCompileOptionsEntries() const;
|
||||
|
||||
cmBTStringRange GetCompileFeaturesEntries() const;
|
||||
|
||||
cmBTStringRange GetCompileWrappersEntries() const;
|
||||
|
||||
cmBTStringRange GetImportedCxxModulesCompileFeaturesEntries() const;
|
||||
|
||||
cmBTStringRange GetCompileDefinitionsEntries() const;
|
||||
@@ -348,6 +351,8 @@ public:
|
||||
|
||||
cmBTStringRange GetLinkOptionsEntries() const;
|
||||
|
||||
cmBTStringRange GetLinkWrappersEntries() const;
|
||||
|
||||
cmBTStringRange GetLinkDirectoriesEntries() const;
|
||||
|
||||
cmBTStringRange GetLinkImplementationEntries() const;
|
||||
|
||||
@@ -1365,8 +1365,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja|FASTBuild")
|
||||
endif()
|
||||
set(CompilerLauncher_ARGS ${LauncherCommon_ARGS})
|
||||
set(LinkerLauncher_ARGS ${LauncherCommon_ARGS})
|
||||
set(ToolchainWrappers_ARGS ${LauncherCommon_ARGS}
|
||||
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
|
||||
if(DEFINED CMake_TEST_ISPC)
|
||||
list(APPEND CompilerLauncher_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
|
||||
list(APPEND ToolchainWrappers_ARGS -DCMake_TEST_ISPC=${CMake_TEST_ISPC})
|
||||
endif()
|
||||
add_RunCMake_test(CompilerLauncher)
|
||||
set_property(TEST RunCMake.CompilerLauncher APPEND
|
||||
@@ -1374,6 +1377,13 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja|FASTBuild")
|
||||
add_RunCMake_test(LinkerLauncher)
|
||||
set_property(TEST RunCMake.LinkerLauncher APPEND
|
||||
PROPERTY LABEL "CUDA" "HIP" "Fortran")
|
||||
# FIXME(#27402,#28110): FASTBuild doesn't currently support this feature, but
|
||||
# it should.
|
||||
if (NOT "${CMAKE_GENERATOR}" STREQUAL "FASTBuild")
|
||||
add_RunCMake_test(ToolchainWrappers)
|
||||
set_property(TEST RunCMake.ToolchainWrappers APPEND
|
||||
PROPERTY LABELS "CUDA" "HIP" "ISPC" "Fortran")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(cpack_tests
|
||||
|
||||
@@ -4,7 +4,7 @@ CMake Error at add_custom_command\.cmake:2 \(add_custom_command\):
|
||||
\$<COMPILE_LANGUAGE>
|
||||
|
||||
\$<COMPILE_LANGUAGE:\.\.\.> may only be used to specify include directories,
|
||||
compile definitions, compile options, and to evaluate components of the
|
||||
file\(GENERATE\) command\.
|
||||
compile definitions, compile options, compile wrappers, and to evaluate
|
||||
components of the file\(GENERATE\) command\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,7 +4,7 @@ CMake Error at add_custom_target\.cmake:1 \(add_custom_target\):
|
||||
\$<COMPILE_LANGUAGE>
|
||||
|
||||
\$<COMPILE_LANGUAGE:\.\.\.> may only be used to specify include directories,
|
||||
compile definitions, compile options, and to evaluate components of the
|
||||
file\(GENERATE\) command\.
|
||||
compile definitions, compile options, compile wrappers, and to evaluate
|
||||
components of the file\(GENERATE\) command\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,7 +4,7 @@ CMake Error at add_executable\.cmake:1 \(add_executable\):
|
||||
\$<COMPILE_LANGUAGE>
|
||||
|
||||
\$<COMPILE_LANGUAGE:\.\.\.> may only be used to specify include directories,
|
||||
compile definitions, compile options, and to evaluate components of the
|
||||
file\(GENERATE\) command\.
|
||||
compile definitions, compile options, compile wrappers, and to evaluate
|
||||
components of the file\(GENERATE\) command\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,7 +4,7 @@ CMake Error at add_library\.cmake:1 \(add_library\):
|
||||
\$<COMPILE_LANGUAGE>
|
||||
|
||||
\$<COMPILE_LANGUAGE:\.\.\.> may only be used to specify include directories,
|
||||
compile definitions, compile options, and to evaluate components of the
|
||||
file\(GENERATE\) command\.
|
||||
compile definitions, compile options, compile wrappers, and to evaluate
|
||||
components of the file\(GENERATE\) command\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,7 +4,7 @@ CMake Error at add_test\.cmake:5 \(add_test\):
|
||||
\$<COMPILE_LANGUAGE>
|
||||
|
||||
\$<COMPILE_LANGUAGE:\.\.\.> may only be used to specify include directories,
|
||||
compile definitions, compile options, and to evaluate components of the
|
||||
file\(GENERATE\) command\.
|
||||
compile definitions, compile options, compile wrappers, and to evaluate
|
||||
components of the file\(GENERATE\) command\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,5 +4,5 @@ CMake Error:
|
||||
\$<COMPILE_LANGUAGE>
|
||||
|
||||
\$<COMPILE_LANGUAGE:\.\.\.> may only be used to specify include directories,
|
||||
compile definitions, compile options, and to evaluate components of the
|
||||
file\(GENERATE\) command\.
|
||||
compile definitions, compile options, compile wrappers, and to evaluate
|
||||
components of the file\(GENERATE\) command\.
|
||||
@@ -4,7 +4,7 @@ CMake Error at target_sources\.cmake:2 \(target_sources\):
|
||||
\$<COMPILE_LANGUAGE>
|
||||
|
||||
\$<COMPILE_LANGUAGE:\.\.\.> may only be used to specify include directories,
|
||||
compile definitions, compile options, and to evaluate components of the
|
||||
file\(GENERATE\) command\.
|
||||
compile definitions, compile options, compile wrappers, and to evaluate
|
||||
components of the file\(GENERATE\) command\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,8 +4,8 @@ CMake Error at add_custom_target\.cmake:2 \(add_custom_target\):
|
||||
\$<COMPILE_LANG_AND_ID:LANG,ID>
|
||||
|
||||
\$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
|
||||
specify include directories, compile definitions, and compile options\. It
|
||||
may not be used with the add_custom_command, add_custom_target, or
|
||||
file\(GENERATE\) commands\.
|
||||
specify include directories, compile definitions, compile options, and
|
||||
compile wrappers\. It may not be used with the add_custom_command,
|
||||
add_custom_target, or file\(GENERATE\) commands\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,8 +4,8 @@ CMake Error at add_executable\.cmake:1 \(add_executable\):
|
||||
\$<COMPILE_LANG_AND_ID:C,MSVC>
|
||||
|
||||
\$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
|
||||
specify include directories, compile definitions, and compile options\. It
|
||||
may not be used with the add_custom_command, add_custom_target, or
|
||||
file\(GENERATE\) commands\.
|
||||
specify include directories, compile definitions, compile options, and
|
||||
compile wrappers\. It may not be used with the add_custom_command,
|
||||
add_custom_target, or file\(GENERATE\) commands\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,8 +4,8 @@ CMake Error at add_library\.cmake:2 \(add_library\):
|
||||
\$<COMPILE_LANG_AND_ID:C,MSVC>
|
||||
|
||||
\$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
|
||||
specify include directories, compile definitions, and compile options\. It
|
||||
may not be used with the add_custom_command, add_custom_target, or
|
||||
file\(GENERATE\) commands\.
|
||||
specify include directories, compile definitions, compile options, and
|
||||
compile wrappers\. It may not be used with the add_custom_command,
|
||||
add_custom_target, or file\(GENERATE\) commands\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,8 +4,8 @@ CMake Error at add_test\.cmake:5 \(add_test\):
|
||||
\$<COMPILE_LANG_AND_ID:CXX,GNU>
|
||||
|
||||
\$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
|
||||
specify include directories, compile definitions, and compile options\. It
|
||||
may not be used with the add_custom_command, add_custom_target, or
|
||||
file\(GENERATE\) commands\.
|
||||
specify include directories, compile definitions, compile options, and
|
||||
compile wrappers\. It may not be used with the add_custom_command,
|
||||
add_custom_target, or file\(GENERATE\) commands\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error:
|
||||
\$<COMPILE_LANG_AND_ID:C,MSVC>
|
||||
|
||||
\$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
|
||||
specify include directories, compile definitions, and compile options\. It
|
||||
may not be used with the add_custom_command, add_custom_target, or
|
||||
file\(GENERATE\) commands\.
|
||||
specify include directories, compile definitions, compile options, and
|
||||
compile wrappers\. It may not be used with the add_custom_command,
|
||||
add_custom_target, or file\(GENERATE\) commands\.
|
||||
@@ -4,6 +4,6 @@ CMake Error at add_custom_command\.cmake:2 \(add_custom_command\):
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at add_custom_target\.cmake:1 \(add_custom_target\):
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at add_executable\.cmake:1 \(add_executable\):
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at add_library\.cmake:1 \(add_library\):
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at add_test\.cmake:5 \(add_test\):
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at file_generate\.cmake:3 \(file\):
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,7 +4,7 @@ CMake Error:
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
|
||||
|
||||
CMake Generate step failed\. Build files cannot be regenerated correctly\.
|
||||
@@ -4,6 +4,6 @@ CMake Error at target_sources\.cmake:2 \(target_sources\):
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at wrong-usage1\.cmake:4 \(target_compile_definitions\):
|
||||
\$<LINK_LANGUAGE:C>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at wrong-usage2\.cmake:4 \(target_compile_options\):
|
||||
\$<LINK_LANGUAGE:C>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,6 @@ CMake Error at wrong-usage3\.cmake:4 \(target_include_directories\):
|
||||
\$<LINK_LANGUAGE:C>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at add_custom_command\.cmake:2 \(add_custom_command\):
|
||||
\$<LINK_LANG_AND_ID:LANG,ID>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at add_custom_target\.cmake:2 \(add_custom_target\):
|
||||
\$<LINK_LANG_AND_ID:LANG,ID>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at add_executable\.cmake:1 \(add_executable\):
|
||||
\$<LINK_LANG_AND_ID:C,MSVC>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at add_library\.cmake:2 \(add_library\):
|
||||
\$<LINK_LANG_AND_ID:C,MSVC>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at add_test\.cmake:5 \(add_test\):
|
||||
\$<LINK_LANG_AND_ID:CXX,GNU>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at file_generate\.cmake:3 \(file\):
|
||||
\$<LINK_LANG_AND_ID:C,GNU>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,7 +4,8 @@ CMake Error:
|
||||
\$<LINK_LANG_AND_ID:C,MSVC>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
|
||||
|
||||
CMake Generate step failed\. Build files cannot be regenerated correctly\.
|
||||
@@ -4,6 +4,7 @@ CMake Error at wrong-usage1\.cmake:4 \(target_compile_definitions\):
|
||||
\$<LINK_LANG_AND_ID:C,GNU>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at wrong-usage2\.cmake:4 \(target_compile_options\):
|
||||
\$<LINK_LANG_AND_ID:C,GNU>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
@@ -4,6 +4,7 @@ CMake Error at wrong-usage3\.cmake:4 \(target_include_directories\):
|
||||
\$<LINK_LANG_AND_ID:C,GNU>
|
||||
|
||||
\$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets to specify
|
||||
link libraries, link directories, link options, and link depends\.
|
||||
link libraries, link directories, link options, link depends, and link
|
||||
wrappers\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:3 \(include\)
|
||||
+1
-1
@@ -4,7 +4,7 @@ CMake Error:
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
|
||||
|
||||
CMake Generate step failed\. Build files cannot be regenerated correctly\.
|
||||
@@ -4,7 +4,7 @@ CMake Error:
|
||||
\$<LINK_LANGUAGE>
|
||||
|
||||
\$<LINK_LANGUAGE:\.\.\.> may only be used with binary targets to specify link
|
||||
libraries, link directories, link options and link depends\.
|
||||
libraries, link directories, link options, link depends, and link wrappers\.
|
||||
|
||||
|
||||
CMake Generate step failed\. Build files cannot be regenerated correctly\.
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.c['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*([ /\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
example_exe(main.c)
|
||||
@@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 4.4)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
@@ -0,0 +1,15 @@
|
||||
.*ctest(\.exe)?"? --launch [^
|
||||
]*--language C[^
|
||||
]* -- [^
|
||||
]*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*-E env CL_LAUNCH=1 [^
|
||||
]*[/\\]main\.c['"
|
||||
].*ctest(\.exe)?"? --launch [^
|
||||
]*--language C[^
|
||||
]* -- [^
|
||||
]*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*-E env LL_LAUNCH=1 [^
|
||||
]*([ /\\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
set(CTEST_USE_LAUNCHERS 1)
|
||||
include(CTestUseLaunchers)
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
|
||||
# The `ctest --launch` launcher is outside of wrappers and launchers.
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;CL_LAUNCH=1")
|
||||
set(CMAKE_C_LINKER_LAUNCHER "${CMAKE_COMMAND};-E;env;LL_LAUNCH=1")
|
||||
example_exe(main.c)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.cu['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*[ /\:]main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
include(common.cmake)
|
||||
enable_language(CUDA)
|
||||
example_exe(main.cu)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.cxx['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*([ /\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
include(common.cmake)
|
||||
enable_language(CXX)
|
||||
example_exe(main.cxx)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,11 @@
|
||||
^CMake Error at DNE\.cmake:[0-9]+ \(set_target_properties\):
|
||||
Specified wrapper 'NOT_A_COMPILE_WRAPPER' for target 'main' does not exist\.
|
||||
Set the GLOBAL property 'CMAKE_COMPILE_WRAPPER_NOT_A_COMPILE_WRAPPER'\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Error at DNE\.cmake:[0-9]+ \(set_target_properties\):
|
||||
Specified wrapper 'NOT_A_LINK_WRAPPER' for target 'main' does not exist\.
|
||||
Set the GLOBAL property 'CMAKE_LINK_WRAPPER_NOT_A_LINK_WRAPPER'\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
@@ -0,0 +1,9 @@
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE iface)
|
||||
set_target_properties(main PROPERTIES
|
||||
COMPILE_WRAPPERS NOT_A_COMPILE_WRAPPER
|
||||
LINK_WRAPPERS NOT_A_LINK_WRAPPER
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
CMake Debug Log at common\.cmake:[0-9]+ \(set_target_properties\):
|
||||
Used compile wrappers for target main:
|
||||
|
||||
\* EXAMPLE_1
|
||||
\* EXAMPLE_2
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
DebugProps\.cmake:[0-9]+ \(example_exe\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Debug Log at common\.cmake:[0-9]+ \(set_target_properties\):
|
||||
Used link wrappers for target main:
|
||||
|
||||
\* EXAMPLE_2
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
DebugProps\.cmake:[0-9]+ \(example_exe\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Debug Log at common\.cmake:[0-9]+ \(target_link_libraries\):
|
||||
Used link wrappers for target main:
|
||||
|
||||
\* EXAMPLE_1
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
DebugProps\.cmake:[0-9]+ \(example_exe\)
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
@@ -0,0 +1,4 @@
|
||||
set(CMAKE_DEBUG_TARGET_PROPERTIES COMPILE_WRAPPERS LINK_WRAPPERS)
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
example_exe(main.c)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.f90['"
|
||||
.-].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*[ /\:]main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
include(common.cmake)
|
||||
enable_language(Fortran)
|
||||
example_exe(main.f90)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.hip['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*[ /\:]main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
include(common.cmake)
|
||||
enable_language(HIP)
|
||||
example_exe(main.hip)
|
||||
@@ -0,0 +1,16 @@
|
||||
.*(-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.cxx['"
|
||||
].*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]test\.ispc['"
|
||||
]|-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]test\.ispc['"
|
||||
].*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.cxx['"
|
||||
]).*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*[ /\:]main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
include(common.cmake)
|
||||
enable_language(CXX ISPC)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CMAKE_ISPC_FLAGS "--arch=x86")
|
||||
endif()
|
||||
example_exe(main.cxx test.ispc)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,11 @@
|
||||
^CMake Error at InterfaceDNE\.cmake:[0-9]+ \(target_link_libraries\):
|
||||
Specified wrapper 'NOT_A_COMPILE_WRAPPER' for target 'main' does not exist\.
|
||||
Set the GLOBAL property 'CMAKE_COMPILE_WRAPPER_NOT_A_COMPILE_WRAPPER'\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Error at InterfaceDNE\.cmake:[0-9]+ \(target_link_libraries\):
|
||||
Specified wrapper 'NOT_A_LINK_WRAPPER' for target 'main' does not exist\.
|
||||
Set the GLOBAL property 'CMAKE_LINK_WRAPPER_NOT_A_LINK_WRAPPER'\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)
|
||||
@@ -0,0 +1,11 @@
|
||||
enable_language(C)
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
|
||||
add_library(iface INTERFACE)
|
||||
set_target_properties(iface PROPERTIES
|
||||
INTERFACE_COMPILE_WRAPPERS NOT_A_COMPILE_WRAPPER
|
||||
INTERFACE_LINK_WRAPPERS NOT_A_LINK_WRAPPER
|
||||
)
|
||||
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE iface)
|
||||
@@ -0,0 +1,5 @@
|
||||
.*-E env CW_IFACE_GENEX=1 [^
|
||||
]*[/\]main\.c['"
|
||||
].*-E env LW_IFACE_GENEX=1 [^
|
||||
]*([ /\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
enable_language(C)
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
|
||||
string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
|
||||
string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
|
||||
string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
|
||||
|
||||
# INTERFACE_{COMPILE,LINK}_WRAPPERS values may themselves use
|
||||
# $<COMPILE_LANGUAGE:...>/$<LINK_LANGUAGE:...> generator expressions.
|
||||
|
||||
set_property(GLOBAL PROPERTY
|
||||
CMAKE_COMPILE_WRAPPER_IFACE_GENEX
|
||||
"${CMAKE_COMMAND};-E;env;CW_IFACE_GENEX=1"
|
||||
)
|
||||
set_property(GLOBAL PROPERTY
|
||||
CMAKE_LINK_WRAPPER_IFACE_GENEX
|
||||
"${CMAKE_COMMAND};-E;env;LW_IFACE_GENEX=1"
|
||||
)
|
||||
|
||||
add_library(iface_genex INTERFACE)
|
||||
set_target_properties(iface_genex PROPERTIES
|
||||
INTERFACE_COMPILE_WRAPPERS "$<$<COMPILE_LANGUAGE:C>:IFACE_GENEX>"
|
||||
INTERFACE_LINK_WRAPPERS "$<$<LINK_LANGUAGE:C>:IFACE_GENEX>"
|
||||
)
|
||||
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE iface_genex)
|
||||
@@ -0,0 +1,9 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*-E env CL_LAUNCH=1 [^
|
||||
]*[/\\]main\.c['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*-E env LL_LAUNCH=1 [^
|
||||
]*([ /\\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
|
||||
# Wrappers go outside of launchers.
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;CL_LAUNCH=1")
|
||||
set(CMAKE_C_LINKER_LAUNCHER "${CMAKE_COMMAND};-E;env;LL_LAUNCH=1")
|
||||
example_exe(main.c)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.c['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*([ /\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
|
||||
# Launchers that evaluate to nothing must not disturb the wrappers.
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "$<0:unused>")
|
||||
set(CMAKE_C_LINKER_LAUNCHER "$<0:unused>")
|
||||
example_exe(main.c)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*__run_co_compile --launcher=[^
|
||||
]*-E;env;CW_OUTER=1;[^
|
||||
]*-E;env;CW_INNER=2;[^
|
||||
]*-E;env;CL_LAUNCH=1[^
|
||||
]* --cppcheck=[^
|
||||
]*-E;true[^
|
||||
]* --source=
|
||||
@@ -0,0 +1,8 @@
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;CL_LAUNCH=1")
|
||||
# Lint tools run the wrappers and launcher via `__run_co_compile --launcher=`.
|
||||
# `cmake -E true` ignores the arguments it is given.
|
||||
set(CMAKE_C_CPPCHECK "${CMAKE_COMMAND};-E;true")
|
||||
example_exe(main.c)
|
||||
@@ -0,0 +1,3 @@
|
||||
.*-E env LW_OUTER=1 [^
|
||||
]*([ /\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
|
||||
string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
|
||||
string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
|
||||
string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
|
||||
|
||||
# `$<LINK_ONLY:...>` dependencies contribute only their link usage
|
||||
# requirements, so `iface`'s INTERFACE_LINK_WRAPPERS apply to `main`
|
||||
# but its INTERFACE_COMPILE_WRAPPERS do not.
|
||||
add_library(link_only INTERFACE)
|
||||
target_link_libraries(link_only INTERFACE "$<LINK_ONLY:iface>")
|
||||
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE link_only)
|
||||
@@ -0,0 +1,21 @@
|
||||
include(common.cmake)
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
|
||||
set_property(GLOBAL PROPERTY
|
||||
CMAKE_COMPILE_WRAPPER_EXAMPLE_1
|
||||
definitely-not-a-command
|
||||
)
|
||||
set_property(GLOBAL PROPERTY
|
||||
CMAKE_LINK_WRAPPER_EXAMPLE_1
|
||||
definitely-not-a-command
|
||||
)
|
||||
|
||||
add_executable(main main.c)
|
||||
set_target_properties(main PROPERTIES
|
||||
# Use the $<0:...> genexp to validate (a) genexp support and (b) handling of
|
||||
# no wrappers.
|
||||
COMPILE_WRAPPERS "$<0:EXAMPLE_1>"
|
||||
LINK_WRAPPERS "$<0:EXAMPLE_1>"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.m['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*[ /\:]main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
include(common.cmake)
|
||||
enable_language(OBJC)
|
||||
example_exe(main.m)
|
||||
@@ -0,0 +1,7 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.mm['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*-E env LW_INNER=2 [^
|
||||
]*[ /\:]main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
include(common.cmake)
|
||||
enable_language(OBJCXX)
|
||||
example_exe(main.mm)
|
||||
@@ -0,0 +1,5 @@
|
||||
.*-E env CW_INNER=2 [^
|
||||
]*[/\]main\.c['"
|
||||
].*-E env LW_INNER=2 [^
|
||||
]*([ /\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
.*-E env CW_OUTER=1 [^
|
||||
]*[/\]main\.c['"
|
||||
].*-E env LW_OUTER=1 [^
|
||||
]*([ /\:]|-e)main(\.exe)?['"
|
||||
]
|
||||
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user