summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallGenerator.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/cmInstallGenerator.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/cmInstallGenerator.cxx')
-rw-r--r--Source/cmInstallGenerator.cxx242
1 files changed, 113 insertions, 129 deletions
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 4218011..e3d5bad 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -14,146 +14,136 @@
#include "cmMakefile.h"
#include "cmSystemTools.h"
-cmInstallGenerator
-::cmInstallGenerator(const char* destination,
- std::vector<std::string> const& configurations,
- const char* component,
- MessageLevel message,
- bool exclude_from_all):
- cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations),
- Destination(destination? destination:""),
- Component(component? component:""),
- Message(message),
- ExcludeFromAll(exclude_from_all)
+cmInstallGenerator::cmInstallGenerator(
+ const char* destination, std::vector<std::string> const& configurations,
+ const char* component, MessageLevel message, bool exclude_from_all)
+ : cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations)
+ , Destination(destination ? destination : "")
+ , Component(component ? component : "")
+ , Message(message)
+ , ExcludeFromAll(exclude_from_all)
{
}
-cmInstallGenerator
-::~cmInstallGenerator()
+cmInstallGenerator::~cmInstallGenerator()
{
}
-void cmInstallGenerator
-::AddInstallRule(
- std::ostream& os,
- std::string const& dest,
- cmInstallType type,
- std::vector<std::string> const& files,
- bool optional /* = false */,
- const char* permissions_file /* = 0 */,
- const char* permissions_dir /* = 0 */,
- const char* rename /* = 0 */,
- const char* literal_args /* = 0 */,
- Indent const& indent
- )
+void cmInstallGenerator::AddInstallRule(
+ std::ostream& os, std::string const& dest, cmInstallType type,
+ std::vector<std::string> const& files, bool optional /* = false */,
+ const char* permissions_file /* = 0 */,
+ const char* permissions_dir /* = 0 */, const char* rename /* = 0 */,
+ const char* literal_args /* = 0 */, Indent const& indent)
{
// Use the FILE command to install the file.
std::string stype;
- switch(type)
- {
- case cmInstallType_DIRECTORY: stype = "DIRECTORY"; break;
- case cmInstallType_PROGRAMS: stype = "PROGRAM"; break;
- case cmInstallType_EXECUTABLE: stype = "EXECUTABLE"; break;
- case cmInstallType_STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break;
- case cmInstallType_SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break;
- case cmInstallType_MODULE_LIBRARY: stype = "MODULE"; break;
- case cmInstallType_FILES: stype = "FILE"; break;
- }
+ switch (type) {
+ case cmInstallType_DIRECTORY:
+ stype = "DIRECTORY";
+ break;
+ case cmInstallType_PROGRAMS:
+ stype = "PROGRAM";
+ break;
+ case cmInstallType_EXECUTABLE:
+ stype = "EXECUTABLE";
+ break;
+ case cmInstallType_STATIC_LIBRARY:
+ stype = "STATIC_LIBRARY";
+ break;
+ case cmInstallType_SHARED_LIBRARY:
+ stype = "SHARED_LIBRARY";
+ break;
+ case cmInstallType_MODULE_LIBRARY:
+ stype = "MODULE";
+ break;
+ case cmInstallType_FILES:
+ stype = "FILE";
+ break;
+ }
os << indent;
- if (cmSystemTools::FileIsFullPath(dest.c_str()))
- {
- os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
- os << indent << " \"";
- for(std::vector<std::string>::const_iterator fi = files.begin();
- fi != files.end(); ++fi)
- {
- if (fi!=files.begin())
- {
- os << ";";
- }
- os << dest << "/";
- if (rename && *rename)
- {
- os << rename;
- }
- else
- {
- os << cmSystemTools::GetFilenameName(*fi);
- }
- }
- os << "\")\n";
- os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
- os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL "
- << "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
- os << indent << "endif()\n";
+ if (cmSystemTools::FileIsFullPath(dest.c_str())) {
+ os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
+ os << indent << " \"";
+ for (std::vector<std::string>::const_iterator fi = files.begin();
+ fi != files.end(); ++fi) {
+ if (fi != files.begin()) {
+ os << ";";
+ }
+ os << dest << "/";
+ if (rename && *rename) {
+ os << rename;
+ } else {
+ os << cmSystemTools::GetFilenameName(*fi);
+ }
+ }
+ os << "\")\n";
+ os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL "
+ << "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
+ os << indent << "endif()\n";
- os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
- os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL "
- << "DESTINATION forbidden (by caller): "
- << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
- os << indent << "endif()\n";
- }
+ os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL "
+ << "DESTINATION forbidden (by caller): "
+ << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
+ os << indent << "endif()\n";
+ }
std::string absDest = this->ConvertToAbsoluteDestination(dest);
os << "file(INSTALL DESTINATION \"" << absDest << "\" TYPE " << stype;
- if(optional)
- {
+ if (optional) {
os << " OPTIONAL";
- }
- switch(this->Message)
- {
- case MessageDefault: break;
- case MessageAlways: os << " MESSAGE_ALWAYS"; break;
- case MessageLazy: os << " MESSAGE_LAZY"; break;
- case MessageNever: os << " MESSAGE_NEVER"; break;
- }
- if(permissions_file && *permissions_file)
- {
+ }
+ switch (this->Message) {
+ case MessageDefault:
+ break;
+ case MessageAlways:
+ os << " MESSAGE_ALWAYS";
+ break;
+ case MessageLazy:
+ os << " MESSAGE_LAZY";
+ break;
+ case MessageNever:
+ os << " MESSAGE_NEVER";
+ break;
+ }
+ if (permissions_file && *permissions_file) {
os << " PERMISSIONS" << permissions_file;
- }
- if(permissions_dir && *permissions_dir)
- {
+ }
+ if (permissions_dir && *permissions_dir) {
os << " DIR_PERMISSIONS" << permissions_dir;
- }
- if(rename && *rename)
- {
+ }
+ if (rename && *rename) {
os << " RENAME \"" << rename << "\"";
- }
+ }
os << " FILES";
- if(files.size() == 1)
- {
+ if (files.size() == 1) {
os << " \"" << files[0] << "\"";
- }
- else
- {
- for(std::vector<std::string>::const_iterator fi = files.begin();
- fi != files.end(); ++fi)
- {
+ } else {
+ for (std::vector<std::string>::const_iterator fi = files.begin();
+ fi != files.end(); ++fi) {
os << "\n" << indent << " \"" << *fi << "\"";
- }
+ }
os << "\n" << indent << " ";
- if(!(literal_args && *literal_args))
- {
+ if (!(literal_args && *literal_args)) {
os << " ";
- }
}
- if(literal_args && *literal_args)
- {
+ }
+ if (literal_args && *literal_args) {
os << literal_args;
- }
+ }
os << ")\n";
}
-std::string
-cmInstallGenerator::CreateComponentTest(const char* component,
- bool exclude_from_all)
+std::string cmInstallGenerator::CreateComponentTest(const char* component,
+ bool exclude_from_all)
{
std::string result = "\"${CMAKE_INSTALL_COMPONENT}\" STREQUAL \"";
result += component;
result += "\"";
- if(!exclude_from_all)
- {
+ if (!exclude_from_all) {
result += " OR NOT CMAKE_INSTALL_COMPONENT";
- }
+ }
return result;
}
@@ -164,7 +154,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
// Begin this block of installation.
std::string component_test =
- this->CreateComponentTest(this->Component.c_str(),this->ExcludeFromAll);
+ this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
os << indent << "if(" << component_test << ")\n";
// Generate the script possibly with per-configuration code.
@@ -179,38 +169,32 @@ bool cmInstallGenerator::InstallsForConfig(const std::string& config)
return this->GeneratesForConfig(config);
}
-std::string
-cmInstallGenerator::ConvertToAbsoluteDestination(std::string const& dest) const
+std::string cmInstallGenerator::ConvertToAbsoluteDestination(
+ std::string const& dest) const
{
std::string result;
- if(!dest.empty() &&
- !cmSystemTools::FileIsFullPath(dest.c_str()))
- {
+ if (!dest.empty() && !cmSystemTools::FileIsFullPath(dest.c_str())) {
result = "${CMAKE_INSTALL_PREFIX}/";
- }
+ }
result += dest;
return result;
}
-cmInstallGenerator::MessageLevel
-cmInstallGenerator::SelectMessageLevel(cmMakefile* mf, bool never)
+cmInstallGenerator::MessageLevel cmInstallGenerator::SelectMessageLevel(
+ cmMakefile* mf, bool never)
{
- if(never)
- {
+ if (never) {
return MessageNever;
- }
+ }
std::string m = mf->GetSafeDefinition("CMAKE_INSTALL_MESSAGE");
- if(m == "ALWAYS")
- {
+ if (m == "ALWAYS") {
return MessageAlways;
- }
- if(m == "LAZY")
- {
+ }
+ if (m == "LAZY") {
return MessageLazy;
- }
- if(m == "NEVER")
- {
+ }
+ if (m == "NEVER") {
return MessageNever;
- }
+ }
return MessageDefault;
}