Normalize slashes of add_custom_(command|target) DEPENDS (#11973)
All commands accepting file paths should normalize the slashes so that the string-represented names can be compared reliably. The commands add_library and add_executable have done this for years. We taught add_custom_command to normalize its OUTPUT names in commita75a0a14
(Normalize add_custom_command OUTPUT names, 2010-12-15). We handled a special case of the DEPENDS option in commit7befc007
(Handle trailing slashes on add_custom_command DEPENDS, 2011-01-26). Teach both add_custom_command and add_custom_target to normalize slashes of DEPENDS files up front. This approach subsumes the above-mentioned special case so remove the one line added for it but keep its test. Extend the CustomCommand test to check that slash count mismatches between custom command OUTPUT and DEPENDS can still be linked correctly.
This commit is contained in:
parent
88548a45fb
commit
128605054a
|
@ -195,11 +195,13 @@ bool cmAddCustomCommandCommand
|
|||
{
|
||||
// An implicit dependency starting point is also an
|
||||
// explicit dependency.
|
||||
depends.push_back(copy);
|
||||
std::string dep = copy;
|
||||
cmSystemTools::ConvertToUnixSlashes(dep);
|
||||
depends.push_back(dep);
|
||||
|
||||
// Add the implicit dependency language and file.
|
||||
cmCustomCommand::ImplicitDependsPair
|
||||
entry(implicit_depends_lang, copy);
|
||||
entry(implicit_depends_lang, dep);
|
||||
implicit_depends.push_back(entry);
|
||||
|
||||
// Switch back to looking for a language.
|
||||
|
@ -213,7 +215,11 @@ bool cmAddCustomCommandCommand
|
|||
target = copy;
|
||||
break;
|
||||
case doing_depends:
|
||||
depends.push_back(copy);
|
||||
{
|
||||
std::string dep = copy;
|
||||
cmSystemTools::ConvertToUnixSlashes(dep);
|
||||
depends.push_back(dep);
|
||||
}
|
||||
break;
|
||||
case doing_outputs:
|
||||
outputs.push_back(filename);
|
||||
|
|
|
@ -123,7 +123,11 @@ bool cmAddCustomTargetCommand
|
|||
currentLine.push_back(copy);
|
||||
break;
|
||||
case doing_depends:
|
||||
depends.push_back(copy);
|
||||
{
|
||||
std::string dep = copy;
|
||||
cmSystemTools::ConvertToUnixSlashes(dep);
|
||||
depends.push_back(dep);
|
||||
}
|
||||
break;
|
||||
case doing_comment:
|
||||
comment_buffer = copy;
|
||||
|
|
|
@ -1893,7 +1893,6 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
|
|||
{
|
||||
// This is a full path. Return it as given.
|
||||
dep = inName;
|
||||
cmSystemTools::ConvertToUnixSlashes(dep);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ ADD_CUSTOM_TARGET(TDocument ALL
|
|||
COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.h to doc2.h."
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.h
|
||||
${PROJECT_BINARY_DIR}/doc2.h
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/doc1.h doc1.txt
|
||||
DEPENDS doc1.txt ${PROJECT_BINARY_DIR}//doc1.h # test 2 slashes
|
||||
COMMENT "Running top-level TDocument commands"
|
||||
SOURCES doc1.tex
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue