[Cmake-commits] [cmake-commits] king committed cmCPluginAPI.cxx 1.42 1.43 cmGlobalXCodeGenerator.cxx 1.209 1.210 cmGlobalXCodeGenerator.h 1.55 1.56 cmSourceFile.cxx 1.54 1.55

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 16 14:30:26 EDT 2009


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

Modified Files:
	cmCPluginAPI.cxx cmGlobalXCodeGenerator.cxx 
	cmGlobalXCodeGenerator.h cmSourceFile.cxx 
Log Message:
BUG: Do not automatically set HEADER_FILE_ONLY

Long ago the native build system generators needed HEADER_FILE_ONLY to
be set on header files to stop them from building.  The modern
generators correctly handle headers without the help of this property.
This removes automatic setting of the property so that it can be used
reliably as an indicator of project author intention.  It fixes VS IDE
project files to show header files normally instead of excluded (broken
by the fix for issue #7845).


Index: cmSourceFile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSourceFile.cxx,v
retrieving revision 1.54
retrieving revision 1.55
diff -C 2 -d -r1.54 -r1.55
*** cmSourceFile.cxx	10 Feb 2009 13:50:21 -0000	1.54
--- cmSourceFile.cxx	16 Mar 2009 18:30:24 -0000	1.55
***************
*** 247,269 ****
      }
  
-   // Look for header files.
-   cmMakefile* mf = this->Location.GetMakefile();
-   const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions();
-   if(std::find(hdrExts.begin(), hdrExts.end(), this->Extension) ==
-      hdrExts.end())
-     {
-     // This is not a known header file extension.  Mark it as not a
-     // header unless the user has already explicitly set the property.
-     if(!this->GetProperty("HEADER_FILE_ONLY"))
-       {
-       this->SetProperty("HEADER_FILE_ONLY", "0");
-       }
-     }
-   else
-     {
-     // This is a known header file extension.  The source cannot be compiled.
-     this->SetProperty("HEADER_FILE_ONLY", "1");
-     }
- 
    // Try to identify the source file language from the extension.
    if(this->Language.empty())
--- 247,250 ----

Index: cmGlobalXCodeGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -C 2 -d -r1.55 -r1.56
*** cmGlobalXCodeGenerator.h	10 Oct 2008 12:11:08 -0000	1.55
--- cmGlobalXCodeGenerator.h	16 Mar 2009 18:30:24 -0000	1.56
***************
*** 160,163 ****
--- 160,164 ----
    void CreateXCodeTargets(cmLocalGenerator* gen, 
                            std::vector<cmXCodeObject*>&);
+   bool IsHeaderFile(cmSourceFile*);
    void AddDependTarget(cmXCodeObject* target,
                         cmXCodeObject* dependTarget);

Index: cmCPluginAPI.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCPluginAPI.cxx,v
retrieving revision 1.42
retrieving revision 1.43
diff -C 2 -d -r1.42 -r1.43
*** cmCPluginAPI.cxx	23 Jan 2008 15:27:59 -0000	1.42
--- cmCPluginAPI.cxx	16 Mar 2009 18:30:24 -0000	1.43
***************
*** 707,714 ****
      }
  
-   // Implement the old SetName method code here.
-   sf->Properties.SetProperty("HEADER_FILE_ONLY", "1",
-                              cmProperty::SOURCE_FILE);
- 
    // Save the original name given.
    sf->SourceName = name;
--- 707,710 ----
***************
*** 743,753 ****
        }
  
-     // See if the file is a header file
-     if(std::find( headerExts.begin(), headerExts.end(),
-                   sf->SourceExtension ) == headerExts.end())
-       {
-       sf->Properties.SetProperty("HEADER_FILE_ONLY", "0",
-                                  cmProperty::SOURCE_FILE);
-       }
      sf->FullPath = hname;
      return;
--- 739,742 ----
***************
*** 764,769 ****
        {
        sf->SourceExtension = *ext;
-       sf->Properties.SetProperty("HEADER_FILE_ONLY", "0",
-                                  cmProperty::SOURCE_FILE);
        sf->FullPath = hname;
        return;
--- 753,756 ----
***************
*** 815,821 ****
  
    // Implement the old SetName method code here.
!   sf->Properties.SetProperty("HEADER_FILE_ONLY",
!                              headerFileOnly? "1" : "0",
!                              cmProperty::SOURCE_FILE);
    sf->SourceName = name;
    std::string fname = sf->SourceName;
--- 802,810 ----
  
    // Implement the old SetName method code here.
!   if(headerFileOnly)
!     {
!     sf->Properties.SetProperty("HEADER_FILE_ONLY", "1",
!                                cmProperty::SOURCE_FILE);
!     }
    sf->SourceName = name;
    std::string fname = sf->SourceName;

Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.209
retrieving revision 1.210
diff -C 2 -d -r1.209 -r1.210
*** cmGlobalXCodeGenerator.cxx	19 Feb 2009 16:51:24 -0000	1.209
--- cmGlobalXCodeGenerator.cxx	16 Mar 2009 18:30:24 -0000	1.210
***************
*** 733,737 ****
          externalObjFiles.push_back(xsf);
          }
!       else if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY") ||
          (tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) ||
          (tsFlags.Type == cmTarget::SourceFileTypePublicHeader))
--- 733,737 ----
          externalObjFiles.push_back(xsf);
          }
!       else if(this->IsHeaderFile(*i) ||
          (tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) ||
          (tsFlags.Type == cmTarget::SourceFileTypePublicHeader))
***************
*** 743,747 ****
          resourceFiles.push_back(xsf);
          }
!       else
          {
          // Include this file in the build if it has a known language
--- 743,747 ----
          resourceFiles.push_back(xsf);
          }
!       else if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY"))
          {
          // Include this file in the build if it has a known language
***************
*** 913,916 ****
--- 913,925 ----
  
  //----------------------------------------------------------------------------
+ bool cmGlobalXCodeGenerator::IsHeaderFile(cmSourceFile* sf)
+ {
+   const std::vector<std::string>& hdrExts =
+     this->CurrentMakefile->GetHeaderExtensions();
+   return (std::find(hdrExts.begin(), hdrExts.end(), sf->GetExtension()) !=
+           hdrExts.end());
+ }
+ 
+ //----------------------------------------------------------------------------
  cmXCodeObject*
  cmGlobalXCodeGenerator::CreateBuildPhase(const char* name,



More information about the Cmake-commits mailing list