diff options
author | Brad King <brad.king@kitware.com> | 2009-02-24 11:41:40 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-02-24 11:41:40 -0500 |
commit | 1595b8e69eac0d2dbab6ac29663a85d8d486a5cc (patch) | |
tree | ded9bc2ffe1ee4ca3adb4f19a24534877d908b85 /Source/cmInstallCommand.cxx | |
parent | a79f8cd4c156b01ef0305a30a9c0ca2dcbf9a1cc (diff) | |
download | cmake-1595b8e69eac0d2dbab6ac29663a85d8d486a5cc.tar.gz |
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.
Diffstat (limited to 'Source/cmInstallCommand.cxx')
-rw-r--r-- | Source/cmInstallCommand.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 001bd95bf1..37c0f9b079 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -855,6 +855,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) DoingConfigurations, DoingComponent }; Doing doing = DoingDirs; bool in_match_mode = false; + bool optional = false; std::vector<std::string> dirs; const char* destination = 0; std::string permissions_file; @@ -878,6 +879,21 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) // Switch to setting the destination property. 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") { // Switch to a new pattern match rule. @@ -1144,7 +1160,8 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) permissions_dir.c_str(), configurations, component.c_str(), - literal_args.c_str())); + literal_args.c_str(), + optional)); // Tell the global generator about any installation component names // specified. |