summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-03-02 03:45:13 (GMT)
committerBrad King <brad.king@kitware.com>2006-03-02 03:45:13 (GMT)
commit54732b060763dbf6e4750f42e9fd228cb4a9eb12 (patch)
treee03491349314f32eae64daeb2c5cda31e796a229 /Source/cmTarget.cxx
parentae62f66033aa79cdbb564bc2e2579def43289c59 (diff)
downloadCMake-54732b060763dbf6e4750f42e9fd228cb4a9eb12.zip
CMake-54732b060763dbf6e4750f42e9fd228cb4a9eb12.tar.gz
CMake-54732b060763dbf6e4750f42e9fd228cb4a9eb12.tar.bz2
ENH: Finished CMAKE_<CONFIG>_POSTFIX feature and documented it. The value of this variable is used when a library target is created to initialize the <CONFIG>_POSTFIX target property. The value of this property is used (even for executables) to define a per-configuration postfix on the name of the target. Also enabled use of the OUTPUT_NAME property for non-executable targets.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx49
1 files changed, 39 insertions, 10 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 68788fa..a02e34e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -56,6 +56,39 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("INSTALL_RPATH", "");
this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF");
this->SetPropertyDefault("BUILD_WITH_INSTALL_RPATH", "OFF");
+
+ // Collect the set of configuration types.
+ std::vector<std::string> configNames;
+ if(const char* configurationTypes =
+ mf->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
+ {
+ cmSystemTools::ExpandListArgument(configurationTypes, configNames);
+ }
+ else if(const char* buildType = mf->GetDefinition("CMAKE_BUILD_TYPE"))
+ {
+ if(*buildType)
+ {
+ configNames.push_back(buildType);
+ }
+ }
+
+ // Setup per-configuration property default values.
+ for(std::vector<std::string>::iterator ci = configNames.begin();
+ ci != configNames.end(); ++ci)
+ {
+ // Initialize per-configuration name postfix property from the
+ // variable only for non-executable targets. This preserves
+ // compatibility with previous CMake versions in which executables
+ // did not support this variable. Projects may still specify the
+ // property directly. TODO: Make this depend on backwards
+ // compatibility setting.
+ if(m_TargetType != cmTarget::EXECUTABLE)
+ {
+ std::string property = cmSystemTools::UpperCase(*ci);
+ property += "_POSTFIX";
+ this->SetPropertyDefault(property.c_str(), 0);
+ }
+ }
}
void cmTarget::TraceVSDependencies(std::string projFile,
@@ -1130,13 +1163,11 @@ void cmTarget::GetFullNameInternal(TargetType type,
? this->GetProperty("IMPORT_SUFFIX")
: this->GetProperty("SUFFIX"));
const char* configPostfix = 0;
- if(config && *config && type != cmTarget::EXECUTABLE)
+ if(config && *config)
{
- std::string configVar = "CMAKE_";
- configVar += config;
- configVar += "_POSTFIX";
- configVar = cmSystemTools::UpperCase(configVar);
- configPostfix = m_Makefile->GetDefinition(configVar.c_str());
+ std::string configProp = cmSystemTools::UpperCase(config);
+ configProp += "_POSTFIX";
+ configPostfix = this->GetProperty(configProp.c_str());
}
const char* prefixVar = this->GetPrefixVariableInternal(type, implib);
const char* suffixVar = this->GetSuffixVariableInternal(type, implib);
@@ -1172,10 +1203,8 @@ void cmTarget::GetFullNameInternal(TargetType type,
// Begin the final name with the prefix.
outPrefix = targetPrefix?targetPrefix:"";
- // Append the target name or property-specified name. Support this
- // only for executable targets.
- const char* outname = this->GetProperty("OUTPUT_NAME");
- if(outname && type == cmTarget::EXECUTABLE)
+ // Append the target name or property-specified name.
+ if(const char* outname = this->GetProperty("OUTPUT_NAME"))
{
outBase = outname;
}