[Cmake-commits] [cmake-commits] king committed cmSourceFileLocation.cxx 1.6 1.7

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jul 30 11:06:13 EDT 2008


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

Modified Files:
	cmSourceFileLocation.cxx 
Log Message:
ENH: Recognize src extensions of all enabled langs

For historical reasons we still support naming of source files without
their extension.  Sources without known extensions are located on disk
by iterating through a fixed set of possible extensions.  We now want
users to always specify the extension, so the fixed set will not be
expanded and is preserved for compatibility with older projects.

This change adds recognition of extensions of all enabled languages to
avoid checking the disk for files whose extensions are unambiguous but
not in the original fixed set.


Index: cmSourceFileLocation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSourceFileLocation.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmSourceFileLocation.cxx	30 Jul 2008 15:06:06 -0000	1.6
--- cmSourceFileLocation.cxx	30 Jul 2008 15:06:11 -0000	1.7
***************
*** 18,21 ****
--- 18,23 ----
  
  #include "cmMakefile.h"
+ #include "cmLocalGenerator.h"
+ #include "cmGlobalGenerator.h"
  #include "cmSystemTools.h"
  
***************
*** 90,98 ****
    if(!ext.empty()) { ext = ext.substr(1); }
  
!   // TODO: Let enable-language specify extensions for each language.
!   cmMakefile const* mf = this->Makefile;
    const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
    const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions();
!   if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() ||
       std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end())
      {
--- 92,103 ----
    if(!ext.empty()) { ext = ext.substr(1); }
  
!   // The global generator checks extensions of enabled languages.
!   cmGlobalGenerator* gg =
!     this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
!   cmMakefile* mf = this->Makefile;
    const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
    const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions();
!   if(gg->GetLanguageFromExtension(ext.c_str()) ||
!      std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() ||
       std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end())
      {



More information about the Cmake-commits mailing list