1
/*=========================================================================
3
Program: CMake - Cross-Platform Makefile Generator
4
Module: $RCSfile: cmTarget.h,v $
6
Date: $Date: 2009-01-13 18:03:53 $
7
Version: $Revision: 1.109.2.8 $
9
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
PURPOSE. See the above copyright notices for more information.
16
=========================================================================*/
1
/*============================================================================
2
CMake - Cross Platform Makefile Generator
3
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5
Distributed under the OSI-approved BSD License (the "License");
6
see accompanying file Copyright.txt for details.
8
This software is distributed WITHOUT ANY WARRANTY; without even the
9
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
See the License for more information.
11
============================================================================*/
37
34
~cmTargetLinkInformationMap();
40
struct cmTargetLinkInterface
42
// Libraries listed in the interface.
43
std::vector<std::string> Libraries;
45
// Shared library dependencies needed for linking on some platforms.
46
std::vector<std::string> SharedDeps;
49
struct cmTargetLinkInterfaceMap:
50
public std::map<cmStdString, cmTargetLinkInterface*>
52
typedef std::map<cmStdString, cmTargetLinkInterface*> derived;
53
cmTargetLinkInterfaceMap() {}
54
cmTargetLinkInterfaceMap(cmTargetLinkInterfaceMap const& r);
55
~cmTargetLinkInterfaceMap();
58
37
class cmTargetInternals;
59
38
class cmTargetInternalPointer
136
116
* Get the list of the source files used by this target
138
std::vector<cmSourceFile*> const &GetSourceFiles()
139
{return this->SourceFiles;}
140
void AddSourceFile(cmSourceFile* sf) { this->SourceFiles.push_back(sf); }
118
std::vector<cmSourceFile*> const& GetSourceFiles();
119
void AddSourceFile(cmSourceFile* sf);
121
/** Get sources that must be built before the given source. */
122
std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf);
143
125
* Flags for a given source file as used in this target. Typically assigned
250
230
bool GetPropertyAsBool(const char *prop);
251
231
void CheckProperty(const char* prop, cmMakefile* context);
233
const char* GetFeature(const char* feature, const char* config);
253
235
bool IsImported() const {return this->IsImportedTarget;}
255
/** Get the library interface dependencies. This is the set of
256
libraries from which something that links to this target may
257
also receive symbols. Returns 0 if the user has not specified
258
such dependencies or for static libraries. */
259
cmTargetLinkInterface const* GetLinkInterface(const char* config);
237
/** The link interface specifies transitive library dependencies and
238
other information needed by targets that link to this target. */
241
// Languages whose runtime libraries must be linked.
242
std::vector<std::string> Languages;
244
// Libraries listed in the interface.
245
std::vector<std::string> Libraries;
247
// Shared library dependencies needed for linking on some platforms.
248
std::vector<std::string> SharedDeps;
250
// Number of repetitions of a strongly connected component of two
251
// or more static libraries.
254
// Libraries listed for other configurations.
255
// Needed only for OLD behavior of CMP0003.
256
std::vector<std::string> WrongConfigLibraries;
258
LinkInterface(): Multiplicity(0) {}
261
/** Get the link interface for the given configuration. Returns 0
262
if the target cannot be linked. */
263
LinkInterface const* GetLinkInterface(const char* config);
265
/** The link implementation specifies the direct library
266
dependencies needed by the object files of the target. */
267
struct LinkImplementation
269
// Languages whose runtime libraries must be linked.
270
std::vector<std::string> Languages;
272
// Libraries linked directly in this configuration.
273
std::vector<std::string> Libraries;
275
// Libraries linked directly in other configurations.
276
// Needed only for OLD behavior of CMP0003.
277
std::vector<std::string> WrongConfigLibraries;
279
LinkImplementation const* GetLinkImplementation(const char* config);
281
/** Link information from the transitive closure of the link
282
implementation and the interfaces of its dependencies. */
285
// The preferred linker language.
286
std::string LinkerLanguage;
288
// Languages whose runtime libraries must be linked.
289
std::vector<std::string> Languages;
291
LinkClosure const* GetLinkClosure(const char* config);
293
/** Strip off leading and trailing whitespace from an item named in
294
the link dependencies of this target. */
295
std::string CheckCMP0004(std::string const& item);
261
297
/** Get the directory in which this target will be built. If the
262
298
configuration name is given then the generator will add its
326
362
std::string& realName, std::string& impName,
327
363
std::string& pdbName, const char* config);
329
/** Get the names of the library used to remove existing copies of
330
the library from the build tree either before linking or during
331
a clean step. This should be called only on a library
333
void GetLibraryCleanNames(std::string& staticName,
334
std::string& sharedName,
335
std::string& sharedSOName,
336
std::string& sharedRealName,
337
std::string& importName,
338
std::string& pdbName,
341
365
/** Get the names of the executable needed to generate a build rule
342
366
that takes into account executable version numbers. This should
343
367
be called only on an executable target. */
345
369
std::string& impName,
346
370
std::string& pdbName, const char* config);
348
/** Get the names of the executable used to remove existing copies
349
of the executable from the build tree either before linking or
350
during a clean step. This should be called only on an
351
executable target. */
352
void GetExecutableCleanNames(std::string& name, std::string& realName,
353
std::string& impName,
354
std::string& pdbName, const char* config);
356
372
/** Add the target output files to the global generator manifest. */
357
373
void GenerateTargetManifest(const char* config);
360
376
* Compute whether this target must be relinked before installing.
362
bool NeedRelinkBeforeInstall();
378
bool NeedRelinkBeforeInstall(const char* config);
364
380
bool HaveBuildTreeRPATH();
365
381
bool HaveInstallTreeRPATH();
367
383
/** Return true if builtin chrpath will work for this target */
368
bool IsChrpathUsed();
384
bool IsChrpathUsed(const char* config);
370
386
std::string GetInstallNameDirForBuildTree(const char* config,
371
387
bool for_xcode = false);
465
490
const LibraryID& lib,
466
491
DependencyMap& dep_map);
468
const char* GetSuffixVariableInternal(TargetType type, bool implib);
469
const char* GetPrefixVariableInternal(TargetType type, bool implib);
470
std::string GetFullNameInternal(TargetType type, const char* config,
472
void GetFullNameInternal(TargetType type, const char* config, bool implib,
493
void AnalyzeLibDependencies( const cmMakefile& mf );
495
const char* GetSuffixVariableInternal(bool implib);
496
const char* GetPrefixVariableInternal(bool implib);
497
std::string GetFullNameInternal(const char* config, bool implib);
498
void GetFullNameInternal(const char* config, bool implib,
473
499
std::string& outPrefix, std::string& outBase,
474
500
std::string& outSuffix);
476
void GetLibraryNamesInternal(std::string& name,
478
std::string& realName,
479
std::string& impName,
480
std::string& pdbName,
483
void GetExecutableNamesInternal(std::string& name,
484
std::string& realName,
485
std::string& impName,
486
std::string& pdbName,
490
502
// Use a makefile variable to set a default for the given property.
491
503
// If the variable is not defined use the given default instead.
492
504
void SetPropertyDefault(const char* property, const char* default_value);
494
// Get the full path to the target output directory.
495
std::string GetOutputDir(bool implib);
496
std::string const& ComputeBaseOutputDir(bool implib);
506
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
507
const char* GetOutputTargetType(bool implib);
509
// Get the target base name.
510
std::string GetOutputName(const char* config, bool implib);
498
512
const char* ImportedGetLocation(const char* config);
499
513
const char* NormalGetLocation(const char* config);
537
549
bool DLLPlatform;
538
550
bool IsImportedTarget;
552
// Cache target output paths for each configuration.
554
OutputInfo const* GetOutputInfo(const char* config);
555
void ComputeOutputDir(const char* config, bool implib, std::string& out);
540
557
// Cache import information from properties for each configuration.
544
std::string Location;
546
std::string ImportLibrary;
547
cmTargetLinkInterface LinkInterface;
549
typedef std::map<cmStdString, ImportInfo> ImportInfoMapType;
550
ImportInfoMapType ImportInfoMap;
551
559
ImportInfo const* GetImportInfo(const char* config);
552
560
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info);
554
562
cmTargetLinkInformationMap LinkInformation;
557
cmTargetLinkInterface* ComputeLinkInterface(const char* config);
558
cmTargetLinkInterfaceMap LinkInterface;
564
bool ComputeLinkInterface(const char* config, LinkInterface& iface);
566
void ComputeLinkImplementation(const char* config,
567
LinkImplementation& impl);
568
void ComputeLinkClosure(const char* config, LinkClosure& lc);
570
void ClearLinkMaps();
572
void MaybeInvalidatePropertyCache(const char* prop);
560
574
// The cmMakefile instance that owns this target. This should
561
575
// always be set.