[Cmake-commits] [cmake-commits] king committed cmTarget.cxx 1.240 1.241 cmTarget.h 1.122 1.123
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri May 1 09:45:44 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv28504/Source
Modified Files:
cmTarget.cxx cmTarget.h
Log Message:
ENH: Allow more specification of target file names
This creates target properties ARCHIVE_OUTPUT_NAME, LIBRARY_OUTPUT_NAME,
and RUNTIME_OUTPUT_NAME, and per-configuration equivalent properties
ARCHIVE_OUTPUT_NAME_<CONFIG>, LIBRARY_OUTPUT_NAME_<CONFIG>, and
RUNTIME_OUTPUT_NAME_<CONFIG>. They allow specification of target output
file names on a per-type, per-configuration basis. For example, a .dll
and its .lib import library may have different base names.
For consistency and to avoid ambiguity, the old <CONFIG>_OUTPUT_NAME
property is now also available as OUTPUT_NAME_<CONFIG>.
See issue #8920.
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.122
retrieving revision 1.123
diff -C 2 -d -r1.122 -r1.123
*** cmTarget.h 1 May 2009 13:45:19 -0000 1.122
--- cmTarget.h 1 May 2009 13:45:41 -0000 1.123
***************
*** 502,505 ****
--- 502,508 ----
std::string const& ComputeBaseOutputDir(bool implib);
+ // Get the target base name.
+ std::string GetOutputName(const char* config, bool implib);
+
const char* ImportedGetLocation(const char* config);
const char* NormalGetLocation(const char* config);
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.240
retrieving revision 1.241
diff -C 2 -d -r1.240 -r1.241
*** cmTarget.cxx 1 May 2009 13:45:19 -0000 1.240
--- cmTarget.cxx 1 May 2009 13:45:40 -0000 1.241
***************
*** 469,478 ****
cm->DefineProperty
("OUTPUT_NAME", cmProperty::TARGET,
! "Sets the real name of a target when it is built.",
! "Sets the real name of a target when it is built and "
! "can be used to help create two targets of the same name even though "
! "CMake requires unique logical target names. There is also a "
! "<CONFIG>_OUTPUT_NAME that can set the output name on a "
! "per-configuration basis.");
cm->DefineProperty
--- 469,487 ----
cm->DefineProperty
("OUTPUT_NAME", cmProperty::TARGET,
! "Output name for target files.",
! "This sets the base name for output files created for an executable or "
! "library target. "
! "If not set, the logical target name is used by default.");
!
! cm->DefineProperty
! ("OUTPUT_NAME_<CONFIG>", cmProperty::TARGET,
! "Per-configuration target file base name.",
! "This is the configuration-specific version of OUTPUT_NAME.");
!
! cm->DefineProperty
! ("<CONFIG>_OUTPUT_NAME", cmProperty::TARGET,
! "Old per-configuration target file base name.",
! "This is a configuration-specific version of OUTPUT_NAME. "
! "Use OUTPUT_NAME_<CONFIG> instead.");
cm->DefineProperty
***************
*** 792,798 ****
"CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created.");
! // define some properties without documentation
! cm->DefineProperty("DEBUG_OUTPUT_NAME", cmProperty::TARGET,0,0);
! cm->DefineProperty("RELEASE_OUTPUT_NAME", cmProperty::TARGET,0,0);
}
--- 801,834 ----
"CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created.");
! cm->DefineProperty
! ("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET,
! "Output name for ARCHIVE target files.",
! "This property specifies the base name for archive target files. "
! "It overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties. "
! CM_TARGET_FILE_TYPES_DOC);
! cm->DefineProperty
! ("ARCHIVE_OUTPUT_NAME_<CONFIG>", cmProperty::TARGET,
! "Per-configuration output name for ARCHIVE target files.",
! "This is the configuration-specific version of ARCHIVE_OUTPUT_NAME.");
! cm->DefineProperty
! ("LIBRARY_OUTPUT_NAME", cmProperty::TARGET,
! "Output name for LIBRARY target files.",
! "This property specifies the base name for library target files. "
! "It overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties. "
! CM_TARGET_FILE_TYPES_DOC);
! cm->DefineProperty
! ("LIBRARY_OUTPUT_NAME_<CONFIG>", cmProperty::TARGET,
! "Per-configuration output name for LIBRARY target files.",
! "This is the configuration-specific version of LIBRARY_OUTPUT_NAME.");
! cm->DefineProperty
! ("RUNTIME_OUTPUT_NAME", cmProperty::TARGET,
! "Output name for RUNTIME target files.",
! "This property specifies the base name for runtime target files. "
! "It overrides OUTPUT_NAME and OUTPUT_NAME_<CONFIG> properties. "
! CM_TARGET_FILE_TYPES_DOC);
! cm->DefineProperty
! ("RUNTIME_OUTPUT_NAME_<CONFIG>", cmProperty::TARGET,
! "Per-configuration output name for RUNTIME target files.",
! "This is the configuration-specific version of RUNTIME_OUTPUT_NAME.");
}
***************
*** 2655,2677 ****
// Append the target name or property-specified name.
! const char* outName = 0;
! if(config && *config)
! {
! std::string configProp = cmSystemTools::UpperCase(config);
! configProp += "_OUTPUT_NAME";
! outName = this->GetProperty(configProp.c_str());
! }
! if(!outName)
! {
! outName = this->GetProperty("OUTPUT_NAME");
! }
! if(outName)
! {
! outBase = outName;
! }
! else
! {
! outBase = this->GetName();
! }
// Append the per-configuration postfix.
--- 2691,2695 ----
// Append the target name or property-specified name.
! outBase += this->GetOutputName(config, implib);
// Append the per-configuration postfix.
***************
*** 3317,3320 ****
--- 3335,3375 ----
//----------------------------------------------------------------------------
+ std::string cmTarget::GetOutputName(const char* config, bool implib)
+ {
+ std::vector<std::string> props;
+ std::string type = this->GetOutputTargetType(implib);
+ std::string configUpper = cmSystemTools::UpperCase(config? config : "");
+ if(!type.empty() && !configUpper.empty())
+ {
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
+ props.push_back(type + "_OUTPUT_NAME_" + configUpper);
+ }
+ if(!type.empty())
+ {
+ // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME
+ props.push_back(type + "_OUTPUT_NAME");
+ }
+ if(!configUpper.empty())
+ {
+ // OUTPUT_NAME_<CONFIG>
+ props.push_back("OUTPUT_NAME_" + configUpper);
+ // <CONFIG>_OUTPUT_NAME
+ props.push_back(configUpper + "_OUTPUT_NAME");
+ }
+ // OUTPUT_NAME
+ props.push_back("OUTPUT_NAME");
+
+ for(std::vector<std::string>::const_iterator i = props.begin();
+ i != props.end(); ++i)
+ {
+ if(const char* outName = this->GetProperty(i->c_str()))
+ {
+ return outName;
+ }
+ }
+ return this->GetName();
+ }
+
+ //----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkVersion()
{
More information about the Cmake-commits
mailing list