| 4044 | }; |
| 4045 | |
| 4046 | void cmLocalGenerator::GenerateTargetInstallRules( |
| 4047 | std::ostream& os, std::string const& config, |
| 4048 | std::vector<std::string> const& configurationTypes) |
| 4049 | { |
| 4050 | // Convert the old-style install specification from each target to |
| 4051 | // an install generator and run it. |
| 4052 | auto const& tgts = this->GetGeneratorTargets(); |
| 4053 | for (auto const& l : tgts) { |
| 4054 | if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) { |
| 4055 | continue; |
| 4056 | } |
| 4057 | |
| 4058 | // Include the user-specified pre-install script for this target. |
| 4059 | if (cmValue preinstall = l->GetProperty("PRE_INSTALL_SCRIPT")) { |
| 4060 | cmInstallScriptGenerator g(*preinstall, false, "", false, false); |
| 4061 | g.Generate(os, config, configurationTypes); |
| 4062 | } |
| 4063 | |
| 4064 | // Install this target if a destination is given. |
| 4065 | if (!l->Target->GetInstallPath().empty()) { |
| 4066 | // Compute the full install destination. Note that converting |
| 4067 | // to unix slashes also removes any trailing slash. |
| 4068 | // We also skip over the leading slash given by the user. |
| 4069 | std::string destination = l->Target->GetInstallPath().substr(1); |
| 4070 | cmSystemTools::ConvertToUnixSlashes(destination); |
| 4071 | if (destination.empty()) { |
| 4072 | destination = "."; |
| 4073 | } |
| 4074 | |
| 4075 | // Generate the proper install generator for this target type. |
| 4076 | switch (l->GetType()) { |
| 4077 | case cmStateEnums::EXECUTABLE: |
| 4078 | case cmStateEnums::STATIC_LIBRARY: |
| 4079 | case cmStateEnums::MODULE_LIBRARY: { |
| 4080 | // Use a target install generator. |
| 4081 | cmInstallTargetGeneratorLocal g(this, l->GetName(), destination, |
| 4082 | false); |
| 4083 | g.Generate(os, config, configurationTypes); |
| 4084 | } break; |
| 4085 | case cmStateEnums::SHARED_LIBRARY: { |
| 4086 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 4087 | // Special code to handle DLL. Install the import library |
| 4088 | // to the normal destination and the DLL to the runtime |
| 4089 | // destination. |
| 4090 | cmInstallTargetGeneratorLocal g1(this, l->GetName(), destination, |
| 4091 | true); |
| 4092 | g1.Generate(os, config, configurationTypes); |
| 4093 | // We also skip over the leading slash given by the user. |
| 4094 | destination = l->Target->GetRuntimeInstallPath().substr(1); |
| 4095 | cmSystemTools::ConvertToUnixSlashes(destination); |
| 4096 | cmInstallTargetGeneratorLocal g2(this, l->GetName(), destination, |
| 4097 | false); |
| 4098 | g2.Generate(os, config, configurationTypes); |
| 4099 | #else |
| 4100 | // Use a target install generator. |
| 4101 | cmInstallTargetGeneratorLocal g(this, l->GetName(), destination, |
| 4102 | false); |
| 4103 | g.Generate(os, config, configurationTypes); |
no test coverage detected