| 140 | } |
| 141 | |
| 142 | void cmExportInstallFileGenerator::SetImportLocationProperty( |
| 143 | std::string const& config, std::string const& suffix, |
| 144 | cmInstallTargetGenerator* itgen, ImportPropertyMap& properties, |
| 145 | std::set<std::string>& importedLocations) |
| 146 | { |
| 147 | // Skip rules that do not match this configuration. |
| 148 | if (!(itgen && itgen->InstallsForConfig(config))) { |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | // Get the target to be installed. |
| 153 | cmGeneratorTarget* target = itgen->GetTarget(); |
| 154 | |
| 155 | // Construct the installed location of the target. |
| 156 | std::string dest = itgen->GetDestination(config); |
| 157 | std::string value; |
| 158 | if (!cmSystemTools::FileIsFullPath(dest)) { |
| 159 | // The target is installed relative to the installation prefix. |
| 160 | value = std::string{ this->GetImportPrefixWithSlash() }; |
| 161 | } |
| 162 | value += dest; |
| 163 | value += "/"; |
| 164 | |
| 165 | if (itgen->IsImportLibrary()) { |
| 166 | // Construct the property name. |
| 167 | std::string prop = cmStrCat("IMPORTED_IMPLIB", suffix); |
| 168 | |
| 169 | // Append the installed file name. |
| 170 | value += cmInstallTargetGenerator::GetInstallFilename( |
| 171 | target, config, cmInstallTargetGenerator::NameImplibReal); |
| 172 | |
| 173 | // Store the property. |
| 174 | properties[prop] = value; |
| 175 | importedLocations.insert(prop); |
| 176 | } else if (itgen->GetTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) { |
| 177 | // Construct the property name. |
| 178 | std::string prop = cmStrCat("IMPORTED_OBJECTS", suffix); |
| 179 | |
| 180 | // Compute all the object files inside this target and setup |
| 181 | // IMPORTED_OBJECTS as a list of object files |
| 182 | std::vector<std::string> objects; |
| 183 | itgen->GetInstallObjectNames(config, objects); |
| 184 | for (std::string& obj : objects) { |
| 185 | obj = cmStrCat(value, obj); |
| 186 | } |
| 187 | |
| 188 | // Store the property. |
| 189 | properties[prop] = cmList::to_string(objects); |
| 190 | importedLocations.insert(prop); |
| 191 | } else { |
| 192 | if (target->IsFrameworkOnApple() && target->HasImportLibrary(config)) { |
| 193 | // store as well IMPLIB value |
| 194 | auto importProp = cmStrCat("IMPORTED_IMPLIB", suffix); |
| 195 | auto importValue = |
| 196 | cmStrCat(value, |
| 197 | cmInstallTargetGenerator::GetInstallFilename( |
| 198 | target, config, cmInstallTargetGenerator::NameImplibReal)); |
| 199 |
no test coverage detected