[Cmake-commits] [cmake-commits] king committed cmConfigureFileCommand.cxx 1.35 1.36 cmConfigureFileCommand.h 1.25 1.26

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Sep 16 15:09:32 EDT 2009


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

Modified Files:
	cmConfigureFileCommand.cxx cmConfigureFileCommand.h 
Log Message:
Teach configure_file to handle relative paths

The configure_file() command now converts relative output paths to full
paths using the current binary directory.  Input relative paths were
already converted using the current source directory, but this behavior
was not previously documented.


Index: cmConfigureFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmConfigureFileCommand.cxx,v
retrieving revision 1.35
retrieving revision 1.36
diff -C 2 -d -r1.35 -r1.36
*** cmConfigureFileCommand.cxx	16 Sep 2009 19:09:19 -0000	1.35
--- cmConfigureFileCommand.cxx	16 Sep 2009 19:09:29 -0000	1.36
***************
*** 28,33 ****
      return false;
      }
!   this->InputFile = args[0];
!   this->OutputFile = args[1];
    if ( !this->Makefile->CanIWriteThisFile(this->OutputFile.c_str()) )
      {
--- 28,48 ----
      return false;
      }
! 
!   const char* inFile = args[0].c_str();
!   if(!cmSystemTools::FileIsFullPath(inFile))
!     {
!     this->InputFile = this->Makefile->GetCurrentDirectory();
!     this->InputFile += "/";
!     }
!   this->InputFile += inFile;
! 
!   const char* outFile = args[1].c_str();
!   if(!cmSystemTools::FileIsFullPath(outFile))
!     {
!     this->OutputFile = this->Makefile->GetCurrentOutputDirectory();
!     this->OutputFile += "/";
!     }
!   this->OutputFile += outFile;
! 
    if ( !this->Makefile->CanIWriteThisFile(this->OutputFile.c_str()) )
      {
***************
*** 90,101 ****
  int cmConfigureFileCommand::ConfigureFile()
  {
!   std::string inFile = this->InputFile;
!   if (!cmSystemTools::FileIsFullPath(inFile.c_str()))
!     {
!     inFile = this->Makefile->GetStartDirectory();
!     inFile += "/";
!     inFile += this->InputFile;
!     }
!   return this->Makefile->ConfigureFile(inFile.c_str(),
      this->OutputFile.c_str(),
      this->CopyOnly,
--- 105,110 ----
  int cmConfigureFileCommand::ConfigureFile()
  {
!   return this->Makefile->ConfigureFile(
!     this->InputFile.c_str(),
      this->OutputFile.c_str(),
      this->CopyOnly,

Index: cmConfigureFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmConfigureFileCommand.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C 2 -d -r1.25 -r1.26
*** cmConfigureFileCommand.h	16 Sep 2009 19:09:19 -0000	1.25
--- cmConfigureFileCommand.h	16 Sep 2009 19:09:29 -0000	1.26
***************
*** 61,67 ****
      {
        return
!         "  configure_file(InputFile OutputFile\n"
          "                 [COPYONLY] [ESCAPE_QUOTES] [@ONLY])\n"
!         "The Input and Output files have to have full paths.  "
          "This command replaces any variables in the input file referenced as "
          "${VAR} or @VAR@ with their values as determined by CMake.  If a "
--- 61,73 ----
      {
        return
!         "  configure_file(<input> <output>\n"
          "                 [COPYONLY] [ESCAPE_QUOTES] [@ONLY])\n"
!         "Copies a file <input> to file <output> and substitutes variable "
!         "values referenced in the file content.  "
!         "If <input> is a relative path it is evaluated with respect to "
!         "the current source directory.  "
!         "If <output> is a relative path it is evaluated with respect to "
!         "the current binary directory.  "
!         "\n"
          "This command replaces any variables in the input file referenced as "
          "${VAR} or @VAR@ with their values as determined by CMake.  If a "



More information about the Cmake-commits mailing list