diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-10-11 15:16:57 +0900 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-10-11 15:16:57 +0900 |
commit | 915c76ded744c0f5f151402b9fa69f3fd8452573 (patch) | |
tree | ca6a387466543248890f346847acaa8343989b22 /Source/cmInstallFilesGenerator.cxx | |
parent | 317dbdb79761ef65e45c7358cfc7571c6afa54ad (diff) | |
download | cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.gz cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.bz2 cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.zip |
Imported Upstream version 3.9.4upstream/3.9.4
Diffstat (limited to 'Source/cmInstallFilesGenerator.cxx')
-rw-r--r-- | Source/cmInstallFilesGenerator.cxx | 117 |
1 files changed, 79 insertions, 38 deletions
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index ec02bc76a..6323a9189 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -1,50 +1,91 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmInstallFilesGenerator.h" - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. +#include "cmGeneratorExpression.h" +#include "cmInstallType.h" +#include "cmSystemTools.h" +#include "cm_auto_ptr.hxx" - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmInstallFilesGenerator.h" +class cmLocalGenerator; -//---------------------------------------------------------------------------- -cmInstallFilesGenerator -::cmInstallFilesGenerator(std::vector<std::string> const& files, - const char* dest, bool programs, - const char* file_permissions, - std::vector<std::string> const& configurations, - const char* component, - const char* rename, - bool optional): - cmInstallGenerator(dest, configurations, component), - Files(files), Programs(programs), - FilePermissions(file_permissions), - Rename(rename), Optional(optional) +cmInstallFilesGenerator::cmInstallFilesGenerator( + std::vector<std::string> const& files, const char* dest, bool programs, + const char* file_permissions, std::vector<std::string> const& configurations, + const char* component, MessageLevel message, bool exclude_from_all, + const char* rename, bool optional) + : cmInstallGenerator(dest, configurations, component, message, + exclude_from_all) + , LocalGenerator(CM_NULLPTR) + , Files(files) + , FilePermissions(file_permissions) + , Rename(rename) + , Programs(programs) + , Optional(optional) { + // We need per-config actions if the destination has generator expressions. + if (cmGeneratorExpression::Find(Destination) != std::string::npos) { + this->ActionsPerConfig = true; + } + + // We need per-config actions if any files have generator expressions. + for (std::vector<std::string>::const_iterator i = files.begin(); + !this->ActionsPerConfig && i != files.end(); ++i) { + if (cmGeneratorExpression::Find(*i) != std::string::npos) { + this->ActionsPerConfig = true; + } + } } -//---------------------------------------------------------------------------- -cmInstallFilesGenerator -::~cmInstallFilesGenerator() +cmInstallFilesGenerator::~cmInstallFilesGenerator() { } -//---------------------------------------------------------------------------- -void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, - Indent const& indent) +void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg) +{ + this->LocalGenerator = lg; +} + +std::string cmInstallFilesGenerator::GetDestination( + std::string const& config) const +{ + cmGeneratorExpression ge; + return ge.Parse(this->Destination)->Evaluate(this->LocalGenerator, config); +} + +void cmInstallFilesGenerator::AddFilesInstallRule( + std::ostream& os, std::string const& config, Indent indent, + std::vector<std::string> const& files) { // Write code to install the files. - const char* no_dir_permissions = 0; - this->AddInstallRule(os, - (this->Programs - ? cmInstallType_PROGRAMS - : cmInstallType_FILES), - this->Files, - this->Optional, - this->FilePermissions.c_str(), no_dir_permissions, - this->Rename.c_str(), 0, indent); + const char* no_dir_permissions = CM_NULLPTR; + this->AddInstallRule( + os, this->GetDestination(config), + (this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), files, + this->Optional, this->FilePermissions.c_str(), no_dir_permissions, + this->Rename.c_str(), CM_NULLPTR, indent); +} + +void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, + Indent indent) +{ + if (this->ActionsPerConfig) { + this->cmInstallGenerator::GenerateScriptActions(os, indent); + } else { + this->AddFilesInstallRule(os, "", indent, this->Files); + } +} + +void cmInstallFilesGenerator::GenerateScriptForConfig( + std::ostream& os, const std::string& config, Indent indent) +{ + std::vector<std::string> files; + cmGeneratorExpression ge; + for (std::vector<std::string>::const_iterator i = this->Files.begin(); + i != this->Files.end(); ++i) { + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + cmSystemTools::ExpandListArgument( + cge->Evaluate(this->LocalGenerator, config), files); + } + this->AddFilesInstallRule(os, config, indent, files); } |