[Cmake-commits] [cmake-commits] king committed cmLocalUnixMakefileGenerator3.cxx 1.251 1.252 cmMakefile.cxx 1.469 1.470 cmTarget.cxx 1.216 1.217

cmake-commits at cmake.org cmake-commits at cmake.org
Wed May 14 11:54:54 EDT 2008


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

Modified Files:
	cmLocalUnixMakefileGenerator3.cxx cmMakefile.cxx cmTarget.cxx 
Log Message:
ENH: Allow users to specify macro-like #include line transforms for dependency scanning.

  - Define IMPLICIT_DEPENDS_INCLUDE_TRANSFORM property on targets and directories.
  - Make the directory version inherited.
  - See issue #6648.


Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.251
retrieving revision 1.252
diff -C 2 -d -r1.251 -r1.252
*** cmLocalUnixMakefileGenerator3.cxx	10 May 2008 22:39:06 -0000	1.251
--- cmLocalUnixMakefileGenerator3.cxx	14 May 2008 15:54:52 -0000	1.252
***************
*** 1876,1879 ****
--- 1876,1905 ----
        << "  )\n";
      }
+ 
+   // Store include transform rule properties.  Write the directory
+   // rules first because they may be overridden by later target rules.
+   std::vector<std::string> transformRules;
+   if(const char* xform =
+      this->Makefile->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM"))
+     {
+     cmSystemTools::ExpandListArgument(xform, transformRules);
+     }
+   if(const char* xform =
+      target.GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM"))
+     {
+     cmSystemTools::ExpandListArgument(xform, transformRules);
+     }
+   if(!transformRules.empty())
+     {
+     cmakefileStream
+       << "SET(CMAKE_INCLUDE_TRANSFORMS\n";
+     for(std::vector<std::string>::const_iterator tri = transformRules.begin();
+         tri != transformRules.end(); ++tri)
+       {
+       cmakefileStream << "  " << this->EscapeForCMake(tri->c_str()) << "\n";
+       }
+     cmakefileStream
+       << "  )\n";
+     }
  }
  

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.216
retrieving revision 1.217
diff -C 2 -d -r1.216 -r1.217
*** cmTarget.cxx	12 May 2008 21:43:45 -0000	1.216
--- cmTarget.cxx	14 May 2008 15:54:52 -0000	1.217
***************
*** 160,163 ****
--- 160,181 ----
  
    cm->DefineProperty
+     ("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM", cmProperty::TARGET,
+      "Specify #include line transforms for dependencies in a target.",
+      "This property specifies rules to transform macro-like #include lines "
+      "during implicit dependency scanning of C and C++ source files.  "
+      "The list of rules must be semicolon-separated with each entry of "
+      "the form \"A_MACRO(%)=value-with-%\" (the % must be literal).  "
+      "During dependency scanning occurrences of A_MACRO(...) on #include "
+      "lines will be replaced by the value given with the macro argument "
+      "substituted for '%'.  For example, the entry\n"
+      "  MYDIR(%)=<mydir/%>\n"
+      "will convert lines of the form\n"
+      "  #include MYDIR(myheader.h)\n"
+      "to\n"
+      "  #include <mydir/myheader.h>\n"
+      "allowing the dependency to be followed.\n"
+      "This property applies to sources in the target on which it is set.");
+ 
+   cm->DefineProperty
      ("IMPORT_PREFIX", cmProperty::TARGET,
       "What comes before the import library name.",

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.469
retrieving revision 1.470
diff -C 2 -d -r1.469 -r1.470
*** cmMakefile.cxx	30 Apr 2008 17:42:39 -0000	1.469
--- cmMakefile.cxx	14 May 2008 15:54:52 -0000	1.470
***************
*** 1295,1298 ****
--- 1295,1304 ----
    this->DefineFlags = parent->DefineFlags;
  
+   // Include transform property.  There is no per-config version.
+   {
+   const char* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM";
+   this->SetProperty(prop, parent->GetProperty(prop));
+   }
+ 
    // compile definitions property and per-config versions
    {
***************
*** 3210,3213 ****
--- 3216,3239 ----
  
    cm->DefineProperty
+     ("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM", cmProperty::DIRECTORY,
+      "Specify #include line transforms for dependencies in a directory.",
+      "This property specifies rules to transform macro-like #include lines "
+      "during implicit dependency scanning of C and C++ source files.  "
+      "The list of rules must be semicolon-separated with each entry of "
+      "the form \"A_MACRO(%)=value-with-%\" (the % must be literal).  "
+      "During dependency scanning occurrences of A_MACRO(...) on #include "
+      "lines will be replaced by the value given with the macro argument "
+      "substituted for '%'.  For example, the entry\n"
+      "  MYDIR(%)=<mydir/%>\n"
+      "will convert lines of the form\n"
+      "  #include MYDIR(myheader.h)\n"
+      "to\n"
+      "  #include <mydir/myheader.h>\n"
+      "allowing the dependency to be followed.\n"
+      "This property applies to sources in all targets within a directory.  "
+      "The property value is initialized in each directory by its value "
+      "in the directory's parent.");
+ 
+   cm->DefineProperty
      ("EXCLUDE_FROM_ALL", cmProperty::DIRECTORY,
       "Exclude the directory from the all target of its parent.",



More information about the Cmake-commits mailing list