summaryrefslogtreecommitdiffstats
path: root/Source/cmExportInstallFileGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-12-26 07:19:33 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-01-04 10:28:56 (GMT)
commitaf3d3b88bef639f623dcdcc7940839799fcef255 (patch)
tree56dc705387e1a3854e0df277a89985d4aad25b02 /Source/cmExportInstallFileGenerator.cxx
parent0de81bba8ca5a4fedace010a88027591071cde36 (diff)
downloadCMake-af3d3b88bef639f623dcdcc7940839799fcef255.zip
CMake-af3d3b88bef639f623dcdcc7940839799fcef255.tar.gz
CMake-af3d3b88bef639f623dcdcc7940839799fcef255.tar.bz2
export: Only generate and install configuration files if needed.
The modern way to create configuration dependent content is using generator expressions in the main export file. The only non-deprecated property still generated in the configuration-specific files are IMPORTED_LOCATION_<CONFIG> INTERFACE_LIBRARY targets have no location, and no need for those files.
Diffstat (limited to 'Source/cmExportInstallFileGenerator.cxx')
-rw-r--r--Source/cmExportInstallFileGenerator.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 5988567..73e9b31 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -115,12 +115,17 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
bool require2_8_12 = false;
bool require3_0_0 = false;
+ bool requiresConfigFiles = false;
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
tei = allTargets.begin();
tei != allTargets.end(); ++tei)
{
cmTarget* te = (*tei)->Target;
+
+ requiresConfigFiles = requiresConfigFiles
+ || te->GetType() != cmTarget::INTERFACE_LIBRARY;
+
this->GenerateImportTargetCode(os, te);
ImportPropertyMap properties;
@@ -197,15 +202,19 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
}
this->GenerateImportedFileCheckLoop(os);
- // Generate an import file for each configuration.
bool result = true;
- for(std::vector<std::string>::const_iterator
- ci = this->Configurations.begin();
- ci != this->Configurations.end(); ++ci)
+ // Generate an import file for each configuration.
+ // Don't do this if we only export INTERFACE_LIBRARY targets.
+ if (requiresConfigFiles)
{
- if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets))
+ for(std::vector<std::string>::const_iterator
+ ci = this->Configurations.begin();
+ ci != this->Configurations.end(); ++ci)
{
- result = false;
+ if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets))
+ {
+ result = false;
+ }
}
}