@@ -56,8 +56,10 @@ void ToolChainInvocation::ParseCommandArgs(char const* const* cli) {
56
56
// Collect include args as we need to ensure Spack
57
57
// Includes come first
58
58
for (char const * const * co = cli; *co; co++) {
59
- std::string const arg = std::string (*co);
60
- if (startswith (arg, " /I" ) || startswith (arg, " -I" )) {
59
+ std::string norm_arg = std::string (*co);
60
+ const std::string arg = std::string (*co);
61
+ lower (norm_arg);
62
+ if (isCommandArg (norm_arg, " i" )) {
61
63
// We have an include arg
62
64
// can have an optional space
63
65
// check if there are characters after
@@ -69,19 +71,20 @@ void ToolChainInvocation::ParseCommandArgs(char const* const* cli) {
69
71
this ->include_args .push_back (arg);
70
72
this ->include_args .emplace_back (*(++co));
71
73
}
72
- } else if (endswith (arg , " .lib" ) &&
73
- (arg .find (" implib:" ) == std::string::npos))
74
+ } else if (endswith (norm_arg , " .lib" ) &&
75
+ (norm_arg .find (" implib:" ) == std::string::npos))
74
76
// Lib args are just libraries
75
77
// provided like system32.lib on the
76
78
// command line.
77
79
// lib specification order does not matter
78
80
// on MSVC but this is useful for filtering system libs
79
81
// and adding all libs
80
82
this ->lib_args .push_back (arg);
81
- else if (endswith (arg , " .obj" ))
83
+ else if (endswith (norm_arg , " .obj" ))
82
84
this ->obj_args .push_back (arg);
83
- else
85
+ else {
84
86
this ->command_args .push_back (arg);
87
+ }
85
88
}
86
89
}
87
90
0 commit comments