MCPcopy Create free account
hub / github.com/Kitware/CMake / SetImportLocationProperty

Method SetImportLocationProperty

Source/cmExportBuildFileGenerator.cxx:62–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void cmExportBuildFileGenerator::SetImportLocationProperty(
63 std::string const& config, std::string const& suffix,
64 cmGeneratorTarget* target, ImportPropertyMap& properties)
65{
66 // Get the makefile in which to lookup target information.
67 cmMakefile* mf = target->Makefile;
68
69 if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
70 std::string prop = cmStrCat("IMPORTED_OBJECTS", suffix);
71
72 // Compute all the object files inside this target and setup
73 // IMPORTED_OBJECTS as a list of object files
74 std::vector<cmSourceFile const*> objectSources;
75 target->GetObjectSources(objectSources, config);
76 std::string const obj_dir = target->GetObjectDirectory(config);
77 std::vector<std::string> objects;
78 for (cmSourceFile const* sf : objectSources) {
79 std::string const& obj = target->GetObjectName(sf);
80 objects.push_back(obj_dir + obj);
81 }
82
83 // Store the property.
84 properties[prop] = cmList::to_string(objects);
85 } else {
86 // Add the main target file.
87 {
88 std::string prop = cmStrCat("IMPORTED_LOCATION", suffix);
89 std::string value;
90 if (target->IsAppBundleOnApple()) {
91 value =
92 target->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
93 } else {
94 value = target->GetFullPath(config,
95 cmStateEnums::RuntimeBinaryArtifact, true);
96 }
97 properties[prop] = value;
98 }
99
100 // Add the import library for windows DLLs.
101 if (target->HasImportLibrary(config)) {
102 std::string prop = cmStrCat("IMPORTED_IMPLIB", suffix);
103 std::string value =
104 target->GetFullPath(config, cmStateEnums::ImportLibraryArtifact, true);
105 if (mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) {
106 target->GetImplibGNUtoMS(config, value, value,
107 "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
108 }
109 properties[prop] = value;
110 }
111 }
112}
113
114bool cmExportBuildFileGenerator::CollectExports(
115 std::function<void(cmGeneratorTarget const*)> visitor)

Calls 11

to_stringFunction · 0.85
GetObjectSourcesMethod · 0.80
GetObjectDirectoryMethod · 0.80
push_backMethod · 0.80
HasImportLibraryMethod · 0.80
GetImplibGNUtoMSMethod · 0.80
cmStrCatFunction · 0.70
GetTypeMethod · 0.45
IsAppBundleOnAppleMethod · 0.45
GetFullPathMethod · 0.45
GetDefinitionMethod · 0.45

Tested by

no test coverage detected