1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 file Copyright.txt or https://cmake.org/licensing for details. */ 3 4 #pragma once 5 6 #include "cmConfigure.h" // IWYU pragma: keep 7 8 #include <string> 9 #include <vector> 10 11 #include "cmStateDirectory.h" 12 13 class cmComputeLinkInformation; 14 class cmGeneratorTarget; 15 class cmOutputConverter; 16 template <typename T> 17 class BT; 18 19 class cmLinkLineComputer 20 { 21 public: 22 cmLinkLineComputer(cmOutputConverter* outputConverter, 23 cmStateDirectory const& stateDir); 24 virtual ~cmLinkLineComputer(); 25 26 cmLinkLineComputer(cmLinkLineComputer const&) = delete; 27 cmLinkLineComputer& operator=(cmLinkLineComputer const&) = delete; 28 29 void SetUseWatcomQuote(bool useWatcomQuote); 30 void SetUseNinjaMulti(bool useNinjaMulti); 31 void SetForResponse(bool forResponse); 32 void SetRelink(bool relink); 33 34 virtual std::string ConvertToLinkReference(std::string const& input) const; 35 36 std::string ComputeLinkPath(cmComputeLinkInformation& cli, 37 std::string const& libPathFlag, 38 std::string const& libPathTerminator); 39 40 void ComputeLinkPath(cmComputeLinkInformation& cli, 41 std::string const& libPathFlag, 42 std::string const& libPathTerminator, 43 std::vector<BT<std::string>>& linkPath); 44 45 std::string ComputeFrameworkPath(cmComputeLinkInformation& cli, 46 std::string const& fwSearchFlag); 47 48 std::string ComputeLinkLibraries(cmComputeLinkInformation& cli, 49 std::string const& stdLibString); 50 51 virtual void ComputeLinkLibraries( 52 cmComputeLinkInformation& cli, std::string const& stdLibString, 53 std::vector<BT<std::string>>& linkLibraries); 54 55 virtual std::string GetLinkerLanguage(cmGeneratorTarget* target, 56 std::string const& config); 57 58 protected: 59 std::string ComputeLinkLibs(cmComputeLinkInformation& cli); 60 void ComputeLinkLibs(cmComputeLinkInformation& cli, 61 std::vector<BT<std::string>>& linkLibraries); 62 std::string ComputeRPath(cmComputeLinkInformation& cli); 63 64 std::string ConvertToOutputFormat(std::string const& input); 65 std::string ConvertToOutputForExisting(std::string const& input); 66 67 cmStateDirectory StateDir; 68 cmOutputConverter* OutputConverter; 69 70 bool ForResponse; 71 bool UseWatcomQuote; 72 bool UseNinjaMulti; 73 bool Relink; 74 }; 75