cmake/Source/cmExportInstallFileGenerator.cxx

523 lines
18 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportInstallFileGenerator.h"
2016-07-09 11:21:54 +02:00
#include "cmAlgorithms.h"
2013-03-16 19:13:01 +02:00
#include "cmExportSet.h"
#include "cmExportSetMap.h"
#include "cmGeneratedFileStream.h"
2016-10-30 18:24:19 +01:00
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
2013-03-16 19:13:01 +02:00
#include "cmGlobalGenerator.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
2016-07-09 11:21:54 +02:00
#include "cmLocalGenerator.h"
2016-10-30 18:24:19 +01:00
#include "cmMakefile.h"
#include "cmPolicies.h"
2017-04-14 19:02:05 +02:00
#include "cmStateTypes.h"
2016-10-30 18:24:19 +01:00
#include "cmSystemTools.h"
#include "cmTarget.h"
2013-03-16 19:13:01 +02:00
#include "cmTargetExport.h"
2016-10-30 18:24:19 +01:00
#include <sstream>
#include <utility>
2016-07-09 11:21:54 +02:00
cmExportInstallFileGenerator::cmExportInstallFileGenerator(
cmInstallExportGenerator* iegen)
: IEGen(iegen)
{
}
std::string cmExportInstallFileGenerator::GetConfigImportFileGlob()
{
std::string glob = this->FileBase;
glob += "-*";
glob += this->FileExt;
return glob;
}
bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
2013-11-03 12:27:13 +02:00
std::vector<cmTargetExport*> allTargets;
2013-03-16 19:13:01 +02:00
{
2016-07-09 11:21:54 +02:00
std::string expectedTargets;
std::string sep;
for (std::vector<cmTargetExport*>::const_iterator tei =
this->IEGen->GetExportSet()->GetTargetExports()->begin();
tei != this->IEGen->GetExportSet()->GetTargetExports()->end();
++tei) {
expectedTargets +=
2016-03-13 13:35:51 +01:00
sep + this->Namespace + (*tei)->Target->GetExportName();
2016-07-09 11:21:54 +02:00
sep = " ";
cmTargetExport* te = *tei;
if (this->ExportedTargets.insert(te->Target).second) {
allTargets.push_back(te);
} else {
std::ostringstream e;
e << "install(EXPORT \"" << this->IEGen->GetExportSet()->GetName()
<< "\" ...) "
<< "includes target \"" << te->Target->GetName()
<< "\" more than once in the export set.";
cmSystemTools::Error(e.str().c_str());
return false;
}
}
2016-07-09 11:21:54 +02:00
this->GenerateExpectedTargetsCode(os, expectedTargets);
2013-03-16 19:13:01 +02:00
}
2016-10-30 18:24:19 +01:00
// Compute the relative import prefix for the file
this->GenerateImportPrefix(os);
2013-03-16 19:13:01 +02:00
std::vector<std::string> missingTargets;
2013-11-03 12:27:13 +02:00
bool require2_8_12 = false;
2014-08-03 19:52:23 +02:00
bool require3_0_0 = false;
2015-08-17 11:37:30 +02:00
bool require3_1_0 = false;
2014-08-03 19:52:23 +02:00
bool requiresConfigFiles = false;
2013-03-16 19:13:01 +02:00
// Create all the imported targets.
2016-07-09 11:21:54 +02:00
for (std::vector<cmTargetExport*>::const_iterator tei = allTargets.begin();
tei != allTargets.end(); ++tei) {
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* gt = (*tei)->Target;
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
requiresConfigFiles =
2017-04-14 19:02:05 +02:00
requiresConfigFiles || gt->GetType() != cmStateEnums::INTERFACE_LIBRARY;
2014-08-03 19:52:23 +02:00
2016-03-13 13:35:51 +01:00
this->GenerateImportTargetCode(os, gt);
2013-03-16 19:13:01 +02:00
ImportPropertyMap properties;
2016-07-09 11:21:54 +02:00
this->PopulateIncludeDirectoriesInterface(
*tei, cmGeneratorExpression::InstallInterface, properties,
missingTargets);
2015-08-17 11:37:30 +02:00
this->PopulateSourcesInterface(*tei,
2016-07-09 11:21:54 +02:00
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", gt,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", gt,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS", gt,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_AUTOUIC_OPTIONS", gt,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gt,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
2013-11-03 12:27:13 +02:00
const bool newCMP0022Behavior =
2016-07-09 11:21:54 +02:00
gt->GetPolicyStatusCMP0022() != cmPolicies::WARN &&
gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior) {
if (this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties,
missingTargets) &&
!this->ExportOld) {
2013-11-03 12:27:13 +02:00
require2_8_12 = true;
}
2016-07-09 11:21:54 +02:00
}
2017-04-14 19:02:05 +02:00
if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
2014-08-03 19:52:23 +02:00
require3_0_0 = true;
2016-07-09 11:21:54 +02:00
}
if (gt->GetProperty("INTERFACE_SOURCES")) {
2015-08-17 11:37:30 +02:00
// We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1
// can consume them.
require3_1_0 = true;
2016-07-09 11:21:54 +02:00
}
2015-08-17 11:37:30 +02:00
2016-07-09 11:21:54 +02:00
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gt,
properties);
2015-11-17 17:22:37 +01:00
2016-03-13 13:35:51 +01:00
this->PopulateCompatibleInterfaceProperties(gt, properties);
2013-03-16 19:13:01 +02:00
2016-03-13 13:35:51 +01:00
this->GenerateInterfaceProperties(gt, os, properties);
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
if (require3_1_0) {
2015-08-17 11:37:30 +02:00
this->GenerateRequiredCMakeVersion(os, "3.1.0");
2016-07-09 11:21:54 +02:00
} else if (require3_0_0) {
2014-08-03 19:52:23 +02:00
this->GenerateRequiredCMakeVersion(os, "3.0.0");
2016-07-09 11:21:54 +02:00
} else if (require2_8_12) {
2013-11-03 12:27:13 +02:00
this->GenerateRequiredCMakeVersion(os, "2.8.12");
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
2016-10-30 18:24:19 +01:00
this->LoadConfigFiles(os);
2016-10-30 18:24:19 +01:00
this->CleanupTemporaryVariables(os);
2013-03-16 19:13:01 +02:00
this->GenerateImportedFileCheckLoop(os);
bool result = true;
2014-08-03 19:52:23 +02:00
// Generate an import file for each configuration.
// Don't do this if we only export INTERFACE_LIBRARY targets.
2016-07-09 11:21:54 +02:00
if (requiresConfigFiles) {
for (std::vector<std::string>::const_iterator ci =
this->Configurations.begin();
ci != this->Configurations.end(); ++ci) {
if (!this->GenerateImportFileConfig(*ci, missingTargets)) {
2014-08-03 19:52:23 +02:00
result = false;
}
}
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
this->GenerateMissingTargetsCheckCode(os, missingTargets);
return result;
}
2016-10-30 18:24:19 +01:00
void cmExportInstallFileGenerator::GenerateImportPrefix(std::ostream& os)
{
// Set an _IMPORT_PREFIX variable for import location properties
// to reference if they are relative to the install prefix.
std::string installPrefix =
this->IEGen->GetLocalGenerator()->GetMakefile()->GetSafeDefinition(
"CMAKE_INSTALL_PREFIX");
std::string const& expDest = this->IEGen->GetDestination();
if (cmSystemTools::FileIsFullPath(expDest)) {
// The export file is being installed to an absolute path so the
// package is not relocatable. Use the configured install prefix.
/* clang-format off */
os <<
"# The installation prefix configured by this project.\n"
"set(_IMPORT_PREFIX \"" << installPrefix << "\")\n"
"\n";
/* clang-format on */
} else {
// Add code to compute the installation prefix relative to the
// import file location.
std::string absDest = installPrefix + "/" + expDest;
std::string absDestS = absDest + "/";
os << "# Compute the installation prefix relative to this file.\n"
<< "get_filename_component(_IMPORT_PREFIX"
<< " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") ||
cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") ||
2017-07-20 19:35:53 +02:00
cmHasLiteralPrefix(absDestS.c_str(), "/libx32/") ||
2016-10-30 18:24:19 +01:00
cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") ||
2017-07-20 19:35:53 +02:00
cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/") ||
cmHasLiteralPrefix(absDestS.c_str(), "/usr/libx32/")) {
2016-10-30 18:24:19 +01:00
// Handle "/usr move" symlinks created by some Linux distros.
/* clang-format off */
os <<
"# Use original install prefix when loaded through a\n"
"# cross-prefix symbolic link such as /lib -> /usr/lib.\n"
"get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n"
"get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n"
"if(_realCurr STREQUAL _realOrig)\n"
" set(_IMPORT_PREFIX \"" << absDest << "\")\n"
"endif()\n"
"unset(_realOrig)\n"
"unset(_realCurr)\n";
/* clang-format on */
}
std::string dest = expDest;
while (!dest.empty()) {
os << "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" "
"PATH)\n";
dest = cmSystemTools::GetFilenamePath(dest);
}
os << "if(_IMPORT_PREFIX STREQUAL \"/\")\n"
<< " set(_IMPORT_PREFIX \"\")\n"
<< "endif()\n"
<< "\n";
}
}
void cmExportInstallFileGenerator::CleanupTemporaryVariables(std::ostream& os)
{
/* clang-format off */
os << "# Cleanup temporary variables.\n"
<< "set(_IMPORT_PREFIX)\n"
<< "\n";
/* clang-format on */
}
void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os)
{
// Now load per-configuration properties for them.
/* clang-format off */
os << "# Load information for each installed configuration.\n"
<< "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"
<< "file(GLOB CONFIG_FILES \"${_DIR}/"
<< this->GetConfigImportFileGlob() << "\")\n"
<< "foreach(f ${CONFIG_FILES})\n"
<< " include(${f})\n"
<< "endforeach()\n"
<< "\n";
/* clang-format on */
}
2016-07-09 11:21:54 +02:00
void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input)
2013-03-16 19:13:01 +02:00
{
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
2017-07-20 19:35:53 +02:00
while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
std::string::npos) {
2013-03-16 19:13:01 +02:00
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
lastPos = endPos;
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
}
2016-07-09 11:21:54 +02:00
bool cmExportInstallFileGenerator::GenerateImportFileConfig(
const std::string& config, std::vector<std::string>& missingTargets)
{
// Skip configurations not enabled for this export.
2016-07-09 11:21:54 +02:00
if (!this->IEGen->InstallsForConfig(config)) {
return true;
2016-07-09 11:21:54 +02:00
}
// Construct the name of the file to generate.
std::string fileName = this->FileDir;
fileName += "/";
fileName += this->FileBase;
fileName += "-";
2016-07-09 11:21:54 +02:00
if (!config.empty()) {
fileName += cmSystemTools::LowerCase(config);
2016-07-09 11:21:54 +02:00
} else {
fileName += "noconfig";
2016-07-09 11:21:54 +02:00
}
fileName += this->FileExt;
// Open the output file to generate it.
cmGeneratedFileStream exportFileStream(fileName.c_str(), true);
2016-07-09 11:21:54 +02:00
if (!exportFileStream) {
std::string se = cmSystemTools::GetLastSystemError();
2015-04-27 22:25:09 +02:00
std::ostringstream e;
2016-07-09 11:21:54 +02:00
e << "cannot write to file \"" << fileName << "\": " << se;
cmSystemTools::Error(e.str().c_str());
return false;
2016-07-09 11:21:54 +02:00
}
std::ostream& os = exportFileStream;
// Start with the import file header.
this->GenerateImportHeaderCode(os, config);
// Generate the per-config target information.
2013-03-16 19:13:01 +02:00
this->GenerateImportConfig(os, config, missingTargets);
// End with the import file footer.
this->GenerateImportFooterCode(os);
// Record this per-config import file.
this->ConfigImportFiles[config] = fileName;
return true;
}
2016-07-09 11:21:54 +02:00
void cmExportInstallFileGenerator::GenerateImportTargetsConfig(
std::ostream& os, const std::string& config, std::string const& suffix,
std::vector<std::string>& missingTargets)
{
// Add each target in the set to the export.
2016-07-09 11:21:54 +02:00
for (std::vector<cmTargetExport*>::const_iterator tei =
this->IEGen->GetExportSet()->GetTargetExports()->begin();
tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) {
// Collect import properties for this target.
2013-03-16 19:13:01 +02:00
cmTargetExport const* te = *tei;
2017-04-14 19:02:05 +02:00
if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
2014-08-03 19:52:23 +02:00
continue;
2016-07-09 11:21:54 +02:00
}
2014-08-03 19:52:23 +02:00
ImportPropertyMap properties;
2012-02-18 12:40:36 +02:00
std::set<std::string> importedLocations;
2014-08-03 19:52:23 +02:00
2012-02-18 12:40:36 +02:00
this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,
properties, importedLocations);
2016-07-09 11:21:54 +02:00
this->SetImportLocationProperty(config, suffix, te->RuntimeGenerator,
properties, importedLocations);
2017-07-20 19:35:53 +02:00
this->SetImportLocationProperty(config, suffix, te->ObjectsGenerator,
properties, importedLocations);
2012-02-18 12:40:36 +02:00
this->SetImportLocationProperty(config, suffix, te->FrameworkGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->BundleGenerator,
properties, importedLocations);
// If any file location was set for the target add it to the
// import file.
2016-07-09 11:21:54 +02:00
if (!properties.empty()) {
// Get the rest of the target details.
2016-07-09 11:21:54 +02:00
cmGeneratorTarget* gtgt = te->Target;
this->SetImportDetailProperties(config, suffix, gtgt, properties,
missingTargets);
2013-03-16 19:13:01 +02:00
this->SetImportLinkInterface(config, suffix,
cmGeneratorExpression::InstallInterface,
2015-11-17 17:22:37 +01:00
gtgt, properties, missingTargets);
// TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff
// is done. Then this can be a propagated include directory.
// this->GenerateImportProperty(config, te->HeaderGenerator,
// properties);
// Generate code in the export file.
2016-03-13 13:35:51 +01:00
this->GenerateImportPropertyCode(os, config, gtgt, properties);
this->GenerateImportedFileChecksCode(os, gtgt, properties,
2012-02-18 12:40:36 +02:00
importedLocations);
}
2016-07-09 11:21:54 +02:00
}
}
2016-07-09 11:21:54 +02:00
void cmExportInstallFileGenerator::SetImportLocationProperty(
const std::string& config, std::string const& suffix,
cmInstallTargetGenerator* itgen, ImportPropertyMap& properties,
std::set<std::string>& importedLocations)
{
// Skip rules that do not match this configuration.
2016-07-09 11:21:54 +02:00
if (!(itgen && itgen->InstallsForConfig(config))) {
return;
2016-07-09 11:21:54 +02:00
}
// Get the target to be installed.
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* target = itgen->GetTarget();
// Construct the installed location of the target.
2015-08-17 11:37:30 +02:00
std::string dest = itgen->GetDestination(config);
std::string value;
2016-07-09 11:21:54 +02:00
if (!cmSystemTools::FileIsFullPath(dest.c_str())) {
// The target is installed relative to the installation prefix.
2015-04-27 22:25:09 +02:00
value = "${_IMPORT_PREFIX}/";
2016-07-09 11:21:54 +02:00
}
value += dest;
value += "/";
2016-07-09 11:21:54 +02:00
if (itgen->IsImportLibrary()) {
// Construct the property name.
std::string prop = "IMPORTED_IMPLIB";
prop += suffix;
// Append the installed file name.
value += itgen->GetInstallFilename(target, config,
cmInstallTargetGenerator::NameImplib);
// Store the property.
properties[prop] = value;
2012-02-18 12:40:36 +02:00
importedLocations.insert(prop);
2017-07-20 19:35:53 +02:00
} else if (itgen->GetTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) {
// Construct the property name.
std::string prop = "IMPORTED_OBJECTS";
prop += suffix;
// Compute all the object files inside this target and setup
// IMPORTED_OBJECTS as a list of object files
std::vector<std::string> objects;
itgen->GetInstallObjectNames(config, objects);
for (std::vector<std::string>::iterator i = objects.begin();
i != objects.end(); ++i) {
*i = value + *i;
}
// Store the property.
properties[prop] = cmJoin(objects, ";");
importedLocations.insert(prop);
2016-07-09 11:21:54 +02:00
} else {
// Construct the property name.
std::string prop = "IMPORTED_LOCATION";
prop += suffix;
// Append the installed file name.
2016-07-09 11:21:54 +02:00
if (target->IsAppBundleOnApple()) {
value += itgen->GetInstallFilename(target, config);
value += ".app/Contents/MacOS/";
value += itgen->GetInstallFilename(target, config);
2016-07-09 11:21:54 +02:00
} else {
value += itgen->GetInstallFilename(target, config,
cmInstallTargetGenerator::NameReal);
2016-07-09 11:21:54 +02:00
}
// Store the property.
properties[prop] = value;
2012-02-18 12:40:36 +02:00
importedLocations.insert(prop);
2016-07-09 11:21:54 +02:00
}
}
2016-07-09 11:21:54 +02:00
void cmExportInstallFileGenerator::HandleMissingTarget(
std::string& link_libs, std::vector<std::string>& missingTargets,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* depender, cmGeneratorTarget* dependee)
2013-03-16 19:13:01 +02:00
{
2013-11-03 12:27:13 +02:00
const std::string name = dependee->GetName();
2016-03-13 13:35:51 +01:00
cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator();
std::vector<std::string> namespaces = this->FindNamespaces(gg, name);
2013-03-16 19:13:01 +02:00
int targetOccurrences = (int)namespaces.size();
2016-07-09 11:21:54 +02:00
if (targetOccurrences == 1) {
2013-03-16 19:13:01 +02:00
std::string missingTarget = namespaces[0];
2013-11-03 12:27:13 +02:00
missingTarget += dependee->GetExportName();
2013-03-16 19:13:01 +02:00
link_libs += missingTarget;
missingTargets.push_back(missingTarget);
2016-07-09 11:21:54 +02:00
} else {
2014-08-03 19:52:23 +02:00
// All exported targets should be known here and should be unique.
// This is probably user-error.
2013-03-16 19:13:01 +02:00
this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences);
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
}
2016-07-09 11:21:54 +02:00
std::vector<std::string> cmExportInstallFileGenerator::FindNamespaces(
cmGlobalGenerator* gg, const std::string& name)
2013-03-16 19:13:01 +02:00
{
std::vector<std::string> namespaces;
const cmExportSetMap& exportSets = gg->GetExportSets();
2016-07-09 11:21:54 +02:00
for (cmExportSetMap::const_iterator expIt = exportSets.begin();
expIt != exportSets.end(); ++expIt) {
2013-03-16 19:13:01 +02:00
const cmExportSet* exportSet = expIt->second;
std::vector<cmTargetExport*> const* targets =
2016-07-09 11:21:54 +02:00
exportSet->GetTargetExports();
2013-03-16 19:13:01 +02:00
bool containsTarget = false;
2016-07-09 11:21:54 +02:00
for (unsigned int i = 0; i < targets->size(); i++) {
if (name == (*targets)[i]->TargetName) {
2013-03-16 19:13:01 +02:00
containsTarget = true;
break;
}
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
if (containsTarget) {
2013-03-16 19:13:01 +02:00
std::vector<cmInstallExportGenerator const*> const* installs =
2016-07-09 11:21:54 +02:00
exportSet->GetInstallations();
for (unsigned int i = 0; i < installs->size(); i++) {
2013-03-16 19:13:01 +02:00
namespaces.push_back((*installs)[i]->GetNamespace());
}
}
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
return namespaces;
}
2016-07-09 11:21:54 +02:00
void cmExportInstallFileGenerator::ComplainAboutMissingTarget(
cmGeneratorTarget* depender, cmGeneratorTarget* dependee, int occurrences)
{
2015-04-27 22:25:09 +02:00
std::ostringstream e;
2016-07-09 11:21:54 +02:00
e << "install(EXPORT \"" << this->IEGen->GetExportSet()->GetName()
2013-03-16 19:13:01 +02:00
<< "\" ...) "
<< "includes target \"" << depender->GetName()
2013-03-16 19:13:01 +02:00
<< "\" which requires target \"" << dependee->GetName() << "\" ";
2016-07-09 11:21:54 +02:00
if (occurrences == 0) {
2013-03-16 19:13:01 +02:00
e << "that is not in the export set.";
2016-07-09 11:21:54 +02:00
} else {
2013-03-16 19:13:01 +02:00
e << "that is not in this export set, but " << occurrences
2016-07-09 11:21:54 +02:00
<< " times in others.";
}
cmSystemTools::Error(e.str().c_str());
}
2013-11-03 12:27:13 +02:00
2016-07-09 11:21:54 +02:00
std::string cmExportInstallFileGenerator::InstallNameDir(
2016-10-30 18:24:19 +01:00
cmGeneratorTarget* target, const std::string& /*config*/)
2013-11-03 12:27:13 +02:00
{
std::string install_name_dir;
2015-11-17 17:22:37 +01:00
cmMakefile* mf = target->Target->GetMakefile();
2016-07-09 11:21:54 +02:00
if (mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) {
install_name_dir = target->GetInstallNameDirForInstallTree();
}
2013-11-03 12:27:13 +02:00
return install_name_dir;
}