cmGeneratorTarget.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmGeneratorTarget_h
  4. #define cmGeneratorTarget_h
  5. #include <cmConfigure.h>
  6. #include "cmLinkItem.h"
  7. #include "cmListFileCache.h"
  8. #include "cmPolicies.h"
  9. #include "cmState.h"
  10. #include <map>
  11. #include <set>
  12. #include <string>
  13. #include <utility>
  14. #include <vector>
  15. class cmComputeLinkInformation;
  16. class cmCustomCommand;
  17. class cmGlobalGenerator;
  18. class cmLocalGenerator;
  19. class cmMakefile;
  20. class cmSourceFile;
  21. class cmTarget;
  22. class cmGeneratorTarget
  23. {
  24. public:
  25. cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
  26. ~cmGeneratorTarget();
  27. cmLocalGenerator* GetLocalGenerator() const;
  28. bool IsImported() const;
  29. bool IsImportedGloballyVisible() const;
  30. const char* GetLocation(const std::string& config) const;
  31. std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
  32. std::vector<cmCustomCommand> const& GetPreLinkCommands() const;
  33. std::vector<cmCustomCommand> const& GetPostBuildCommands() const;
  34. #define DECLARE_TARGET_POLICY(POLICY) \
  35. cmPolicies::PolicyStatus GetPolicyStatus##POLICY() const \
  36. { \
  37. return this->PolicyMap.Get(cmPolicies::POLICY); \
  38. }
  39. CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
  40. #undef DECLARE_TARGET_POLICY
  41. /** Get the location of the target in the build tree with a placeholder
  42. referencing the configuration in the native build system. This
  43. location is suitable for use as the LOCATION target property. */
  44. const char* GetLocationForBuild() const;
  45. cmComputeLinkInformation* GetLinkInformation(
  46. const std::string& config) const;
  47. cmState::TargetType GetType() const;
  48. const std::string& GetName() const;
  49. std::string GetExportName() const;
  50. std::vector<std::string> GetPropertyKeys() const;
  51. const char* GetProperty(const std::string& prop) const;
  52. bool GetPropertyAsBool(const std::string& prop) const;
  53. void GetSourceFiles(std::vector<cmSourceFile*>& files,
  54. const std::string& config) const;
  55. void GetObjectSources(std::vector<cmSourceFile const*>&,
  56. const std::string& config) const;
  57. const std::string& GetObjectName(cmSourceFile const* file);
  58. bool HasExplicitObjectName(cmSourceFile const* file) const;
  59. void AddExplicitObjectName(cmSourceFile const* sf);
  60. void GetResxSources(std::vector<cmSourceFile const*>&,
  61. const std::string& config) const;
  62. void GetIDLSources(std::vector<cmSourceFile const*>&,
  63. const std::string& config) const;
  64. void GetExternalObjects(std::vector<cmSourceFile const*>&,
  65. const std::string& config) const;
  66. void GetHeaderSources(std::vector<cmSourceFile const*>&,
  67. const std::string& config) const;
  68. void GetExtraSources(std::vector<cmSourceFile const*>&,
  69. const std::string& config) const;
  70. void GetCustomCommands(std::vector<cmSourceFile const*>&,
  71. const std::string& config) const;
  72. void GetExpectedResxHeaders(std::set<std::string>&,
  73. const std::string& config) const;
  74. void GetAppManifest(std::vector<cmSourceFile const*>&,
  75. const std::string& config) const;
  76. void GetManifests(std::vector<cmSourceFile const*>&,
  77. const std::string& config) const;
  78. void GetCertificates(std::vector<cmSourceFile const*>&,
  79. const std::string& config) const;
  80. void GetXamlSources(std::vector<cmSourceFile const*>&,
  81. const std::string& config) const;
  82. void GetExpectedXamlHeaders(std::set<std::string>&,
  83. const std::string& config) const;
  84. void GetExpectedXamlSources(std::set<std::string>&,
  85. const std::string& config) const;
  86. std::set<cmLinkItem> const& GetUtilityItems() const;
  87. void ComputeObjectMapping();
  88. const char* GetFeature(const std::string& feature,
  89. const std::string& config) const;
  90. bool GetFeatureAsBool(const std::string& feature,
  91. const std::string& config) const;
  92. bool IsLinkInterfaceDependentBoolProperty(const std::string& p,
  93. const std::string& config) const;
  94. bool IsLinkInterfaceDependentStringProperty(const std::string& p,
  95. const std::string& config) const;
  96. bool IsLinkInterfaceDependentNumberMinProperty(
  97. const std::string& p, const std::string& config) const;
  98. bool IsLinkInterfaceDependentNumberMaxProperty(
  99. const std::string& p, const std::string& config) const;
  100. bool GetLinkInterfaceDependentBoolProperty(const std::string& p,
  101. const std::string& config) const;
  102. const char* GetLinkInterfaceDependentStringProperty(
  103. const std::string& p, const std::string& config) const;
  104. const char* GetLinkInterfaceDependentNumberMinProperty(
  105. const std::string& p, const std::string& config) const;
  106. const char* GetLinkInterfaceDependentNumberMaxProperty(
  107. const std::string& p, const std::string& config) const;
  108. cmLinkInterface const* GetLinkInterface(
  109. const std::string& config, const cmGeneratorTarget* headTarget) const;
  110. void ComputeLinkInterface(const std::string& config,
  111. cmOptionalLinkInterface& iface,
  112. const cmGeneratorTarget* head) const;
  113. cmLinkInterfaceLibraries const* GetLinkInterfaceLibraries(
  114. const std::string& config, const cmGeneratorTarget* headTarget,
  115. bool usage_requirements_only) const;
  116. void ComputeLinkInterfaceLibraries(const std::string& config,
  117. cmOptionalLinkInterface& iface,
  118. const cmGeneratorTarget* head,
  119. bool usage_requirements_only) const;
  120. /** Get the full path to the target according to the settings in its
  121. makefile and the configuration type. */
  122. std::string GetFullPath(const std::string& config = "", bool implib = false,
  123. bool realname = false) const;
  124. std::string NormalGetFullPath(const std::string& config, bool implib,
  125. bool realname) const;
  126. std::string NormalGetRealName(const std::string& config) const;
  127. /** @return the Mac App directory without the base */
  128. std::string GetAppBundleDirectory(const std::string& config,
  129. bool contentOnly) const;
  130. /** Return whether this target is an executable Bundle, a framework
  131. or CFBundle on Apple. */
  132. bool IsBundleOnApple() const;
  133. /** Get the full name of the target according to the settings in its
  134. makefile. */
  135. std::string GetFullName(const std::string& config = "",
  136. bool implib = false) const;
  137. /** @return the Mac framework directory without the base. */
  138. std::string GetFrameworkDirectory(const std::string& config,
  139. bool rootDir) const;
  140. /** Return the framework version string. Undefined if
  141. IsFrameworkOnApple returns false. */
  142. std::string GetFrameworkVersion() const;
  143. /** @return the Mac CFBundle directory without the base */
  144. std::string GetCFBundleDirectory(const std::string& config,
  145. bool contentOnly) const;
  146. /** Return the install name directory for the target in the
  147. * build tree. For example: "\@rpath/", "\@loader_path/",
  148. * or "/full/path/to/library". */
  149. std::string GetInstallNameDirForBuildTree(const std::string& config) const;
  150. /** Return the install name directory for the target in the
  151. * install tree. For example: "\@rpath/" or "\@loader_path/". */
  152. std::string GetInstallNameDirForInstallTree() const;
  153. cmListFileBacktrace GetBacktrace() const;
  154. const std::vector<std::string>& GetLinkDirectories() const;
  155. std::set<std::string> const& GetUtilities() const;
  156. cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
  157. bool LinkLanguagePropagatesToDependents() const
  158. {
  159. return this->GetType() == cmState::STATIC_LIBRARY;
  160. }
  161. /** Get the macro to define when building sources in this target.
  162. If no macro should be defined null is returned. */
  163. const char* GetExportMacro() const;
  164. /** Get the soname of the target. Allowed only for a shared library. */
  165. std::string GetSOName(const std::string& config) const;
  166. void GetFullNameComponents(std::string& prefix, std::string& base,
  167. std::string& suffix,
  168. const std::string& config = "",
  169. bool implib = false) const;
  170. /** Append to @a base the mac content directory and return it. */
  171. std::string BuildMacContentDirectory(const std::string& base,
  172. const std::string& config = "",
  173. bool contentOnly = true) const;
  174. /** @return the mac content directory for this target. */
  175. std::string GetMacContentDirectory(const std::string& config = CM_NULLPTR,
  176. bool implib = false) const;
  177. /** @return folder prefix for IDEs. */
  178. std::string GetEffectiveFolderName() const;
  179. cmTarget* Target;
  180. cmMakefile* Makefile;
  181. cmLocalGenerator* LocalGenerator;
  182. cmGlobalGenerator const* GlobalGenerator;
  183. cmSourceFile const* GetModuleDefinitionFile(const std::string& config) const;
  184. /** Return whether or not the target is for a DLL platform. */
  185. bool IsDLLPlatform() const;
  186. /** @return whether this target have a well defined output file name. */
  187. bool HaveWellDefinedOutputFiles() const;
  188. /** Link information from the transitive closure of the link
  189. implementation and the interfaces of its dependencies. */
  190. struct LinkClosure
  191. {
  192. // The preferred linker language.
  193. std::string LinkerLanguage;
  194. // Languages whose runtime libraries must be linked.
  195. std::vector<std::string> Languages;
  196. };
  197. LinkClosure const* GetLinkClosure(const std::string& config) const;
  198. void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
  199. cmLinkImplementation const* GetLinkImplementation(
  200. const std::string& config) const;
  201. void ComputeLinkImplementationLanguages(
  202. const std::string& config, cmOptionalLinkImplementation& impl) const;
  203. cmLinkImplementationLibraries const* GetLinkImplementationLibraries(
  204. const std::string& config) const;
  205. void ComputeLinkImplementationLibraries(const std::string& config,
  206. cmOptionalLinkImplementation& impl,
  207. const cmGeneratorTarget* head) const;
  208. cmGeneratorTarget* FindTargetToLink(std::string const& name) const;
  209. // Compute the set of languages compiled by the target. This is
  210. // computed every time it is called because the languages can change
  211. // when source file properties are changed and we do not have enough
  212. // information to forward these property changes to the targets
  213. // until we have per-target object file properties.
  214. void GetLanguages(std::set<std::string>& languages,
  215. std::string const& config) const;
  216. void GetObjectLibrariesCMP0026(
  217. std::vector<cmGeneratorTarget*>& objlibs) const;
  218. std::string GetFullNameImported(const std::string& config,
  219. bool implib) const;
  220. bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
  221. bool HaveBuildTreeRPATH(const std::string& config) const;
  222. /** Full path with trailing slash to the top-level directory
  223. holding object files for this target. Includes the build
  224. time config name placeholder if needed for the generator. */
  225. std::string ObjectDirectory;
  226. void UseObjectLibraries(std::vector<std::string>& objs,
  227. const std::string& config) const;
  228. void GetAppleArchs(const std::string& config,
  229. std::vector<std::string>& archVec) const;
  230. /** Return the rule variable used to create this type of target. */
  231. std::string GetCreateRuleVariable(std::string const& lang,
  232. std::string const& config) const;
  233. /** Get the include directories for this target. */
  234. std::vector<std::string> GetIncludeDirectories(
  235. const std::string& config, const std::string& lang) const;
  236. void GetCompileOptions(std::vector<std::string>& result,
  237. const std::string& config,
  238. const std::string& language) const;
  239. void GetCompileFeatures(std::vector<std::string>& features,
  240. const std::string& config) const;
  241. void GetCompileDefinitions(std::vector<std::string>& result,
  242. const std::string& config,
  243. const std::string& language) const;
  244. bool IsSystemIncludeDirectory(const std::string& dir,
  245. const std::string& config) const;
  246. /** Add the target output files to the global generator manifest. */
  247. void ComputeTargetManifest(const std::string& config) const;
  248. /**
  249. * Trace through the source files in this target and add al source files
  250. * that they depend on, used by all generators
  251. */
  252. void TraceDependencies();
  253. /** Get the directory in which this target will be built. If the
  254. configuration name is given then the generator will add its
  255. subdirectory for that configuration. Otherwise just the canonical
  256. output directory is given. */
  257. std::string GetDirectory(const std::string& config = "",
  258. bool implib = false) const;
  259. /** Get the directory in which to place the target compiler .pdb file.
  260. If the configuration name is given then the generator will add its
  261. subdirectory for that configuration. Otherwise just the canonical
  262. compiler pdb output directory is given. */
  263. std::string GetCompilePDBDirectory(const std::string& config = "") const;
  264. /** Get sources that must be built before the given source. */
  265. std::vector<cmSourceFile*> const* GetSourceDepends(
  266. cmSourceFile const* sf) const;
  267. /** Return whether this target uses the default value for its output
  268. directory. */
  269. bool UsesDefaultOutputDir(const std::string& config, bool implib) const;
  270. // Cache target output paths for each configuration.
  271. struct OutputInfo
  272. {
  273. std::string OutDir;
  274. std::string ImpDir;
  275. std::string PdbDir;
  276. bool empty() const
  277. {
  278. return OutDir.empty() && ImpDir.empty() && PdbDir.empty();
  279. }
  280. };
  281. OutputInfo const* GetOutputInfo(const std::string& config) const;
  282. /** Get the name of the pdb file for the target. */
  283. std::string GetPDBName(const std::string& config = "") const;
  284. /** Whether this library has soname enabled and platform supports it. */
  285. bool HasSOName(const std::string& config) const;
  286. struct CompileInfo
  287. {
  288. std::string CompilePdbDir;
  289. };
  290. CompileInfo const* GetCompileInfo(const std::string& config) const;
  291. typedef std::map<std::string, CompileInfo> CompileInfoMapType;
  292. mutable CompileInfoMapType CompileInfoMap;
  293. bool IsNullImpliedByLinkLibraries(const std::string& p) const;
  294. /** Get the name of the compiler pdb file for the target. */
  295. std::string GetCompilePDBName(const std::string& config = "") const;
  296. /** Get the path for the MSVC /Fd option for this target. */
  297. std::string GetCompilePDBPath(const std::string& config = "") const;
  298. // Get the target base name.
  299. std::string GetOutputName(const std::string& config, bool implib) const;
  300. void AddSource(const std::string& src);
  301. void AddTracedSources(std::vector<std::string> const& srcs);
  302. /**
  303. * Flags for a given source file as used in this target. Typically assigned
  304. * via SET_TARGET_PROPERTIES when the property is a list of source files.
  305. */
  306. enum SourceFileType
  307. {
  308. SourceFileTypeNormal,
  309. SourceFileTypePrivateHeader, // is in "PRIVATE_HEADER" target property
  310. SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property
  311. SourceFileTypeResource, // is in "RESOURCE" target property *or*
  312. // has MACOSX_PACKAGE_LOCATION=="Resources"
  313. SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources"
  314. };
  315. struct SourceFileFlags
  316. {
  317. SourceFileFlags()
  318. : Type(SourceFileTypeNormal)
  319. , MacFolder(CM_NULLPTR)
  320. {
  321. }
  322. SourceFileFlags(SourceFileFlags const& r)
  323. : Type(r.Type)
  324. , MacFolder(r.MacFolder)
  325. {
  326. }
  327. SourceFileType Type;
  328. const char* MacFolder; // location inside Mac content folders
  329. };
  330. void GetAutoUicOptions(std::vector<std::string>& result,
  331. const std::string& config) const;
  332. /** Get the names of the executable needed to generate a build rule
  333. that takes into account executable version numbers. This should
  334. be called only on an executable target. */
  335. void GetExecutableNames(std::string& name, std::string& realName,
  336. std::string& impName, std::string& pdbName,
  337. const std::string& config) const;
  338. /** Get the names of the library needed to generate a build rule
  339. that takes into account shared library version numbers. This
  340. should be called only on a library target. */
  341. void GetLibraryNames(std::string& name, std::string& soName,
  342. std::string& realName, std::string& impName,
  343. std::string& pdbName, const std::string& config) const;
  344. /**
  345. * Compute whether this target must be relinked before installing.
  346. */
  347. bool NeedRelinkBeforeInstall(const std::string& config) const;
  348. /** Return true if builtin chrpath will work for this target */
  349. bool IsChrpathUsed(const std::string& config) const;
  350. /** Get the directory in which this targets .pdb files will be placed.
  351. If the configuration name is given then the generator will add its
  352. subdirectory for that configuration. Otherwise just the canonical
  353. pdb output directory is given. */
  354. std::string GetPDBDirectory(const std::string& config) const;
  355. ///! Return the preferred linker language for this target
  356. std::string GetLinkerLanguage(const std::string& config = "") const;
  357. /** Does this target have a GNU implib to convert to MS format? */
  358. bool HasImplibGNUtoMS() const;
  359. /** Convert the given GNU import library name (.dll.a) to a name with a new
  360. extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
  361. bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
  362. const char* newExt = CM_NULLPTR) const;
  363. bool IsExecutableWithExports() const;
  364. /** Return whether or not the target has a DLL import library. */
  365. bool HasImportLibrary() const;
  366. /** Get a build-tree directory in which to place target support files. */
  367. std::string GetSupportDirectory() const;
  368. /** Return whether this target may be used to link another target. */
  369. bool IsLinkable() const;
  370. /** Return whether this target is a shared library Framework on
  371. Apple. */
  372. bool IsFrameworkOnApple() const;
  373. /** Return whether this target is an executable Bundle on Apple. */
  374. bool IsAppBundleOnApple() const;
  375. /** Return whether this target is a XCTest on Apple. */
  376. bool IsXCTestOnApple() const;
  377. /** Return whether this target is a CFBundle (plugin) on Apple. */
  378. bool IsCFBundleOnApple() const;
  379. struct SourceFileFlags GetTargetSourceFileFlags(
  380. const cmSourceFile* sf) const;
  381. struct ResxData
  382. {
  383. mutable std::set<std::string> ExpectedResxHeaders;
  384. mutable std::vector<cmSourceFile const*> ResxSources;
  385. };
  386. struct XamlData
  387. {
  388. std::set<std::string> ExpectedXamlHeaders;
  389. std::set<std::string> ExpectedXamlSources;
  390. std::vector<cmSourceFile const*> XamlSources;
  391. };
  392. void ReportPropertyOrigin(const std::string& p, const std::string& result,
  393. const std::string& report,
  394. const std::string& compatibilityType) const;
  395. class TargetPropertyEntry;
  396. bool HaveInstallTreeRPATH() const;
  397. /** Whether this library has \@rpath and platform supports it. */
  398. bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
  399. /** Whether this library defaults to \@rpath. */
  400. bool MacOSXRpathInstallNameDirDefault() const;
  401. /** Test for special case of a third-party shared library that has
  402. no soname at all. */
  403. bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
  404. const char* ImportedGetLocation(const std::string& config) const;
  405. /** Get the target major and minor version numbers interpreted from
  406. the VERSION property. Version 0 is returned if the property is
  407. not set or cannot be parsed. */
  408. void GetTargetVersion(int& major, int& minor) const;
  409. /** Get the target major, minor, and patch version numbers
  410. interpreted from the VERSION or SOVERSION property. Version 0
  411. is returned if the property is not set or cannot be parsed. */
  412. void GetTargetVersion(bool soversion, int& major, int& minor,
  413. int& patch) const;
  414. std::string GetFortranModuleDirectory(std::string const& working_dir) const;
  415. private:
  416. void AddSourceCommon(const std::string& src);
  417. std::string CreateFortranModuleDirectory(
  418. std::string const& working_dir) const;
  419. mutable bool FortranModuleDirectoryCreated;
  420. mutable std::string FortranModuleDirectory;
  421. friend class cmTargetTraceDependencies;
  422. struct SourceEntry
  423. {
  424. std::vector<cmSourceFile*> Depends;
  425. };
  426. typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
  427. SourceEntriesType SourceDepends;
  428. mutable std::map<cmSourceFile const*, std::string> Objects;
  429. std::set<cmSourceFile const*> ExplicitObjectName;
  430. mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
  431. mutable std::string ExportMacro;
  432. void ConstructSourceFileFlags() const;
  433. mutable bool SourceFileFlagsConstructed;
  434. mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
  435. mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
  436. std::string GetFullNameInternal(const std::string& config,
  437. bool implib) const;
  438. void GetFullNameInternal(const std::string& config, bool implib,
  439. std::string& outPrefix, std::string& outBase,
  440. std::string& outSuffix) const;
  441. typedef std::map<std::string, LinkClosure> LinkClosureMapType;
  442. mutable LinkClosureMapType LinkClosureMap;
  443. // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
  444. const char* GetOutputTargetType(bool implib) const;
  445. void ComputeVersionedName(std::string& vName, std::string const& prefix,
  446. std::string const& base, std::string const& suffix,
  447. std::string const& name,
  448. const char* version) const;
  449. struct CompatibleInterfacesBase
  450. {
  451. std::set<std::string> PropsBool;
  452. std::set<std::string> PropsString;
  453. std::set<std::string> PropsNumberMax;
  454. std::set<std::string> PropsNumberMin;
  455. };
  456. CompatibleInterfacesBase const& GetCompatibleInterfaces(
  457. std::string const& config) const;
  458. struct CompatibleInterfaces : public CompatibleInterfacesBase
  459. {
  460. CompatibleInterfaces()
  461. : Done(false)
  462. {
  463. }
  464. bool Done;
  465. };
  466. mutable std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap;
  467. typedef std::map<std::string, cmComputeLinkInformation*>
  468. cmTargetLinkInformationMap;
  469. mutable cmTargetLinkInformationMap LinkInformation;
  470. void CheckPropertyCompatibility(cmComputeLinkInformation* info,
  471. const std::string& config) const;
  472. cmGeneratorTarget(cmGeneratorTarget const&);
  473. void operator=(cmGeneratorTarget const&);
  474. struct LinkImplClosure : public std::vector<cmGeneratorTarget const*>
  475. {
  476. LinkImplClosure()
  477. : Done(false)
  478. {
  479. }
  480. bool Done;
  481. };
  482. mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
  483. typedef std::map<std::string, cmHeadToLinkInterfaceMap> LinkInterfaceMapType;
  484. mutable LinkInterfaceMapType LinkInterfaceMap;
  485. mutable LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
  486. cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceMap(
  487. std::string const& config) const;
  488. cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap(
  489. std::string const& config) const;
  490. // Cache import information from properties for each configuration.
  491. struct ImportInfo
  492. {
  493. ImportInfo()
  494. : NoSOName(false)
  495. , Multiplicity(0)
  496. {
  497. }
  498. bool NoSOName;
  499. unsigned int Multiplicity;
  500. std::string Location;
  501. std::string SOName;
  502. std::string ImportLibrary;
  503. std::string Languages;
  504. std::string Libraries;
  505. std::string LibrariesProp;
  506. std::string SharedDeps;
  507. };
  508. typedef std::map<std::string, ImportInfo> ImportInfoMapType;
  509. mutable ImportInfoMapType ImportInfoMap;
  510. void ComputeImportInfo(std::string const& desired_config,
  511. ImportInfo& info) const;
  512. ImportInfo const* GetImportInfo(const std::string& config) const;
  513. /** Strip off leading and trailing whitespace from an item named in
  514. the link dependencies of this target. */
  515. std::string CheckCMP0004(std::string const& item) const;
  516. cmLinkInterface const* GetImportLinkInterface(
  517. const std::string& config, const cmGeneratorTarget* head,
  518. bool usage_requirements_only) const;
  519. typedef std::map<std::string, std::vector<cmSourceFile*> >
  520. SourceFilesMapType;
  521. mutable SourceFilesMapType SourceFilesMap;
  522. std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
  523. std::vector<TargetPropertyEntry*> CompileOptionsEntries;
  524. std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
  525. std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
  526. std::vector<TargetPropertyEntry*> SourceEntries;
  527. mutable std::set<std::string> LinkImplicitNullProperties;
  528. void ExpandLinkItems(std::string const& prop, std::string const& value,
  529. std::string const& config,
  530. const cmGeneratorTarget* headTarget,
  531. bool usage_requirements_only,
  532. std::vector<cmLinkItem>& items,
  533. bool& hadHeadSensitiveCondition) const;
  534. void LookupLinkItems(std::vector<std::string> const& names,
  535. std::vector<cmLinkItem>& items) const;
  536. void GetSourceFiles(std::vector<std::string>& files,
  537. const std::string& config) const;
  538. struct HeadToLinkImplementationMap
  539. : public std::map<cmGeneratorTarget const*, cmOptionalLinkImplementation>
  540. {
  541. };
  542. typedef std::map<std::string, HeadToLinkImplementationMap> LinkImplMapType;
  543. mutable LinkImplMapType LinkImplMap;
  544. cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(
  545. const std::string& config, const cmGeneratorTarget* head) const;
  546. bool ComputeOutputDir(const std::string& config, bool implib,
  547. std::string& out) const;
  548. typedef std::map<std::string, OutputInfo> OutputInfoMapType;
  549. mutable OutputInfoMapType OutputInfoMap;
  550. typedef std::pair<std::string, bool> OutputNameKey;
  551. typedef std::map<OutputNameKey, std::string> OutputNameMapType;
  552. mutable OutputNameMapType OutputNameMap;
  553. mutable std::set<cmLinkItem> UtilityItems;
  554. cmPolicies::PolicyMap PolicyMap;
  555. mutable bool PolicyWarnedCMP0022;
  556. mutable bool DebugIncludesDone;
  557. mutable bool DebugCompileOptionsDone;
  558. mutable bool DebugCompileFeaturesDone;
  559. mutable bool DebugCompileDefinitionsDone;
  560. mutable bool DebugSourcesDone;
  561. mutable bool LinkImplementationLanguageIsContextDependent;
  562. mutable bool UtilityItemsDone;
  563. bool DLLPlatform;
  564. bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
  565. std::string& out) const;
  566. public:
  567. const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure(
  568. const std::string& config) const;
  569. mutable std::map<std::string, std::string> MaxLanguageStandards;
  570. std::map<std::string, std::string> const& GetMaxLanguageStandards() const
  571. {
  572. return this->MaxLanguageStandards;
  573. }
  574. struct StrictTargetComparison
  575. {
  576. bool operator()(cmGeneratorTarget const* t1,
  577. cmGeneratorTarget const* t2) const;
  578. };
  579. };
  580. #endif