summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst26
-rw-r--r--Help/release/3.27.rst6
-rw-r--r--Source/cmDebuggerVariables.cxx39
-rw-r--r--Source/cmGeneratorExpressionNode.cxx4
-rw-r--r--Source/cmWorkerPool.cxx2
-rw-r--r--Tests/CMakeLib/testDebugger.h12
-rw-r--r--Tests/CMakeLib/testDebuggerVariables.cxx29
-rw-r--r--Tests/CMakeLib/testDebuggerVariablesHelper.cxx1
-rw-r--r--Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake6
-rw-r--r--Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake3
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
11 files changed, 92 insertions, 37 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 473e8d7..981bd90 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -1789,20 +1789,20 @@ In the following, the phrase "the ``tgt`` filename" means the name of the
.. versionadded:: 3.27
Full path to the linker import file. On DLL platforms, it would be the
- ``.lib`` file. On AIX, for the executables, and on macOS, for the shared
- libraries, it could be, respectively, the ``.imp`` or ``.tbd`` import file,
- depending of the value of :prop_tgt:`ENABLE_EXPORTS` property.
+ ``.lib`` file. For executables on AIX, and for shared libraries on macOS,
+ it could be, respectively, the ``.imp`` or ``.tbd`` import file,
+ depending on the value of the :prop_tgt:`ENABLE_EXPORTS` property.
- An empty string is returned when there is no import file associated with the
- target.
+ This expands to an empty string when there is no import file associated
+ with the target.
.. genex:: $<TARGET_IMPORT_FILE_BASE_NAME:tgt>
.. versionadded:: 3.27
- Base name of file linker import file of the target ``tgt`` without prefix and
- suffix. For example, if target file name is ``libbase.tbd``, the base name is
- ``base``.
+ Base name of the linker import file of the target ``tgt`` without prefix or
+ suffix. For example, if the target file name is ``libbase.tbd``, the base
+ name is ``base``.
See also the :prop_tgt:`OUTPUT_NAME` and :prop_tgt:`ARCHIVE_OUTPUT_NAME`
target properties and their configuration specific variants
@@ -1831,7 +1831,7 @@ In the following, the phrase "the ``tgt`` filename" means the name of the
Suffix of the import file of the target ``tgt``.
- The suffix corresponds to the file extension (such as ".lib" or ".tbd").
+ The suffix corresponds to the file extension (such as ``.lib`` or ``.tbd``).
See also the :prop_tgt:`IMPORT_SUFFIX` target property.
@@ -1842,13 +1842,15 @@ In the following, the phrase "the ``tgt`` filename" means the name of the
.. versionadded:: 3.27
- Name of the import file of the target target ``tgt``.
+ Name of the import file of the target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
.. genex:: $<TARGET_IMPORT_FILE_DIR:tgt>
+ .. versionadded:: 3.27
+
Directory of the import file of the target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this
@@ -1863,11 +1865,11 @@ In the following, the phrase "the ``tgt`` filename" means the name of the
.. versionadded:: 3.27
On macOS, it could be the ``.tbd`` import file associated with the shared
- library, depending of the value of :prop_tgt:`ENABLE_EXPORTS` property.
+ library, depending on the value of the :prop_tgt:`ENABLE_EXPORTS` property.
This generator expression is equivalent to
:genex:`$<TARGET_LINKER_LIBRARY_FILE>` or
- :genex:`$<TARGET_LINKER_IMPORT_FILE>` generator expressions, depending of the
+ :genex:`$<TARGET_LINKER_IMPORT_FILE>` generator expressions, depending on the
characteristics of the target and the platform.
.. genex:: $<TARGET_LINKER_FILE_BASE_NAME:tgt>
diff --git a/Help/release/3.27.rst b/Help/release/3.27.rst
index 930a0dc..52768d1 100644
--- a/Help/release/3.27.rst
+++ b/Help/release/3.27.rst
@@ -157,6 +157,12 @@ Generator Expressions
:ref:`transformation <GenEx Path Transformations>` operations learned
to process :ref:`lists <CMake Language Lists>` of paths element-wise.
+* The :genex:`TARGET_IMPORT_FILE`, :genex:`TARGET_IMPORT_FILE_BASE_NAME`,
+ :genex:`TARGET_IMPORT_FILE_PREFIX`, :genex:`TARGET_IMPORT_FILE_SUFFIX`,
+ :genex:`TARGET_IMPORT_FILE_NAME`, and :genex:`TARGET_IMPORT_FILE_DIR`
+ generator expressions were added. These expand to details about the
+ linker import file for a target.
+
* The :genex:`TARGET_RUNTIME_DLL_DIRS` generator expression was added.
It expands to a list of the directories containing DLLs in
:genex:`TARGET_RUNTIME_DLLS`.
diff --git a/Source/cmDebuggerVariables.cxx b/Source/cmDebuggerVariables.cxx
index 40fe41f..8acce34 100644
--- a/Source/cmDebuggerVariables.cxx
+++ b/Source/cmDebuggerVariables.cxx
@@ -78,15 +78,16 @@ dap::array<dap::Variable> cmDebuggerVariables::HandleVariablesRequest()
entry.Value.empty()) {
continue;
}
- variables.push_back(dap::Variable{ {},
- {},
- {},
- entry.Name,
- {},
- PrivateDataHint,
- entry.Type,
- entry.Value,
- 0 });
+ variables.push_back(dap::Variable{
+ {},
+ {},
+ {},
+ entry.Name,
+ {},
+ PrivateDataHint,
+ SupportsVariableType ? entry.Type : dap::optional<dap::string>(),
+ entry.Value,
+ 0 });
}
}
@@ -106,16 +107,16 @@ void cmDebuggerVariables::EnumerateSubVariablesIfAny(
{
dap::array<dap::Variable> ret;
for (auto const& variables : SubVariables) {
- toBeReturned.emplace_back(
- dap::Variable{ {},
- {},
- {},
- variables->GetName(),
- {},
- PrivatePropertyHint,
- SupportsVariableType ? "collection" : nullptr,
- variables->GetValue(),
- variables->GetId() });
+ toBeReturned.emplace_back(dap::Variable{
+ {},
+ {},
+ {},
+ variables->GetName(),
+ {},
+ PrivatePropertyHint,
+ SupportsVariableType ? "collection" : dap::optional<dap::string>(),
+ variables->GetValue(),
+ variables->GetId() });
}
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index bb4fc7e..7fe814a 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -384,7 +384,9 @@ static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode
"$<REMOVE_DUPLICATES:...> expression requires one parameter");
}
- return cmList{ parameters.front() }.remove_duplicates().to_string();
+ return cmList{ parameters.front(), cmList::EmptyElements::Yes }
+ .remove_duplicates()
+ .to_string();
}
} removeDuplicatesNode;
diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx
index 1d15c27..27cdbba 100644
--- a/Source/cmWorkerPool.cxx
+++ b/Source/cmWorkerPool.cxx
@@ -309,7 +309,7 @@ void cmUVReadOnlyProcess::UVExit(uv_process_t* handle, int64_t exitStatus,
// Set error message on demand
proc.Result()->ExitStatus = exitStatus;
proc.Result()->TermSignal = termSignal;
- if (!proc.Result()->error()) {
+ if (proc.Result()->ErrorMessage.empty()) {
if (termSignal != 0) {
proc.Result()->ErrorMessage = cmStrCat(
"Process was terminated by signal ", proc.Result()->TermSignal);
diff --git a/Tests/CMakeLib/testDebugger.h b/Tests/CMakeLib/testDebugger.h
index 8ba21f6..d8d2caa 100644
--- a/Tests/CMakeLib/testDebugger.h
+++ b/Tests/CMakeLib/testDebugger.h
@@ -19,11 +19,15 @@
do { \
ASSERT_TRUE(x.name == expectedName); \
ASSERT_TRUE(x.value == expectedValue); \
- ASSERT_TRUE(x.type.value() == expectedType); \
- ASSERT_TRUE(x.evaluateName.has_value() == false); \
- if (std::string(expectedType) == "collection") { \
- ASSERT_TRUE(x.variablesReference != 0); \
+ if (expectedType == nullptr) { \
+ ASSERT_TRUE(x.type == dap::optional<dap::string>()); \
+ } else { \
+ ASSERT_TRUE(x.type == dap::optional<dap::string>(expectedType)); \
+ if (std::string(expectedType) == "collection") { \
+ ASSERT_TRUE(x.variablesReference != 0); \
+ } \
} \
+ ASSERT_TRUE(x.evaluateName.has_value() == false); \
} while (false)
#define ASSERT_VARIABLE_REFERENCE(x, expectedName, expectedValue, \
diff --git a/Tests/CMakeLib/testDebuggerVariables.cxx b/Tests/CMakeLib/testDebuggerVariables.cxx
index 6c19baa..0d8d18d 100644
--- a/Tests/CMakeLib/testDebuggerVariables.cxx
+++ b/Tests/CMakeLib/testDebuggerVariables.cxx
@@ -8,6 +8,7 @@
#include <unordered_set>
#include <vector>
+#include <cm3p/cppdap/optional.h>
#include <cm3p/cppdap/protocol.h>
#include <cm3p/cppdap/types.h>
@@ -174,6 +175,33 @@ static bool testSortTheResult()
return true;
}
+static bool testNoSupportsVariableType()
+{
+ auto variablesManager =
+ std::make_shared<cmDebugger::cmDebuggerVariablesManager>();
+
+ auto vars = std::make_shared<cmDebugger::cmDebuggerVariables>(
+ variablesManager, "Variables", false, []() {
+ return std::vector<cmDebugger::cmDebuggerVariableEntry>{ { "test",
+ "value" } };
+ });
+
+ auto subvars = std::make_shared<cmDebugger::cmDebuggerVariables>(
+ variablesManager, "Children", false);
+
+ vars->AddSubVariables(subvars);
+
+ dap::array<dap::Variable> variables =
+ variablesManager->HandleVariablesRequest(
+ CreateVariablesRequest(vars->GetId()));
+
+ ASSERT_TRUE(variables.size() == 2);
+ ASSERT_VARIABLE(variables[0], "Children", "", nullptr);
+ ASSERT_VARIABLE(variables[1], "test", "value", nullptr);
+
+ return true;
+}
+
int testDebuggerVariables(int, char*[])
{
return runTests(std::vector<std::function<bool()>>{
@@ -181,5 +209,6 @@ int testDebuggerVariables(int, char*[])
testConstructors,
testIgnoreEmptyStringEntries,
testSortTheResult,
+ testNoSupportsVariableType,
});
}
diff --git a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx
index e0bbdf0..d61b73b 100644
--- a/Tests/CMakeLib/testDebuggerVariablesHelper.cxx
+++ b/Tests/CMakeLib/testDebuggerVariablesHelper.cxx
@@ -8,6 +8,7 @@
#include <utility>
#include <vector>
+#include <cm3p/cppdap/optional.h>
#include <cm3p/cppdap/protocol.h>
#include <cm3p/cppdap/types.h>
#include <stddef.h>
diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake
new file mode 100644
index 0000000..a996e53
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element-check.cmake
@@ -0,0 +1,6 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/REMOVE_DUPLICATES-generated.txt" content)
+
+set(expected "1;;2;3")
+if(NOT content STREQUAL expected)
+ set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake
new file mode 100644
index 0000000..9d5944f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/REMOVE_DUPLICATES-empty-element.cmake
@@ -0,0 +1,3 @@
+cmake_policy(VERSION 3.11)
+
+file(GENERATE OUTPUT "REMOVE_DUPLICATES-generated.txt" CONTENT "$<REMOVE_DUPLICATES:1$<SEMICOLON>$<SEMICOLON>2$<SEMICOLON>$<SEMICOLON>3>")
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 3fd9947..2a0c893 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -36,6 +36,7 @@ run_cmake(TARGET_NAME_IF_EXISTS-alias-target)
run_cmake(TARGET_NAME_IF_EXISTS-imported-target)
run_cmake(TARGET_NAME_IF_EXISTS-imported-global-target)
run_cmake(REMOVE_DUPLICATES-empty)
+run_cmake(REMOVE_DUPLICATES-empty-element)
run_cmake(REMOVE_DUPLICATES-1)
run_cmake(REMOVE_DUPLICATES-2)
run_cmake(REMOVE_DUPLICATES-3)