[Cmake-commits] [cmake-commits] king committed cmMakefile.cxx 1.479 1.480

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Aug 19 10:28:25 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv15894/Source

Modified Files:
	cmMakefile.cxx 
Log Message:
BUG: Linking to modules is for 2.2 compat only

The compatibility check to allow linking to modules should test for
CMake 2.2, not the unreleased 2.3.  See issue #7500.  Furthermore, the
message should be more clear about fixing the code instead of setting
CMAKE_BACKWARDS_COMPATIBILITY unless one is just trying to build an
existing project.


Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.479
retrieving revision 1.480
diff -C 2 -d -r1.479 -r1.480
*** cmMakefile.cxx	18 Aug 2008 20:29:00 -0000	1.479
--- cmMakefile.cxx	19 Aug 2008 14:28:22 -0000	1.480
***************
*** 1223,1227 ****
        {
        // CMake versions below 2.4 allowed linking to modules.
!       bool allowModules = this->NeedBackwardsCompatibility(2,3);
        // if it is not a static or shared library then you can not link to it
        if(!((tgt->GetType() == cmTarget::STATIC_LIBRARY) ||
--- 1223,1227 ----
        {
        // CMake versions below 2.4 allowed linking to modules.
!       bool allowModules = this->NeedBackwardsCompatibility(2,2);
        // if it is not a static or shared library then you can not link to it
        if(!((tgt->GetType() == cmTarget::STATIC_LIBRARY) ||
***************
*** 1230,1244 ****
          {
          cmOStringStream e;
!         e << "Attempt to add link target " << lib << " of type: "
            << cmTarget::TargetTypeNames[static_cast<int>(tgt->GetType())]
!           << "\nto target " << target
!           << ". One can only link to STATIC or SHARED libraries, or "
            << "to executables with the ENABLE_EXPORTS property set.";
          // in older versions of cmake linking to modules was allowed
          if( tgt->GetType() == cmTarget::MODULE_LIBRARY )
            {
!           e <<
!             "\nTo allow linking of modules set "
!             "CMAKE_BACKWARDS_COMPATIBILITY to 2.2 or lower\n";
            }
          // if no modules are allowed then this is always an error
--- 1230,1247 ----
          {
          cmOStringStream e;
!         e << "Target \"" << lib << "\" of type "
            << cmTarget::TargetTypeNames[static_cast<int>(tgt->GetType())]
!           << " may not be linked into another target.  "
!           << "One may link only to STATIC or SHARED libraries, or "
            << "to executables with the ENABLE_EXPORTS property set.";
          // in older versions of cmake linking to modules was allowed
          if( tgt->GetType() == cmTarget::MODULE_LIBRARY )
            {
!           e << "\n"
!             << "If you are developing a new project, re-organize it to avoid "
!             << "linking to modules.  "
!             << "If you are just trying to build an existing project, "
!             << "set CMAKE_BACKWARDS_COMPATIBILITY to 2.2 or lower to allow "
!             << "linking to modules.";
            }
          // if no modules are allowed then this is always an error
***************
*** 1248,1252 ****
             (allowModules && tgt->GetType() != cmTarget::MODULE_LIBRARY))
            {
!           cmSystemTools::Error(e.str().c_str());
            }
          }
--- 1251,1255 ----
             (allowModules && tgt->GetType() != cmTarget::MODULE_LIBRARY))
            {
!           this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
            }
          }



More information about the Cmake-commits mailing list