summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-03-12 13:53:16 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-03-12 13:53:27 (GMT)
commit5822a7bed289100b78a502e449b436da2fe67af1 (patch)
tree920db69d6a17edf227348b8c9ecc95190d7a80d9 /Source
parent7358f317e356dff8ef2c1cdd216b9e6063cd4d9a (diff)
parent463c2fba4eec7f364689a11b7c36afe966b1f151 (diff)
downloadCMake-5822a7bed289100b78a502e449b436da2fe67af1.zip
CMake-5822a7bed289100b78a502e449b436da2fe67af1.tar.gz
CMake-5822a7bed289100b78a502e449b436da2fe67af1.tar.bz2
Merge topic 'shell_path'
463c2fba4e Genex: Teach SHELL_PATH to support a list of paths 21da25d2a8 Tests: Generalize GeneratorExpression MSYS path conversion workaround Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3057
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionNode.cxx24
1 files changed, 20 insertions, 4 deletions
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index ce308cc..50fd16e 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -15,6 +15,8 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
+#include "cmState.h"
+#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -2045,13 +2047,27 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
{
- if (!cmSystemTools::FileIsFullPath(parameters.front())) {
+ std::vector<std::string> listIn;
+ cmSystemTools::ExpandListArgument(parameters.front(), listIn);
+ if (listIn.empty()) {
reportError(context, content->GetOriginalExpression(),
- "\"" + parameters.front() + "\" is not an absolute path.");
+ "\"\" is not an absolute path.");
return std::string();
}
- cmOutputConverter converter(context->LG->GetStateSnapshot());
- return converter.ConvertDirectorySeparatorsForShell(parameters.front());
+ cmStateSnapshot snapshot = context->LG->GetStateSnapshot();
+ cmOutputConverter converter(snapshot);
+ const char* separator = snapshot.GetState()->UseWindowsShell() ? ";" : ":";
+ std::vector<std::string> listOut;
+ listOut.reserve(listIn.size());
+ for (auto const& in : listIn) {
+ if (!cmSystemTools::FileIsFullPath(in)) {
+ reportError(context, content->GetOriginalExpression(),
+ "\"" + in + "\" is not an absolute path.");
+ return std::string();
+ }
+ listOut.emplace_back(converter.ConvertDirectorySeparatorsForShell(in));
+ }
+ return cmJoin(listOut, separator);
}
} shellPathNode;