From ec479f101f7113d21efd15257461e337ddc4f8b4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 9 Jan 2020 16:40:22 -0500 Subject: cmLocalGenerator: collapse the path after construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The path may contain `..` or `.` components naïvely, so compute them out before letting the generator handle them. --- Source/cmLocalGenerator.cxx | 2 ++ Tests/CustomCommand/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6b282ab..4f1f582 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2011,6 +2011,8 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, dep = cmStrCat(this->GetCurrentBinaryDirectory(), '/', inName); } + dep = cmSystemTools::CollapseFullPath(dep, this->GetBinaryDirectory()); + return true; } diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 86c74ba..d43cdba 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -535,6 +535,7 @@ set_property(SOURCE "${gen_file}" PROPERTY SYMBOLIC ON) add_custom_target(command_expand_lists ALL DEPENDS "${gen_file}") set_property(TARGET command_expand_lists PROPERTY CMPARGS "${cmp_args}") +# This also tests that `./` is squeezed out of the resulting path. set(depends_path "./depended_upon_path.txt") add_custom_command( -- cgit v0.12