diff options
Diffstat (limited to 'Source/cmExportInstallFileGenerator.cxx')
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 1025dc0..73e9b31 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -114,13 +114,18 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) std::vector<std::string> missingTargets; bool require2_8_12 = false; - bool require2_8_13 = 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; @@ -160,7 +165,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) } if (te->GetType() == cmTarget::INTERFACE_LIBRARY) { - require2_8_13 = true; + require3_0_0 = true; } this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); @@ -169,7 +174,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateInterfaceProperties(te, os, properties); } - if (require2_8_13) + if (require3_0_0) { this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007"); } @@ -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; + } } } |