[Cmake-commits] [cmake-commits] king committed cmInstallCommand.cxx 1.50 1.51 cmInstallCommand.h 1.31 1.32 cmInstallDirectoryGenerator.cxx 1.6 1.7 cmInstallDirectoryGenerator.h 1.5 1.6

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 24 11:41:42 EST 2009


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

Modified Files:
	cmInstallCommand.cxx cmInstallCommand.h 
	cmInstallDirectoryGenerator.cxx cmInstallDirectoryGenerator.h 
Log Message:
ENH: Add install(DIRECTORY) option 'OPTIONAL'

This adds the OPTIONAL option to the install(DIRECTORY) command.  It
tells the installation rule that it is not an error if the source
directory does not exist.  See issue #8394.


Index: cmInstallCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.cxx,v
retrieving revision 1.50
retrieving revision 1.51
diff -C 2 -d -r1.50 -r1.51
*** cmInstallCommand.cxx	24 Feb 2009 16:41:00 -0000	1.50
--- cmInstallCommand.cxx	24 Feb 2009 16:41:31 -0000	1.51
***************
*** 856,859 ****
--- 856,860 ----
    Doing doing = DoingDirs;
    bool in_match_mode = false;
+   bool optional = false;
    std::vector<std::string> dirs;
    const char* destination = 0;
***************
*** 879,882 ****
--- 880,898 ----
        doing = DoingDestination;
        }
+     else if(args[i] == "OPTIONAL")
+       {
+       if(in_match_mode)
+         {
+         cmOStringStream e;
+         e << args[0] << " does not allow \""
+           << args[i] << "\" after PATTERN or REGEX.";
+         this->SetError(e.str().c_str());
+         return false;
+         }
+ 
+       // Mark the rule as optional.
+       optional = true;
+       doing = DoingNone;
+       }
      else if(args[i] == "PATTERN")
        {
***************
*** 1145,1149 ****
                                      configurations,
                                      component.c_str(),
!                                     literal_args.c_str()));
  
    // Tell the global generator about any installation component names
--- 1161,1166 ----
                                      configurations,
                                      component.c_str(),
!                                     literal_args.c_str(),
!                                     optional));
  
    // Tell the global generator about any installation component names

Index: cmInstallDirectoryGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallDirectoryGenerator.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** cmInstallDirectoryGenerator.h	18 Dec 2008 15:06:09 -0000	1.5
--- cmInstallDirectoryGenerator.h	24 Feb 2009 16:41:39 -0000	1.6
***************
*** 32,36 ****
                                std::vector<std::string> const& configurations,
                                const char* component,
!                               const char* literal_args);
    virtual ~cmInstallDirectoryGenerator();
  
--- 32,37 ----
                                std::vector<std::string> const& configurations,
                                const char* component,
!                               const char* literal_args,
!                               bool optional = false);
    virtual ~cmInstallDirectoryGenerator();
  
***************
*** 41,44 ****
--- 42,46 ----
    std::string DirPermissions;
    std::string LiteralArguments;
+   bool Optional;
  };
  

Index: cmInstallDirectoryGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallDirectoryGenerator.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmInstallDirectoryGenerator.cxx	28 Jan 2008 13:38:35 -0000	1.6
--- cmInstallDirectoryGenerator.cxx	24 Feb 2009 16:41:36 -0000	1.7
***************
*** 27,34 ****
                                std::vector<std::string> const& configurations,
                                const char* component,
!                               const char* literal_args):
    cmInstallGenerator(dest, configurations, component), Directories(dirs),
    FilePermissions(file_permissions), DirPermissions(dir_permissions),
!   LiteralArguments(literal_args)
  {
  }
--- 27,35 ----
                                std::vector<std::string> const& configurations,
                                const char* component,
!                               const char* literal_args,
!                               bool optional):
    cmInstallGenerator(dest, configurations, component), Directories(dirs),
    FilePermissions(file_permissions), DirPermissions(dir_permissions),
!   LiteralArguments(literal_args), Optional(optional)
  {
  }
***************
*** 46,55 ****
  {
    // Write code to install the directories.
-   bool not_optional = false;
    const char* no_properties = 0;
    const char* no_rename = 0;
    this->AddInstallRule(os, cmTarget::INSTALL_DIRECTORY,
                         this->Directories,
!                        not_optional, no_properties,
                         this->FilePermissions.c_str(),
                         this->DirPermissions.c_str(),
--- 47,55 ----
  {
    // Write code to install the directories.
    const char* no_properties = 0;
    const char* no_rename = 0;
    this->AddInstallRule(os, cmTarget::INSTALL_DIRECTORY,
                         this->Directories,
!                        this->Optional, no_properties,
                         this->FilePermissions.c_str(),
                         this->DirPermissions.c_str(),

Index: cmInstallCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -C 2 -d -r1.31 -r1.32
*** cmInstallCommand.h	14 Apr 2008 22:03:15 -0000	1.31
--- cmInstallCommand.h	24 Feb 2009 16:41:31 -0000	1.32
***************
*** 216,220 ****
        "          [FILE_PERMISSIONS permissions...]\n"
        "          [DIRECTORY_PERMISSIONS permissions...]\n"
!       "          [USE_SOURCE_PERMISSIONS]\n"
        "          [CONFIGURATIONS [Debug|Release|...]]\n"
        "          [COMPONENT <component>] [FILES_MATCHING]\n"
--- 216,220 ----
        "          [FILE_PERMISSIONS permissions...]\n"
        "          [DIRECTORY_PERMISSIONS permissions...]\n"
!       "          [USE_SOURCE_PERMISSIONS] [OPTIONAL]\n"
        "          [CONFIGURATIONS [Debug|Release|...]]\n"
        "          [COMPONENT <component>] [FILES_MATCHING]\n"



More information about the Cmake-commits mailing list