summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/add_library.rst5
-rw-r--r--Help/manual/cmake-compile-features.7.rst6
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst11
-rw-r--r--Help/prop_tgt/CUDA_EXTENSIONS.rst6
-rw-r--r--Help/prop_tgt/CUDA_STANDARD.rst16
-rw-r--r--Help/prop_tgt/CXX_EXTENSIONS.rst6
-rw-r--r--Help/prop_tgt/C_EXTENSIONS.rst6
-rw-r--r--Help/prop_tgt/HIP_EXTENSIONS.rst6
-rw-r--r--Help/prop_tgt/LANG_EXTENSIONS.rst3
-rw-r--r--Help/prop_tgt/OBJCXX_EXTENSIONS.rst6
-rw-r--r--Help/prop_tgt/OBJC_EXTENSIONS.rst6
-rw-r--r--Help/variable/CMAKE_LANG_EXTENSIONS.rst3
-rw-r--r--Help/variable/CMAKE_LANG_EXTENSIONS_DEFAULT.rst7
-rw-r--r--Modules/CheckLinkerFlag.cmake6
-rw-r--r--Modules/Compiler/NVHPC.cmake1
-rw-r--r--Modules/FindHDF5.cmake10
-rw-r--r--Modules/FindPkgConfig.cmake49
-rw-r--r--Modules/Platform/Windows-GNU.cmake2
-rw-r--r--Source/cmCustomCommandGenerator.cxx12
-rw-r--r--Source/cmGlobalGenerator.cxx3
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmLinkItem.cxx12
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaTargetGenerator.cxx2
-rw-r--r--Source/cmScanDepFormat.cxx2
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-in-release-graph-ninja-stdout.txt2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-ninja-stdout.txt2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-release-ninja-stdout.txt2
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake10
-rw-r--r--Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake10
33 files changed, 163 insertions, 61 deletions
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index dfc6500..1235155 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -166,6 +166,8 @@ itself and is not included as a target in the generated buildsystem.
call are ``PRIVATE`` to the interface library and do not appear in its
:prop_tgt:`INTERFACE_SOURCES` target property.
+.. _`add_library imported libraries`:
+
Imported Libraries
^^^^^^^^^^^^^^^^^^
@@ -205,7 +207,8 @@ The ``<type>`` must be one of:
:prop_tgt:`IMPORTED_IMPLIB_<CONFIG>`) specifies the location of the
DLL import library file (``.lib`` or ``.dll.a``) on disk, and the
``IMPORTED_LOCATION`` is the location of the ``.dll`` runtime
- library (and is optional).
+ library (and is optional, but needed by the :genex:`TARGET_RUNTIME_DLLS`
+ generator expression).
Additional usage requirements may be specified in ``INTERFACE_*`` properties.
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index a0459fa..67b0f6e 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -119,9 +119,9 @@ Availability of Compiler Extensions
-----------------------------------
The :prop_tgt:`<LANG>_EXTENSIONS` target property defaults to the compiler's
-efault. Note that because most compilers enable extensions by default, this
-may expose cross-platform bugs in user code or in the headers of third-party
-dependencies.
+default (see :variable:`CMAKE_<LANG>_EXTENSIONS_DEFAULT`). Note that because
+most compilers enable extensions by default, this may expose portability bugs
+in user code or in the headers of third-party dependencies.
:prop_tgt:`<LANG>_EXTENSIONS` used to default to ``ON``. See :policy:`CMP0128`.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 62608e2..df13dd0 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -1068,7 +1068,7 @@ which is just the string ``tgt``.
.. code-block:: cmake
- find_package(foo REQUIRED)
+ find_package(foo CONFIG REQUIRED) # package generated by install(EXPORT)
add_executable(exe main.c)
target_link_libraries(exe PRIVATE foo::foo foo::bar)
@@ -1077,6 +1077,15 @@ which is just the string ``tgt``.
COMMAND_EXPAND_LISTS
)
+ .. note::
+
+ :ref:`Imported Targets` are supported only if they know the location
+ of their ``.dll`` files. An imported ``SHARED`` or ``MODULE`` library
+ must have :prop_tgt:`IMPORTED_LOCATION` set to its ``.dll`` file. See
+ the :ref:`add_library imported libraries <add_library imported libraries>`
+ section for details. Many :ref:`Find Modules` produce imported targets
+ with the ``UNKNOWN`` type and therefore will be ignored.
+
.. genex:: $<INSTALL_PREFIX>
Content of the install prefix when the target is exported via
diff --git a/Help/prop_tgt/CUDA_EXTENSIONS.rst b/Help/prop_tgt/CUDA_EXTENSIONS.rst
index 2ddba0b..ab467ac 100644
--- a/Help/prop_tgt/CUDA_EXTENSIONS.rst
+++ b/Help/prop_tgt/CUDA_EXTENSIONS.rst
@@ -15,5 +15,7 @@ See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
This property is initialized by the value of
-the :variable:`CMAKE_CUDA_EXTENSIONS` variable if it is set when a target
-is created.
+the :variable:`CMAKE_CUDA_EXTENSIONS` variable if set when a target is created
+and otherwise by the value of
+:variable:`CMAKE_CUDA_EXTENSIONS_DEFAULT <CMAKE_<LANG>_EXTENSIONS_DEFAULT>`
+(see :policy:`CMP0128`).
diff --git a/Help/prop_tgt/CUDA_STANDARD.rst b/Help/prop_tgt/CUDA_STANDARD.rst
index 5ef57be..950ba12 100644
--- a/Help/prop_tgt/CUDA_STANDARD.rst
+++ b/Help/prop_tgt/CUDA_STANDARD.rst
@@ -12,21 +12,27 @@ flag such as ``-std=gnu++11`` to the compile line.
Supported values are:
``98``
- CUDA C++98
+ CUDA C++98. Note that this maps to the same as ``03`` internally.
+
+``03``
+ CUDA C++03
``11``
CUDA C++11
``14``
- CUDA C++14
+ CUDA C++14. While CMake 3.8 and later *recognize* ``14`` as a valid value,
+ CMake 3.9 was the first version to include support for any compiler.
``17``
- CUDA C++17
+ CUDA C++17. While CMake 3.8 and later *recognize* ``17`` as a valid value,
+ CMake 3.18 was the first version to include support for any compiler.
``20``
.. versionadded:: 3.12
- CUDA C++20
+ CUDA C++20. While CMake 3.12 and later *recognize* ``20`` as a valid value,
+ CMake 3.18 was the first version to include support for any compiler.
``23``
.. versionadded:: 3.20
@@ -43,7 +49,7 @@ means that using:
with a compiler which does not support ``-std=gnu++11`` or an equivalent
flag will not result in an error or warning, but will instead add the
-``-std=gnu++98`` flag if supported. This "decay" behavior may be controlled
+``-std=gnu++03`` flag if supported. This "decay" behavior may be controlled
with the :prop_tgt:`CUDA_STANDARD_REQUIRED` target property.
Additionally, the :prop_tgt:`CUDA_EXTENSIONS` target property may be used to
control whether compiler-specific extensions are enabled on a per-target basis.
diff --git a/Help/prop_tgt/CXX_EXTENSIONS.rst b/Help/prop_tgt/CXX_EXTENSIONS.rst
index bda531e..9b52504 100644
--- a/Help/prop_tgt/CXX_EXTENSIONS.rst
+++ b/Help/prop_tgt/CXX_EXTENSIONS.rst
@@ -15,5 +15,7 @@ See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
This property is initialized by the value of
-the :variable:`CMAKE_CXX_EXTENSIONS` variable if it is set when a target
-is created.
+the :variable:`CMAKE_CXX_EXTENSIONS` variable if set when a target is created
+and otherwise by the value of
+:variable:`CMAKE_CXX_EXTENSIONS_DEFAULT <CMAKE_<LANG>_EXTENSIONS_DEFAULT>` (see
+:policy:`CMP0128`).
diff --git a/Help/prop_tgt/C_EXTENSIONS.rst b/Help/prop_tgt/C_EXTENSIONS.rst
index b2abb46..a53090c 100644
--- a/Help/prop_tgt/C_EXTENSIONS.rst
+++ b/Help/prop_tgt/C_EXTENSIONS.rst
@@ -15,5 +15,7 @@ See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
This property is initialized by the value of
-the :variable:`CMAKE_C_EXTENSIONS` variable if it is set when a target
-is created.
+the :variable:`CMAKE_C_EXTENSIONS` variable if set when a target is created and
+otherwise by the value of
+:variable:`CMAKE_C_EXTENSIONS_DEFAULT <CMAKE_<LANG>_EXTENSIONS_DEFAULT>` (see
+:policy:`CMP0128`).
diff --git a/Help/prop_tgt/HIP_EXTENSIONS.rst b/Help/prop_tgt/HIP_EXTENSIONS.rst
index b731753..d1475c9 100644
--- a/Help/prop_tgt/HIP_EXTENSIONS.rst
+++ b/Help/prop_tgt/HIP_EXTENSIONS.rst
@@ -15,5 +15,7 @@ See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
This property is initialized by the value of
-the :variable:`CMAKE_HIP_EXTENSIONS` variable if it is set when a target
-is created.
+the :variable:`CMAKE_HIP_EXTENSIONS` variable if set when a target is created
+and otherwise by the value of
+:variable:`CMAKE_HIP_EXTENSIONS_DEFAULT <CMAKE_<LANG>_EXTENSIONS_DEFAULT>` (see
+:policy:`CMP0128`).
diff --git a/Help/prop_tgt/LANG_EXTENSIONS.rst b/Help/prop_tgt/LANG_EXTENSIONS.rst
index 2add21d..afc2ad3 100644
--- a/Help/prop_tgt/LANG_EXTENSIONS.rst
+++ b/Help/prop_tgt/LANG_EXTENSIONS.rst
@@ -14,7 +14,8 @@ These properties specify whether compiler-specific extensions are requested.
These properties are initialized by the value of the
:variable:`CMAKE_<LANG>_EXTENSIONS` variable if it is set when a target is
-created.
+created and otherwise by the value of
+:variable:`CMAKE_<LANG>_EXTENSIONS_DEFAULT` (see :policy:`CMP0128`).
For supported CMake versions see the respective pages.
To control language standard versions see :prop_tgt:`<LANG>_STANDARD`.
diff --git a/Help/prop_tgt/OBJCXX_EXTENSIONS.rst b/Help/prop_tgt/OBJCXX_EXTENSIONS.rst
index 8a254f2..2a15dec 100644
--- a/Help/prop_tgt/OBJCXX_EXTENSIONS.rst
+++ b/Help/prop_tgt/OBJCXX_EXTENSIONS.rst
@@ -18,5 +18,7 @@ If the property is not set, and the project has set the :prop_tgt:`CXX_EXTENSION
the value of :prop_tgt:`CXX_EXTENSIONS` is set for :prop_tgt:`OBJCXX_EXTENSIONS`.
This property is initialized by the value of
-the :variable:`CMAKE_OBJCXX_EXTENSIONS` variable if it is set when a target
-is created.
+the :variable:`CMAKE_OBJCXX_EXTENSIONS` variable if set when a target is
+created and otherwise by the value of
+:variable:`CMAKE_OBJCXX_EXTENSIONS_DEFAULT <CMAKE_<LANG>_EXTENSIONS_DEFAULT>`
+(see :policy:`CMP0128`).
diff --git a/Help/prop_tgt/OBJC_EXTENSIONS.rst b/Help/prop_tgt/OBJC_EXTENSIONS.rst
index ef1c754..cd72e5f 100644
--- a/Help/prop_tgt/OBJC_EXTENSIONS.rst
+++ b/Help/prop_tgt/OBJC_EXTENSIONS.rst
@@ -18,5 +18,7 @@ See the :manual:`cmake-compile-features(7)` manual for information on
compile features and a list of supported compilers.
This property is initialized by the value of
-the :variable:`CMAKE_OBJC_EXTENSIONS` variable if it is set when a target
-is created.
+the :variable:`CMAKE_OBJC_EXTENSIONS` variable if set when a target is created
+and otherwise by the value of
+:variable:`CMAKE_OBJC_EXTENSIONS_DEFAULT <CMAKE_<LANG>_EXTENSIONS_DEFAULT>`
+(see :policy:`CMP0128`).
diff --git a/Help/variable/CMAKE_LANG_EXTENSIONS.rst b/Help/variable/CMAKE_LANG_EXTENSIONS.rst
index 84e5e3a..3a32002 100644
--- a/Help/variable/CMAKE_LANG_EXTENSIONS.rst
+++ b/Help/variable/CMAKE_LANG_EXTENSIONS.rst
@@ -11,7 +11,8 @@ The variations are:
* :variable:`CMAKE_OBJCXX_EXTENSIONS`
Default values for :prop_tgt:`<LANG>_EXTENSIONS` target properties if set when
-a target is created.
+a target is created. For the compiler's default setting see
+:variable:`CMAKE_<LANG>_EXTENSIONS_DEFAULT`.
For supported CMake versions see the respective pages.
diff --git a/Help/variable/CMAKE_LANG_EXTENSIONS_DEFAULT.rst b/Help/variable/CMAKE_LANG_EXTENSIONS_DEFAULT.rst
index 6783eb5..a66453a 100644
--- a/Help/variable/CMAKE_LANG_EXTENSIONS_DEFAULT.rst
+++ b/Help/variable/CMAKE_LANG_EXTENSIONS_DEFAULT.rst
@@ -3,5 +3,8 @@ CMAKE_<LANG>_EXTENSIONS_DEFAULT
.. versionadded:: 3.22
-Default value used when the :prop_tgt:`<LANG>_EXTENSIONS` target property is
-not set. Initialized during compiler detection to the compiler's default.
+Compiler's default extensions mode. Used as the default for the
+:prop_tgt:`<LANG>_EXTENSIONS` target property when
+:variable:`CMAKE_<LANG>_EXTENSIONS` is not set (see :policy:`CMP0128`).
+
+This variable is read-only. Modifying it is undefined behavior.
diff --git a/Modules/CheckLinkerFlag.cmake b/Modules/CheckLinkerFlag.cmake
index 28ac2e3..e85e43e 100644
--- a/Modules/CheckLinkerFlag.cmake
+++ b/Modules/CheckLinkerFlag.cmake
@@ -41,6 +41,10 @@ include_guard(GLOBAL)
include(CMakeCheckCompilerFlagCommonPatterns)
+cmake_policy(PUSH)
+cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
+cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
+
function(CHECK_LINKER_FLAG _lang _flag _var)
get_property (_supported_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
if (NOT _lang IN_LIST _supported_languages)
@@ -82,3 +86,5 @@ function(CHECK_LINKER_FLAG _lang _flag _var)
endforeach()
set(${_var} "${${_var}}" PARENT_SCOPE)
endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/Compiler/NVHPC.cmake b/Modules/Compiler/NVHPC.cmake
index 7048670..b51bb43 100644
--- a/Modules/Compiler/NVHPC.cmake
+++ b/Modules/Compiler/NVHPC.cmake
@@ -12,4 +12,5 @@ include(Compiler/PGI)
macro(__compiler_nvhpc lang)
# Logic specific to NVHPC.
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
endmacro()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index e335355..6cadadb 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -161,6 +161,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
# scope somewhere else. We can't rely on it because different components may
# have been requested for this call.
set(HDF5_FOUND OFF)
+set(HDF5_LIBRARIES)
+set(HDF5_HL_LIBRARIES)
# List of the valid HDF5 components
set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran)
@@ -560,7 +562,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_NO_FIND_PACKAGE_CONFIG_FILE)
set(HDF5_${_lang}_FOUND TRUE)
endif()
if(HDF5_FIND_HL)
- get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} )
+ get_target_property(_hdf5_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_hdf5_imported_conf} )
if (NOT _hdf5_lang_hl_location)
get_target_property(_hdf5_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION_${_hdf5_imported_conf})
if (NOT _hdf5_hl_lang_location)
@@ -586,6 +588,9 @@ if(NOT HDF5_FOUND)
set(HDF5_COMPILER_NO_INTERROGATE TRUE)
# Only search for languages we've enabled
foreach(_lang IN LISTS HDF5_LANGUAGE_BINDINGS)
+ set(HDF5_${_lang}_LIBRARIES)
+ set(HDF5_${_lang}_HL_LIBRARIES)
+
# First check to see if our regular compiler is one of wrappers
if(_lang STREQUAL "C")
_HDF5_test_regular_compiler_C(
@@ -811,6 +816,9 @@ if( NOT HDF5_FOUND )
endif()
foreach(_lang IN LISTS HDF5_LANGUAGE_BINDINGS)
+ set(HDF5_${_lang}_LIBRARIES)
+ set(HDF5_${_lang}_HL_LIBRARIES)
+
# The "main" library.
set(_hdf5_main_library "")
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 4de5331..ef43a3a 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -12,13 +12,24 @@ Finds the ``pkg-config`` executable and adds the :command:`pkg_get_variable`,
following variables will also be set:
``PKG_CONFIG_FOUND``
- if pkg-config executable was found
+ True if a pkg-config executable was found.
+
+``PKG_CONFIG_VERSION_STRING``
+ .. versionadded:: 2.8.8
+
+ The version of pkg-config that was found.
+
``PKG_CONFIG_EXECUTABLE``
- pathname of the pkg-config program
+ The pathname of the pkg-config program.
+
``PKG_CONFIG_ARGN``
- list of arguments to pass to pkg-config
-``PKG_CONFIG_VERSION_STRING``
- version of pkg-config (since CMake 2.8.8)
+ .. versionadded:: 3.22
+
+ A list of arguments to pass to pkg-config.
+
+Both ``PKG_CONFIG_EXECUTABLE`` and ``PKG_CONFIG_ARGN`` are initialized by the
+module, but may be overridden by the user. See `Variables Affecting Behavior`_
+for how these variables are initialized.
#]========================================]
@@ -923,24 +934,30 @@ Variables Affecting Behavior
.. variable:: PKG_CONFIG_EXECUTABLE
- This can be set to the path of the pkg-config executable. If not provided,
- it will be set by the module as a result of calling :command:`find_program`
- internally.
+ This cache variable can be set to the path of the pkg-config executable.
+ :command:`find_program` is called internally by the module with this
+ variable.
.. versionadded:: 3.1
- The ``PKG_CONFIG`` environment variable can be used as a hint.
+ The ``PKG_CONFIG`` environment variable can be used as a hint if
+ ``PKG_CONFIG_EXECUTABLE`` has not yet been set.
+
+ .. versionchanged:: 3.22
+ If the ``PKG_CONFIG`` environment variable is set, only the first
+ argument is taken from it when using it as a hint.
.. variable:: PKG_CONFIG_ARGN
.. versionadded:: 3.22
- This can be set to a list of arguments to additionally pass to pkg-config
- if needed. If not provided, it will be an empty string, however, if the
- environment variable ``PKG_CONFIG`` is provided, this will be set to the
- result of splitting the variable.
-
- The ``PKG_CONFIG`` environment variable can be used to provide both
- ``PKG_CONFIG_EXECUTABLE`` and ``PKG_CONFIG_ARGN``
+ This cache variable can be set to a list of arguments to additionally pass
+ to pkg-config if needed. If not provided, it will be initialized from the
+ ``PKG_CONFIG`` environment variable, if set. The first argument in that
+ environment variable is assumed to be the pkg-config program, while all
+ remaining arguments after that are used to initialize ``PKG_CONFIG_ARGN``.
+ If no such environment variable is defined, ``PKG_CONFIG_ARGN`` is
+ initialized to an empty string. The module does not update the variable once
+ it has been set in the cache.
.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 3ca5053..51dc146 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -144,7 +144,7 @@ macro(__windows_compiler_gnu_abi lang)
# Query the VS Installer tool for locations of VS 2017 and above.
set(_vs_installer_paths "")
- foreach(vs RANGE 16 15 -1) # change the first number to the largest supported version
+ foreach(vs RANGE 17 15 -1) # change the first number to the largest supported version
cmake_host_system_information(RESULT _vs_dir QUERY VS_${vs}_DIR)
if(_vs_dir)
list(APPEND _vs_installer_paths "${_vs_dir}/VC/Auxiliary/Build")
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 04d09d4..fd0a63c 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -91,7 +91,7 @@ std::string EvaluateSplitConfigGenex(
// Record targets referenced by the genex.
if (utils) {
- // FIXME: What is the proper condition for a cross-dependency?
+ // Use a cross-dependency if we referenced the command config.
bool const cross = !useOutputConfig;
for (cmGeneratorTarget* gt : cge->GetTargets()) {
utils->emplace(BT<std::pair<std::string, bool>>(
@@ -176,6 +176,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
cmGeneratorTarget const* target{ lg->FindGeneratorTargetToUse(
this->Target) };
+ bool const distinctConfigs = this->OutputConfig != this->CommandConfig;
+
const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines();
for (cmCustomCommandLine const& cmdline : cmdlines) {
cmCustomCommandLine argv;
@@ -191,8 +193,10 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
argv.push_back(std::move(parsed_arg));
}
- // For remaining arguments, we default to the OUTPUT_CONFIG.
- useOutputConfig = true;
+ if (distinctConfigs) {
+ // For remaining arguments, we default to the OUTPUT_CONFIG.
+ useOutputConfig = true;
+ }
}
if (!argv.empty()) {
@@ -200,7 +204,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
// collect the target to add a target-level dependency on it.
cmGeneratorTarget* gt = this->LG->FindGeneratorTargetToUse(argv.front());
if (gt && gt->GetType() == cmStateEnums::EXECUTABLE) {
- // FIXME: What is the proper condition for a cross-dependency?
+ // GetArgv0Location uses the command config, so use a cross-dependency.
bool const cross = true;
this->Utilities.emplace(BT<std::pair<std::string, bool>>(
{ gt->GetName(), cross }, cc.GetBacktrace()));
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ac283ab..9914902 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1402,6 +1402,9 @@ bool cmGlobalGenerator::Compute()
this->SupportsDefaultConfigs())) {
return false;
}
+ if (!this->InspectConfigTypeVariables()) {
+ return false;
+ }
// Some generators track files replaced during the Generate.
// Start with an empty vector:
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index cc0ad29..96696aa 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -153,6 +153,8 @@ public:
*/
virtual void Configure();
+ virtual bool InspectConfigTypeVariables() { return true; }
+
bool Compute();
virtual void AddExtraIDETargets() {}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3f6f55e..7122b9f 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -568,9 +568,6 @@ void cmGlobalNinjaGenerator::Generate()
msg.str());
return;
}
- if (!this->InspectConfigTypeVariables()) {
- return;
- }
if (!this->OpenBuildFileStreams()) {
return;
}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index ec73475..84fc06c 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -481,8 +481,6 @@ protected:
const std::set<std::string>& all, const std::set<std::string>& defaults,
const std::vector<std::string>& items);
- virtual bool InspectConfigTypeVariables() { return true; }
-
std::set<std::string> CrossConfigs;
std::set<std::string> DefaultConfigs;
std::string DefaultFileConfig;
diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx
index 4e50d70..62e7ef4 100644
--- a/Source/cmLinkItem.cxx
+++ b/Source/cmLinkItem.cxx
@@ -32,7 +32,11 @@ bool operator<(cmLinkItem const& l, cmLinkItem const& r)
{
// Order among targets.
if (l.Target && r.Target) {
- return l.Target < r.Target;
+ if (l.Target != r.Target) {
+ return l.Target < r.Target;
+ }
+ // Order identical targets via cross-config.
+ return l.Cross < r.Cross;
}
// Order targets before strings.
if (l.Target) {
@@ -42,10 +46,10 @@ bool operator<(cmLinkItem const& l, cmLinkItem const& r)
return false;
}
// Order among strings.
- if (l.String < r.String) {
- return true;
+ if (l.String != r.String) {
+ return l.String < r.String;
}
- // Order among cross-config.
+ // Order identical strings via cross-config.
return l.Cross < r.Cross;
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 596084b..517d529 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -902,7 +902,7 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
const std::string impLibPath = localGen.ConvertToOutputFormat(
targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
- this->EnsureParentDirectoryExists(impLibPath);
+ this->EnsureParentDirectoryExists(targetOutputImplib);
}
const std::string objPath =
@@ -1211,7 +1211,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
const std::string impLibPath = localGen.ConvertToOutputFormat(
targetOutputImplib, cmOutputConverter::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
- this->EnsureParentDirectoryExists(impLibPath);
+ this->EnsureParentDirectoryExists(targetOutputImplib);
if (gt->HasImportLibrary(config)) {
// Some linkers may update a binary without touching its import lib.
byproducts.ExplicitOuts.emplace_back(targetOutputImplib);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 57fc020..57657b1 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1749,7 +1749,7 @@ void cmNinjaTargetGenerator::EnsureDirectoryExists(
} else {
cmGlobalNinjaGenerator* gg = this->GetGlobalGenerator();
std::string fullPath = gg->GetCMakeInstance()->GetHomeOutputDirectory();
- // Also ensures their is a trailing slash.
+ // Also ensures there is a trailing slash.
gg->StripNinjaOutputPathPrefixAsSuffix(fullPath);
fullPath += path;
cmSystemTools::MakeDirectory(fullPath);
diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx
index 6fcbce5..82a374a 100644
--- a/Source/cmScanDepFormat.cxx
+++ b/Source/cmScanDepFormat.cxx
@@ -97,7 +97,7 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp,
}
Json::Value const& version = ppi["version"];
- if (version.asUInt() != 0) {
+ if (version.asUInt() > 1) {
cmSystemTools::Error(cmStrCat("-E cmake_ninja_dyndep failed to parse ",
arg_pp, ": version ", version.asString()));
return false;
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index 4c488e6..f00565e 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -3,6 +3,7 @@ project(IncludeDirectories)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
OR (CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+ OR CMAKE_C_COMPILER_ID STREQUAL NVHPC
OR CMAKE_C_COMPILER_ID STREQUAL AppleClang
OR ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "19.29.30036.3" AND
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-in-release-graph-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-in-release-graph-ninja-stdout.txt
new file mode 100644
index 0000000..80e9c2f
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-in-release-graph-ninja-stdout.txt
@@ -0,0 +1,2 @@
+^\[1/1\] Generating echo_depend_target\.txt
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Release'$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-ninja-stdout.txt
new file mode 100644
index 0000000..1a79877
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-debug-ninja-stdout.txt
@@ -0,0 +1,2 @@
+^\[1/1\] Generating echo_depend_target\.txt
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Debug[\/]echo(\.exe)?' 'Debug'$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-release-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-release-ninja-stdout.txt
new file mode 100644
index 0000000..80e9c2f
--- /dev/null
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex-echo_depend_target-release-ninja-stdout.txt
@@ -0,0 +1,2 @@
+^\[1/1\] Generating echo_depend_target\.txt
+'[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build'\$ '[^']*[\/]Tests[\/]RunCMake[\/]NinjaMultiConfig[\/]CustomCommandOutputGenex-build[\/]Release[\/]echo(\.exe)?' 'Release'$
diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
index bb68a50..2de5a3a 100644
--- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandOutputGenex.cmake
@@ -143,6 +143,16 @@ add_custom_command(
PROPERTY SYMBOLIC 1)
add_custom_target(echo_dbgx DEPENDS "$<$<CONFIG:Debug>:echo_dbgx_Debug.txt>")
+# A non-cross-config custom command expresses target dependencies in command config.
+add_custom_command(
+ OUTPUT echo_depend_target.txt
+ COMMAND ${CMAKE_COMMAND} -E env $<TARGET_FILE:echo> $<CONFIG>
+ # A real project should do:
+ # DEPENDS $<TARGET_FILE:echo>
+ # but here we are testing the target-level dependency implied by TARGET_FILE.
+ )
+add_custom_target(echo_depend_target DEPENDS echo_depend_target.txt)
+
add_custom_target(echo_target_raw
BYPRODUCTS echo_target_raw_$<CONFIG>.txt
COMMENT echo_target_raw
diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
index c7b876c..4a0c130 100644
--- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake
@@ -344,6 +344,16 @@ run_ninja(CustomCommandOutputGenex echo_dbgx-release build-Release.ninja echo_db
run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
run_ninja(CustomCommandOutputGenex echo_dbgx-debug-in-release-graph build-Release.ninja echo_dbgx:Debug)
run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
+# echo_depend_target
+run_ninja(CustomCommandOutputGenex echo_depend_target-debug-prep build-Debug.ninja echo:Debug)
+run_ninja(CustomCommandOutputGenex echo_depend_target-debug build-Debug.ninja echo_depend_target)
+run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)
+run_ninja(CustomCommandOutputGenex echo_depend_target-release-prep build-Release.ninja echo:Release)
+run_ninja(CustomCommandOutputGenex echo_depend_target-release build-Release.ninja echo_depend_target)
+run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
+run_ninja(CustomCommandOutputGenex echo_depend_target-debug-in-release-graph-prep build-Release.ninja echo:Release)
+run_ninja(CustomCommandOutputGenex echo_depend_target-debug-in-release-graph build-Release.ninja echo_depend_target:Debug)
+run_ninja(CustomCommandOutputGenex clean-release-graph build-Release.ninja -t clean)
# echo_target_raw
run_ninja(CustomCommandOutputGenex echo_target_raw-debug build-Debug.ninja echo_target_raw:Debug)
run_ninja(CustomCommandOutputGenex clean-debug-graph build-Debug.ninja -t clean)