mirror of
https://github.com/reactos/CMake.git
synced 2024-11-30 23:10:26 +00:00
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 outputdb4780d584
cmGeneratorTarget: search for relative paths to the binary directoryec479f101f
cmLocalGenerator: collapse the path after constructionfd0ba705ce
add_custom_command: check if a relative path should be an in-source pathfd84f510f8
cmLocalGenerator: simplify the current source dir query Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4195
This commit is contained in:
commit
9b9dfacaa5
@ -8,7 +8,6 @@
|
||||
|
||||
#include <cmext/algorithm>
|
||||
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmCustomCommandLines.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
@ -30,9 +29,6 @@ void AppendPaths(const std::vector<std::string>& inputs,
|
||||
cmExpandedList(cge->Evaluate(lg, config));
|
||||
for (std::string& it : result) {
|
||||
cmSystemTools::ConvertToUnixSlashes(it);
|
||||
if (cmContains(it, '/') && !cmSystemTools::FileIsFullPath(it)) {
|
||||
it = cmStrCat(lg->GetMakefile()->GetCurrentBinaryDirectory(), '/', it);
|
||||
}
|
||||
if (cmSystemTools::FileIsFullPath(it)) {
|
||||
it = cmSystemTools::CollapseFullPath(
|
||||
it, lg->GetMakefile()->GetHomeOutputDirectory());
|
||||
|
@ -2713,6 +2713,17 @@ void cmTargetTraceDependencies::FollowName(std::string const& name)
|
||||
if (i == this->NameMap.end() || i->first != name) {
|
||||
// Check if we know how to generate this file.
|
||||
cmSourcesWithOutput sources = this->Makefile->GetSourcesWithOutput(name);
|
||||
// If we failed to find a target or source and we have a relative path, it
|
||||
// might be a valid source if made relative to the current binary
|
||||
// directory.
|
||||
if (!sources.Target && !sources.Source &&
|
||||
!cmSystemTools::FileIsFullPath(name)) {
|
||||
auto fullname =
|
||||
cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/', name);
|
||||
fullname = cmSystemTools::CollapseFullPath(
|
||||
fullname, this->Makefile->GetHomeOutputDirectory());
|
||||
sources = this->Makefile->GetSourcesWithOutput(fullname);
|
||||
}
|
||||
i = this->NameMap.emplace_hint(i, name, sources);
|
||||
}
|
||||
if (cmTarget* t = i->second.Target) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
@ -549,3 +550,19 @@ add_custom_command(
|
||||
)
|
||||
|
||||
add_custom_target(depends_on_path ALL DEPENDS "depends_on_path.txt")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "depends_on_in_source_path.txt"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/main.cxx" depends_on_in_source_path.txt
|
||||
DEPENDS main.cxx
|
||||
)
|
||||
|
||||
add_custom_target(depends_on_in_source_path ALL DEPENDS "depends_on_in_source_path.txt")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "depends_on_in_rel_source_path.txt"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/main.cxx" depends_on_in_rel_source_path.txt
|
||||
DEPENDS ./main.cxx
|
||||
)
|
||||
|
||||
add_custom_target(depends_on_in_rel_source_path ALL DEPENDS "depends_on_in_rel_source_path.txt")
|
||||
|
Loading…
Reference in New Issue
Block a user