[Cmake-commits] [cmake-commits] king committed cmSetPropertyCommand.cxx 1.7 1.8 cmSetTargetPropertiesCommand.cxx 1.9 1.10 cmTarget.cxx 1.223 1.224 cmTarget.h 1.118 1.119
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Aug 19 11:43:53 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv24701/Source
Modified Files:
cmSetPropertyCommand.cxx cmSetTargetPropertiesCommand.cxx
cmTarget.cxx cmTarget.h
Log Message:
ENH: Disallow link-type keywords in link interface
The LINK_INTERFACE_LIBRARIES target property may not contain the
"debug", "optimized", or "general" keywords. These keywords are
supported only by the target_link_libraries (and link_libraries) command
and are not a generic library list feature in CMake. When a user
attempts to add one of these keywords to the property value, we now
produce an error message that refers users to alternative means.
Index: cmSetTargetPropertiesCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetTargetPropertiesCommand.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -C 2 -d -r1.9 -r1.10
*** cmSetTargetPropertiesCommand.cxx 28 Jan 2008 13:38:36 -0000 1.9
--- cmSetTargetPropertiesCommand.cxx 19 Aug 2008 15:43:51 -0000 1.10
***************
*** 104,107 ****
--- 104,108 ----
target->SetProperty(propertyPairs[k].c_str(),
propertyPairs[k+1].c_str());
+ target->CheckProperty(propertyPairs[k].c_str(), mf);
}
}
Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.118
retrieving revision 1.119
diff -C 2 -d -r1.118 -r1.119
*** cmTarget.h 18 Aug 2008 15:39:22 -0000 1.118
--- cmTarget.h 19 Aug 2008 15:43:51 -0000 1.119
***************
*** 246,249 ****
--- 246,250 ----
const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
bool GetPropertyAsBool(const char *prop);
+ void CheckProperty(const char* prop, cmMakefile* context);
bool IsImported() const {return this->IsImportedTarget;}
Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.223
retrieving revision 1.224
diff -C 2 -d -r1.223 -r1.224
*** cmTarget.cxx 19 Aug 2008 14:29:35 -0000 1.223
--- cmTarget.cxx 19 Aug 2008 15:43:51 -0000 1.224
***************
*** 23,26 ****
--- 23,27 ----
#include "cmComputeLinkInformation.h"
#include "cmListFileCache.h"
+ #include <cmsys/RegularExpression.hxx>
#include <map>
#include <set>
***************
*** 1692,1695 ****
--- 1693,1759 ----
//----------------------------------------------------------------------------
+ static void cmTargetCheckLINK_INTERFACE_LIBRARIES(
+ const char* prop, const char* value, cmMakefile* context, bool imported
+ )
+ {
+ // Look for link-type keywords in the value.
+ static cmsys::RegularExpression
+ keys("(^|;)(debug|optimized|general)(;|$)");
+ if(!keys.find(value))
+ {
+ return;
+ }
+
+ // Support imported and non-imported versions of the property.
+ const char* base = (imported?
+ "IMPORTED_LINK_INTERFACE_LIBRARIES" :
+ "LINK_INTERFACE_LIBRARIES");
+
+ // Report an error.
+ cmOStringStream e;
+ e << "Property " << prop << " may not contain link-type keyword \""
+ << keys.match(2) << "\". "
+ << "The " << base << " property has a per-configuration "
+ << "version called " << base << "_<CONFIG> which may be "
+ << "used to specify per-configuration rules.";
+ if(!imported)
+ {
+ e << " "
+ << "Alternatively, an IMPORTED library may be created, configured "
+ << "with a per-configuration location, and then named in the "
+ << "property value. "
+ << "See the add_library command's IMPORTED mode for details."
+ << "\n"
+ << "If you have a list of libraries that already contains the "
+ << "keyword, use the target_link_libraries command with its "
+ << "LINK_INTERFACE_LIBRARIES mode to set the property. "
+ << "The command automatically recognizes link-type keywords and sets "
+ << "the LINK_INTERFACE_LIBRARIES and LINK_INTERFACE_LIBRARIES_DEBUG "
+ << "properties accordingly.";
+ }
+ context->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+
+ //----------------------------------------------------------------------------
+ void cmTarget::CheckProperty(const char* prop, cmMakefile* context)
+ {
+ // Certain properties need checking.
+ if(strncmp(prop, "LINK_INTERFACE_LIBRARIES", 24) == 0)
+ {
+ if(const char* value = this->GetProperty(prop))
+ {
+ cmTargetCheckLINK_INTERFACE_LIBRARIES(prop, value, context, false);
+ }
+ }
+ if(strncmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES", 33) == 0)
+ {
+ if(const char* value = this->GetProperty(prop))
+ {
+ cmTargetCheckLINK_INTERFACE_LIBRARIES(prop, value, context, true);
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------------
void cmTarget::MarkAsImported()
{
Index: cmSetPropertyCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetPropertyCommand.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmSetPropertyCommand.cxx 1 Apr 2008 18:22:06 -0000 1.7
--- cmSetPropertyCommand.cxx 19 Aug 2008 15:43:51 -0000 1.8
***************
*** 272,275 ****
--- 272,278 ----
}
+ // Check the resulting value.
+ target->CheckProperty(name, this->Makefile);
+
return true;
}
More information about the Cmake-commits
mailing list