| 2116 | } |
| 2117 | |
| 2118 | bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects( |
| 2119 | std::string const& l) const |
| 2120 | { |
| 2121 | // Check for an explicit setting one way or the other. |
| 2122 | std::string const responseVar = |
| 2123 | "CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_OBJECTS"; |
| 2124 | if (cmValue val = this->Makefile->GetDefinition(responseVar)) { |
| 2125 | if (!val->empty()) { |
| 2126 | return val.IsOn(); |
| 2127 | } |
| 2128 | } |
| 2129 | |
| 2130 | // Check for a system limit. |
| 2131 | if (size_t const limit = cmSystemTools::CalculateCommandLineLengthLimit()) { |
| 2132 | // Compute the total length of our list of object files with room |
| 2133 | // for argument separation and quoting. This does not convert paths |
| 2134 | // relative to CMAKE_CURRENT_BINARY_DIR like the final list will be, so |
| 2135 | // the actual list will likely be much shorter than this. However, in |
| 2136 | // the worst case all objects will remain as absolute paths. |
| 2137 | size_t length = 0; |
| 2138 | for (std::string const& obj : this->Objects) { |
| 2139 | length += obj.size() + 3; |
| 2140 | } |
| 2141 | for (std::string const& ext_obj : this->ExternalObjects) { |
| 2142 | length += ext_obj.size() + 3; |
| 2143 | } |
| 2144 | |
| 2145 | // We need to guarantee room for both objects and libraries, so |
| 2146 | // if the objects take up more than half then use a response file |
| 2147 | // for them. |
| 2148 | if (length > (limit / 2)) { |
| 2149 | return true; |
| 2150 | } |
| 2151 | } |
| 2152 | |
| 2153 | // We do not need a response file for objects. |
| 2154 | return false; |
| 2155 | } |
| 2156 | |
| 2157 | bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries( |
| 2158 | std::string const& l) const |
no test coverage detected