[Cmake-commits] [cmake-commits] hoffman committed cmComputeLinkInformation.cxx 1.27 1.28 cmComputeLinkInformation.h 1.16 1.17

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Mar 18 17:32:29 EDT 2008


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

Modified Files:
	cmComputeLinkInformation.cxx cmComputeLinkInformation.h 
Log Message:
ENH: try to reduce the number of CMP0003 warnings that people see.  Only report them for unique sets of libraries with no full path.  Also add a message explaining the course of action that should be taken


Index: cmComputeLinkInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.cxx,v
retrieving revision 1.27
retrieving revision 1.28
diff -C 2 -d -r1.27 -r1.28
*** cmComputeLinkInformation.cxx	15 Mar 2008 14:00:40 -0000	1.27
--- cmComputeLinkInformation.cxx	18 Mar 2008 21:32:26 -0000	1.28
***************
*** 1339,1345 ****
        w << (this->Makefile->GetPolicies()
              ->GetPolicyWarning(cmPolicies::CMP0003)) << "\n";
!       this->PrintLinkPolicyDiagnosis(w);
!       this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
!                                         this->Target->GetBacktrace());
        }
      case cmPolicies::OLD:
--- 1339,1354 ----
        w << (this->Makefile->GetPolicies()
              ->GetPolicyWarning(cmPolicies::CMP0003)) << "\n";
!       std::string libs = "CMP0003-WARNING-FOR-";
!       this->PrintLinkPolicyDiagnosis(w, libs);
!       const char* def = this->CMakeInstance->GetCacheDefinition(libs.c_str());
!       if(!def)
!         {
!         this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
!                                           this->Target->GetBacktrace());
!         this->CMakeInstance->AddCacheEntry(libs.c_str(),
!                                            "TRUE",
!                                            "",
!                                            cmCacheManager::INTERNAL);
!         }
        }
      case cmPolicies::OLD:
***************
*** 1356,1360 ****
        e << (this->Makefile->GetPolicies()->
              GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n";
!       this->PrintLinkPolicyDiagnosis(e);
        this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
                                          this->Target->GetBacktrace());
--- 1365,1370 ----
        e << (this->Makefile->GetPolicies()->
              GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n";
!       std::string libs;
!       this->PrintLinkPolicyDiagnosis(e, libs);
        this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
                                          this->Target->GetBacktrace());
***************
*** 1374,1379 ****
  
  //----------------------------------------------------------------------------
! void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
  {
    // Name the target.
    os << "Target \"" << this->Target->GetName() << "\" ";
--- 1384,1394 ----
  
  //----------------------------------------------------------------------------
! void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os, 
!                                                         std::string& libs)
  {
+   os << "The best way to remove this warning is to set policy CMP0003 "
+      << "to NEW. Then, try to build the project, if you get linker errors, "
+      << "either use the full paths to the libraries that can not be "
+      << "found, or use link_directories to add the missing directories.\n";
    // Name the target.
    os << "Target \"" << this->Target->GetName() << "\" ";
***************
*** 1417,1421 ****
      line += sep;
      line += *i;
! 
      // Convert to the other separator.
      sep = ", ";
--- 1432,1436 ----
      line += sep;
      line += *i;
!     libs += *i;
      // Convert to the other separator.
      sep = ", ";
***************
*** 1428,1437 ****
  
    // Tell the user what is wrong.
!   os << "The linker will search for libraries in the second list.  "
       << "Finding them may depend on linker search paths earlier CMake "
       << "versions added as an implementation detail for linking to the "
       << "libraries in the first list.  "
       << "For compatibility CMake is including the extra linker search "
!      << "paths, but policy CMP0003 should be set by the project.";
  }
  
--- 1443,1453 ----
  
    // Tell the user what is wrong.
!   os << "This maybe OK as well.  However, the linker will search "
!      << "for libraries in the second list.  "
       << "Finding them may depend on linker search paths earlier CMake "
       << "versions added as an implementation detail for linking to the "
       << "libraries in the first list.  "
       << "For compatibility CMake is including the extra linker search "
!      << "paths, but policy CMP0003 should be set by the project. ";
  }
  

Index: cmComputeLinkInformation.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C 2 -d -r1.16 -r1.17
*** cmComputeLinkInformation.h	13 Mar 2008 20:23:18 -0000	1.16
--- cmComputeLinkInformation.h	18 Mar 2008 21:32:26 -0000	1.17
***************
*** 155,159 ****
    cmOrderDirectories* OrderLinkerSearchPath;
    bool FinishLinkerSearchDirectories();
!   void PrintLinkPolicyDiagnosis(std::ostream&);
    std::set<cmStdString> ImplicitLinkDirs;
  
--- 155,159 ----
    cmOrderDirectories* OrderLinkerSearchPath;
    bool FinishLinkerSearchDirectories();
!   void PrintLinkPolicyDiagnosis(std::ostream&, std::string& libs);
    std::set<cmStdString> ImplicitLinkDirs;
  



More information about the Cmake-commits mailing list