summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx238
1 files changed, 140 insertions, 98 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3856091..c9cbd00 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -27,7 +27,10 @@
#include "assert.h"
#include <errno.h>
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#if defined(CMake_HAVE_CXX_UNORDERED_SET)
+#include <unordered_set>
+#define UNORDERED_SET std::unordered_set
+#elif defined(CMAKE_BUILD_WITH_CMAKE)
#include <cmsys/hash_set.hxx>
#define UNORDERED_SET cmsys::hash_set
#else
@@ -39,13 +42,13 @@ class cmGeneratorTarget::TargetPropertyEntry
static cmLinkImplItem NoLinkImplItem;
public:
- TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
+ TargetPropertyEntry(CM_AUTO_PTR<cmCompiledGeneratorExpression> cge,
cmLinkImplItem const& item = NoLinkImplItem)
: ge(cge)
, LinkImplItem(item)
{
}
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
+ const CM_AUTO_PTR<cmCompiledGeneratorExpression> ge;
cmLinkImplItem const& LinkImplItem;
};
cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem;
@@ -250,7 +253,7 @@ void CreatePropertyGeneratorExpressions(
for (std::vector<std::string>::const_iterator it = entries.begin();
it != entries.end(); ++it, ++btIt) {
cmGeneratorExpression ge(*btIt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
cge->SetEvaluateForBuildsystem(evaluateForBuildsystem);
items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
}
@@ -258,6 +261,7 @@ void CreatePropertyGeneratorExpressions(
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
: Target(t)
+ , FortranModuleDirectoryCreated(false)
, SourceFileFlagsConstructed(false)
, PolicyWarnedCMP0022(false)
, DebugIncludesDone(false)
@@ -439,7 +443,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
// Now evaluate genex and update the previously-prepared map entry.
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
i->second = cge->Evaluate(this->LocalGenerator, config);
} else if (i->second.empty()) {
// An empty map entry indicates we have been called recursively
@@ -457,7 +461,7 @@ void cmGeneratorTarget::AddSource(const std::string& src)
this->Target->AddSource(src);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
cge->SetEvaluateForBuildsystem(true);
this->SourceEntries.push_back(new TargetPropertyEntry(cge));
this->SourceFilesMap.clear();
@@ -473,7 +477,7 @@ void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
cge->SetEvaluateForBuildsystem(true);
this->SourceEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge));
@@ -487,7 +491,7 @@ std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
if (i != this->SourceDepends.end()) {
return &i->second.Depends;
}
- return 0;
+ return CM_NULLPTR;
}
static void handleSystemIncludesDep(
@@ -798,7 +802,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
if (iter == this->SystemIncludesCache.end()) {
cmGeneratorExpressionDAGChecker dagChecker(
- this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
+ this->GetName(), "SYSTEM_INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
bool excludeImported = this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
@@ -858,7 +862,7 @@ static void AddInterfaceEntries(
if (it->Target) {
std::string genex = "$<TARGET_PROPERTY:" + *it + "," + prop + ">";
cmGeneratorExpression ge(it->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
cge->SetEvaluateForBuildsystem(true);
entries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge, *it));
@@ -994,7 +998,8 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
this->DebugSourcesDone = true;
}
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES",
+ CM_NULLPTR, CM_NULLPTR);
UNORDERED_SET<std::string> uniqueSrcs;
bool contextDependentDirectSources =
@@ -1306,11 +1311,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
this->GetName());
}
- if (cmp0042 == cmPolicies::NEW) {
- return true;
- }
-
- return false;
+ return cmp0042 == cmPolicies::NEW;
}
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
@@ -1352,8 +1353,9 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config,
fpath += ".app";
if (!this->Makefile->PlatformIsAppleIos()) {
fpath += "/Contents";
- if (!contentOnly)
+ if (!contentOnly) {
fpath += "/MacOS";
+ }
}
return fpath;
}
@@ -1381,8 +1383,9 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config,
fpath += ext;
if (!this->Makefile->PlatformIsAppleIos()) {
fpath += "/Contents";
- if (!contentOnly)
+ if (!contentOnly) {
fpath += "/MacOS";
+ }
}
return fpath;
}
@@ -1504,7 +1507,7 @@ const char* cmGeneratorTarget::GetExportMacro() const
}
return this->ExportMacro.c_str();
} else {
- return 0;
+ return CM_NULLPTR;
}
}
@@ -1529,7 +1532,7 @@ public:
if (item.find("::") != std::string::npos) {
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
- std::stringstream e;
+ std::ostringstream e;
switch (this->Target->GetLocalGenerator()->GetPolicyStatus(
cmPolicies::CMP0028)) {
case cmPolicies::WARN: {
@@ -1630,7 +1633,7 @@ public:
if (this->Preferred.empty()) {
return "";
} else if (this->Preferred.size() > 1) {
- std::stringstream e;
+ std::ostringstream e;
e << "Target " << this->Target->GetName()
<< " contains multiple languages with the highest linker preference"
<< " (" << this->Preference << "):\n";
@@ -1748,7 +1751,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
{
// There is no compile information for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
if (this->GetType() > cmState::OBJECT_LIBRARY) {
@@ -1757,7 +1760,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
msg += " which has type ";
msg += cmState::GetTargetTypeName(this->GetType());
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
- return 0;
+ return CM_NULLPTR;
}
// Lookup/compute/cache the compile information for this configuration.
@@ -1786,7 +1789,7 @@ cmSourceFile const* cmGeneratorTarget::GetModuleDefinitionFile(
return data.front();
}
- return 0;
+ return CM_NULLPTR;
}
bool cmGeneratorTarget::IsDLLPlatform() const
@@ -1839,8 +1842,8 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
}
cmGeneratorExpression ge;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "AUTOUIC_OPTIONS", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "AUTOUIC_OPTIONS", CM_NULLPTR, CM_NULLPTR);
cmSystemTools::ExpandListArgument(
ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false, this,
&dagChecker),
@@ -1925,7 +1928,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
this->Makefile = target->Target->GetMakefile();
this->LocalGenerator = target->GetLocalGenerator();
this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
- this->CurrentEntry = 0;
+ this->CurrentEntry = CM_NULLPTR;
// Queue all the source files already specified for the target.
if (target->GetType() != cmState::INTERFACE_LIBRARY) {
@@ -2000,7 +2003,7 @@ void cmTargetTraceDependencies::Trace()
this->CheckCustomCommand(*cc);
}
}
- this->CurrentEntry = 0;
+ this->CurrentEntry = CM_NULLPTR;
this->GeneratorTarget->AddTracedSources(this->NewSources);
}
@@ -2116,8 +2119,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
// Check for target references in generator expressions.
for (cmCustomCommandLine::const_iterator cli = cit->begin();
cli != cit->end(); ++cli) {
- const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(*cli);
+ const CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*cli);
cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true);
std::set<cmGeneratorTarget*> geTargets = cge->GetTargets();
targets.insert(geTargets.begin(), geTargets.end());
@@ -2200,7 +2202,7 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory(
void cmGeneratorTarget::GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const
{
- const char* archs = 0;
+ const char* archs = CM_NULLPTR;
if (!config.empty()) {
std::string defVarName = "OSX_ARCHITECTURES_";
defVarName += cmSystemTools::UpperCase(config);
@@ -2358,8 +2360,8 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
std::vector<std::string> includes;
UNORDERED_SET<std::string> uniqueIncludes;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "INCLUDE_DIRECTORIES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2402,7 +2404,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
libDir = frameworkCheck.match(1);
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str());
linkInterfaceIncludeDirectoriesEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge));
@@ -2485,8 +2487,8 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
{
UNORDERED_SET<std::string> uniqueOptions;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_OPTIONS", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "COMPILE_OPTIONS", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2537,8 +2539,8 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
{
UNORDERED_SET<std::string> uniqueFeatures;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_FEATURES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "COMPILE_FEATURES", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2587,8 +2589,8 @@ void cmGeneratorTarget::GetCompileDefinitions(
{
UNORDERED_SET<std::string> uniqueOptions;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "COMPILE_DEFINITIONS", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "COMPILE_DEFINITIONS", CM_NULLPTR, CM_NULLPTR);
std::vector<std::string> debugProperties;
const char* debugProp =
@@ -2626,7 +2628,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
}
case cmPolicies::OLD: {
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(configProp);
linkInterfaceCompileDefinitionsEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge));
@@ -2794,8 +2796,8 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
this->IsFrameworkOnApple()) {
// Versioning is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
- version = 0;
- soversion = 0;
+ version = CM_NULLPTR;
+ soversion = CM_NULLPTR;
}
if (version && !soversion) {
// The soversion must be set if the library version is set. Use
@@ -2869,7 +2871,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
const char* version = this->GetProperty("VERSION");
if (this->GetType() != cmState::EXECUTABLE ||
this->Makefile->IsOn("XCODE")) {
- version = 0;
+ version = CM_NULLPTR;
}
#endif
@@ -2969,7 +2971,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
: this->GetProperty("PREFIX"));
const char* targetSuffix = (implib ? this->GetProperty("IMPORT_SUFFIX")
: this->GetProperty("SUFFIX"));
- const char* configPostfix = 0;
+ const char* configPostfix = CM_NULLPTR;
if (!config.empty()) {
std::string configProp = cmSystemTools::UpperCase(config);
configProp += "_POSTFIX";
@@ -2977,7 +2979,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
// Mac application bundles and frameworks have no postfix.
if (configPostfix &&
(this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) {
- configPostfix = 0;
+ configPostfix = CM_NULLPTR;
}
}
const char* prefixVar = this->Target->GetPrefixVariableInternal(implib);
@@ -3011,14 +3013,14 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
fw_prefix = this->GetOutputName(config, false);
fw_prefix += ".framework/";
targetPrefix = fw_prefix.c_str();
- targetSuffix = 0;
+ targetSuffix = CM_NULLPTR;
}
if (this->IsCFBundleOnApple()) {
fw_prefix = this->GetCFBundleDirectory(config, false);
fw_prefix += "/";
targetPrefix = fw_prefix.c_str();
- targetSuffix = 0;
+ targetSuffix = CM_NULLPTR;
}
// Begin the final name with the prefix.
@@ -3267,7 +3269,7 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
switch (t) {
case BoolType:
assert(0 && "String compatibility check function called for boolean");
- return 0;
+ return CM_NULLPTR;
case StringType:
return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
case NumberMinType:
@@ -3276,7 +3278,7 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
}
assert(0 && "Unreachable!");
- return 0;
+ return CM_NULLPTR;
}
template <typename PropertyType>
@@ -3314,7 +3316,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
}
if (emitted.insert(*pi).second) {
getLinkInterfaceDependentProperty<PropertyType>(depender, *pi, config, t,
- 0);
+ CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
@@ -3340,11 +3342,13 @@ static std::string intersect(const std::set<std::string>& s1,
{
std::string result;
result = intersect(s1, s2);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s3);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
return intersect(s2, s3);
}
@@ -3355,14 +3359,17 @@ static std::string intersect(const std::set<std::string>& s1,
{
std::string result;
result = intersect(s1, s2);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s3);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
result = intersect(s1, s4);
- if (!result.empty())
+ if (!result.empty()) {
return result;
+ }
return intersect(s2, s3, s4);
}
@@ -3387,24 +3394,25 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
}
checkPropertyConsistency<bool>(this, li->Target, strBool, emittedBools,
- config, BoolType, 0);
+ config, BoolType, CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
- checkPropertyConsistency<const char*>(
- this, li->Target, strString, emittedStrings, config, StringType, 0);
+ checkPropertyConsistency<const char*>(this, li->Target, strString,
+ emittedStrings, config, StringType,
+ CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
checkPropertyConsistency<const char*>(this, li->Target, strNumMin,
emittedMinNumbers, config,
- NumberMinType, 0);
+ NumberMinType, CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
checkPropertyConsistency<const char*>(this, li->Target, strNumMax,
emittedMaxNumbers, config,
- NumberMaxType, 0);
+ NumberMaxType, CM_NULLPTR);
if (cmSystemTools::GetErrorOccuredFlag()) {
return;
}
@@ -3537,7 +3545,7 @@ std::pair<bool, const char*> consistentStringProperty(const char* lhs,
const char* rhs)
{
const bool b = strcmp(lhs, rhs) == 0;
- return std::make_pair(b, b ? lhs : 0);
+ return std::make_pair(b, b ? lhs : CM_NULLPTR);
}
std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
@@ -3546,7 +3554,7 @@ std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
{
char* pEnd;
- const char* const null_ptr = 0;
+ const char* const null_ptr = CM_NULLPTR;
long lnum = strtol(lhs, &pEnd, 0);
if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) {
@@ -3580,7 +3588,7 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
return std::make_pair(true, lhs);
}
- const char* const null_ptr = 0;
+ const char* const null_ptr = CM_NULLPTR;
switch (t) {
case BoolType:
@@ -3751,28 +3759,28 @@ bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
- BoolType, 0);
+ BoolType, CM_NULLPTR);
}
const char* cmGeneratorTarget::GetLinkInterfaceDependentStringProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char*>(
- this, p, config, "empty", StringType, 0);
+ this, p, config, "empty", StringType, CM_NULLPTR);
}
const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMinProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char*>(
- this, p, config, "empty", NumberMinType, 0);
+ this, p, config, "empty", NumberMinType, CM_NULLPTR);
}
const char* cmGeneratorTarget::GetLinkInterfaceDependentNumberMaxProperty(
const std::string& p, const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char*>(
- this, p, config, "empty", NumberMaxType, 0);
+ this, p, config, "empty", NumberMaxType, CM_NULLPTR);
}
cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
@@ -3787,7 +3795,7 @@ cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
new cmComputeLinkInformation(this, config);
if (!info || !info->Compute()) {
delete info;
- info = 0;
+ info = CM_NULLPTR;
}
// Store the information for this configuration.
@@ -3839,6 +3847,40 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
}
}
+std::string cmGeneratorTarget::GetFortranModuleDirectory() const
+{
+ if (!this->FortranModuleDirectoryCreated) {
+ this->FortranModuleDirectory = true;
+ this->FortranModuleDirectory = this->CreateFortranModuleDirectory();
+ }
+
+ return this->FortranModuleDirectory;
+}
+
+std::string cmGeneratorTarget::CreateFortranModuleDirectory() const
+{
+ std::string mod_dir;
+ const char* target_mod_dir = this->GetProperty("Fortran_MODULE_DIRECTORY");
+ const char* moddir_flag =
+ this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
+ if (target_mod_dir && moddir_flag) {
+ // Compute the full path to the module directory.
+ if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
+ // Already a full path.
+ mod_dir = target_mod_dir;
+ } else {
+ // Interpret relative to the current output directory.
+ mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
+ mod_dir += "/";
+ mod_dir += target_mod_dir;
+ }
+
+ // Make sure the module output directory exists.
+ cmSystemTools::MakeDirectory(mod_dir);
+ }
+ return mod_dir;
+}
+
std::string cmGeneratorTarget::GetFrameworkVersion() const
{
assert(this->GetType() != cmState::INTERFACE_LIBRARY);
@@ -3930,14 +3972,15 @@ void cmGeneratorTarget::ExpandLinkItems(
std::vector<cmLinkItem>& items, bool& hadHeadSensitiveCondition) const
{
cmGeneratorExpression ge;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), prop, CM_NULLPTR,
+ CM_NULLPTR);
// The $<LINK_ONLY> expression may be in a link interface to specify private
// link dependencies that are otherwise excluded from usage requirements.
if (usage_requirements_only) {
dagChecker.SetTransitivePropertiesOnly();
}
std::vector<std::string> libs;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(value);
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config,
false, headTarget, this,
&dagChecker),
@@ -3958,7 +4001,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
// export symbols.
if (this->GetType() == cmState::EXECUTABLE &&
!this->IsExecutableWithExports()) {
- return 0;
+ return CM_NULLPTR;
}
// Lookup any existing link interface for this configuration.
@@ -3982,7 +4025,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
}
}
- return iface.Exists ? &iface : 0;
+ return iface.Exists ? &iface : CM_NULLPTR;
}
void cmGeneratorTarget::ComputeLinkInterface(
@@ -4074,7 +4117,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
// export symbols.
if (this->GetType() == cmState::EXECUTABLE &&
!this->IsExecutableWithExports()) {
- return 0;
+ return CM_NULLPTR;
}
// Lookup any existing link interface for this configuration.
@@ -4097,7 +4140,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
usage_requirements_only);
}
- return iface.Exists ? &iface : 0;
+ return iface.Exists ? &iface : CM_NULLPTR;
}
std::string cmGeneratorTarget::GetDirectory(const std::string& config,
@@ -4126,7 +4169,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
{
// There is no output information for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
// Only libraries and executables have well-defined output files.
@@ -4136,7 +4179,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
msg += " which has type ";
msg += cmState::GetTargetTypeName(this->GetType());
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
- return 0;
+ return CM_NULLPTR;
}
// Lookup/compute/cache the output information for this configuration.
@@ -4167,7 +4210,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
cmake::FATAL_ERROR,
"Target '" + this->GetName() + "' OUTPUT_DIRECTORY depends on itself.",
this->GetBacktrace());
- return 0;
+ return CM_NULLPTR;
}
return &i->second;
}
@@ -4181,7 +4224,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Look for a target property defining the target output directory
// based on the target type.
std::string targetTypeName = this->GetOutputTargetType(implib);
- const char* propertyName = 0;
+ const char* propertyName = CM_NULLPTR;
std::string propertyNameStr = targetTypeName;
if (!propertyNameStr.empty()) {
propertyNameStr += "_OUTPUT_DIRECTORY";
@@ -4190,7 +4233,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = 0;
+ const char* configProp = CM_NULLPTR;
std::string configPropStr = targetTypeName;
if (!configPropStr.empty()) {
configPropStr += "_OUTPUT_DIRECTORY_";
@@ -4202,8 +4245,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
if (const char* config_outdir = this->GetProperty(configProp)) {
// Use the user-specified per-configuration output directory.
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(config_outdir);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(config_outdir);
out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory.
@@ -4211,7 +4253,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
} else if (const char* outdir = this->GetProperty(propertyName)) {
// Use the user-specified output directory.
cmGeneratorExpression ge;
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory if the value contained a
@@ -4258,7 +4300,7 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
{
// Look for a target property defining the target output directory
// based on the target type.
- const char* propertyName = 0;
+ const char* propertyName = CM_NULLPTR;
std::string propertyNameStr = kind;
if (!propertyNameStr.empty()) {
propertyNameStr += "_OUTPUT_DIRECTORY";
@@ -4268,7 +4310,7 @@ bool cmGeneratorTarget::ComputePDBOutputDir(const std::string& kind,
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(conf);
- const char* configProp = 0;
+ const char* configProp = CM_NULLPTR;
std::string configPropStr = kind;
if (!configPropStr.empty()) {
configPropStr += "_OUTPUT_DIRECTORY_";
@@ -4326,7 +4368,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// An explicit list of interface libraries may be set for shared
// libraries and executables that export symbols.
- const char* explicitLibraries = 0;
+ const char* explicitLibraries = CM_NULLPTR;
std::string linkIfaceProp;
if (this->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
this->GetPolicyStatusCMP0022() != cmPolicies::WARN) {
@@ -4452,7 +4494,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
{
cmGeneratorTarget::ImportInfo const* info = this->GetImportInfo(config);
if (!info) {
- return 0;
+ return CM_NULLPTR;
}
std::string CONFIG = cmSystemTools::UpperCase(config);
@@ -4488,7 +4530,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
{
// There is no imported information for non-imported targets.
if (!this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
// Lookup/compute/cache the import information for this
@@ -4514,7 +4556,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
// If the location is empty then the target is not available for
// this configuration.
if (i->second.Location.empty() && i->second.ImportLibrary.empty()) {
- return 0;
+ return CM_NULLPTR;
}
// Return the import information.
@@ -4531,8 +4573,8 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
// Initialize members.
info.NoSOName = false;
- const char* loc = 0;
- const char* imp = 0;
+ const char* loc = CM_NULLPTR;
+ const char* imp = CM_NULLPTR;
std::string suffix;
if (!this->Target->GetMappedConfig(desired_config, &loc, &imp, suffix)) {
return;
@@ -4674,7 +4716,7 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation(
{
// There is no link implementation for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
std::string CONFIG = cmSystemTools::UpperCase(config);
@@ -4903,7 +4945,7 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal(
{
// There is no link implementation for imported targets.
if (this->IsImported()) {
- return 0;
+ return CM_NULLPTR;
}
// Populate the link implementation libraries for this configuration.
@@ -4943,10 +4985,10 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
end = entryRange.end();
le != end; ++le, ++btIt) {
std::vector<std::string> llibs;
- cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
- "LINK_LIBRARIES", 0, 0);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this->GetName(), "LINK_LIBRARIES", CM_NULLPTR, CM_NULLPTR);
cmGeneratorExpression ge(*btIt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
+ CM_AUTO_PTR<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
std::string const evaluated =
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs);
@@ -5037,7 +5079,7 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
// within the project.
if (tgt && tgt->GetType() == cmState::EXECUTABLE &&
!tgt->IsExecutableWithExports()) {
- tgt = 0;
+ tgt = CM_NULLPTR;
}
if (tgt && tgt->GetType() == cmState::OBJECT_LIBRARY) {
@@ -5051,7 +5093,7 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
"with the ENABLE_EXPORTS property set.";
cmake* cm = this->LocalGenerator->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
- tgt = 0;
+ tgt = CM_NULLPTR;
}
return tgt;