diff options
author | Brad King <brad.king@kitware.com> | 2019-01-29 14:17:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-29 14:18:42 (GMT) |
commit | 60c06620a690f0cbeeaa3fba762e19cd031669ca (patch) | |
tree | c72e5f4bd45dc2a769e0c7f7bcbbfbd108f0e0f7 /Source/cmLocalGenerator.cxx | |
parent | 90ac5e6384735deb0ac523684010b2f4701d4f4d (diff) | |
parent | b6a957c9696706a338cdeef63540bf8a4c42d22d (diff) | |
download | CMake-60c06620a690f0cbeeaa3fba762e19cd031669ca.zip CMake-60c06620a690f0cbeeaa3fba762e19cd031669ca.tar.gz CMake-60c06620a690f0cbeeaa3fba762e19cd031669ca.tar.bz2 |
Merge topic 'cmoutputconverter-simplify'
b6a957c969 cmOutputConverter: move ConvertToRelativePath to cmStateDirectory.
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2831
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 24bc7fa..252aa4c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -316,7 +316,7 @@ void cmLocalGenerator::GenerateTestFiles() for (cmStateSnapshot const& i : children) { // TODO: Use add_subdirectory instead? std::string outP = i.GetDirectory().GetCurrentBinary(); - outP = this->ConvertToRelativePath(parentBinDir, outP); + outP = this->MaybeConvertToRelativePath(parentBinDir, outP); outP = cmOutputConverter::EscapeForCMake(outP); fout << "subdirs(" << outP << ")" << std::endl; } @@ -2321,7 +2321,7 @@ std::string cmLocalGenerator::ConstructComment( std::string currentBinaryDir = this->GetCurrentBinaryDirectory(); for (std::string const& o : ccg.GetOutputs()) { comment += sep; - comment += this->ConvertToRelativePath(currentBinaryDir, o); + comment += this->MaybeConvertToRelativePath(currentBinaryDir, o); sep = ", "; } return comment; @@ -2578,15 +2578,15 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget( std::string const& fullPath = source.GetFullPath(); // Try referencing the source relative to the source tree. - std::string relFromSource = - this->ConvertToRelativePath(this->GetCurrentSourceDirectory(), fullPath); + std::string relFromSource = this->MaybeConvertToRelativePath( + this->GetCurrentSourceDirectory(), fullPath); assert(!relFromSource.empty()); bool relSource = !cmSystemTools::FileIsFullPath(relFromSource); bool subSource = relSource && relFromSource[0] != '.'; // Try referencing the source relative to the binary tree. - std::string relFromBinary = - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), fullPath); + std::string relFromBinary = this->MaybeConvertToRelativePath( + this->GetCurrentBinaryDirectory(), fullPath); assert(!relFromBinary.empty()); bool relBinary = !cmSystemTools::FileIsFullPath(relFromBinary); bool subBinary = relBinary && relFromBinary[0] != '.'; @@ -2685,6 +2685,13 @@ std::string const& cmLocalGenerator::GetCurrentSourceDirectory() const return this->StateSnapshot.GetDirectory().GetCurrentSource(); } +std::string cmLocalGenerator::MaybeConvertToRelativePath( + std::string const& local_path, std::string const& remote_path) const +{ + return this->StateSnapshot.GetDirectory().ConvertToRelPathIfNotContained( + local_path, remote_path); +} + std::string cmLocalGenerator::GetTargetDirectory( const cmGeneratorTarget* /*unused*/) const { |