summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCustomCommandCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-03-30 13:52:07 (GMT)
committerBrad King <brad.king@kitware.com>2011-03-30 13:52:07 (GMT)
commit128605054a2d773189869d6e1b5000e6d4a93241 (patch)
tree364a4e2703e50e3d573356e0ac0af86c5acb1ee6 /Source/cmAddCustomCommandCommand.cxx
parent88548a45fbd35205469ac9fd332349551e172496 (diff)
downloadCMake-128605054a2d773189869d6e1b5000e6d4a93241.zip
CMake-128605054a2d773189869d6e1b5000e6d4a93241.tar.gz
CMake-128605054a2d773189869d6e1b5000e6d4a93241.tar.bz2
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 commit a75a0a14 (Normalize add_custom_command OUTPUT names, 2010-12-15). We handled a special case of the DEPENDS option in commit 7befc007 (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.
Diffstat (limited to 'Source/cmAddCustomCommandCommand.cxx')
-rw-r--r--Source/cmAddCustomCommandCommand.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 502829e..5634849 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -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);