diff options
author | Brad King <brad.king@kitware.com> | 2020-01-20 16:51:27 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-20 16:52:00 (GMT) |
commit | 9b9dfacaa56240cabee28106237e1274d37fc460 (patch) | |
tree | a1050fd9cfb3477f739106813ac96dbbc982fc5b /Source/cmLocalGenerator.cxx | |
parent | ac59da4c6a44527eaca5ea082a26488ea6c805c5 (diff) | |
parent | ba3a417dce45c6aa4f93d520ef0546b20f13fad9 (diff) | |
download | CMake-9b9dfacaa56240cabee28106237e1274d37fc460.zip CMake-9b9dfacaa56240cabee28106237e1274d37fc460.tar.gz CMake-9b9dfacaa56240cabee28106237e1274d37fc460.tar.bz2 |
Merge topic 'acc-fix-in-source-depends-path'
ba3a417dce Tests/CustomCommand: add a test for depending on a `./path`
e23475dc73 Tests/CustomCommand: fix custom command line to actually make its output
db4780d584 cmGeneratorTarget: search for relative paths to the binary directory
ec479f101f cmLocalGenerator: collapse the path after construction
fd0ba705ce add_custom_command: check if a relative path should be an in-source path
fd84f510f8 cmLocalGenerator: simplify the current source dir query
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4195
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cc07b11..f13e18b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2003,8 +2003,16 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, // Treat the name as relative to the source directory in which it // was given. - dep = cmStrCat(this->StateSnapshot.GetDirectory().GetCurrentSource(), '/', - inName); + dep = cmStrCat(this->GetCurrentSourceDirectory(), '/', inName); + + // If the in-source path does not exist, assume it instead lives in the + // binary directory. + if (!cmSystemTools::FileExists(dep)) { + dep = cmStrCat(this->GetCurrentBinaryDirectory(), '/', inName); + } + + dep = cmSystemTools::CollapseFullPath(dep, this->GetBinaryDirectory()); + return true; } |